Knowledgebase

How do I change my Server's SSH port? Print

  • 0

How do I change my Rcs.is's SSH port?

You can change your Rcs.is’s default SSH port by editing its SSH configuration file. To do this, open the /etc/ssh/sshd_config file in a text editor:

nano /etc/ssh/sshd_config

Remove the comment hash (#) in the # Port 22 line and then replace the 22 value with your desired port value. In the following example, the Port line is uncommented and the 22 value is replaced with 20202. This makes the Rcs.is only accessible via SSH using port 20202.

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

Include /etc/ssh/sshd_config.d/*.conf

Port 20202
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

After editing the port number, save the file and close it. To implement the changes, reboot the Rcs.is:

reboot

Once the Rcs.is reboots, you can confirm the changes by logging in to the Rcs.is using the ssh command line tool and its port (-p) flag. Use the -p flag to specify the Rcs.is’s new SSH port:

ssh root@<your_droplet_IP_address> -p <new_port_number>

For example, if your Rcs.is has the IP address 192.88.99.255 and the Rcs.is’s new SSH port is 20202, you would format the command like this:

ssh root@192.88.99.255 -p 20202

A successful login to the Rcs.is confirms that SSH port has been successfully reassigned. If your login was unsuccessful, you can log in to the Rcs.is from the Rcs.is Console and troubleshoot the configuration file.


Was this answer helpful?
Back

Powered by WHMCompleteSolution