/etc/login.defs文件定義了與/etc/password和/etc/shadow配套的用戶限制設定。這個文件是需要的,缺失並不會影響系統的使用,但是也許會產生意想不到的錯誤。
如果/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加密密碼
。。。。。。