Modify SSH to Use a Non-default Port

A simple, but very effective, step you can take to enhance your server’s security is to update the port SSH uses to a port other than 22 (the default). To do this, login to your VPS as root and follow these steps:

1. Open the SSH config file with the vi editor:

# vi /etc/ssh/sshd_config

2. Press the “A” key to enter editing mode. Look for this line, near the top of the file:

#Port 22

3. Uncomment the line (remove the pound symbol) and change the port value to any number of your choosing:

Port 6486

4. Press ESC, then type :wq (colon-w-q) and press enter to save and exit the file.

5. If you are running a firewall, ensure that the port you selected is open.

6. Restart the SSH service:

(CentOS) # service sshd restart

(Debian) # /etc/init.d/ssh restart

You will now access SSH through the new port, like this:

# ssh [email protected] -p 6486

 

Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.