Chinaunix首页 | 论坛 | 博客
  • 博客访问: 79689
  • 博文数量: 52
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: -20
  • 用 户 组: 普通用户
  • 注册时间: 2018-06-04 17:51
文章分类

全部博文(52)

文章存档

2013年(6)

2012年(3)

2011年(4)

2010年(18)

2009年(21)

我的朋友

分类: LINUX

2010-12-23 16:58:30

1,只允许某个IP登录,拒绝其他所有IP
在 /etc/hosts.allow 写:
sshd: 1.2.3.4
在 /etc/hosts.deny 写:
sshd: ALL
用 iptables 也行:
iptables -I INPUT -p tcp --dport 22 -j DROP
iptables -I INPUT -p tcp --dport 22 -s 1.2.3.4 -j ACCEPT

2,禁止某个用户通过ssh登录
在/etc/ssh/sshd_conf添加
AllowUsers 用户名
或者
AllowGroups 组名
或者
DenyUsers 用户名

3,设定登录黑名单
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登录
阅读(1391) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-12-26 17:35:48

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com