Modifying SSH connection ports

Expertise level: Easy

Follow this procedure to change your SSH port:

  • Login to your server with SSH as root.
  • Edit the file /etc/ssh/sshd_config using your favourite text editor.
  • Find the line "Port 22" and change 22 to the desired port number (The default ssh port is 22).
  • Remove the "#" sign at the beginning of the line (if exist).

The part of the file will look like this:

Port 22
  • Save the file and exit.
  • Restart the sshd service:
/etc/init.sshd restart
/etc/init.ssh restart
/etc/rc.d/sshd stop ; /etc/rc.dsshd start
Have more questions? Submit a request


Article is closed for comments.
Powered by Zendesk