Modify an Existing Group in CentOS / RedHat / Fedora / Ubuntu and Scientific Linux

To modify an existing Group in CentOS / RedHat / Fedora / Ubuntu and Scientific Linux  , you can use ‘ groupmod ‘ command as root.

The syntax for groupmod command as shown below

groupmod [options] GROUP_NAME 

When we run ‘groupmod’ command on shell prompt these files are used and affected.

/etc/group                                  Group account information.
/etc/gshadow                             Secure group account information.

/etc/login.defs                           Shadow password suite configuration.
/etc/passwd                                User account information.

Default Min/max values for automatic gid selection define in ‘/etc/login.defs ‘ (Fedora and CentOS)

GID_MIN                  1000
GID_MAX                 60000

# System accounts

SYS_GID_MIN          201
SYS_GID_MAX         999

Default Min/max values for automatic gid selection define in ‘/etc/login.defs ‘ (Ubuntu)

GID_MIN                  1000
GID_MAX                 60000

# System accounts

#SYS_GID_MIN        100
#SYS_GID_MAX       999


To change group ID to GID ,you use groupmod command  with ‘ -g ‘ or ‘ –gid ‘ option

[root@localhost ~]# cat /etc/group | grep Developer
[root@localhost ~]#

[root@localhost ~]# groupmod -g 1015 Developer

[root@localhost ~]# cat /etc/group | grep Developer
[root@localhost ~]#

 If you want to change the name of an existing group , You can use ‘ groupmod ‘ command with ‘-n’ or ‘–new-name’ option

The name of the group will be changed from
Developer     to  Developer_admin

[root@localhost ~]# groupmod -n Developer_admin Developer

[root@localhost ~]# cat /etc/group | grep Developer_admin
[root@localhost ~]#

To assign a  duplicate (non-unique) GID for a group , you use   ‘ -o ‘ option  and ‘ -g ‘ option  with ‘groupmod ‘ command.

[root@localhost ~]# cat /etc/group | grep Developer_admin

[root@localhost ~]# groupmod -g 1015 -o Testers

[root@localhost ~]# cat /etc/group | grep Testers
[root@localhost ~]#

Hence Developer_admin and Testers both groups have a same GID (1015)

 All command line options  used with the ‘groupadd’ command are shown below


         Options:                                                     Description


  -g, –gid GID                                          change the group ID to GID

  -h, –help                                               display this help message and exit

  -n, –new-name NEW_GROUP         change the name to NEW_GROUP

  -o, –non-unique                                allow to use a duplicate (non-unique) GID

  -p, –password PASSWORD             change the password to this (encrypted)


  -R, –root CHROOT_DIR                    directory to chroot into


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s