ufw default deny incoming

Category: Security & Hardening

ufw default deny incoming

Set the default policy to block all incoming traffic

Changes the fallback for incoming connections to deny, so any port without an explicit allow rule is refused. This is the recommended baseline for servers. Combined with ufw default allow outgoing, you build a default-deny posture.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.