Section: Firewalling with nftables and iptables

Allow SSH with iptables

bash
bash
sudo iptables -I INPUT -p tcp --dport 22 -j ACCEPT
Explanation

Insert a rule allowing inbound SSH.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Firewalling with nftables and iptables
Allow SSH with nftables
Permit inbound SSH traffic.
OpenIn sheetbashsame section
List iptables rules
Show IPv4 filter rules with counters.
OpenIn sheetbashsame section
Export iptables rules
Dump current iptables rules in restore format.
OpenIn sheetbashsame section
Drop traffic from IP
Block all inbound traffic from a source IP.
OpenIn sheetbashsame section
Enable masquerading
Apply source NAT for outbound traffic.
OpenIn sheetbashsame section
Allow a port with UFW
Allow inbound TCP on a specific port.
OpenIn sheetbashsame section