Provided by: login_4.2-3.1ubuntu5.4_amd64 bug

名称

       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)
           This parameter specifies which values in the gecos field of the /etc/passwd file may
           be changed by regular users using the chfn program. It can be any combination of
           letters f, r, w, h, for Full name, Room number, Work phone, and Home phone,
           respectively. For backward compatibility, yes is equivalent to rwh and no is
           equivalent to frwh. If not specified, only the superuser can make any changes. The
           most restrictive setting is better achieved by not installing chfn SUID.

       CONSOLE_GROUPS (string)
           在控制台登录时,添加到用户附加组集中的组列表(就如 CONSOLE 所确定的)。默认是无。 使用时
           需要注意:这可能使用户获取这些组的永久权限,甚至登录到的不是此控制台时。

       CREATE_HOME (boolean)
           指示是否应该为新用户默认创建主目录。

           此设置并不应用到系统用户,并且可以使用命令行覆盖。

       DEFAULT_HOME (boolean)
           如果不能 cd 到主目录时,说明是否允许登录。默认是否。

           如果设置为 yes,如果不能 cd 到主目录时,用户将会登录到根目录(/)。

       ENCRYPT_METHOD (string)
           这定义了系统加密密码的默认算法(如果没有在命令行上指定算法)。

           可以使用如下值:DES (default), MD5, SHA256, SHA512.

           注意,此参数会覆盖 MD5_CRYPT_ENAB 变量。

           注意:这只影响组密码的产生。用户密码的产生是由 PAM 和 PAM 配置负责的。建议设置此变量和
           PAM 配置一致。

       ENV_HZ (string)
           如果设置了,将会用于在用户登录时定义 HZ 环境变量。值必须以 HZ= 开头。Linux 上的常用值
           是 HZ=100HZ 环境变量只有当用户(超级用户)使用 sulogin 登录时才设置。

       ENV_PATH (string)
           If set, it will be used to define the PATH environment variable when a regular user
           login. The value is a colon separated list of paths (for example /bin:/usr/bin) and
           can be preceded by PATH=. The default value is PATH=/bin:/usr/bin.

       ENV_SUPATH (string)
           If set, it will be used to define the PATH environment variable when the superuser
           login. The value is a colon separated list of paths (for example
           /sbin:/bin:/usr/sbin:/usr/bin) and can be preceded by PATH=. The default value is
           PATH=/sbin:/bin:/usr/sbin:/usr/bin.

       ERASECHAR (number)
           终端擦除字符 (010 = backspace, 0177 = DEL)。

           此值可以使用前缀“0”表示八进制,“0x”表示十六进制。

       FAIL_DELAY (number)
           登录失败后,等待多少秒才再允许登录。

       FAKE_SHELL (string)
           如果设置了,login 将执行此 shell 而不是在 /etc/passwd 中指定的用户 shell。

       GID_MAX (number), GID_MIN (number)
           useraddgroupaddnewusers 创建的常规组的组 ID 的范围。

           GID_MINGID_MAX 的默认值分别是 1000 和 60000。

       HUSHLOGIN_FILE (string)
           If defined, this file can inhibit all the usual chatter during the login sequence. If
           a full pathname is specified, then hushed mode will be enabled if the user's name or
           shell are found in the file. If not a full pathname, then hushed mode will be enabled
           if the file exists in the user's home directory.

       KILLCHAR (number)
           终端 KILL 字符 (025 = CTRL/U)。

           此值可以使用前缀“0”表示八进制,“0x”表示十六进制。

       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)
           定义用户邮箱文件的位置(相对于主目录)。

       MAIL_DIR and MAIL_FILE 变量由 useraddusermoduserdel 用于创建、移动或删除用户邮箱。

       MAX_MEMBERS_PER_GROUP (number)
           每个组条目的最大成员数。达到最大值时,在 /etc/group 开始一个新条目(行)(使用同样的名
           称,同样的密码,同样的 GID)。

           默认值是 0,意味着组中的成员数没有限制。

           此功能(分割组)允许限制组文件中的行长度。这对于确保 NIS 组的行比长于 1024 字符。

           如果要强制这个限制,可以使用 25。

           注意:分割组可能不受所有工具的支持(甚至在 Shadow 工具集中)。您不应该使用这个变量,除非
           真的需要。

       MD5_CRYPT_ENAB (boolean)
           表示密码是否必须使用基于 MD5 的算法加密。如果设为 yes,新密码将使用可以和新版 FreeBSD
           兼容的基于 MD5 的算法加密。它支持无限长度的密码以及更长的盐字符串。如果您需要将加密的
           密码复制到其它不理解新算法的系统,设置为 no。默认值是 no。

           This variable is superseded by the ENCRYPT_METHOD variable or by any command line
           option used to configure the encryption algorithm.

           此变量已经废弃。您应该使用 ENCRYPT_METHOD。

           注意:这只影响组密码的产生。用户密码的产生是由 PAM 和 PAM 配置负责的。建议设置此变量和
           PAM 配置一致。

       PASS_MAX_DAYS (number)
           一个密码可以使用的最大天数。如果密码比这旧,将会强迫更改密码。如果不指定,就假定为
           -1,这会禁用这个限制。

       PASS_MIN_DAYS (number)
           两次更改密码时间的最小间隔。将会拒绝任何早于此的更改密码的尝试。如果不指定,假定为
           -1,将会禁用这个限制。

       PASS_WARN_AGE (number)
           密码过期之前给出警告的天数。0 表示只有只在过期的当天警告,负值表示不警告。如果没有指
           定,不会给警告。

       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)
           ENCRYPT_METHOD 设为 SHA256SHA512 时,此项确定加密算法默认使用 SHA 轮转数目(当轮转
           数没有通过命令行指定时)。

           使用很多轮转,会让暴力破解更加困难。但是需要注意,认证用户时也会需要更多的 CPU 资源。

           如果没有指定,libc 会选择默认的轮转数(5000)。

           值必须在 1000 - 999,999,999 之间。

           如果只设置了一个 SHA_CRYPT_MIN_ROUNDSSHA_CRYPT_MAX_ROUNDS 值,就会使用这个值。

           如果 SHA_CRYPT_MIN_ROUNDS > SHA_CRYPT_MAX_ROUNDS,将会使用大的那个。

           注意:这只影响组密码的产生。用户密码的产生是由 PAM 和 PAM 配置负责的。建议设置此变量和
           PAM 配置一致。

       SULOG_FILE (string)
           如果定义了,所有的 su 活动都会记录到此文件。

       SU_NAME (string)
           如果定义了,就是运行“su -”时显示的命令名称。例如,如果定义为“su”,那么“ps”会显示此命令
           为“-su”。如果没有定义,“ps”将会显示实际执行的 shell,例如类似于“-sh”。

       SUB_GID_MIN (number), SUB_GID_MAX (number), SUB_GID_COUNT (number)
           If /etc/subuid exists, the commands useradd and newusers (unless the user already have
           subordinate group IDs) allocate SUB_GID_COUNT unused group IDs from the range
           SUB_GID_MIN to SUB_GID_MAX for each new user.

           The default values for SUB_GID_MIN, SUB_GID_MAX, SUB_GID_COUNT are respectively
           100000, 600100000 and 10000.

       SUB_UID_MIN (number), SUB_UID_MAX (number), SUB_UID_COUNT (number)
           If /etc/subuid exists, the commands useradd and newusers (unless the user already have
           subordinate user IDs) allocate SUB_UID_COUNT unused user IDs from the range
           SUB_UID_MIN to SUB_UID_MAX for each new user.

           The default values for SUB_UID_MIN, SUB_UID_MAX, SUB_UID_COUNT are respectively
           100000, 600100000 and 10000.

       SYS_GID_MAX (number), SYS_GID_MIN (number)
           useraddgroupaddnewusers 创建的系统组的组 ID 的范围。

           SYS_GID_MINSYS_GID_MAX 的默认值分别是 101 和 GID_MIN-1。

       SYS_UID_MAX (number), SYS_UID_MIN (number)
           useraddnewusers 创建的系统用户的用户 ID 的范围。

           SYS_UID_MINSYS_UID_MAX 的默认值分别是 101 和 UID_MIN-1。

       SYSLOG_SG_ENAB (boolean)
           允许“syslog”记录 sg 的活动。

       SYSLOG_SU_ENAB (boolean)
           除了 sulog 文件日志,也为 su 活动启用“syslog”日志。

       TTYGROUP (string), TTYPERM (string)
           The terminal permissions: the login tty will be owned by the TTYGROUP group, and the
           permissions will be set to TTYPERM.

           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)
           If defined, file which maps tty line to TERM environment parameter. Each line of the
           file is in a format something like "vt100 tty01".

       UID_MAX (number), UID_MIN (number)
           useraddnewusers 创建的普通用户的用户 ID 的范围。

           UID_MINUID_MAX 的默认值分别是 1000 和 60000。

       UMASK (number)
           文件模式创建掩码初始化为此值。如果没有指定,掩码初始化为 022。

           useraddnewusers 使用此掩码设置它们创建的用户主目录的模式。

           也被 pam_umask 用作默认 umask 值。

       USERDEL_CMD (string)
           如果定义了,这是删除账户时执行的命令。它应该移除所有属于此用户的的 at/cron/print 等作
           业(作为第一个参数传递)。

           这个脚本的返回值并不被带到账户中去。

           这是一个示例脚本,它移除用户的 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 创建用户时,也会创
           建一个同名的默认组。

交叉引用

       如下交叉引用显示影子密码套件哪个程序使用哪个参数。

       chfn
           CHFN_RESTRICT

       chgpasswd
           ENCRYPT_METHOD MAX_MEMBERS_PER_GROUP MD5_CRYPT_ENAB SHA_CRYPT_MAX_ROUNDS
           SHA_CRYPT_MIN_ROUNDS

       chpasswd
           SHA_CRYPT_MAX_ROUNDS SHA_CRYPT_MIN_ROUNDS

       gpasswd
           ENCRYPT_METHOD MAX_MEMBERS_PER_GROUP MD5_CRYPT_ENAB SHA_CRYPT_MAX_ROUNDS
           SHA_CRYPT_MIN_ROUNDS

       groupadd
           GID_MAX GID_MIN MAX_MEMBERS_PER_GROUP SYS_GID_MAX SYS_GID_MIN

       groupdel
           MAX_MEMBERS_PER_GROUP

       groupmems
           MAX_MEMBERS_PER_GROUP

       groupmod
           MAX_MEMBERS_PER_GROUP

       grpck
           MAX_MEMBERS_PER_GROUP

       grpconv
           MAX_MEMBERS_PER_GROUP

       grpunconv
           MAX_MEMBERS_PER_GROUP

       login
           CONSOLE_GROUPS DEFAULT_HOME ERASECHAR FAIL_DELAY FAKE_SHELL HUSHLOGIN_FILE KILLCHAR
           LOGIN_RETRIES LOGIN_TIMEOUT LOG_OK_LOGINS LOG_UNKFAIL_ENAB TTYGROUP TTYPERM
           TTYTYPE_FILE USERGROUPS_ENAB

       newgrp / sg
           SYSLOG_SG_ENAB

       newusers
           ENCRYPT_METHOD GID_MAX GID_MIN MAX_MEMBERS_PER_GROUP MD5_CRYPT_ENAB PASS_MAX_DAYS
           PASS_MIN_DAYS PASS_WARN_AGE SHA_CRYPT_MAX_ROUNDS SHA_CRYPT_MIN_ROUNDS SUB_GID_COUNT
           SUB_GID_MAX SUB_GID_MIN SUB_UID_COUNT SUB_UID_MAX SUB_UID_MIN SYS_GID_MAX SYS_GID_MIN
           SYS_UID_MAX SYS_UID_MIN UID_MAX UID_MIN UMASK

       pwck
           PASS_MAX_DAYS PASS_MIN_DAYS PASS_WARN_AGE

       pwconv
           PASS_MAX_DAYS PASS_MIN_DAYS PASS_WARN_AGE

       su
           CONSOLE_GROUPS DEFAULT_HOME ENV_PATH ENV_SUPATH SULOG_FILE SU_NAME SYSLOG_SU_ENAB

       sulogin
           ENV_HZ

       useradd
           CREATE_HOME GID_MAX GID_MIN MAIL_DIR MAX_MEMBERS_PER_GROUP PASS_MAX_DAYS PASS_MIN_DAYS
           PASS_WARN_AGE SUB_GID_COUNT SUB_GID_MAX SUB_GID_MIN SUB_UID_COUNT SUB_UID_MAX
           SUB_UID_MIN SYS_GID_MAX SYS_GID_MIN SYS_UID_MAX SYS_UID_MIN UID_MAX UID_MIN UMASK

       userdel
           MAIL_DIR MAIL_FILE MAX_MEMBERS_PER_GROUP USERDEL_CMD USERGROUPS_ENAB

       usermod
           MAIL_DIR MAIL_FILE MAX_MEMBERS_PER_GROUP

缺陷

       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.

参见

       login(1), passwd(1), su(1), passwd(5), shadow(5), pam(8).