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

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


If you have any web hosting questions please feel free to reach out to us. We're happy to help.
Shared Hosting | Reseller Hosting | Managed WordPress Hosting | Fully Managed VPS Hosting

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.
Subscribe to comment notifications
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments