SSH访问linux

来源:互联网 发布:与大津法相似的算法 编辑:程序博客网 时间:2024/05/18 01:56

在/etc/hosts.allow输入  
  (其中192.168.10.88是你要允许登陆ssh的ip,或者是一个网段192.168.10.0/24)  
  sshd:192.168.10.88:allow  
   
  在/etc/hosts.deny输入(表示除了上面允许的,其他的ip   都拒绝登陆ssh)  
  sshd:ALL
vi /etc/ssh/sshd_config

比如说你只允许1.1.1.1这个IP进入,其它都禁止: 
方法1、iptables。 
iptables   -A   INPUT   -s   1.1.1.1   --destination-port   22   -j   ACCEPT 
iptables   -A   INPUT   --destination   22   -j   DROP 
方法2: 
vi   /etc/ssh/sshd_config 
添加一行: 
allowusers   
xxx@1.1.1.1 
注:xxx为你用来登入服务器的用户名。

原创粉丝点击