A few UFW tidbits
Here are some of the common UFW rule management commands that I seem to always forget...
- View rules in numbered format:
sudo ufw status numbered
- Add an allow rule with comment:
sudo ufw allow from <IP> to any port <#> comment "Comment goes here"
- Add an deny rule with comment:
sudo ufw deny from <IP> to any port <#> comment "Comment goes here"
- Add an deny rule to all ports:
sudo ufw deny from <IP> to any
- Insert a rule at the head of the rule chain:
sudo ufw insert 1 deny from <IP> to any port <#>
- Delete a rule (usually after viewing numbered rules):
sudo ufw delete <#>