Change SSH port in CWP

CWP comes with the OpenSSH server. This is using by default port 22. CWP doesn’t modify this at installation time but notifies you to change it as soon as possible. The message looks like:

cwp ssh port warning

WARNING: Security vulnerability! Your server is using default SSH Port 22, to make your server more secure change SSH port in config file /etc/ssh/sshd_config and in CSF firewall ! After changes are done don’t forget to restart SSH and CSF Firewall.

To modify the SSH port on CentOs Web Panel:

  1. Login to CWP at https://domainname.com:2087 (port 2087 is for a secure connection)
  2. Go to Services Config->SSH Configuration
  3. This will open for editing the file /etc/ssh/sshd_config
  4. Look for the line:
    #Port 22

    and change the port number to something else, like 2211; also remove the # character from the beginning of the line. In the end, you will have:

    Port 2211
  5. Click the Save changes button
  6. Go to the Dashboard and restart the SSH server.
  7. Go to Security->CSF Firewall, click the Firewall Configuration button
  8. Look for the # Allow incoming TCP ports section and add your port number to the list.
  9. Click the Save changes button
  10. Go to Security->CSF Firewall, click the Firewall Restart button
  11. Now you will be able to connect to the server via SSH using the new port number

The short video tutorial for this KB article:

CWP – change SSH port

Related KB article: Change the default SSH server port number

This Post Has 4 Comments

  1. Mahmut Bozkurt

    Thanks

  2. Oğuzhan Özçelik

    Thanks mate!

  3. Kornelije Kovac

    What’s the point of this? How does it make server more secure?

    1. PlotHost

      We didn’t say it makes the server more secure 🙂 But it’s considered a good practice.
      The idea is that you usually see many more connection attempts on the default port -22. So by changing the default port you reduce the number of failed login attempts.

Leave a Reply