3.5. Managing Groups via Command-Line Tools
gpasswd. The files affected include
/etc/groupwhich stores group account information and
/etc/gshadow, which stores secure group account information.
3.5.1. Creating Groups
groupaddcommand is run at the shell prompt as
Example 3.18. Creating a Group with Default Settings
~]# groupadd friends
groupaddcommand creates a new group called
friends. You can read more information about the group from the newly-created line in the
friendsis attached with a unique GID (group ID) of 30005 and is not attached with any users. Optionally, you can set a password for a group by running
groupadd option(s) groupname
groupaddcommand with the
-goption. Remember that this value must be unique (unless the
-ooption is used) and the value must be non-negative.
groupadd -g GID
Example 3.19. Creating a Group with Specified GID
schoolmatesand sets GID of 60002 for it:
~]# groupadd -g 60002 schoolmates
-gand GID already exists,
groupaddrefuses to create another group with existing GID. As a workaround, use the
-foption, with which
groupaddcreates a group, but with a different GID.
groupadd -f GID
-roption to the
groupaddcommand. System groups are used for system purposes, which practically means that GID is allocated from 1 to 499 within the reserved range of 999.
groupadd -r group_name
groupadd, see the groupadd(8) man pages.