【问题标题】:How do I revert a ufw command? [closed]如何还原 ufw 命令? [关闭]
【发布时间】:2016-06-03 17:30:05
【问题描述】:

我的 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

【问题讨论】:

    标签: debian firewall ufw


    【解决方案1】:

    从 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
    

    【讨论】:

    • 谢谢!我特别需要sudo ufw delete allow http 并按要求工作。
    • 太棒了。直接从您的 linux 机器获得帮助的一个好方法是输入“man”(用于手动),然后输入您需要帮助的命令。特别是流行的命令在其手册中有非常详细的信息,以及示例。这也适用于文件(只要它们有手动输入 - 输入“man shadow”将向您解释存储所有密码的影子文件)。 :)
    猜你喜欢
    • 2020-05-16
    • 2013-12-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-07
    相关资源
    最近更新 更多