groupmod - Unix, Linux Command



NAME

groupmod modify a group definition on the system

SYNOPSIS

groupmod [options] GROUP

DESCRIPTION

groupmodThe groupmod command modifies the definition of the specified GROUP by modifying the appropriate entry in the group database.

Options

Tag Description
-g, --gid GID The group ID of the given GROUP will be changed to GID.

The value of GID must be a non-negative decimal integer. This value must be unique, unless the -o option is used. Users who use the group as primary group will be updated to keep the group as their primary group.

Any files that have the old group ID and must continue to belong to GROUP, must have their group ID changed manually. No checks will be performed with regard to the GID_MIN, GID_MAX, SYS_GID_MIN, or SYS_GID_MAX from /etc/login.defs.

-h, --help Display help message and exit.
-n, --new-name NEW_GROUP The name of the group will be changed from GROUP to NEW_GROUP.
-o, --non-unique When used with the -g option, allow to change the group GID to a non-unique value.
-p, --password PASSWORD The encrypted password, as returned by crypt.
-R, --root CHROOT_DIR Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory. See also chroot.

EXAMPLES

Example-1:

To change the group "newgroup" to "oldgroup".

# groupmod -n oldgroup newgroup

output:

# groupmod -n oldgroup newgroup

# grep oldgroup /etc/group
oldgroup:x:9090:

Example-2:

To change groupid of group:

# groupmod -g 777 oldgroup

output:

# grep oldgroup /etc/group
oldgroup:x:777:

Example-3:

To use same gid for multiple groups, use -o option

#groupmod -g 777 newgroup

output: ( both oldgroup and newgroup have same GID's)

# grep oldgroup /etc/group
oldgroup:x:777:

# grep newgroup /etc/group
oldgroup:x:777:

Print
Advertisements