在RedHat 6.x系统下配置普通用户密码复杂度。
将/etc/pam.d/system-auth中的password相关文件注释掉,见下图中的红色框体。
针对pam.d下的system-auth配置文件做更改后,需要重启OS。针对密码的策略就会生效。重启系统后测试更改普通用户密码。
[root@node1 ~]# useradd test1
[root@node1 ~]# passwd test1 #针对test1配置密码
Changing password for user test1.
New password:
BAD PASSWORD: it is WAY too short #密码长度太短
BAD PASSWORD: is too simple #密码太简单
Retype new password:
passwd: all authentication tokens updated successfully.
[root@node1 ~]# passwd test1
Changing password for user test1.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple #密码太简单
Retype new password:
Sorry, passwords do not match. #密码不匹配
New password:
BAD PASSWORD: it is too simplistic/systematic
Retype new password:
passwd: all authentication tokens updated successfully.
在root用户登录的环境下,即使普通用户密码的复杂度不满足要求,依旧会配置密码成功;但如果普通用户登录系统,密码复杂度策略就会生效,配置不达标的密码就会提示失败。