建议配置口令的有效期策略,定期更换口令,防止口令被轻易破解。
备份
cp /etc/login.defs /etc/login.defs_backup`date +%Y%m%d`
修改参数
#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.
sed -i 's/\(PASS_MAX_DAYS\).*/\1 90/g' /etc/login.defs
sed -i 's/\(PASS_MIN_DAYS\).*/\1 1/g' /etc/login.defs
sed -i 's/\(PASS_MAX_LEN\).*/\1 8/g' /etc/login.defs
sed -i 's/\(PASS_WARN_AGE\).*/\1 28/g' /etc/login.defs