Knowledgebase

Change SSH Port

  • 262

The following steps are performed to change default SSH port number on CentOS:

1) Login to the CentOS server.
2) Back up then edit the /etc/ssh/sshd_config file.
3) Add the line Port XXXX to the file, where XXXX is the new port number.
4) Update the SELinux policy for the new SSH port.
5) Update the iptables firewall rule for the new SSH port.
6) Restart the services or the server.
7) Check the changes worked by connecting on the new port.


Was this answer helpful?