1GROUPADD(8) System Management Commands GROUPADD(8)
2
3
4
6 groupadd - create a new group
7
9 groupadd [options] group
10
12 The groupadd command creates a new group account using the values
13 specified on the command line plus the default values from the system.
14 The new group will be entered into the system files as needed.
15
17 The options which apply to the groupadd command are:
18
19 -f, --force
20 This option causes the command to simply exit with success status
21 if the specified group already exists. When used with -g, and the
22 specified GID already exists, another (unique) GID is chosen (i.e.
23 -g is turned off).
24
25 -g, --gid GID
26 The numerical value of the group's ID. This value must be unique,
27 unless the -o option is used. The value must be non-negative. The
28 default is to use the smallest ID value greater than or equal to
29 GID_MIN and greater than every other group.
30
31 See also the -r option and the GID_MAX description.
32
33 -h, --help
34 Display help message and exit.
35
36 -K, --key KEY=VALUE
37 Overrides /etc/login.defs defaults (GID_MIN, GID_MAX and others).
38 Multiple -K options can be specified.
39
40 Example: -K GID_MIN=100 -K GID_MAX=499
41
42 Note: -K GID_MIN=10,GID_MAX=499 doesn't work yet.
43
44 -o, --non-unique
45 This option permits to add a group with a non-unique GID.
46
47 -p, --password PASSWORD
48 The encrypted password, as returned by crypt(3). The default is to
49 disable the password.
50
51 Note: This option is not recommended because the password (or
52 encrypted password) will be visible by users listing the processes.
53
54 You should make sure the password respects the system's password
55 policy.
56
57 -r, --system
58 Create a system group.
59
60 The numeric identifiers of new system groups are chosen in the
61 SYS_GID_MIN-SYS_GID_MAX range, defined in login.defs, instead of
62 GID_MIN-GID_MAX.
63
64 -R, --root CHROOT_DIR
65 Apply changes in the CHROOT_DIR directory and use the configuration
66 files from the CHROOT_DIR directory.
67
68 -P, --prefix PREFIX_DIR
69 Apply changes in the PREFIX_DIR directory and use the configuration
70 files from the PREFIX_DIR directory. This option does not chroot
71 and is intended for preparing a cross-compilation target. Some
72 limitations: NIS and LDAP users/groups are not verified. PAM
73 authentication is using the host files. No SELINUX support.
74
75 -U, --users
76 A list of usernames to add as members of the group.
77
78 The default behavior (if the -g, -N, and -U options are not
79 specified) is defined by the USERGROUPS_ENAB variable in
80 /etc/login.defs.
81
83 The following configuration variables in /etc/login.defs change the
84 behavior of this tool:
85
86 GID_MAX (number), GID_MIN (number)
87 Range of group IDs used for the creation of regular groups by
88 useradd, groupadd, or newusers.
89
90 The default value for GID_MIN (resp. GID_MAX) is 1000 (resp.
91 60000).
92
93 MAX_MEMBERS_PER_GROUP (number)
94 Maximum members per group entry. When the maximum is reached, a new
95 group entry (line) is started in /etc/group (with the same name,
96 same password, and same GID).
97
98 The default value is 0, meaning that there are no limits in the
99 number of members in a group.
100
101 This feature (split group) permits to limit the length of lines in
102 the group file. This is useful to make sure that lines for NIS
103 groups are not larger than 1024 characters.
104
105 If you need to enforce such limit, you can use 25.
106
107 Note: split groups may not be supported by all tools (even in the
108 Shadow toolsuite). You should not use this variable unless you
109 really need it.
110
111 SYS_GID_MAX (number), SYS_GID_MIN (number)
112 Range of group IDs used for the creation of system groups by
113 useradd, groupadd, or newusers.
114
115 The default value for SYS_GID_MIN (resp. SYS_GID_MAX) is 101
116 (resp. GID_MIN-1).
117
119 /etc/group
120 Group account information.
121
122 /etc/gshadow
123 Secure group account information.
124
125 /etc/login.defs
126 Shadow password suite configuration.
127
129 Groupnames may contain only lower and upper case letters, digits,
130 underscores, or dashes. They can end with a dollar sign. Dashes are not
131 allowed at the beginning of the groupname. Fully numeric groupnames and
132 groupnames . or .. are also disallowed.
133
134 Groupnames may only be up to 32 characters long.
135
136 You may not add a NIS or LDAP group. This must be performed on the
137 corresponding server.
138
139 If the groupname already exists in an external group database such as
140 NIS or LDAP, groupadd will deny the group creation request.
141
143 The groupadd command exits with the following values:
144
145 0
146 success
147
148 2
149 invalid command syntax
150
151 3
152 invalid argument to option
153
154 4
155 GID is already used (when called without -o)
156
157 9
158 group name is already used
159
160 10
161 can't update group file
162
164 chfn(1), chsh(1), passwd(1), gpasswd(8), groupdel(8), groupmod(8),
165 login.defs(5), useradd(8), userdel(8), usermod(8).
166
167
168
169shadow-utils 4.11.1 02/10/2022 GROUPADD(8)