感谢支持
我们一直在努力

Linux下防止未授权IP使用ssh服务

Linux下防止未授权IP使用ssh服务


方法一


iptables -A INPUT -p tcp -s 192.168.0.0/24 –destination-port 22 -j ACCEPT


iptables -A INPUT -p tcp -s 192.168.1.0/24 –destination-port 22 -j ACCEPT


iptables -A INPUT -p tcp -s ! 127.0.0.1 –destination-port 22 -j DROP


方法二


[root@nihao ~]# more /etc/hosts.deny


#


# hosts.deny    This file describes the names of the hosts which are


#               *not* allowed to use the local INET services, as decided


#               by the ‘/usr/sbin/tcpd’ server.


#


# The portmap line is redundant, but it is left to remind you that


# the new secure portmap uses hosts.deny and hosts.allow.  In particular


# you should know that NFS uses portmap!


sshd: ALL : deny


[root@nihao ~]# more /etc/hosts.allow


#


# hosts.allow   This file describes the names of the hosts which are


#               allowed to use the local INET services, as decided


#               by the ‘/usr/sbin/tcpd’ server.


#


sshd: 192.168.0.230 :allow


这里写允许的ip或者网段

赞(0) 打赏
转载请注明出处:服务器评测 » Linux下防止未授权IP使用ssh服务
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏