UFW
·- $ sudo ufw status verbose Rules in order, plus default policy and logging level. Read this first.
- $ sudo ufw default deny incoming Anything not explicitly allowed is dropped. The sane starting point.
- $ sudo ufw default allow outgoing Outbound stays open, so apt, DNS and updates keep working.
- $ sudo ufw allow 22/tcp Open SSH first. Enabling with no SSH rule ends your session.
- $ sudo ufw allow from 10.0.0.0/24 to any port 5432 Postgres reachable from the LAN only — not from the internet.
- $ sudo ufw limit 22/tcp Allow SSH but throttle repeat connections: a cheap brute-force brake.
-
$ sudo ufw app list
Named profiles like
Nginx FullandOpenSSHthat expand to ports. -
$ sudo ufw delete allow 80/tcp
Delete by the exact rule text
statusprints. -
$ sudo ufw enable
Turn it on and persist across reboots;
--dry-runpreviews.