如何恢复ufw命令?

时间:2016-06-03 17:30:06

标签: debian firewall ufw

我的Debian服务器上的

sudo ufw status最初显示以下配置:

Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)

我已经能够通过sudo ufw allow http成功地允许http连接,这产生了以下结果:

Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
80                         ALLOW       Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
80                         ALLOW       Anywhere (v6)

撤消此命令的命令是什么?我已尝试sudo ufw deny http,但现在sudo ufw status与最初不同(现在明确列出了http被拒绝):

Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
80                         DENY        Anywhere
OpenSSH (v6)               ALLOW       Anywhere (v6)
80                         DENY        Anywhere (v6)

这与我的初始配置相同,还是有不同的命令可以还原sudo ufw allow http

1 个答案:

答案 0 :(得分:3)

从ufw的手册页,它支持“删除”命令

   delete RULE|NUM
          deletes the corresponding RULE

他们也举了一个例子:

   To delete a rule, simply prefix the original rule with delete with or without the rule comment. For example, if the original rule was:

     ufw deny 80/tcp

   Use this to delete it:

     ufw delete deny 80/tcp

   You may also specify the rule by NUM, as seen in the status numbered output. For example, if you want to delete rule number '3', use:

     ufw delete 3