ufw-delete
Remove Uncomplicated Firewall rules by specification or number
TLDR
SYNOPSIS
ufw [--dry-run] [--force] delete NUMufw [--dry-run] delete allow|deny|reject|limit [rule]ufw [--dry-run] route delete allow|deny|reject|limit [rule]
DESCRIPTION
ufw delete removes a previously added Uncomplicated Firewall user rule. It is a ufw subcommand, not a separate binary.Two forms exist. By number: run `ufw status numbered`, then `ufw delete N`. Numbers are 1-based positions in that listing and shift after each deletion, so re-check the list between deletes. By specification: prefix the original add command with delete, for example `ufw delete deny 80/tcp`. The comment from the original rule may be omitted.When IPv6 is enabled, a generic rule such as `ufw allow 22/tcp` creates paired IPv4 and IPv6 entries. Deleting by number removes only the numbered row. Prefixing the original rule with delete removes both versions in one command.
PARAMETERS
delete NUM
Remove the user rule with that index from `ufw status numbered`delete RULE
Remove the rule that matches the original allow / deny / reject / limit command (comment optional)route delete
Remove a forwarded/routed rule, using the same syntax as `ufw route ...`--force
Skip the confirmation prompt when deleting by number--dry-run
Show what would change without applying it
INSTALL
CAVEATS
Requires root or sudo. Deleting the rule that permits your current SSH session can lock you out; prefer `--dry-run` and keep an alternate path. After a numbered delete, later rule numbers change. Multi-port rules must be deleted as a whole (you cannot drop one port from a `80,443` rule). `ufw delete` only affects ufw-managed user rules, not custom chains in `/etc/ufw/before.rules` or `/etc/ufw/after.rules`.
HISTORY
Part of ufw (Uncomplicated Firewall), the Ubuntu-originated frontend for iptables/nftables.
SEE ALSO
ufw(8), ufw-status(8), ufw-allow(8), ufw-deny(8), ufw-default(8), iptables(8)
