On Unix-like operating systems, the groupmod command modifies the configuration of a group.
This page describes the GNU/Linux version of groupmod.
Description
The groupmod command modifies the definition of the specified group by modifying the appropriate entry in the files /etc/group, /etc/gshadow, and /etc/passwd.
- Description
- Syntax
- Configuration
- Exit values
- Examples
- Related commands
- Linux commands help
Syntax
groupmod [options] GROUP
Options
Configuration
The following configuration variables in /etc/login.defs change the behavior of this tool:
MAX_MEMBERS_PER_GROUP (number)
Maximum members per group entry. When the maximum is reached, a new group entry (line) is started in /etc/group (with the same name, same password, and same GID).
The default value is 0, meaning there are no limits in the number of members in a group.
This feature (split group) permits to limit the length of lines in the group file. This is useful to make sure lines for NIS groups are not larger than 1024 characters.
If you need to enforce such limit, you can use 25.
Exit values
The groupmod command exits with the following values:
Split groups may not be supported by all tools (even in the Shadow toolsuite). You should not use this variable unless you need it.
Examples
groupmod -n bettergroup newgroup
In the example above, the groupmod command would change the group “newgroup” to “bettergroup”.
For this command to work, you must have superuser rights or be logged in as root.
Related commands
gpasswd — Administer /etc/group and /etc/gshadow.groupadd — Add a group to the system.groupdel — Remove a group from the system.