码迷,mamicode.com
首页 > 其他好文 > 详细

ssh设置

时间:2016-06-09 23:34:41      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:

方法一:
在/etc/hosts.allow中添加允许ssh登陆的ip或者网段

sshd:192.168.1.2:allow
sshd:192.168.1.0/24:allow
在/etc/hosts.deny添加不允许ssh登陆的IP
sshd:ALL #ALL表示除了上面允许的,其他的ip 都拒绝登陆ssh


方法二:
使用iptables。

iptables -A INPUT -p tcp -s 192.168.1.2 --destination-port 22 -j ACCEPT
iptables -A INPUT -p tcp --destination-port 22 -j DROP

方法三:
修改ssh配置文件

vi /etc/ssh/sshd_config
添加一行:
allowusers xxx@192.168.1.2
注:xxx为你用来登入服务器的用户名。

ssh设置

标签:

原文地址:http://www.cnblogs.com/hygs/p/5572946.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!