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 SYS_GID_MAX (number), SYS_GID_MIN (number)
341 Range of group IDs used for the creation of system groups by
342 useradd, groupadd, or newusers.
343
344 The default value for SYS_GID_MIN (resp. SYS_GID_MAX) is 101
345 (resp. GID_MIN-1).
346
347 SYS_UID_MAX (number), SYS_UID_MIN (number)
348 Range of user IDs used for the creation of system users by useradd
349 or newusers.
350
351 The default value for SYS_UID_MIN (resp. SYS_UID_MAX) is 101
352 (resp. UID_MIN-1).
353
354 SYSLOG_SG_ENAB (boolean)
355 Enable "syslog" logging of sg activity.
356
357 SYSLOG_SU_ENAB (boolean)
358 Enable "syslog" logging of su activity - in addition to sulog file
359 logging.
360
361 TTYGROUP (string), TTYPERM (string)
362 The terminal permissions: the login tty will be owned by the
363 TTYGROUP group, and the permissions will be set to TTYPERM.
364
365 By default, the ownership of the terminal is set to the user's
366 primary group and the permissions are set to 0600.
367
368 TTYGROUP can be either the name of a group or a numeric group
369 identifier.
370
371 If you have a write program which is "setgid" to a special group
372 which owns the terminals, define TTYGROUP to the group number and
373 TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign
374 TTYPERM to either 622 or 600.
375
376 TTYTYPE_FILE (string)
377 If defined, file which maps tty line to TERM environment parameter.
378 Each line of the file is in a format something like "vt100 tty01".
379
380 UID_MAX (number), UID_MIN (number)
381 Range of user IDs used for the creation of regular users by useradd
382 or newusers.
383
384 The default value for UID_MIN (resp. UID_MAX) is 1000 (resp.
385 60000).
386
387 ULIMIT (number)
388 Default ulimit value.
389
390 UMASK (number)
391 The file mode creation mask is initialized to this value. If not
392 specified, the mask will be initialized to 022.
393
394 useradd and newusers use this mask to set the mode of the home
395 directory they create
396
397 It is also used by login to define users' initial umask. Note that
398 this mask can be overridden by the user's GECOS line (if
399 QUOTAS_ENAB is set) or by the specification of a limit with the K
400 identifier in limits(5).
401
402 USERDEL_CMD (string)
403 If defined, this command is run when removing a user. It should
404 remove any at/cron/print jobs etc. owned by the user to be removed
405 (passed as the first argument).
406
407 The return code of the script is not taken into account.
408
409 Here is an example script, which removes the user's cron, at and
410 print jobs:
411
412 #! /bin/sh
413
414 # Check for the required argument.
415 if [ $# != 1 ]; then
416 echo "Usage: $0 username"
417 exit 1
418 fi
419
420 # Remove cron jobs.
421 crontab -r -u $1
422
423 # Remove at jobs.
424 # Note that it will remove any jobs owned by the same UID,
425 # even if it was shared by a different username.
426 AT_SPOOL_DIR=/var/spool/cron/atjobs
427 find $AT_SPOOL_DIR -name "[^.]*" -type f -user $1 -delete \;
428
429 # Remove print jobs.
430 lprm $1
431
432 # All done.
433 exit 0
434
435
436
437 USERGROUPS_ENAB (boolean)
438 Enable setting of the umask group bits to be the same as owner bits
439 (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid
440 is the same as gid, and username is the same as the primary group
441 name.
442
443 If set to yes, userdel will remove the user's group if it contains
444 no more members, and useradd will create by default a group with
445 the name of the user.
446
448 The following cross references show which programs in the shadow
449 password suite use which parameters.
450
451 chpasswd
452 ENCRYPT_METHOD MD5_CRYPT_ENABSHA_CRYPT_MAX_ROUNDS
453 SHA_CRYPT_MIN_ROUNDS
454
455 gpasswd
456 ENCRYPT_METHOD MAX_MEMBERS_PER_GROUP MD5_CRYPT_ENAB
457 SHA_CRYPT_MAX_ROUNDS SHA_CRYPT_MIN_ROUNDS
458
459 groupadd
460 GID_MAX GID_MIN MAX_MEMBERS_PER_GROUP SYS_GID_MAX SYS_GID_MIN
461
462 groupdel
463 MAX_MEMBERS_PER_GROUP
464
465 groupmems
466 MAX_MEMBERS_PER_GROUP
467
468 groupmod
469 MAX_MEMBERS_PER_GROUP
470
471 grpck
472 MAX_MEMBERS_PER_GROUP
473
474 grpconv
475 MAX_MEMBERS_PER_GROUP
476
477 grpunconv
478 MAX_MEMBERS_PER_GROUP
479
480 newgrp / sg
481 SYSLOG_SG_ENAB
482
483 newusers
484 ENCRYPT_METHOD GID_MAX GID_MIN MAX_MEMBERS_PER_GROUP MD5_CRYPT_ENAB
485 PASS_MAX_DAYS PASS_MIN_DAYS PASS_WARN_AGE SHA_CRYPT_MAX_ROUNDS
486 SHA_CRYPT_MIN_ROUNDS SYS_GID_MAX SYS_GID_MIN SYS_UID_MAX
487 SYS_UID_MIN UID_MAX UID_MIN UMASK
488
489 pwck
490 PASS_MAX_DAYS PASS_MIN_DAYS PASS_WARN_AGE
491
492 pwconv
493 PASS_MAX_DAYS PASS_MIN_DAYS PASS_WARN_AGE
494
495 useradd
496 CREATE_HOME GID_MAX GID_MIN MAIL_DIR MAX_MEMBERS_PER_GROUP
497 PASS_MAX_DAYS PASS_MIN_DAYS PASS_WARN_AGE SYS_GID_MAX SYS_GID_MIN
498 SYS_UID_MAX SYS_UID_MIN UID_MAX UID_MIN UMASK
499
500 userdel
501 MAIL_DIR MAIL_FILE MAX_MEMBERS_PER_GROUP USERDEL_CMD
502 USERGROUPS_ENAB
503
504 usermod
505 MAIL_DIR MAIL_FILE MAX_MEMBERS_PER_GROUP
506
508 login(1), passwd(1), su(1), passwd(5), shadow(5), pam(8).
509
510
511
512shadow-utils 4.1.5.1 03/14/2019 LOGIN.DEFS(5)