1.允许指定IP或IP段访问,设置白名单
vi /etc/hosts.allow
#在最后一行添加:
sshd:192.168.1.10 #允许192.168.1.10访问
sshd:192.168.1.* #允许192.168.1该IP段访问
2.限制其他IP访问,设置黑名单
vi /etc/hosts.deny
#在最后一行添加:
sshd:ALL #限制除/etc/hosts.allow外的其他一切IP访问本服务器
vi /etc/hosts.allow
#在最后一行添加:
sshd:192.168.1.10 #允许192.168.1.10访问
sshd:192.168.1.* #允许192.168.1该IP段访问
vi /etc/hosts.deny
#在最后一行添加:
sshd:ALL #限制除/etc/hosts.allow外的其他一切IP访问本服务器