Synergy Wholesale

Changing the SSH port on your VPS

Before completing these steps, login to your VPS via SSH.

Changing the SSH Port

By default, SSH runs on port 22. Changing the SSH port can help reduce the number of automated attacks on your server. However, please note that this is not a comprehensive security measure and should be used in conjunction with other security practices. To change the SSH port, please follow the steps below:
  1. Open the SSH configuration file in Nano by typing in this command:
    nano /etc/ssh/sshd_config
  2. Navigate down the lines using your arrow keys, and un-comment the line in the file that says "#Port 22".
    1. Use the backspace or delete key to remove the hash character.
    2. Change 22 to your desired port number.
  3. Then, exit Nano:
    1. Press Ctrl+X to quit.
    2. Then, press Y to confirm your changes
    3. Press the Enter key to confirm that the filename remains the same (do not change this).
  4. Restart the SSH daemon:systemctl restart sshd

Updating your firewall settings

If you have a firewall set up on the server, you will need to ensure that you adjust your firewall settings to allow for connections on the new SSH port. If you have CSF installed (cPanel servers)
  1. Open the CSF config file:
    nano /etc/csf/csf.conf
  2. Look for the allowed TCP ports (approximately line 138).
  3. Use the arrow keys to navigate the cursor after one of the separating commas.
  4. Type in your new port number here and add a comma if there are any values after this.
  5. Press Ctrl+X to quit.
  6. Then, press Y to confirm your changes.
  7. Press the Enter key to confirm that the filename remains the same (do not change this).
  8. Restart CSF using the following command:
    csf -r
If you're using FirewallD (CentOS/AlmaLinux 7/8, Ubuntu 18+) Note: In this example, the new SSH Port is 2222. Make sure you adjust the port number for your use case. Please replace port=2222 with your new nominated port.
sudo firewall-cmd --permanent --zone=public --add-port=2222/tcp
sudo firewall-cmd --reload

Related Articles

WHM··4 minute read

This guide will go over creating and managing account packages in WHM. This does require you to be logged into WHM.

WHM··2 minute read

This guide will go over how to log in to WHM (Web Host Manager) and provide some tips for first-time users. Accessing WHM To access WHM, the easiest way is through your Synergy Wholesale account: Log in to your Synergy Wholesale account.

WHM··3 minute read

This guide will go over navigation within WHM (Web Host Manager) and some of its features. This requires you to log in to WHM. If you haven't logged in yet, please refer to our WHM Logging In guide first.

WHM··3 minute read

This guide will go over our recommended initial configuration steps after logging in to WHM, If you haven't logged in yet, please refer to our Accessing WHM guide first. Initial Configuration Steps We recommend going through the following initial configuration steps to ensure your WHM/cPanel server is set up correctly: Hostname Note: This step is only required for Self Managed VPS users, as our Fully Managed VPS users will have this set up for you.

WHM··2 minute read

This guide will go over creating and managing cPanel accounts within WHM. If you haven't logged in yet, please refer to our Accessing WHM guide first.

VPS Addons··1 minute read

What addons are available for my VPS? Self Managed VPS Plans The following addons are available for Self-Managed VPS services that do not already have these installed: Complete Security Suite which includes: ImunifyAV+ Anti-virus Monitoring Fortinet Hardware Firewall Halon outbound Email Spam Protection Acronis Backups Fortinet Hardware Firewall Nagios Service Monitoring LiteSpeed Web Server + LiteSpeed Cache CloudLinux & Kernelcare (AlmaLinux 8 servers only) Installatron (AlmaLinux 8 servers only) Additional cPanel Account Licences Fully Managed VPS Plans Fully Managed VPS's already include all the above addons however there are some differences: Complete Security Suite: Instead of ImunifyAV+ we use Monarx for Anti-virus.