1NEWUSERS(8) System Management Commands NEWUSERS(8)
2
3
4
6 newusers - update and create new users in batch
7
9 newusers [options] [file]
10
12 The newusers command reads a file (or the standard input by default)
13 and uses this information to update a set of existing users or to
14 create new users. Each line is in the same format as the standard
15 password file (see passwd(5)) with the exceptions explained below:
16
17 pw_name:pw_passwd:pw_uid:pw_gid:pw_gecos:pw_dir:pw_shell
18
19 pw_name
20 This is the name of the user.
21
22 It can be the name of a new user or the name of an existing user
23 (or a user created before by newusers). In case of an existing
24 user, the user's information will be changed, otherwise a new user
25 will be created.
26
27 pw_passwd
28 This field will be encrypted and used as the new value of the
29 encrypted password.
30
31 pw_uid
32 This field is used to define the UID of the user.
33
34 If the field is empty, a new (unused) UID will be defined
35 automatically by newusers.
36
37 If this field contains a number, this number will be used as the
38 UID.
39
40 If this field contains the name of an existing user (or the name of
41 a user created before by newusers), the UID of the specified user
42 will be used.
43
44 If the UID of an existing user is changed, the files ownership of
45 the user's file should be fixed manually.
46
47 pw_gid
48 This field is used to define the primary group ID for the user.
49
50 If this field contains the name of an existing group (or a group
51 created before by newusers), the GID of this group will be used as
52 the primary group ID for the user.
53
54 If this field is a number, this number will be used as the primary
55 group ID of the user. If no groups exist with this GID, a new group
56 will be created with this GID, and the name of the user.
57
58 If this field is empty, a new group will be created with the name
59 of the user and a GID will be automatically defined by newusers to
60 be used as the primary group ID for the user and as the GID for the
61 new group.
62
63 If this field contains the name of a group which does not exist
64 (and was not created before by newusers), a new group will be
65 created with the specified name and a GID will be automatically
66 defined by newusers to be used as the primary group ID for the user
67 and GID for the new group.
68
69 pw_gecos
70 This field is copied in the GECOS field of the user.
71
72 pw_dir
73 This field is used to define the home directory of the user.
74
75 If this field does not specify an existing directory, the specified
76 directory is created, with ownership set to the user being created
77 or updated and its primary group. Note that newusers does not
78 create parent directories of the new user's home directory. The
79 newusers command will fail to create the home directory if the
80 parent directories do not exist, and will send a message to stderr
81 informing the user of the failure. The newusers command will not
82 halt or return a failure to the calling shell if it fails to create
83 the home directory, it will continue to process the batch of new
84 users specified.
85
86 If the home directory of an existing user is changed, newusers does
87 not move or copy the content of the old directory to the new
88 location. This should be done manually.
89
90 pw_shell
91 This field defines the shell of the user. No checks are performed
92 on this field.
93
94 newusers first tries to create or change all the specified users, and
95 then write these changes to the user or group databases. If an error
96 occurs (except in the final writes to the databases), no changes are
97 committed to the databases.
98
99 This command is intended to be used in a large system environment where
100 many accounts are updated at a single time.
101
103 The options which apply to the newusers command are:
104
105 --badname
106 Allow names that do not conform to standards.
107
108 -c, --crypt-method
109 Use the specified method to encrypt the passwords.
110
111 The available methods are DES, MD5, NONE, and SHA256 or SHA512 if
112 your libc support these methods.
113
114 -h, --help
115 Display help message and exit.
116
117 -r, --system
118 Create a system account.
119
120 System users will be created with no aging information in
121 /etc/shadow, and their numeric identifiers are chosen in the
122 SYS_UID_MIN-SYS_UID_MAX range, defined in login.defs, instead of
123 UID_MIN-UID_MAX (and their GID counterparts for the creation of
124 groups).
125
126 -R, --root CHROOT_DIR
127 Apply changes in the CHROOT_DIR directory and use the configuration
128 files from the CHROOT_DIR directory.
129
130 -s, --sha-rounds
131 Use the specified number of rounds to encrypt the passwords.
132
133 The value 0 means that the system will choose the default number of
134 rounds for the crypt method (5000).
135
136 A minimal value of 1000 and a maximal value of 999,999,999 will be
137 enforced.
138
139 You can only use this option with the SHA256 or SHA512 crypt
140 method.
141
142 By default, the number of rounds is defined by the
143 SHA_CRYPT_MIN_ROUNDS and SHA_CRYPT_MAX_ROUNDS variables in
144 /etc/login.defs.
145
147 The input file must be protected since it contains unencrypted
148 passwords.
149
150 You should make sure the passwords and the encryption method respect
151 the system's password policy.
152
154 The following configuration variables in /etc/login.defs change the
155 behavior of this tool:
156
157 ENCRYPT_METHOD (string)
158 This defines the system default encryption algorithm for encrypting
159 passwords (if no algorithm are specified on the command line).
160
161 It can take one of these values: DES (default), MD5, SHA256,
162 SHA512. MD5 and DES should not be used for new hashes, see crypt(5)
163 for recommendations.
164
165 Note: this parameter overrides the MD5_CRYPT_ENAB variable.
166
167 GID_MAX (number), GID_MIN (number)
168 Range of group IDs used for the creation of regular groups by
169 useradd, groupadd, or newusers.
170
171 The default value for GID_MIN (resp. GID_MAX) is 1000 (resp.
172 60000).
173
174 HOME_MODE (number)
175 The mode for new home directories. If not specified, the UMASK is
176 used to create the mode.
177
178 useradd and newusers use this to set the mode of the home directory
179 they create.
180
181 MAX_MEMBERS_PER_GROUP (number)
182 Maximum members per group entry. When the maximum is reached, a new
183 group entry (line) is started in /etc/group (with the same name,
184 same password, and same GID).
185
186 The default value is 0, meaning that there are no limits in the
187 number of members in a group.
188
189 This feature (split group) permits to limit the length of lines in
190 the group file. This is useful to make sure that lines for NIS
191 groups are not larger than 1024 characters.
192
193 If you need to enforce such limit, you can use 25.
194
195 Note: split groups may not be supported by all tools (even in the
196 Shadow toolsuite). You should not use this variable unless you
197 really need it.
198
199 MD5_CRYPT_ENAB (boolean)
200 Indicate if passwords must be encrypted using the MD5-based
201 algorithm. If set to yes, new passwords will be encrypted using the
202 MD5-based algorithm compatible with the one used by recent releases
203 of FreeBSD. It supports passwords of unlimited length and longer
204 salt strings. Set to no if you need to copy encrypted passwords to
205 other systems which don't understand the new algorithm. Default is
206 no.
207
208 This variable is superseded by the ENCRYPT_METHOD variable or by
209 any command line option used to configure the encryption algorithm.
210
211 This variable is deprecated. You should use ENCRYPT_METHOD.
212
213 PASS_MAX_DAYS (number)
214 The maximum number of days a password may be used. If the password
215 is older than this, a password change will be forced. If not
216 specified, -1 will be assumed (which disables the restriction).
217
218 PASS_MIN_DAYS (number)
219 The minimum number of days allowed between password changes. Any
220 password changes attempted sooner than this will be rejected. If
221 not specified, 0 will be assumed (which disables the restriction).
222
223 PASS_WARN_AGE (number)
224 The number of days warning given before a password expires. A zero
225 means warning is given only upon the day of expiration, a negative
226 value means no warning is given. If not specified, no warning will
227 be provided.
228
229 SHA_CRYPT_MIN_ROUNDS (number), SHA_CRYPT_MAX_ROUNDS (number)
230 When ENCRYPT_METHOD is set to SHA256 or SHA512, this defines the
231 number of SHA rounds used by the encryption algorithm by default
232 (when the number of rounds is not specified on the command line).
233
234 With a lot of rounds, it is more difficult to brute forcing the
235 password. But note also that more CPU resources will be needed to
236 authenticate users.
237
238 If not specified, the libc will choose the default number of rounds
239 (5000), which is orders of magnitude too low for modern hardware.
240
241 The values must be inside the 1000-999,999,999 range.
242
243 If only one of the SHA_CRYPT_MIN_ROUNDS or SHA_CRYPT_MAX_ROUNDS
244 values is set, then this value will be used.
245
246 If SHA_CRYPT_MIN_ROUNDS > SHA_CRYPT_MAX_ROUNDS, the highest value
247 will be used.
248
249 SUB_GID_MIN (number), SUB_GID_MAX (number), SUB_GID_COUNT (number)
250 If /etc/subuid exists, the commands useradd and newusers (unless
251 the user already have subordinate group IDs) allocate SUB_GID_COUNT
252 unused group IDs from the range SUB_GID_MIN to SUB_GID_MAX for each
253 new user.
254
255 The default values for SUB_GID_MIN, SUB_GID_MAX, SUB_GID_COUNT are
256 respectively 100000, 600100000 and 65536.
257
258 SUB_UID_MIN (number), SUB_UID_MAX (number), SUB_UID_COUNT (number)
259 If /etc/subuid exists, the commands useradd and newusers (unless
260 the user already have subordinate user IDs) allocate SUB_UID_COUNT
261 unused user IDs from the range SUB_UID_MIN to SUB_UID_MAX for each
262 new user.
263
264 The default values for SUB_UID_MIN, SUB_UID_MAX, SUB_UID_COUNT are
265 respectively 100000, 600100000 and 65536.
266
267 SYS_GID_MAX (number), SYS_GID_MIN (number)
268 Range of group IDs used for the creation of system groups by
269 useradd, groupadd, or newusers.
270
271 The default value for SYS_GID_MIN (resp. SYS_GID_MAX) is 101
272 (resp. GID_MIN-1).
273
274 SYS_UID_MAX (number), SYS_UID_MIN (number)
275 Range of user IDs used for the creation of system users by useradd
276 or newusers.
277
278 The default value for SYS_UID_MIN (resp. SYS_UID_MAX) is 101
279 (resp. UID_MIN-1).
280
281 UID_MAX (number), UID_MIN (number)
282 Range of user IDs used for the creation of regular users by useradd
283 or newusers.
284
285 The default value for UID_MIN (resp. UID_MAX) is 1000 (resp.
286 60000).
287
288 UMASK (number)
289 The file mode creation mask is initialized to this value. If not
290 specified, the mask will be initialized to 022.
291
292 useradd and newusers use this mask to set the mode of the home
293 directory they create if HOME_MODE is not set.
294
295 It is also used by login to define users' initial umask. Note that
296 this mask can be overridden by the user's GECOS line (if
297 QUOTAS_ENAB is set) or by the specification of a limit with the K
298 identifier in limits(5).
299
301 /etc/passwd
302 User account information.
303
304 /etc/shadow
305 Secure user account information.
306
307 /etc/group
308 Group account information.
309
310 /etc/gshadow
311 Secure group account information.
312
313 /etc/login.defs
314 Shadow password suite configuration.
315
316 /etc/subgid
317 Per user subordinate group IDs.
318
319 /etc/subuid
320 Per user subordinate user IDs.
321
323 login.defs(5), passwd(1), subgid(5), subuid(5), useradd(8).
324
325
326
327shadow-utils 4.11.1 02/10/2022 NEWUSERS(8)