iptables -P INPUT DROP

Category: Security & Hardening

iptables -P INPUT DROP

Set the INPUT chain default policy to drop

Makes DROP the fallback for any packet that matches no INPUT rule, silently discarding everything else. This is the core of a default-deny firewall, but applied over an active SSH session it severs your connection unless port 22 is already allowed. Test with a short timeout or use a rule-based drop first.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.