nft add rule inet filter input tcp dport 22 accept

Category: Security & Hardening

nft add rule inet filter input tcp dport 22 accept

Allow SSH traffic in the nftables input chain

Adds a rule that accepts TCP packets destined for port 22, the SSH port, in the input chain. nftables matches modern syntax directly, with no separate match module needed. Add this before any drop rule or you may cut off your SSH session.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.