SELinux is very powerful security mechanism for Linux distributions. Distributions like CentOS, RHEL or Fedora comes SELinux enabled by default. In some situations we do not need SELinux protection especially in end user systems. In this tutorial we will look how to disable SELinux temporarily or Permanently.
List SELinux Status
First step is getting information about SELinux status. We can get and list SELinux status with the sestatus
command.
$ sestatus

We can see from first line of output that the SELinux status
is enabled
Disable SELinux Temporarily
There is different ways to disable SELinux. Disabling SELinux temporarily work only for current run. After the system is rebooted SELinux configuration will revert to the persistent one and the SELinux will be enabled. We can disable with the following ways. All of them requires root privileges.
$ echo 0 > /selinux/enforce
OR
$ setenforce 0
OR
$ setenforce Permissive
Disable SELinux Permanently
The best way to get rid of from SELinux is disabling it permanently. We should save configuration. This will make configuration effective between reboots. We have different ways to accomplish this. All of them requires root privileges.
Change SELINUX=enforcing
line in /etc/sysconfig/selinux
to the following.
SELINUX=disabled

1 thought on “How To Disable SELinux Temporarily or Permanently in CentOS, RHEL, Fedora”