更改密码时系统多次提示输入密码?


环境

  • 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?


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM