Change SSH port in CWP

SSH Port 22

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:


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 (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
    You can also get here by clicking the link from the warning message.
  4. Look for the line:
    #Port 22

    The default port for SSH client connections is 22; to change this default to something else, like 2211; enter a port number between 1024 and 32,767.

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