The groupmod command is used to change the group’s own attributes. It will edit the /etc/group file for you. Modifications of the group might include changing its name or GID.

Below are associated configuration files:

  • /etc/group: Group account information.
  • /etc/gshadow: Secure group account info.

Syntax

The syntax of the groupmod command is:

# groupmod [options] {group names}

Some groupmod options include the below.

Option Used To Example
-g Change a group ID. # groupmod -g 123 sales
-n Rename group # groupmod -n newsales sales

groupmod Command Examples

1. To change the group ID:

# groupmod -g 600 SUPPORT
# groupmod --gid 600 SUPPORT

2. To change the group name:

# groupmod -n SUPPORT
# groupmod --new-name SUPPORT

3. To change the group ID with non-unique:

# groupmod -o 0 SUPPORT
# groupmod --non-unique 0 SUPPORT

4. To change the group password:

# groupmod -p [email protected]$531&465%361&23*2314251 SUPPORT
# groupmod --password [email protected]$531&465%361&23*2314251 SUPPORT

5. To get the help for groupmod:

# groupmod -h
# groupmod --help