How to: Allow telnet and ssh through iptables under Linux

ww‮al.w‬utturi.com
How to: Allow telnet and ssh through iptables under Linux

To allow telnet and ssh connections through iptables in Linux, you will need to add rules to the iptables firewall to allow incoming connections on the relevant ports.

telnet uses port 23 by default, and ssh uses port 22 by default. To allow telnet and ssh connections through iptables, you will need to add rules to allow incoming connections on these ports.

To allow telnet and ssh connections through iptables, you can use the iptables-A option to append a rule to the INPUT chain. The INPUT chain specifies the rules for incoming connections.

For example, to allow telnet and ssh connections through iptables, you can use the following iptables commands:

$ iptables -A INPUT -p tcp --dport 23 -j ACCEPT
$ iptables -A INPUT -p tcp --dport 22 -j ACCEPT

These commands will add rules to the INPUT chain to allow incoming telnet and ssh connections.

Note that you will need to have root privileges to use the iptables command. You can use the sudo command to execute the iptables command with root privileges.

You can also use the firewall-cmd command to allow telnet and ssh connections through the iptables firewall. To allow telnet and ssh connections using firewall-cmd, use the following commands:

$ firewall-cmd --permanent --add-port=23/tcp
$ firewall-cmd --permanent --add-port=22/tcp
$ firewall-cmd --reload

These commands will add rules to allow incoming telnet and ssh connections and reload the iptables firewall.

Created Time:2017-10-29 22:08:41  Author:lautturi