IBM Cloud Docs
Configuring SSH to run on a nonstandard port

Configuring SSH to run on a nonstandard port

Use the following steps to force SSH to run on a nonstandard port.

  1. Open /etc/ssh/sshd_config in a text editor. The following example is for vi editor.

    # vi /etc/ssh/sshd_config
    
  2. Go to the following line:

    # Port 22

  3. Uncomment and edit this line to reflect the new port. You can set this port to any nonstandard port.

    Port 2255
    
  4. Save and quit the file, and restart SSH.

    # /etc/init.d/sshd restart
    
  5. If you are connected to the server by using SSH on port 22, you need to reconnect by using the new port.