Groupadd command
Syntax
groupadd [ Options ]
This command creates a new group account using the values specified on the command line and the default values from the system. A new group will be entered into the system files as required. The options that apply to the groupadd command are
-g gid
The g gid is the numerical value of the group's ID. In this the value must be unique, unless the -o option is used and the value must be non-negative. A default is to use the smallest value that is greater than 500. However, this value must be greater than the group ID value of the already existing groups. Values among 0 and 499 are typically reserved by system accounts.
-r
This flag instructs groupadd for add a system account. The first available gid that is lower than 499 will be automatically selected unless -g option is given also on the command line. Associated files to be updated when the groupadd command is used are
/etc/group - group account information
/etc/gshadow - to secure group account information
Practice 1
The given example shows how to create groups
# groupadd -g 515 marketing
# groupadd -g 516 sales
# groupadd -g 517 technical
# groupadd -g 518 student
# groupadd -g 519 manager
# groupadd -g 520 dummy1
# groupadd -g 521 dummy2
# groupadd -g 522 dummy3
The given command will create groups for sales, marketing, student, manager, technical, dummy1, dummy2 and dummy3 with the unique ids.