Search This Blog

Thursday, November 22, 2018

UFW delete firewall rule by number

The numbers of your firewall rules can listed using:

$ sudo ufw status numbered
Status: active

     To                         Action      From
     --                         ------      ----
[ 1] 22/tcp                     ALLOW IN    Anywhere                  
[ 2] 22                         ALLOW IN    10.100.0.0/16             

[ 3] 22/tcp (v6)                ALLOW IN    Anywhere (v6)  


Use this syntax:

sudo ufw delete ####
sudo ufw reload
sudo ufw status

where #### is the number of your firewall rule.