Linux分卷用户测试,linux用户密码策略测试

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=3

password    sufficient    pam_unix.so md5 shadow nullok try_first_pass use_authtok

3. Comment out the first of the two lines:

#password    requisite     pam_cracklib.so try_first_pass retry=3

4. 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_pass

5. 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, maxcla***epeat, 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值