Permissions
groupmod
Modify a local group.
grouprenamegidpermissionsadmin
Additional Notes
groupmod changes properties of an existing local group, usually its name or numeric GID.
Changing a GID can affect file ownership display and access decisions, so check existing files and users first.
Syntax
groupmod [options] group
Parameters
options: Flags that change howgroupmodbehaves.user: User account affected by the command.group: Group account affected by the command.file: File or directory whose ownership, mode, or access policy is being changed.
Common Options
-n NEWNAME: Rename the group.-g GID: Change numeric group ID.-o: Allow a non-unique GID when used with-g.
Examples
sudo groupmod -n engineers developers
Rename developers to engineers.
sudo groupmod -g 2001 lab
Change the group's GID.
getent group engineers
Check the changed group.
Practical Notes
- Rename changes the group database entry, not necessarily documentation or scripts.
- Be careful changing GIDs on systems with shared files.
- Use
find / -gid OLDGIDif you need to find files with an old group ID.