Adding Groups with groupadd

If you need to create some new user or system groups. Any server programs that you install should have their own users and group, use groupadd.

This command creates a new group, using the system values configured in /etc/default/useradd and /etc/skel/:

# groupadd newgroup

You can create a system group with -r flag:

# groupadd -r newgroup

The -r flag is a Red Hat-specific option. If your version of groupadd does not have it, you’ll have to specify the next available system group number:

# groupadd -g 127 newgroup

Look in /etc/group to see the next available group number.

It’s a good idea to stick to a consistent group numbering scheme. Linux doesn’t care, for the most part, but for your own sanity it’s essential. Red Hat system groups are 0-499; Debian’s are 100-999.