table of contents
- Tumbleweed 4.20.2-1.1
- Leap-16.0
- Leap-15.6
| LOGIN.DEFS(5) | File Formats and Configuration | LOGIN.DEFS(5) |
NAME¶
login.defs - shadow password suite configuration
DESCRIPTION¶
The /etc/login.defs file defines the site-specific configuration for the shadow password suite. This file is required. Absence of this file will not prevent system operation, but will probably result in undesirable operation.
This file is a readable text file, each line of the file describing one configuration parameter. The lines consist of a configuration name and value, separated by whitespace. Blank lines and comment lines are ignored. Comments are introduced with a "#" pound sign and the pound sign must be the first non-white character of the line.
Parameter values may be of four types: strings, booleans, numbers, and long numbers. A string is comprised of any printable characters. A boolean should be either the value yes or no. An undefined boolean parameter or one with a value other than these will be given a no value. Numbers (both regular and long) may be either decimal values, octal values (precede the value with 0) or hexadecimal values (precede the value with 0x). The maximum value of the regular and long numeric parameters is machine-dependent.
This configuration file controls the behavior of system tools for user and group management. The parameters may be used by shadow-utils programs, PAM modules, and other system components. The actual behavior depends on the system configuration and which authentication mechanisms are enabled.
The following configuration items are provided:
CHFN_AUTH (boolean)
CHFN_RESTRICT (string)
CHSH_AUTH (boolean)
CONSOLE (string)
If not defined, root will be allowed on any device.
The device should be specified without the /dev/ prefix.
CONSOLE_GROUPS (string)
Use with caution - it is possible for users to gain permanent access to these groups, even when not logged in on the console.
CREATE_HOME (boolean)
This setting does not apply to system users, and can be overridden on the command line.
DEFAULT_HOME (boolean)
If set to yes, the user will login in the root (/) directory if it is not possible to cd to her home directory.
ENCRYPT_METHOD (string)
It can take one of these values: SHA256, SHA512 (default), . See crypt(5) for recommendations.
History: This variable is used by other programs, which may still default to unsafe algorithms such as DES. To avoid using unsafe algorithms, the variable should always be specified.
ENV_HZ (string)
ENV_PATH (string)
ENV_SUPATH (string)
ENV_TZ (string)
If a full path is specified but the file does not exist or cannot be read, the default is to use TZ=CST6CDT.
ENVIRON_FILE (string)
Lines starting with a # are treated as comment lines and ignored.
ERASECHAR (number)
The value can be prefixed "0" for an octal value, or "0x" for an hexadecimal value.
FAIL_DELAY (number)
FAILLOG_ENAB (boolean)
FAKE_SHELL (string)
FTMP_FILE (string)
GID_MAX (number), GID_MIN (number)
The default value for GID_MIN (resp. GID_MAX) is 1000 (resp. 60000).
HMAC_CRYPTO_ALGO (string)
Note: check hmac(3) to see the possible algorithms that are available in your system.
HOME_MODE (number)
useradd and newusers use this to set the mode of the home directory they create.
HUSHLOGIN_FILE (string)
ISSUE_FILE (string)
KILLCHAR (number)
The value can be prefixed "0" for an octal value, or "0x" for an hexadecimal value.
LASTLOG_ENAB (boolean)
LASTLOG_UID_MAX (number)
No LASTLOG_UID_MAX option present in the configuration means that there is no user ID limit for writing lastlog entries.
LOG_OK_LOGINS (boolean)
LOG_UNKFAIL_ENAB (boolean)
Note: logging unknown usernames may be a security issue if an user enter her password instead of her login name.
LOGIN_RETRIES (number)
LOGIN_STRING (string)
If the string contains %s, this will be replaced by the user's name.
LOGIN_TIMEOUT (number)
MAIL_CHECK_ENAB (boolean)
You should disable it if the shell startup files already check for mail ("mailx -e" or equivalent).
MAIL_DIR (string)
MAIL_FILE (string)
The MAIL_DIR and MAIL_FILE variables are used by useradd, usermod, and userdel to create, move, or delete the user's mail spool.
If MAIL_CHECK_ENAB is set to yes, they are also used to define the MAIL environment variable.
MAX_MEMBERS_PER_GROUP (number)
The default value is 0, meaning that there are no limits in the number of members in a group.
This feature (split group) permits to limit the length of lines in the group file. This is useful to make sure that lines for NIS groups are not larger than 1024 characters.
If you need to enforce such limit, you can use 25.
Note: split groups may not be supported by all tools (even in the Shadow toolsuite). You should not use this variable unless you really need it.
MOTD_FILE (string)
NOLOGINS_FILE (string)
NONEXISTENT (string)
OBSCURE_CHECKS_ENAB (boolean)
PASS_ALWAYS_WARN (boolean)
PASS_CHANGE_TRIES (number)
PASS_MAX_DAYS (number)
PASS_WARN_AGE (number)
PASS_MAX_DAYS, and PASS_WARN_AGE are only used at the time of account creation. Any changes to these settings won't affect existing accounts.
PASS_MIN_LEN (number)
PORTTIME_CHECKS_ENAB (boolean)
QUOTAS_ENAB (boolean)
SHA_CRYPT_MIN_ROUNDS (number), SHA_CRYPT_MAX_ROUNDS (number)
With a lot of rounds, it is more difficult to brute force the password. But note also that more CPU resources will be needed to authenticate users.
If not specified, the libc will choose the default number of rounds (5000), which is orders of magnitude too low for modern hardware.
The values must be inside the 1000-999,999,999 range.
If only one of the SHA_CRYPT_MIN_ROUNDS or SHA_CRYPT_MAX_ROUNDS values is set, then this value will be used.
If SHA_CRYPT_MIN_ROUNDS > SHA_CRYPT_MAX_ROUNDS, the highest value will be used.
SULOG_FILE (string)
SU_NAME (string)
SU_WHEEL_ONLY (boolean)
SUB_GID_MIN (number), SUB_GID_MAX (number), SUB_GID_COUNT (number)
The default values for SUB_GID_MIN, SUB_GID_MAX, SUB_GID_COUNT are respectively 100000, 600100000 and 65536.
SUB_GID_DETERMINISTIC (boolean)
start = SUB_GID_MIN + ((UID - UID_MIN) * SUB_GID_COUNT)
end = start + SUB_GID_COUNT - 1
This ensures the same UID always receives the same subordinate GID range on every system, making it suitable for environments with centralized user management (LDAP, NIS, etc.) or synchronized UIDs across systems.
If SUB_GID_DETERMINISTIC is enabled, you can use usermod --add-subgids -S to produce deterministic subgids.
WARNING: Because UID_MIN is used to calculate the ranges, any change of UID_MIN will change the ranges calculated. SUB_GID_COUNT is used to calculate the ranges, any change of SUB_GID_COUNT will change the ranges calculated. Users with identities less than UID_MIN are incompatible with SUB_GID_DETERMINISTIC, but can still be set manually.
WARNING: Do not mix deterministic and linear (default) allocation on the same system or across systems sharing /etc/subgid via network storage (NFS, etc.). Mixing allocation methods will cause subordinate ID range conflicts and overlaps .
The default value for SUB_GID_DETERMINISTIC is no.
Range Calculation Examples¶
With default configuration (UID_MIN=1000, SUB_GID_MIN=100000, SUB_GID_COUNT=65536):
| UID | Calculation | Subordinate GID Range |
| 1000 | 100000 + ((1000-1000) * 65536) | 100000-165535 |
| 1001 | 100000 + ((1001-1000) * 65536) | 165536-231071 |
| 1002 | 100000 + ((1002-1000) * 65536) | 231072-296607 |
| 1100 | 100000 + ((1100-1000) * 65536) | 6653600-6719135 |
Subordinate ID Space Planning¶
When planning subordinate ID allocation, calculate the maximum number of users the space can accommodate:
capacity = (SUB_GID_MAX - SUB_GID_MIN) / SUB_GID_COUNT
With default values: (600100000 - 100000) / 65536 ≈ 9155 users.
For high-density environments with many users and smaller allocations:
SUB_GID_COUNT 4096
SUB_GID_MIN 100000
SUB_GID_MAX 10000000
This gives: (10000000 - 100000) / 4096 ≈ 2417 users.
UNSAFE_SUB_GID_DETERMINISTIC_WRAP (boolean)
Only effective when SUB_GID_DETERMINISTIC is set to yes.
When set to yes (WRAP MODE), allows the deterministic range calculation to wrap around using modulo arithmetic when a UID would overflow the configured subordinate ID space. The subordinate ID space is treated as a ring buffer.
WARNING: Range overlaps can lead to container escapes and privilege escalation. For example, with SUB_GID_MIN=100000, SUB_GID_MAX=200000, SUB_GID_COUNT=65536, User A (UID 1000) gets range [100000, 165535] and User B (UID 1001) wraps and overlaps with User A. User B's container can now access files from User A's containers.
Use only in development, testing, or tightly constrained lab environments.
When set to no (default), any arithmetic overflow or range exceeding SUB_GID_MAX is a hard error. This guarantees non-overlapping, monotonic allocation.
The default value for UNSAFE_SUB_GID_DETERMINISTIC_WRAP is no.
SUB_GID_STORE_BY_UID (boolean)
SUB_UID_MIN (number), SUB_UID_MAX (number), SUB_UID_COUNT (number)
The default values for SUB_UID_MIN, SUB_UID_MAX, SUB_UID_COUNT are respectively 100000, 600100000 and 65536.
SUB_UID_DETERMINISTIC (boolean)
start = SUB_UID_MIN + ((UID - UID_MIN) * SUB_UID_COUNT)
end = start + SUB_UID_COUNT - 1
This ensures the same UID always receives the same subordinate UID range on every system, making it suitable for environments with centralized user management (LDAP, NIS, etc.) or synchronized UIDs across systems.
If SUB_UID_DETERMINISTIC is enabled, you can use usermod --add-subuids -S to produce deterministic subuids.
WARNING: Because UID_MIN is used to calculate the ranges, any change of UID_MIN will change the ranges calculated. SUB_UID_COUNT is used to calculate the ranges, any change of SUB_UID_COUNT will change the ranges calculated. Users with identities less than UID_MIN are incompatible with SUB_UID_DETERMINISTIC, but can still be set manually.
WARNING: Do not mix deterministic and linear (default) allocation on the same system or across systems sharing /etc/subuid via network storage (NFS, etc.). Mixing allocation methods will cause subordinate ID range conflicts and overlaps .
The default value for SUB_UID_DETERMINISTIC is no.
Range Calculation Examples¶
With default configuration (UID_MIN=1000, SUB_UID_MIN=100000, SUB_UID_COUNT=65536):
| UID | Calculation | Subordinate UID Range |
| 1000 | 100000 + ((1000-1000) * 65536) | 100000-165535 |
| 1001 | 100000 + ((1001-1000) * 65536) | 165536-231071 |
| 1002 | 100000 + ((1002-1000) * 65536) | 231072-296607 |
| 1100 | 100000 + ((1100-1000) * 65536) | 6653600-6719135 |
Subordinate ID Space Planning¶
When planning subordinate ID allocation, calculate the maximum number of users the space can accommodate:
capacity = (SUB_UID_MAX - SUB_UID_MIN) / SUB_UID_COUNT
With default values: (600100000 - 100000) / 65536 ≈ 9155 users.
For high-density environments with many users and smaller allocations:
SUB_UID_COUNT 4096
SUB_UID_MIN 100000
SUB_UID_MAX 10000000
This gives: (10000000 - 100000) / 4096 ≈ 2417 users.
UNSAFE_SUB_UID_DETERMINISTIC_WRAP (boolean)
Only effective when SUB_UID_DETERMINISTIC is set to yes.
When set to yes (WRAP MODE), allows the deterministic range calculation to wrap around using modulo arithmetic when a UID would overflow the configured subordinate ID space. The subordinate ID space is treated as a ring buffer.
WARNING: Range overlaps can lead to container escapes and privilege escalation. For example, with SUB_UID_MIN=100000, SUB_UID_MAX=200000, SUB_UID_COUNT=65536, User A (UID 1000) gets range [100000, 165535] and User B (UID 1001) wraps and overlaps with User A. User B's container can now access files from User A's containers.
Use only in development, testing, or tightly constrained lab environments.
When set to no (default), any arithmetic overflow or range exceeding SUB_UID_MAX is a hard error. This guarantees non-overlapping, monotonic allocation.
The default value for UNSAFE_SUB_UID_DETERMINISTIC_WRAP is no.
SUB_UID_STORE_BY_UID (boolean)
SYS_GID_MAX (number), SYS_GID_MIN (number)
The default value for SYS_GID_MIN (resp. SYS_GID_MAX) is 101 (resp. GID_MIN-1).
SYS_UID_MAX (number), SYS_UID_MIN (number)
The default value for SYS_UID_MIN (resp. SYS_UID_MAX) is 101 (resp. UID_MIN-1).
SYSLOG_SG_ENAB (boolean)
SYSLOG_SU_ENAB (boolean)
TTYGROUP (string), TTYPERM (number)
TTYGROUP can be either the name of a group or a numeric group identifier.
If TTYGROUP is not defined, then the group ownership of the terminal is set to the user's primary group. If TTYPERM is not defined, then the permissions are set to 0600.
If you have a write program which is "setgid" to a special group which owns the terminals, define TTYGROUP to the group number and TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign TTYPERM to either 622 or 600.
TTYTYPE_FILE (string)
UID_MAX (number), UID_MIN (number)
The default value for UID_MIN (resp. UID_MAX) is 1000 (resp. 60000).
ULIMIT (number)
UMASK (number)
useradd and newusers use this mask to set the mode of the home directory they create if HOME_MODE is not set.
It is also used by login to define users' initial umask. Note that this mask can be overridden by the user's GECOS line (if QUOTAS_ENAB is set) or by the specification of a limit with the K identifier in limits(5).
USERDEL_CMD (string)
The return code of the script is not taken into account.
Here is an example script, which removes the user's cron, at and print jobs:
#! /bin/sh # Check for the required argument. if [ $# != 1 ]; then echo "Usage: $0 username" exit 1 fi # Remove cron jobs. crontab -r -u $1 # Remove at jobs. # Note that it will remove any jobs owned by the same UID, # even if it was shared by a different username. AT_SPOOL_DIR=/var/spool/cron/atjobs find $AT_SPOOL_DIR -name "[^.]*" -type f -user $1 -delete \; # Remove print jobs. lprm $1 # All done. exit 0
USERGROUPS_ENAB (boolean)
If set to yes, userdel will remove the user's group if it contains no more members, and useradd will create by default a group with the name of the user.
CROSS REFERENCES¶
The following cross references show which programs in the shadow password suite use which parameters.
chfn
chgpasswd
chpasswd
chsh
gpasswd
groupadd
groupdel
groupmod
grpck
grpconv
grpunconv
lastlog
login
newgrp / sg
newusers
passwd
pwck
pwconv
su
sulogin
useradd
userdel
usermod
SEE ALSO¶
| 08/08/2026 | shadow-utils 4.20.2 |