Search Our Database

How To Change SSH Daemon Port Number

Last updated on |

SSH daemon port will listen to port 22 by default. To change the SSH port number, you can follow the tutorial guide.

Step 1 – Access your web server, using the default port number 22 or existing port number.

Step 2 – Edit the sshd configuration.

vi /etc/ssh/sshd_config

Step 3 – Search for the line below and modify the port number to your desired port number.

#Port 22


Port 8822

Step 4 – You must ensure your server’s firewall is not blocking your new port number. Execute the following commands and restart sshd service.

iptables -A INPUT -ptcp --dport 8822-jACCEPT
iptables -A OUTPUT -ptcp --sport 8822 -jACCEPT
service iptables save
/etc/init.d/sshd restart