Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I revert a ufw command? [closed]

sudo ufw status on my Debian server initially showed the following configuration:

Status: active

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

I've been able to successfully allow http connections via sudo ufw allow http which yielded the following:

Status: active

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

What is the command to reverse this? I've tried sudo ufw deny http, but now sudo ufw status is different than originally (it now explicitly lists that http is denied):

Status: active

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

Is this the same as my initial config, or is there a different command to revert sudo ufw allow http?

like image 790
YPCrumble Avatar asked Jun 03 '16 17:06

YPCrumble


1 Answers

From ufw's man page, it supports a "delete" command

   delete RULE|NUM
          deletes the corresponding RULE

They also give an example:

   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
like image 145
Aaa Avatar answered Jan 03 '23 00:01

Aaa