How To: Add or Create Group In CentOS / Red Hat / Fedora / Scientific Linux / Ubuntu

Group is a collection of user to whom the sane permissions are to be applied. To Add or Create Group In CentOS / Red Hat / Fedora / Scientic Linux / Ubuntu, you  can use ‘groupadd ‘ command as a root.

The Syntax  to  Create a group  in Linux:

groupadd [options] GROUP_NAME

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

/etc/grop                     Group account information

/etc/gshadow              Secure group account information.
/etc/login.defs             Shadow password suite configuration.

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 Create a Developer Group with groupadd command :

[root@localhost ~]# groupadd Developer

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

[root@localhost ~]#

 To Create Group with specific groupid ( greater than 1000):

 [root@localhost ~]# groupadd -g 1016 Testers

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

To assign a  duplicate (non-unique) GID for a group , you use   ‘ -o ‘ option  and ‘ -g ‘ option  with ‘groupadd ‘ 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)


To create a system group, you can use  ‘groupadd’ command with ‘–r’ option. The numeric id of system groups always chosen in the SYS_GID_MIN-SYS_GID_MAX range, which is defined in /etc/login.defs


[root@localhost ~]# groupadd -r dev_admin

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

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


      Options                                                             Description


  -f, –force                                          exit successfully if the group already exists,

                                                               and cancel -g if the GID is already used

  -g, –gid GID                                     Group ID for the group, which must be unique and

                                                                 greater than 1000.

  -h, –help                                            display this help message and exit

  -K, –key KEY=VALUE                  override /etc/login.defs defaults

  -o, –non-unique                            allow to create groups with duplicate

                                                                (non-unique) GID

  -p, –password PASSWORD        use this encrypted password for the new group

  -r, –system                                       create a system account

  -R, –root CHROOT_DIR               directory to chroot into


Leave a Reply

Please log in using one of these methods to post your comment: 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