限制用户登录IP的方法有两种

admin   ·   发表于 4个月前   ·   linux

1)修改/etc/hosts.allow和/etc/hosts.deny 这两个文件,把需要通过的IP写在/etc/hosts.allow 文件里


[root@localhost ~]# cat /etc/hosts.allow 
sshd:192.168.1.11:allow
[root@localhost ~]# cat /etc/hosts.deny 
sshd:ALL
[root@localhost ~]# /etc/init.d/sshd restart     #重启服务使配置生效


2)修改/etc/ssh/sshd_config文件

[root@localhost ~]# cat /etc/ssh/sshd_config 
allowusers ywxi@192.168.1.11
allowusers root@192.168.1.11
denyusers  ywxitest@192.168.1.11
[root@localhost ~]# /etc/init.d/sshd restart     #重启服务使配置生效
 

0 条回复   |  直到 4个月前 | 153 次浏览
登录后才可发表内容