Red Hat Linux (RHEL) 5/6: Change OpenSSH Port Number

https://w‮l.ww‬autturi.com
Red Hat Linux (RHEL) 5/6: Change OpenSSH Port Number

To change the port number used by OpenSSH on a Red Hat Enterprise Linux (RHEL) 5 or 6 system, you will need to edit the /etc/ssh/sshd_config configuration file. This file contains the configuration options for the OpenSSH server.

Here's a general outline of the steps you will need to follow to change the OpenSSH port number on a RHEL 5 or 6 system:

  1. Open the /etc/ssh/sshd_config configuration file in a text editor.

  2. Locate the Port directive in the file. The Port directive specifies the port number that the OpenSSH server listens on.

  3. Change the port number to the desired value. The port number must be a valid TCP port number between 1 and 65535.

  4. Save the configuration file and close the text editor.

  5. Restart the OpenSSH server to apply the changes. You can use the systemctl command to restart the OpenSSH server.

systemctl restart ssh
  1. Test the connection to the OpenSSH server using the new port number. You can use the ssh command to connect to the OpenSSH server and specify the port number using the -p option.

Here's an example of how to connect to an OpenSSH server listening on port 2222:

ssh -p 2222 user@example.com

Once you have changed the OpenSSH port number and restarted the server, it should listen on the new port number and connections should be made using the new port number. Consult the OpenSSH documentation and online resources for more information on how to configure and use the OpenSSH server.

Created Time:2017-10-30 14:27:14  Author:lautturi