今天有開發報故,sftp無法登錄。檢查服務都是正常的,之前3月份也出現過此問題,當時忙沒有注意,現在看每3個月出現問題。這才想到是密碼過期導致的。
先重置用戶密碼,發現過期日志為Oct 08, 2017,有效期為90天。
[root@01 ~]# chage -l testuser Last password change : Jul 10, 2017 Password expires : Oct 08, 2017 Password inactive : never Account expires : never Minimum number of days between password change : 0 Maximum number of days between password change : 90 Number of days of warning before password expires : 10
修改密碼為永不過期,修改后見紅色標注
[root@01 ~]# chage -M 99999 testuser [root@01 ~]# chage -l testuser Last password change : Jul 10, 2017 Password expires : never Password inactive : never Account expires : Oct 16, 2243 Minimum number of days between password change : 0 Maximum number of days between password change : 99999 Number of days of warning before password expires : 10
如果賬戶設置過了過期時間,后面新加的用戶都會受到這個設置的影響
這個主要是由/etc/login.defs參數文件中的一些參數控制的的。它主要用於用戶賬號限制
PASS_MAX_DAYS 90
PASS_MIN_DAYS 0
PASS_MIN_LEN 6
PASS_WARN_AGE 10
參考
Linux賬戶密碼過期安全策略設置 - 瀟湘隱者 - 博客園
http://www.cnblogs.com/kerrycode/p/5600525.html