CentOS Linux 5/6: Change OpenSSH Port Number

www.la‮ruttu‬i.com
CentOS Linux 5/6: Change OpenSSH Port Number

To change the port number that OpenSSH listens on in CentOS Linux 5/6, you will need to edit the OpenSSH server configuration file.

  1. Open the /etc/ssh/sshd_config file in a text editor.
sudo nano /etc/ssh/sshd_config
  1. Locate the line that begins with Port and change the port number to the desired value. For example, to change the port to 2222:
Port 2222
  1. Save and close the sshd_config file.

  2. Restart the OpenSSH server to apply the changes:

sudo service sshd restart
  1. If you are using a firewall, you will need to allow incoming connections on the new port.
Created Time:2017-10-16 14:38:40  Author:lautturi