This article describes how to change the SSH port number for a server. You may want to do this for security reasons, for example, or if you use a third-party service that requires a specific SSH port number.
To change the port for the SSH server, follow these steps:
Restart the SSH service using the appropriate command for your Linux distribution:
service sshd restart
For Debian and Ubuntu, type:
service ssh restart
While still logged in as root, in a new terminal window try to log in using the new SSH port number. If the login fails, check your settings. Do not exit your open root session until you are able to log in using the new configuration.
If you have a firewall configured for your server, you must also update the firewall rules to allow access on the new SSH port:
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.