/etc/group. Managing groups simplifies permission control and is essential for multi-user Linux systems and team-based workflows.

Quick overview — what you’ll do
- Create system groups.
- Create user accounts.
- Assign users to supplementary groups and change primary groups.
- Rename groups and change GIDs.
- Remove groups and validate
/etc/group.
1) Create groups
Create the groups you need withgroupadd:
/etc/group or using grep:
2) Create users
Create three example users and their home directories with-m:
groupuser1).
3) Assign supplementary groups
Useusermod -G to set supplementary groups for an account. Important: the uppercase -G replaces the entire supplementary-group list; to append instead of replacing, use -aG.
Use
-G to set supplementary groups (this replaces the list). Use -aG to append to the existing supplementary groups without removing any existing ones.developers and admins as supplementary groups for groupuser1, then append the wheel group:
4) Change the primary group
To change a user’s primary group, use the lowercase-g:
5) Rename a group and change its GID
Usegroupmod -n to rename a group and groupmod -g to change its GID.
Example — rename developers to devs and set the devs GID to 20000:
/etc/group (excerpt):
6) Remove groups
When you need to delete groups, usegroupdel. Be careful not to remove groups that are required by system services or in active use.
Warning: Deleting a group that is in use can cause permission and access issues. Verify memberships and service dependencies before running
groupdel.admins and devs:
Commands summary
Validation & tips
- Always verify group membership with
id <username>and check/etc/group. - Use
-aGwhen you only want to add a supplementary group without removing existing ones. - Be cautious changing GIDs if files or directories are already owned by the old GID; you may need to update ownership with
chown.
Links and references
- Linux user and group management (man pages) — search
groupadd,groupmod,groupdel,usermod - Understanding /etc/group format
- Red Hat: User and group administration
groupadd, groupmod, groupdel, and usermod you can effectively manage primary and supplementary group memberships and control GIDs that appear in /etc/group.