LOGIN.DEFS(5) | 文件格式和转化 | LOGIN.DEFS(5) |
login.defs - 影子密码套件配置
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.
提供如下配置项:
CHFN_RESTRICT (string)
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)
此设置并不应用到系统用户,并且可以使用命令行覆盖。
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: DES (default), MD5, SHA256, SHA512.
Note: this parameter overrides the MD5_CRYPT_ENAB variable.
注意:这只影响组密码的产生。用户密码的产生是由 PAM 和 PAM 配置负责的。建议设置此变量和 PAM 配置一致。
ENV_HZ (string)
The HZ environment variable is only set when the user (the superuser) logs in with sulogin.
ENV_PATH (string)
ENV_SUPATH (string)
ERASECHAR (number)
此值可以使用前缀“0”表示八进制,“0x”表示十六进制。
FAIL_DELAY (number)
FAKE_SHELL (string)
GID_MAX (number), GID_MIN (number)
The default value for GID_MIN (resp. GID_MAX) is 1000 (resp. 60000).
HOME_MODE (number)
useradd and newusers use this to set the mode of the home directory they create.
HUSHLOGIN_FILE (string)
KILLCHAR (number)
此值可以使用前缀“0”表示八进制,“0x”表示十六进制。
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)
注意:如果用户不小心将密码输入到了登录名中,记录未知用户名可能是一个安全隐患。
LOGIN_RETRIES (number)
This will most likely be overridden by PAM, since the default pam_unix module has its own built in of 3 retries. However, this is a safe fallback in case you are using an authentication module that does not enforce PAM_MAXTRIES.
LOGIN_TIMEOUT (number)
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.
MAX_MEMBERS_PER_GROUP (number)
默认值是 0,意味着组中的成员数没有限制。
此功能(分割组)允许限制组文件中的行长度。这对于确保 NIS 组的行比长于 1024 字符。
如果要强制这个限制,可以使用 25。
注意:分割组可能不受所有工具的支持(甚至在 Shadow 工具集中)。您不应该使用这个变量,除非真的需要。
MD5_CRYPT_ENAB (boolean)
This variable is superseded by the ENCRYPT_METHOD variable or by any command line option used to configure the encryption algorithm.
This variable is deprecated. You should use ENCRYPT_METHOD.
注意:这只影响组密码的产生。用户密码的产生是由 PAM 和 PAM 配置负责的。建议设置此变量和 PAM 配置一致。
PASS_MAX_DAYS (number)
PASS_MIN_DAYS (number)
PASS_WARN_AGE (number)
PASS_MAX_DAYS, PASS_MIN_DAYS and PASS_WARN_AGE are only used at the time of account creation. Any changes to these settings won't affect existing accounts.
SHA_CRYPT_MIN_ROUNDS (number), SHA_CRYPT_MAX_ROUNDS (number)
使用很多轮转,会让暴力破解更加困难。但是需要注意,认证用户时也会需要更多的 CPU 资源。
如果没有指定,libc 会选择默认的轮转数(5000)。
值必须在 1000 - 999,999,999 之间。
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.
注意:这只影响组密码的产生。用户密码的产生是由 PAM 和 PAM 配置负责的。建议设置此变量和 PAM 配置一致。
SULOG_FILE (string)
SU_NAME (string)
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_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.
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 (string)
By default, the ownership of the terminal is set to the user's primary group and the permissions are set to 0600.
TTYGROUP can be either the name of a group or a numeric group identifier.
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).
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 pam_umask as the default umask value.
USERDEL_CMD (string)
这个脚本的返回值并不被带到账户中去。
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)
如下交叉引用显示影子密码套件哪个程序使用哪个参数。
chfn
chgpasswd
chpasswd
gpasswd
groupadd
groupdel
groupmems
groupmod
grpck
grpconv
grpunconv
lastlog
login
newgrp / sg
newusers
pwck
pwconv
su
sulogin
useradd
userdel
usermod
Much of the functionality that used to be provided by the shadow password suite is now handled by PAM. Thus, /etc/login.defs is no longer used by passwd(1), or less used by login(1), and su(1). Please refer to the corresponding PAM configuration files instead.
2020-02-07 | shadow-utils 4.8.1 |