CentOS限制SSH登录地址

编辑hosts.allow文件,将允许连接的地址写进去

[root@Elements ~]# vim /etc/hosts.allow
sshd:10.10.10.1:allow
sshd:172.16.203.1:allow
sshd:192.168.1.1:allow

在hosts.deny文件中写入禁止所有

[root@Elements ~]# vim /etc/hosts.deny
sshd:ALL

重启sshd服务

CentOS 6 :service sshd restart
CentOS 7 :systemctl restart sshd.service

 

posted @ 2018-10-17 15:42  Chuyio  阅读(1320)  评论(0编辑  收藏  举报