Search The Hostwinds Guides Knowledge Base

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

Share This Article [TheChamp-Sharing]

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 you server for services before they can attempt authentication.

With some ISPs doing selective port blocking, it may be necessary to change the default ports for essential services like SSH.  You can generally tell if you are being port blocked if your service is able to be pinged, but you cannot login via SSH.

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

Then select the Get VNC funtion 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. 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 affect, you will need to restart the sshd service.

Restart the SSH Server

# systemctl restart sshd 

Helpful Related Articles