How To Change SSH Daemon Port Number

< Back to the Title Topic

How To Change SSH Daemon Port Number

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

to

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

Previous Ping plotter
Next How to change OpenSSH Port on CentOS 7