如何恢复 ufw 命令?
How do I revert a ufw command?
sudo ufw status
在我的 Debian 服务器上最初显示以下配置:
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
?
来自 ufw 的手册页,它支持 "delete" 命令
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 status
在我的 Debian 服务器上最初显示以下配置:
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
?
来自 ufw 的手册页,它支持 "delete" 命令
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