最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
sshd 限制登陆的几种方法总结
时间:2022-06-30 16:12:03 编辑:袖梨 来源:一聚教程网
sshd 限制登陆的几种方法总结
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=denyfile=/etc/sshd_user_deny_listonerr=succeed
所有/etc/sshd_user_deny_list里面的用户被拒绝ssh登录
相关文章
- 原神2025最新兑换码有哪些 限时前瞻福利领取 11-16
- 百炼英雄2025兑换码大全 最新礼包福利领取合集 11-16
- 寻道大千2025兑换码 最新可用的礼包码合集 11-16
- 蛋仔派对2025兑换码 最新礼包码合集 11-16
- 元气骑士2025兑换码大全 最新可用礼包码合集 11-16
- 明日方舟终末地测试资格查询入口 官方验证方法一览 11-16