login.defs是设置用户帐号限制的文件,在这里我们可配置密码的最大过期天数,密码的最大长度约束等内容。该文件里的配置对root用户无效。如果/etc/shadow文件里有相同的选项,则以/etc/shadow里的设置为准,也就是说/etc/shadow的配置优先级高于/etc/login.defs。下面内容是该文件的节选:
... # # Password aging controls: # # PASS_MAX_DAYS Maximum number of days a password may be used. # PASS_MIN_DAYS Minimum number of days allowed between password change. # PASS_WARN_AGE Number of days warning given before a password expires. # PASS_MAX_DAYS 99999 PASS_MIN_DAYS 0 PASS_WARN_AGE 7 ... # # Number of significant characters in the password for crypt(). # Default is 8, don't change unless your crypt() is better. # If using MD5 in your PAM configuration, set this higher. # PASS_MAX_LEN 8 ...