Knowledgebase Home / How To Change Server’s SSH Port on VPS

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

How useful was this post?

Click on a star to rate it!

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?


If the steps above listed in this article do not resolve your issue, please feel free to open a support ticket and we’d be happy to take a look. Looking for better web hosting? Sign up today and take 50% off your first month with promo code: 1stmonth50

Our Guiding Principles

  • Provide consistent, stable and reliable web hosting services.
  • Ensure rapid ticket response and quick resolutions to issues.
  • Never saturate or over-provision servers to ensure stability and speed for our customers.
  • Use only high quality enterprise-class hardware to ensure minimal downtime from hardware failures.
  • Provide clear pricing with no hidden fees or gotchas.