To allow incoming traffic on the default SSH port (22), you could tell iptables to allow all TCP traffic on that port to come in.
sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
Referring back to the list above, you can see that this tells iptables:
- append this rule to the input chain (-A INPUT
-A INPUT
) so we look at incoming traffic - check to see if it is TCP (-p tcp
-p tcp
). - if so, check to see if the input goes to the SSH port (--dport ssh
--dport ssh
). - if so, accept the input (-j ACCEPT
-j ACCEPT
).
Hopefully this works for you also you may want to add the ftp ports which are 20-21, just change the ssh
to 20
and 21
.