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.
Please note that the parameters in this configuration file control the behavior of the tools from the shadow-utils component. None of these tools uses the PAM mechanism, and the utilities that use PAM (such as the passwd command) should be configured elsewhere. The only values that affect PAM modules are FAIL_DELAY for pam_faildelay module, and UMASK for pam_umask module. Refer to pam(8) for more information.
提供如下配置项:
CHFN_AUTH (boolean)
CHFN_RESTRICT (string)
CHSH_AUTH (boolean)
CONSOLE (string)
如果没有定义,可以在任何设备上使用 root。
指定的设备时不带 /dev/ 前缀。
CONSOLE_GROUPS (string)
CREATE_HOME (boolean)
此设置并不应用到系统用户,并且可以使用命令行覆盖。
DEFAULT_HOME (boolean)
如果设置为 yes,如果不能 cd 到主目录时,用户将会登录到根目录(/)。
ENCRYPT_METHOD (string)
可以使用如下值:DES (default), MD5, SHA256, SHA512.
注意,此参数会覆盖 MD5_CRYPT_ENAB 变量。
ENV_HZ (string)
ENV_PATH (string)
ENV_SUPATH (string)
ENV_TZ (string)
如果将完整路径指定为了一个不存在或不可读的文件,则默认使用 TZ=CST6CDT。
ENVIRON_FILE (string)
以 # 开头的行将视为注释,并被忽略。
ERASECHAR (number)
此值可以使用前缀“0”表示八进制,“0x”表示十六进制。
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 500 (resp. 60000).
HUSHLOGIN_FILE (string)
ISSUE_FILE (string)
KILLCHAR (number)
此值可以使用前缀“0”表示八进制,“0x”表示十六进制。
LASTLOG_ENAB (boolean)
LOG_OK_LOGINS (boolean)
LOG_UNKFAIL_ENAB (boolean)
注意:如果用户不小心将密码输入到了登录名中,记录未知用户名可能是一个安全隐患。
LOGIN_RETRIES (number)
LOGIN_STRING (string)
如果字符串包含 %s,将会被用户名替换。
LOGIN_TIMEOUT (number)
MAIL_CHECK_ENAB (boolean)
如果 shell 的启动文件已经检查了邮件("mailx -e" 或者其它同功能的工具),您应该禁用它。
MAIL_DIR (string)
MAIL_FILE (string)
MAIL_DIR and MAIL_FILE 变量由 useradd,usermod 和 userdel 用于创建、移动或删除用户邮箱。
如果 MAIL_CHECK_ENAB 设置为 yes,它们也被用于定义 MAIL 环境变量。
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.
此变量已经废弃。您应该使用 ENCRYPT_METHOD。
MOTD_FILE (string)
NOLOGINS_FILE (string)
OBSCURE_CHECKS_ENAB (boolean)
PASS_ALWAYS_WARN (boolean)
PASS_CHANGE_TRIES (number)
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.
PASS_MAX_LEN (number), PASS_MIN_LEN (number)
PORTTIME_CHECKS_ENAB (boolean)
QUOTAS_ENAB (boolean)
SHA_CRYPT_MIN_ROUNDS (number), SHA_CRYPT_MAX_ROUNDS (number)
使用很多轮转,会让暴力破解更加困难。但是需要注意,认证用户时也会需要更多的 CPU 资源。
如果没有指定,libc 会选择默认的轮转数(5000)。
值必须在 1000 - 999,999,999 之间。
如果只设置了一个 SHA_CRYPT_MIN_ROUNDS 或 SHA_CRYPT_MAX_ROUNDS 值,就会使用这个值。
如果 SHA_CRYPT_MIN_ROUNDS > SHA_CRYPT_MAX_ROUNDS,将会使用大的那个。
SULOG_FILE (string)
SU_NAME (string)
SU_WHEEL_ONLY (boolean)
SYS_GID_MAX (number), SYS_GID_MIN (number)
The default value for SYS_GID_MIN (resp. SYS_GID_MAX) is 201 (resp. GID_MIN-1).
SYS_UID_MAX (number), SYS_UID_MIN (number)
The default value for SYS_UID_MIN (resp. SYS_UID_MAX) is 201 (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 500 (resp. 60000).
ULIMIT (number)
UMASK (number)
useradd 和 newusers 使用此掩码设置它们创建的用户主目录的模式。
也被 login 用于指定用户的初始 umask。注意,此掩码可以被用户的 GECOS 行覆盖(当设置了 QUOTAS_ENAB 时),也可以被带 K 指示符的 limits(5) 定义的限制值覆盖。
USERDEL_CMD (string)
这个脚本的返回值并不被带到账户中去。
这是一个示例脚本,它移除用户的 cron、at 和 print 作业:
#! /bin/sh # 检查需要的参数 if [ $# != 1 ]; then echo "Usage: $0 username" exit 1 fi # 移除 cron 作业 crontab -r -u $1 # 移除 at 作业 # 注意这将移除所有属于同一个 UID 的作业 # 即使此 ID 由多个用户名共享 AT_SPOOL_DIR=/var/spool/cron/atjobs find $AT_SPOOL_DIR -name "[^.]*" -type f -user $1 -delete \; # 移除 print 作业 lprm $1 # 全部完成 exit 0
USERGROUPS_ENAB (boolean)
如果设置为 yes,如果组中没有成员了,userdel 将移除此用户组,useradd 创建用户时,也会创建一个同名的默认组。
交叉引用¶
如下交叉引用显示影子密码套件哪个程序使用哪个参数。
chpasswd
ENCRYPT_METHOD MD5_CRYPT_ENAB SHA_CRYPT_MAX_ROUNDS SHA_CRYPT_MIN_ROUNDS
gpasswd
groupadd
groupdel
groupmems
groupmod
grpck
grpconv
grpunconv
newgrp / sg
newusers
pwck
pwconv
useradd
userdel
usermod
参见¶
2016-05-11 | shadow-utils 4.1.5.1 |