sshd 限制登陆的几种方法总结
sshd限制登陆的几种方法总结
1.在/etc/hosts.allow写:
在/etc/hosts.allow写: sshd:1.2.3.4 在/etc/hosts.deny写: sshd:ALL
2.用iptables也行:
iptables-IINPUT-ptcp--dport22-jDROP iptables-IINPUT-ptcp--dport22-s1.2.3.4-jACCEPT
3.禁止某个用户通过ssh登录
在/etc/ssh/sshd_conf添加 AllowUsers用户名 或者 AllowGroups组名 或者 DenyUsers用户名
4.设定登录黑名单
vi/etc/pam.d/sshd 增加 authrequired/lib/security/pam_listfile.soitem=usersense=denyfile=/etc/sshd_user_deny_listonerr=succeed 所有/etc/sshd_user_deny_list里面的用户被拒绝ssh登录
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!