This guide will walk you through the process of changing your server’s SSH port from the default port 22 to a different one. Changing the SSH port is a recommended security measure. Make sure the new port number is not already in use by another service and is allowed through your server's firewall.
Changing the SSH Port on CentOS 6, CentOS 7, Debian 8, Debian 9, Ubuntu 14.04, Ubuntu 16.04, and Ubuntu 18.04:
1. Log in to your Linux VPS using SSH as the root user. You can do this through a terminal or an SSH client like PuTTY.
2. Open the SSH configuration file by running:
3. Locate the line that reads:
4. Remove the '#' symbol and replace "22" with your desired port number.
5. Save and exit the file by pressing Esc, then typing :wq and hitting Enter.
6. Restart the SSH service with the appropriate command for your OS:
- CentOS 6, Debian 8, Debian 9:
- CentOS 7:
- Ubuntu 14.04, Ubuntu 16.04, Ubuntu 18.04:
You should now be able to connect to your server using the new SSH port.
Changing the SSH Port on Fedora 28:
1. Log in to your Linux VPS via SSH.
2. Open the SSH configuration file by running:
3. Find the line that reads:
4. Remove the '#' symbol and replace "22" with your desired port number.
5. Save and exit the file by pressing 'Esc', then typing ':wq' and hitting Enter.
6. Add a new firewall rule to allow SSH on your new port number. Replace "22" with your new port number:
7. Reload the firewall and SSH services:
You can now connect to your VPS using the new SSH port. If you have any questions or need assistance, feel free to leave a comment or contact our 24/7 customer service. We’re here to help!