Need help? Chat now!

Hostwinds Tutorials

Search results for:


Table of Contents


Why Change the default SSH port (TCP 22)?
Now edit the SSH Server configuration file.
Restart the SSH Server

How to Change SSH port using Get VNC (Linux Command Line)

Tags Linux 

Why Change the default SSH port (TCP 22)?
Now edit the SSH Server configuration file.
Restart the SSH Server

Why Change the default SSH port (TCP 22)?

For the security-minded, changing the default ports for services is usually the first step in hardening your server from attack.  It makes the job of any hacker a little bit harder now that they have to probe your server for services before they can attempt authentication.

With some ISPs doing selective port blocking, changing the default ports for essential services like SSH may be necessary.  You can generally tell if you are port blocked if your service can be pinged, but you cannot log in via SSH.

The Hostwinds Cloud Control portal is where we can change your SSH Port using Get VNC if you cannot connect to your server using SSH.

Then select the Get VNC function by clicking on the action tab and the Get VNC button.

Login to the VPS as root and manually type the password (sorry, no cope+paste when using Get VNC through the Hostwinds Cloud Portal).  Once logged in, you should see something like this.

Now edit the SSH Server configuration file.

We will be using nano in this guide to edit the file. But, of course, you are welcome to use your favorite text editor.

# nano /etc/ssh/sshd_config 

You can also ADD multiple ports for SSH here. Just add another "Port XXXX" on its own line.

Press CTRL-O, then return to save.

Press CTRL-X to exit back to the command line.

At this point, if you have a firewall -- Ubunutu/Debian or CentOS/RHEL/Fedora -- close port 22 if appropriate and open your new ports.

To allow the new setting to take effect, you will need to restart the sshd service.

Restart the SSH Server

# systemctl restart sshd 

Written by Hostwinds Team  /  June 5, 2021