linux用户密码策略测试

您所在的位置:网站首页 linux口令策略 linux用户密码策略测试

linux用户密码策略测试

#linux用户密码策略测试| 来源: 网络整理| 查看: 265

1、linux普通用户默认密码策略:

     用passwd修改用户密码,常常提示“BAD PASSWORD: it is based on a dictionary word”。实际上linux要求的密码验证机制是在/etc/login.defs中规定最小密码字符数;同时还要受到/etc/pam.d/passwd的限定。但是在root用户下怎么设置都可以,可以不受验证机制的约束,即便出来“BAD PASSWORD: it is based on a dictionary word”也可以修改成功。     但是普通用户修改自己的密码,如果不符合密码验证机制的话就修改不成功,会有各种报错。“BAD PASSWORD: it's WAY too short”,这是报密码太短,不符合/etc/login.defs的设置;“BAD PASSWORD: it is based on your username”,这是密码与帐号不能同名,这是不符合/etc/pam.d/passwd的设置;

“BAD PASSWORD: it is based on a dictionary word”这是因为出现了字典里的字符串。

如何去掉限制呢?

1. vi /etc/pam.d/system-auth as root.2. Look for the following two lines:password    requisite     pam_cracklib.so try_first_pass retry=3password    sufficient    pam_unix.so md5 shadow nullok try_first_pass use_authtok3. Comment out the first of the two lines:#password    requisite     pam_cracklib.so try_first_pass retry=34. Remove use_authtok on the second line. Otherwise you’ll get “passwd: Authentication information cannot be recovered” error.password    sufficient    pam_unix.so md5 shadow nullok try_first_pass5. That’s it. Try changing your password again.

当只是操作第3步时,pam_cracklib.so密码复杂度不检查,但use_authtok依旧起作用,会导致所有无法修改密码,则会出来如下报错:

passwd: Authentication token manipulation error

按如上操作时,密码复杂度不检查,但普通用户依旧受限于pam_cracklib的最短密码长度。

Simple           Is the new password too small? This is controlled by 6 arguments minlen, maxclassrepeat, dcredit, ucredit,lcredit, and ocredit. 

2、对普通用户修改密码,增加密码安全性:

修改/etc/pam.d/system-auth

     password    requisite     pam_cracklib.so try_first_pass retry=3 minlen=8 lcredit=-1 ucredit=-1 ocredit=-1 dcredit=-1 enforce_for_root 

 

  其中enforce_for_root 是强制管理员修改,若无,管理员修改不受限制

  pam_cracklib.so模块,在centos6版本中有enforce_for_root,在5版本中无,可以使用pam_passwdqc.so

3、使用pam_passwdqc.so模块

          password    requisite  pam_passwdqc.so  enforce=everyone

   独立于pam_cracklib模块,单独设置密码安全性。

4、限制失败登录次数,在sshd,login,su

auth    required  pam_tally2.so onerr=fail deny=3 unlock_time=60 even_deny_root root_unlock_time=30



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3