Posts Tagged ‘linux add groups’

Linux – Add Group

June 7, 2011 2 comments

Add a new group to /etc/group for Linux/Unix

If you have multiple accounts on a linux/unix box that require the same access you can setup groups with select privileges. This helps with administration and maintenance.

To create a group you would issue the following command:

$ groupadd -g 300 <groupname>


-g gid

The unique, numerical value of the group’s ID. Unless issuing the -o flag, this must be non-negative. The default is to use the smallest ID value greater than 500 and greater than any other group value. Values between 0 – 499 are usually reserved for system accounts.


This flag adds a system account. Unless specified with the -g flad, the first available value below 499 will be used.


This is the force flag and will cause the command to exit with an error if when the group about to be added already exists. This flag also changes the way -g works. If the gid already exists then it will force the group creation to fall back to standard behaviour (adding a group as if neither -g or -o have been specified).

Alternate Method

Alternately, you could add the group by editing the /etc/group file as the root user.

For example on an AIX environment you could add the dba group as the following:


On a Redhat environment you could add the dba group as the following:


Where krobbe and oracle are the users within that group, 300 is the groupid
You would do this by:

# vi /etc/group

Then shift + G to go to the bottom of the file, then i for insert, then type in the command. When you have entered the command esc to exit insert then :wq to write the file.