1LOGIN.DEFS(5) File Formats and Conversions LOGIN.DEFS(5)
2
3
4
6 login.defs - shadow password suite configuration
7
9 The /etc/login.defs file defines the site-specific configuration for
10 the shadow password suite. This file is required. Absence of this file
11 will not prevent system operation, but will probably result in
12 undesirable operation.
13
14 This file is a readable text file, each line of the file describing one
15 configuration parameter. The lines consist of a configuration name and
16 value, separated by whitespace. Blank lines and comment lines are
17 ignored. Comments are introduced with a "#" pound sign and the pound
18 sign must be the first non-white character of the line.
19
20 Parameter values may be of four types: strings, booleans, numbers, and
21 long numbers. A string is comprised of any printable characters. A
22 boolean should be either the value yes or no. An undefined boolean
23 parameter or one with a value other than these will be given a no
24 value. Numbers (both regular and long) may be either decimal values,
25 octal values (precede the value with 0) or hexadecimal values (precede
26 the value with 0x). The maximum value of the regular and long numeric
27 parameters is machine-dependent.
28
29 Please note that the parameters in this configuration file control the
30 behavior of the tools from the shadow-utils component. None of these
31 tools uses the PAM mechanism, and the utilities that use PAM (such as
32 the passwd command) should be configured elsewhere. The only values
33 that affect PAM modules are ENCRYPT_METHOD and SHA_CRYPT_MAX_ROUNDS for
34 pam_unix module, FAIL_DELAY for pam_faildelay module, and UMASK for
35 pam_umask module. Refer to pam(8) for more information.
36
37 The following configuration items are provided:
38
39 CHFN_AUTH (boolean)
40 If yes, the chfn program will require authentication before making
41 any changes, unless run by the superuser.
42
43 CHFN_RESTRICT (string)
44 This parameter specifies which values in the gecos field of the
45 /etc/passwd file may be changed by regular users using the chfn
46 program. It can be any combination of letters f, r, w, h, for Full
47 name, Room number, Work phone, and Home phone, respectively. For
48 backward compatibility, yes is equivalent to rwh and no is
49 equivalent to frwh. If not specified, only the superuser can make
50 any changes. The most restrictive setting is better achieved by not
51 installing chfn SUID.
52
53 CHSH_AUTH (boolean)
54 If yes, the chsh program will require authentication before making
55 any changes, unless run by the superuser.
56
57 CONSOLE (string)
58 If defined, either full pathname of a file containing device names
59 (one per line) or a ":" delimited list of device names. Root logins
60 will be allowed only upon these devices.
61
62 If not defined, root will be allowed on any device.
63
64 The device should be specified without the /dev/ prefix.
65
66 CONSOLE_GROUPS (string)
67 List of groups to add to the user's supplementary groups set when
68 logging in on the console (as determined by the CONSOLE setting).
69 Default is none.
70
71 Use with caution - it is possible for users to gain permanent
72 access to these groups, even when not logged in on the console.
73
74 CREATE_HOME (boolean)
75 Indicate if a home directory should be created by default for new
76 users.
77
78 This setting does not apply to system users, and can be overridden
79 on the command line.
80
81 DEFAULT_HOME (boolean)
82 Indicate if login is allowed if we can't cd to the home directory.
83 Default is no.
84
85 If set to yes, the user will login in the root (/) directory if it
86 is not possible to cd to her home directory.
87
88 ENCRYPT_METHOD (string)
89 This defines the system default encryption algorithm for encrypting
90 passwords (if no algorithm are specified on the command line).
91
92 It can take one of these values: DES (default), MD5, SHA256,
93 SHA512.
94
95 Note: this parameter overrides the MD5_CRYPT_ENAB variable.
96
97 ENV_HZ (string)
98 If set, it will be used to define the HZ environment variable when
99 a user login. The value must be preceded by HZ=. A common value on
100 Linux is HZ=100.
101
102 ENV_PATH (string)
103 If set, it will be used to define the PATH environment variable
104 when a regular user login. The value is a colon separated list of
105 paths (for example /bin:/usr/bin) and can be preceded by PATH=. The
106 default value is PATH=/bin:/usr/bin.
107
108 ENV_SUPATH (string)
109 If set, it will be used to define the PATH environment variable
110 when the superuser login. The value is a colon separated list of
111 paths (for example /sbin:/bin:/usr/sbin:/usr/bin) and can be
112 preceded by PATH=. The default value is
113 PATH=/sbin:/bin:/usr/sbin:/usr/bin.
114
115 ENV_TZ (string)
116 If set, it will be used to define the TZ environment variable when
117 a user login. The value can be the name of a timezone preceded by
118 TZ= (for example TZ=CST6CDT), or the full path to the file
119 containing the timezone specification (for example /etc/tzname).
120
121 If a full path is specified but the file does not exist or cannot
122 be read, the default is to use TZ=CST6CDT.
123
124 ENVIRON_FILE (string)
125 If this file exists and is readable, login environment will be read
126 from it. Every line should be in the form name=value.
127
128 Lines starting with a # are treated as comment lines and ignored.
129
130 ERASECHAR (number)
131 Terminal ERASE character (010 = backspace, 0177 = DEL).
132
133 The value can be prefixed "0" for an octal value, or "0x" for an
134 hexadecimal value.
135
136 FAIL_DELAY (number)
137 Delay in seconds before being allowed another attempt after a login
138 failure.
139
140 FAILLOG_ENAB (boolean)
141 Enable logging and display of /var/log/faillog login failure info.
142
143 FAKE_SHELL (string)
144 If set, login will execute this shell instead of the users' shell
145 specified in /etc/passwd.
146
147 FTMP_FILE (string)
148 If defined, login failures will be logged in this file in a utmp
149 format.
150
151 GID_MAX (number), GID_MIN (number)
152 Range of group IDs used for the creation of regular groups by
153 useradd, groupadd, or newusers.
154
155 The default value for GID_MIN (resp. GID_MAX) is 1000 (resp.
156 60000).
157
158 HUSHLOGIN_FILE (string)
159 If defined, this file can inhibit all the usual chatter during the
160 login sequence. If a full pathname is specified, then hushed mode
161 will be enabled if the user's name or shell are found in the file.
162 If not a full pathname, then hushed mode will be enabled if the
163 file exists in the user's home directory.
164
165 ISSUE_FILE (string)
166 If defined, this file will be displayed before each login prompt.
167
168 KILLCHAR (number)
169 Terminal KILL character (025 = CTRL/U).
170
171 The value can be prefixed "0" for an octal value, or "0x" for an
172 hexadecimal value.
173
174 LASTLOG_ENAB (boolean)
175 Enable logging and display of /var/log/lastlog login time info.
176
177 LOG_OK_LOGINS (boolean)
178 Enable logging of successful logins.
179
180 LOG_UNKFAIL_ENAB (boolean)
181 Enable display of unknown usernames when login failures are
182 recorded.
183
184 Note: logging unknown usernames may be a security issue if an user
185 enter her password instead of her login name.
186
187 LOGIN_RETRIES (number)
188 Maximum number of login retries in case of bad password.
189
190 LOGIN_STRING (string)
191 The string used for prompting a password. The default is to use
192 "Password: ", or a translation of that string. If you set this
193 variable, the prompt will not be translated.
194
195 If the string contains %s, this will be replaced by the user's
196 name.
197
198 LOGIN_TIMEOUT (number)
199 Max time in seconds for login.
200
201 MAIL_CHECK_ENAB (boolean)
202 Enable checking and display of mailbox status upon login.
203
204 You should disable it if the shell startup files already check for
205 mail ("mailx -e" or equivalent).
206
207 MAIL_DIR (string)
208 The mail spool directory. This is needed to manipulate the mailbox
209 when its corresponding user account is modified or deleted. If not
210 specified, a compile-time default is used.
211
212 MAIL_FILE (string)
213 Defines the location of the users mail spool files relatively to
214 their home directory.
215
216 The MAIL_DIR and MAIL_FILE variables are used by useradd, usermod, and
217 userdel to create, move, or delete the user's mail spool.
218
219 If MAIL_CHECK_ENAB is set to yes, they are also used to define the MAIL
220 environment variable.
221
222 MAX_MEMBERS_PER_GROUP (number)
223 Maximum members per group entry. When the maximum is reached, a new
224 group entry (line) is started in /etc/group (with the same name,
225 same password, and same GID).
226
227 The default value is 0, meaning that there are no limits in the
228 number of members in a group.
229
230 This feature (split group) permits to limit the length of lines in
231 the group file. This is useful to make sure that lines for NIS
232 groups are not larger than 1024 characters.
233
234 If you need to enforce such limit, you can use 25.
235
236 Note: split groups may not be supported by all tools (even in the
237 Shadow toolsuite). You should not use this variable unless you
238 really need it.
239
240 MD5_CRYPT_ENAB (boolean)
241 Indicate if passwords must be encrypted using the MD5-based
242 algorithm. If set to yes, new passwords will be encrypted using the
243 MD5-based algorithm compatible with the one used by recent releases
244 of FreeBSD. It supports passwords of unlimited length and longer
245 salt strings. Set to no if you need to copy encrypted passwords to
246 other systems which don't understand the new algorithm. Default is
247 no.
248
249 This variable is superseded by the ENCRYPT_METHOD variable or by
250 any command line option used to configure the encryption algorithm.
251
252 This variable is deprecated. You should use ENCRYPT_METHOD.
253
254 MOTD_FILE (string)
255 If defined, ":" delimited list of "message of the day" files to be
256 displayed upon login.
257
258 NOLOGINS_FILE (string)
259 If defined, name of file whose presence will inhibit non-root
260 logins. The contents of this file should be a message indicating
261 why logins are inhibited.
262
263 OBSCURE_CHECKS_ENAB (boolean)
264 Enable additional checks upon password changes.
265
266 PASS_ALWAYS_WARN (boolean)
267 Warn about weak passwords (but still allow them) if you are root.
268
269 PASS_CHANGE_TRIES (number)
270 Maximum number of attempts to change password if rejected (too
271 easy).
272
273 PASS_MAX_DAYS (number)
274 The maximum number of days a password may be used. If the password
275 is older than this, a password change will be forced. If not
276 specified, -1 will be assumed (which disables the restriction).
277
278 PASS_MIN_DAYS (number)
279 The minimum number of days allowed between password changes. Any
280 password changes attempted sooner than this will be rejected. If
281 not specified, -1 will be assumed (which disables the restriction).
282
283 PASS_WARN_AGE (number)
284 The number of days warning given before a password expires. A zero
285 means warning is given only upon the day of expiration, a negative
286 value means no warning is given. If not specified, no warning will
287 be provided.
288
289 PASS_MAX_DAYS, PASS_MIN_DAYS and PASS_WARN_AGE are only used at the
290 time of account creation. Any changes to these settings won't affect
291 existing accounts.
292
293 PASS_MAX_LEN (number), PASS_MIN_LEN (number)
294 Number of significant characters in the password for crypt().
295 PASS_MAX_LEN is 8 by default. Don't change unless your crypt() is
296 better. This is ignored if MD5_CRYPT_ENAB set to yes.
297
298 PORTTIME_CHECKS_ENAB (boolean)
299 Enable checking of time restrictions specified in /etc/porttime.
300
301 QUOTAS_ENAB (boolean)
302 Enable setting of resource limits from /etc/limits and ulimit,
303 umask, and niceness from the user's passwd gecos field.
304
305 SHA_CRYPT_MIN_ROUNDS (number), SHA_CRYPT_MAX_ROUNDS (number)
306 When ENCRYPT_METHOD is set to SHA256 or SHA512, this defines the
307 number of SHA rounds used by the encryption algorithm by default
308 (when the number of rounds is not specified on the command line).
309
310 With a lot of rounds, it is more difficult to brute forcing the
311 password. But note also that more CPU resources will be needed to
312 authenticate users.
313
314 If not specified, the libc will choose the default number of rounds
315 (5000).
316
317 The values must be inside the 1000-999,999,999 range.
318
319 If only one of the SHA_CRYPT_MIN_ROUNDS or SHA_CRYPT_MAX_ROUNDS
320 values is set, then this value will be used.
321
322 If SHA_CRYPT_MIN_ROUNDS > SHA_CRYPT_MAX_ROUNDS, the highest value
323 will be used.
324
325 SULOG_FILE (string)
326 If defined, all su activity is logged to this file.
327
328 SU_NAME (string)
329 If defined, the command name to display when running "su -". For
330 example, if this is defined as "su" then a "ps" will display the
331 command is "-su". If not defined, then "ps" would display the name
332 of the shell actually being run, e.g. something like "-sh".
333
334 SU_WHEEL_ONLY (boolean)
335 If yes, the user must be listed as a member of the first gid 0
336 group in /etc/group (called root on most Linux systems) to be able
337 to su to uid 0 accounts. If the group doesn't exist or is empty, no
338 one will be able to su to uid 0.
339
340 SUB_GID_MIN (number), SUB_GID_MAX (number), SUB_GID_COUNT (number)
341 If /etc/subuid exists, the commands useradd and newusers (unless
342 the user already have subordinate group IDs) allocate SUB_GID_COUNT
343 unused group IDs from the range SUB_GID_MIN to SUB_GID_MAX for each
344 new user.
345
346 The default values for SUB_GID_MIN, SUB_GID_MAX, SUB_GID_COUNT are
347 respectively 100000, 600100000 and 10000.
348
349 SUB_UID_MIN (number), SUB_UID_MAX (number), SUB_UID_COUNT (number)
350 If /etc/subuid exists, the commands useradd and newusers (unless
351 the user already have subordinate user IDs) allocate SUB_UID_COUNT
352 unused user IDs from the range SUB_UID_MIN to SUB_UID_MAX for each
353 new user.
354
355 The default values for SUB_UID_MIN, SUB_UID_MAX, SUB_UID_COUNT are
356 respectively 100000, 600100000 and 10000.
357
358 SYS_GID_MAX (number), SYS_GID_MIN (number)
359 Range of group IDs used for the creation of system groups by
360 useradd, groupadd, or newusers.
361
362 The default value for SYS_GID_MIN (resp. SYS_GID_MAX) is 101
363 (resp. GID_MIN-1).
364
365 SYS_UID_MAX (number), SYS_UID_MIN (number)
366 Range of user IDs used for the creation of system users by useradd
367 or newusers.
368
369 The default value for SYS_UID_MIN (resp. SYS_UID_MAX) is 101
370 (resp. UID_MIN-1).
371
372 SYSLOG_SG_ENAB (boolean)
373 Enable "syslog" logging of sg activity.
374
375 SYSLOG_SU_ENAB (boolean)
376 Enable "syslog" logging of su activity - in addition to sulog file
377 logging.
378
379 TTYGROUP (string), TTYPERM (string)
380 The terminal permissions: the login tty will be owned by the
381 TTYGROUP group, and the permissions will be set to TTYPERM.
382
383 By default, the ownership of the terminal is set to the user's
384 primary group and the permissions are set to 0600.
385
386 TTYGROUP can be either the name of a group or a numeric group
387 identifier.
388
389 If you have a write program which is "setgid" to a special group
390 which owns the terminals, define TTYGROUP to the group number and
391 TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign
392 TTYPERM to either 622 or 600.
393
394 TTYTYPE_FILE (string)
395 If defined, file which maps tty line to TERM environment parameter.
396 Each line of the file is in a format something like "vt100 tty01".
397
398 UID_MAX (number), UID_MIN (number)
399 Range of user IDs used for the creation of regular users by useradd
400 or newusers.
401
402 The default value for UID_MIN (resp. UID_MAX) is 1000 (resp.
403 60000).
404
405 ULIMIT (number)
406 Default ulimit value.
407
408 UMASK (number)
409 The file mode creation mask is initialized to this value. If not
410 specified, the mask will be initialized to 022.
411
412 useradd and newusers use this mask to set the mode of the home
413 directory they create
414
415 It is also used by login to define users' initial umask. Note that
416 this mask can be overridden by the user's GECOS line (if
417 QUOTAS_ENAB is set) or by the specification of a limit with the K
418 identifier in limits(5).
419
420 USERDEL_CMD (string)
421 If defined, this command is run when removing a user. It should
422 remove any at/cron/print jobs etc. owned by the user to be removed
423 (passed as the first argument).
424
425 The return code of the script is not taken into account.
426
427 Here is an example script, which removes the user's cron, at and
428 print jobs:
429
430 #! /bin/sh
431
432 # Check for the required argument.
433 if [ $# != 1 ]; then
434 echo "Usage: $0 username"
435 exit 1
436 fi
437
438 # Remove cron jobs.
439 crontab -r -u $1
440
441 # Remove at jobs.
442 # Note that it will remove any jobs owned by the same UID,
443 # even if it was shared by a different username.
444 AT_SPOOL_DIR=/var/spool/cron/atjobs
445 find $AT_SPOOL_DIR -name "[^.]*" -type f -user $1 -delete \;
446
447 # Remove print jobs.
448 lprm $1
449
450 # All done.
451 exit 0
452
453
454
455 USERGROUPS_ENAB (boolean)
456 Enable setting of the umask group bits to be the same as owner bits
457 (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid
458 is the same as gid, and username is the same as the primary group
459 name.
460
461 If set to yes, userdel will remove the user's group if it contains
462 no more members, and useradd will create by default a group with
463 the name of the user.
464
466 The following cross references show which programs in the shadow
467 password suite use which parameters.
468
469 chgpasswd
470 ENCRYPT_METHOD MAX_MEMBERS_PER_GROUP MD5_CRYPT_ENAB
471 SHA_CRYPT_MAX_ROUNDS SHA_CRYPT_MIN_ROUNDS
472
473 chpasswd
474 ENCRYPT_METHOD MD5_CRYPT_ENAB SHA_CRYPT_MAX_ROUNDS
475 SHA_CRYPT_MIN_ROUNDS
476
477 gpasswd
478 ENCRYPT_METHOD MAX_MEMBERS_PER_GROUP MD5_CRYPT_ENAB
479 SHA_CRYPT_MAX_ROUNDS SHA_CRYPT_MIN_ROUNDS
480
481 groupadd
482 GID_MAX GID_MIN MAX_MEMBERS_PER_GROUP SYS_GID_MAX SYS_GID_MIN
483
484 groupdel
485 MAX_MEMBERS_PER_GROUP
486
487 groupmems
488 MAX_MEMBERS_PER_GROUP
489
490 groupmod
491 MAX_MEMBERS_PER_GROUP
492
493 grpck
494 MAX_MEMBERS_PER_GROUP
495
496 grpconv
497 MAX_MEMBERS_PER_GROUP
498
499 grpunconv
500 MAX_MEMBERS_PER_GROUP
501
502 newgrp / sg
503 SYSLOG_SG_ENAB
504
505 newusers
506 ENCRYPT_METHOD GID_MAX GID_MIN MAX_MEMBERS_PER_GROUP MD5_CRYPT_ENAB
507 PASS_MAX_DAYS PASS_MIN_DAYS PASS_WARN_AGE SHA_CRYPT_MAX_ROUNDS
508 SHA_CRYPT_MIN_ROUNDS SUB_GID_COUNT SUB_GID_MAX SUB_GID_MIN
509 SUB_UID_COUNT SUB_UID_MAX SUB_UID_MIN SYS_GID_MAX SYS_GID_MIN
510 SYS_UID_MAX SYS_UID_MIN UID_MAX UID_MIN UMASK
511
512 pwck
513 PASS_MAX_DAYS PASS_MIN_DAYS PASS_WARN_AGE
514
515 pwconv
516 PASS_MAX_DAYS PASS_MIN_DAYS PASS_WARN_AGE
517
518 useradd
519 CREATE_HOME GID_MAX GID_MIN MAIL_DIR MAX_MEMBERS_PER_GROUP
520 PASS_MAX_DAYS PASS_MIN_DAYS PASS_WARN_AGE SUB_GID_COUNT SUB_GID_MAX
521 SUB_GID_MIN SUB_UID_COUNT SUB_UID_MAX SUB_UID_MIN SYS_GID_MAX
522 SYS_GID_MIN SYS_UID_MAX SYS_UID_MIN UID_MAX UID_MIN UMASK
523
524 userdel
525 MAIL_DIR MAIL_FILE MAX_MEMBERS_PER_GROUP USERDEL_CMD
526 USERGROUPS_ENAB
527
528 usermod
529 MAIL_DIR MAIL_FILE MAX_MEMBERS_PER_GROUP
530
532 login(1), passwd(1), su(1), passwd(5), shadow(5), pam(8).
533
534
535
536shadow-utils 4.6 05/11/2019 LOGIN.DEFS(5)