- Log in to the server using SSH as root user.
- Open /etc/ssh/sshd_config in a text editor and modify “Port” directive with new port number
- 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
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
We believe your website will be faster with VeeroTech. Try us and see with a free migration and 30 day trial. use promo code freetrial at checkout.