Tag Archives: change ssh port

How To Change Server’s SSH Port on VPS

Quick Steps

  1. Log in to the server using SSH as root user.
  2. Open /etc/ssh/sshd_config in a text editor and modify “Port” directive with new port number
  3. Save the changes and restart the SSH service.

In this article, we’ll be explaining how to change the SSH port on your VPS

Even though Secure Shell (SSH) allows you to have a secure connection with your remote server, the default SSH port 22 tends to be an easy target for attackers. It’s recommended to change the default port to add extra layer of protection to your server.

1. Log in to the server as root using SSH.

2. Open the /etc/ssh/sshd_config file in your preferred text editor (nano, vi, etc.).

3. Locate the following line:

# Port 22

4. Remove # and change 22 to your desired port number and save the change. 

5. Restart the sshd service by running the following command:

    service sshd restart

Conclusion

Great, now you’ve learned how to change SSH port!

Note: If you have a firewall configured for your server, you must also update the firewall rules to allow access on the new SSH port