X
    Categories: Linux

How to turn off-disable SELINUX

Security-Enhanced Linux (SELINUX) is a Linux feature that provides the mechanism for supporting access control security policies.But SELINUX can sometimes get in your way. Therefore you need to turn off-disable SELINUX. However before you turn off-disable SELINUX make sure you have a valid reason ,why you are doing it.

How to turn off-disable SELINUX temporarily

Step 1: First of all Check the current status of selinux using below command:

[root@rhel1 ~]# getenforce
Enforcing
[root@rhel1 ~]#

For another method use below command which results the same:

[root@rhel1 ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted
[root@rhel1 ~]#

Step 2: To temporarily turn off-disable SELINUX use below method:

[root@rhel1 ~]# echo 0 > /selinux/enforce

Another method

[root@rhel1 ~]# setenforce 0

Rather you can set it to permissive mode. As a result SELINUX will be giving warning messages instead of enforcing it.  To do the same use below command:

[root@rhel1 ~]# setenforce Permissive

Above all method described are not persistent across reboot. As a result it will work till next reboot. Furthermore If you want to do it permanently across reboot follow below procedure.

How to turn off-disable SELINUX permanently

To turn it off permanently change value of “SELINUX” parameter to “disabled” in the file “/etc/sysconfig/selinux” as below

save and quit file using “wq!” command and you are almost done just reboot the system finally.

Finally recheck using below commands:

[root@rhel1 ~]# sestatus
SELinux status: disabled
[root@rhel1 ~]# getenforce
Disabled
[root@rhel1 ~]#
Related Post