/etc/login.defs 是設定使用者帳号限制的檔案。該檔案裡的配置對root使用者無效。
如果/etc/shadow檔案裡有相同的選項,則以/etc/shadow裡的設定為準,也就是說/etc/shadow的配置優先級高于/etc/login.defs
# *REQUIRED* required
# Directory where mailboxes reside, _or_ name of file, relative to the
# home directory. If you _do_ define both, MAIL_DIR takes precedence.
# QMAIL_DIR is for Qmail
#
#QMAIL_DIR Maildir
MAIL_DIR /var/spool/mail
#建立使用者時,要在目錄/var/spool/mail中建立一個使用者mail檔案
#MAIL_FILE .mail
# 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 changes.
# PASS_MIN_LEN Minimum acceptable password length.
# PASS_WARN_AGE Number of days warning given before a password expires.
PASS_MAX_DAYS 99999
#密碼最大有效期
PASS_MIN_DAYS 0
#兩次修改密碼的最小間隔時間
PASS_MIN_LEN 5
#密碼最小長度,對于root無效
PASS_WARN_AGE 7
#密碼過期前多少天開始提示
# Min/max values for automatic uid selection in useradd
#建立使用者時不指定UID的話自動UID的範圍
UID_MIN 500
#使用者ID的最小值
UID_MAX 60000
#使用者ID的最大值
# Min/max values for automatic gid selection in groupadd
#自動組ID的範圍
GID_MIN 500
#組ID的最小值
GID_MAX 60000
#組ID的最大值
# If defined, this command is run when removing a user.
# It should remove any at/cron/print jobs etc. owned by
# the user to be removed (passed as the first argument).
#USERDEL_CMD /usr/sbin/userdel_local
#當删除使用者的時候執行的腳本
# If useradd should create home directories for users by default
# On RH systems, we do. This option is overridden with the -m flag on
# useradd command line.
CREATE_HOME yes
#使用useradd的時候是夠建立使用者目錄
# The permission mask is initialized to this value. If not specified,
# the permission mask will be initialized to 022.
UMASK 077
# This enables userdel to remove user groups if no members exist.
USERGROUPS_ENAB yes
#用MD5加密密碼
本文轉自獨彈古調 51CTO部落格,原文連結:http://blog.51cto.com/hunkz/1629962,如需轉載請自行聯系原作者