UFW delete firewall rule by number

The Uncomplicated Firewall (ufw) is a frontend for iptables and is particularly well-suited for host-based firewalls.

Get all rules:

ufw status numbered


Status: active
     To                         Action      From
     --                         ------      ----
[ 1] 80/tcp                     ALLOW IN    Anywhere
[ 2] 443/tcp                    ALLOW IN    Anywhere

Delete rule:

ufw delete 2

Leave a comment

Your email address will not be published. Required fields are marked *