Use of groupadd for user and group management on the command line interface
Groupadd-create a new group
The groupadd command is used to create a new group.
Syntax
Groupadd [options] group
Option:
-H for help
-G: create a user group with the specified GID
-P: Specify the group password when creating the group
-R -- system: creates a system user with the UID ranging from 1 to 499.
-O, -- non-unique allows repeated groups to be created
-F when creating a group, if the group exists, it also exits successfully.
-K, -- key KEY key = VALUE
Overrides/etc/login. defs defaults (GID_MIN, GID_MAX and
Others). Multiple-K options can be specified.
Example:-K GID_MIN = 100-K GID_MAX = 499
Note:-K GID_MIN = 10, GID_MAX = 499 doesn't work yet.
I don't know why the-K option is used? Explanations
The following is an example.
# Groupadd xiao1
# Cat/etc/group | tail-1
Xiao1: x: 4039: information of the created group xiao1
# Groupadd-g 4040 xiao1
Groupadd: group 'xiao1' already exists creation failed
# Groupadd-g 4039 xiao2
Groupadd: GID '000000' already exists creation failed
# Groupadd-g 4040-o-f xiao1 created successfully
# Groupadd-g 4039-o-f xiao2 created successfully
Note: When-o-f is used together, a non-unique group can be created successfully. What are the benefits of doing so when I am a little white? Explanations