We must enable SELinux as far as the security is concerned if the systems are in the production environment. If the SELinux is enabled and permission is denied a message “avc:denied” will be printed in /var/log/messages. By default, SELinux is enabled and enforcing mode. You must be wondering why are we disabling the SELinux. Sometime we may have to disable SELinux to check the proper functioning of the application also you may disabled the SELinux in UAT/testing environment. In this page, we are going to see the simple steps to disable SELinux in Red Hat and CentOS Linux 8/7/6.
There are three modes of SELinux
Enforcing – It’s is default mode, it will enforce the policies on the system.
Permissive – In this mode SELinux is enables but not enforcing the security policies. But warnings and logs will be printed if SELinux policy setting is breached.
Disabled – This will totally disabled the SELinux.
From the above output, we can see that SELinux is enabled and enforcing mode. We can see the details status using -b option along with sestatus command. Which shows the details description of the services are enabled and disabled.
# sestatus -b
# setenforce 0
# setenforce Permissive
Save and exit the file. Need to restart your system to take effect.
Now check the status of SELinux with below command.