当前位置:首页 > 操作系统 > Linux

Linux如何设置错误口令登陆超过N次锁定用户(针对sshd)

错误口令登陆超过3次锁定用户15分钟

# vi /etc/pam.d/sshd
...
auth       required     pam_tally2.so deny=5 unlock_time=900 even_deny_root root_unlock_time=900
...

保存退出,立刻生效

 

注:这里使用的是 pam_tally2 模块;

  deny: 错误口令登陆次数;

  unlock_time: 锁定用户时间,单位为秒;

  如果想取消对 root 的锁定则把  even_deny_root 和 root_unlock_time=900 删除

 

pam_tally 模块设置如下配置

# vi /etc/pam.d/sshd
...
auth  required  pam_tally.so  onerr=fail  no_magic_root
account  required  pam_tally.so   deny=3  no_magic_root even_deny_root_account  per_user  reset
...

 保存退出,立刻生效

原文:https://www.cnblogs.com/freess/p/10087641.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐