To change the port for the SSH server, follow these steps:
- Log in to the server as root using SSH.
- Open the /etc/ssh/sshd_config file in your preferred text editor (nano, vi, etc.).
- Locate the following line:
Port 7822
Remember that for security reasons, A2 Hosting uses port 7822 for SSH connections instead of the default port 22. - Change 7822 to the new port number that you want to use.
- Save the changes to the /etc/ssh/sshd_config file, and then exit the text editor.
- Restart the SSH service using the appropriate command for your Linux distribution:
- For CentOS and Fedora, type:
service sshd restart
- For Debian and Ubuntu, type:
service ssh restart
- For CentOS and Fedora, type:
- 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.