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:
3. Uncomment the line (remove the pound symbol) and change the port value to any number of your choosing:
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