最新下载
热门教程
- 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登录
相关文章
- 永劫无间卡顿不流畅怎么解决?永劫无间卡顿解决方法 08-02
- 胖企鹅(PENGU)价格预测:看涨旗形为8月冲击0.11美元埋下伏笔 08-02
- 《原神》5.6版本上半卡池抽取建议 08-02
- 《指尖无双》所有卡池保底机制一览2025 08-02
- 沉寂12.4年的比特币巨鲸苏醒,转移价值3500万美元BTC 08-02
- 《曙光重临》进化石获取途径一览 08-02