環境
- RHEL Linux 6
- RHEL Linux 7
- PAM
問題
- 在更改系統上任何用戶的密碼時,要求輸入密碼三次(或多次)。
[root@server ~]# passwd testuser
Changing password for user testuser.
New password:
Retype new password:
Retype new password: <------ 額外的密碼提示
passwd: all authentication tokens updated successfully.
[root@server~]#
解析
-
從/etc/pam.d/passwd和/或/etc/pam.d/system-auth文件中刪除密碼策略/復雜度模塊的額外條目(多行)。
-
對於RHEL 7,/etc/pam.d/system-auth文件中的默認密碼部分應如下所示:
password requisite pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=
password sufficient pam_unix.so sha512 shadow nullok try_first_pass use_authtok
password sufficient pam_sss.so use_authtok
password required pam_deny.so
- 然而/etc/pam.d/passwd看起來應該像這樣:
auth include system-auth
account include system-auth
password substack system-auth
-password optional pam_gnome_keyring.so use_authtok
password substack postlogin
- 如果是RHEL 6,文件中應該是pam_cracklib.so而不是pam_pwquality.so。
解決
現有環境因基准加固的修改了system-auth導致該問題,
將 /etc/pam.d/system-auth 文件中的 password requisite pam_cracklib.so try_first_pass retry=3 type=
注釋保存后解決。(無需重啟)
參考:
1.RHEL Why does system prompt to enter password multiple times while changing the password?