1. 在 /etc/hosts.allow 写:
在/etc/hosts.allow写: sshd: 1.2.3.4 在 /etc/hosts.deny 写: sshd: ALL
2. 用 iptables 也行:
iptables -I INPUT -p tcp --dport 22 -j DROP iptables -I INPUT -p tcp --dport 22 -s 1.2.3.4 -j ACCEPT
3. 禁止某个用户通过ssh登录
在/etc/ssh/sshd_conf添加 AllowUsers 用户名 或者 AllowGroups 组名 或者 DenyUsers 用户名
4. 设定登录黑名单
vi /etc/pam.d/sshd 增加 auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/sshd_user_deny_list onerr=succeed 所有/etc/sshd_user_deny_list里面的用户被拒绝ssh登录
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
您可能感兴趣的文章:
声明:本站(华域联盟www.cnhackhy.com)所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

评论(0)