sudo ufw enable

Category: Self-Hosting

sudo ufw enable

Enable UFW and start enforcing firewall rules — do this only after allowing SSH to avoid locking

Turns on the firewall and begins enforcing rules. Make sure port 22 (SSH) is allowed BEFORE running this on a remote server or you'll lock yourself out.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.