Problem Statement
Which file contains group information in Linux?
Explanation
The /etc/group file contains group information with format: groupname:x:GID:member_list. Example: developers:x:1005:john,jane,bob defines a group 'developers' with GID 1005 and three members. The 'x' in password field indicates group password (rarely used, stored in /etc/gshadow if set).
Each user has a primary group (specified in /etc/passwd) and can belong to multiple supplementary groups (listed in /etc/group). Primary group is the default group for files created by the user. Supplementary groups provide additional permissions. Check user's groups with groups username or id username commands.
Group management commands include groupadd to create groups, groupdel to delete groups, groupmod to modify groups, and usermod -aG to add users to groups. Example: groupadd developers creates developers group, usermod -aG developers john adds john to developers group without removing from other groups (-a for append, without it replaces all groups).
Understanding groups is crucial for managing file access permissions, especially in multi-user environments or for controlling access to resources like Docker (docker group), sudo access (sudo/wheel group), or development tools. Groups enable flexible, maintainable access control without managing individual user permissions.
