< 返回新闻公告列表

Ubuntu18.04系统如何允许和禁止ip访问

发布时间:2022-12-17 14:45:23    来源: 纵横云

Ubuntu18.04系统如何允许和禁止ip访问

在ubuntu18.04中如何允许和禁止ip访问呢?本文给出详细说明。

我们可以修改/etc/hosts.allow和/etc/hosts.deny的配制,来许可或者拒绝哪些ip、主机可以访问。

1.修改/etc/hosts.deny

vi /etc/hosts.deny

并增加一条内容

all:ip

保存后退出

Ubuntu18.04系统如何允许和禁止ip访问-1125

2.重启机器令配置生效

reboot

3.测试,ip是通的,但是ssh链接被拒绝了

Ubuntu18.04系统如何允许和禁止ip访问-1126

Ubuntu18.04系统如何允许和禁止ip访问-1127

4.修改/etc/hosts.allow

vi /etc/hosts.allow

并增加一条内容

all:ip

保存后退出

Ubuntu18.04系统如何允许和禁止ip访问-1128

5.重启令配置生效

reboot

6.测试

Ubuntu18.04系统如何允许和禁止ip访问-1129

可以远程

说明:当hosts.allow和 host.deny相冲突时,以hosts.allow设置优先。

19906048601
19906048601 19906048601
返回顶部
返回顶部 返回顶部