File selinux with content SELINUX=enforcing as below:
[[email protected] ~]$ sudo cat /etc/sysconfig/selinux
[sudo] password for huupv:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
# SELINUXTYPE= can take one of these three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
How do it...
Step 1: Open sshd_config file
# vi /etc/ssh/sshd_configAdd port 2222 as below:
Port 2222Step 2: Enable port 2222 with rule selinux.
# sudo semanage port -a -t ssh_port_t -p tcp 2222Step 3: restart ssh services
#systemctl restart sshd