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
We can see from first line of output that the
SELinux status is
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
$ setenforce 0
$ 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.
SELINUX=enforcing line in
/etc/sysconfig/selinux to the following.