RHEL 6: Change OpenSSH Port To 1255 ( SELinux Config )

RHEL 6: Change OpenSSH Port To 1255 ( SELinux Config )

To change the OpenSSH port number on RHEL 6 with SELinux enabled, you can use the following steps:

  1. Edit the /etc/ssh/sshd_config file and change the Port setting to the desired port number. For example, to change the port number to 1255:
refer to‮iruttual:‬.com
sudo nano /etc/ssh/sshd_config

Change the following line:

#Port 22

To:

Port 1255

Save and close the file.

  1. Restart the OpenSSH server to apply the changes:
sudo service ssh restart
  1. Update the SELinux policy to allow the OpenSSH server to listen on the new port number. You can do this by using the semanage command:
sudo semanage port -a -t ssh_port_t -p tcp 1255

This will update the SELinux policy to allow the OpenSSH server to listen on port 1255.

  1. Update the firewall rules to allow incoming connections on the new port number. You can do this by using the firewall-cmd command:
sudo firewall-cmd --add-port=1255/tcp --permanent
sudo firewall-cmd --reload

This will update the firewall rules to allow incoming connections on port 1255.

After completing these steps, the OpenSSH server should be listening on port 1255 and allowing incoming connections on that port. You can use the ss -lnp command to verify that the OpenSSH server is listening on the correct port.

Note: These steps assume that you are using the default SELinux policy and firewall configuration on your system. If you have modified these settings, you may need to adjust the steps accordingly.

Created Time:2017-10-16 14:38:54  Author:lautturi