How to disable-deactivate SELinux

Security-Enhanced Linux (SELinux) is a Linux feature that provides a mechanism to support access control security policies. SELinux can sometimes get in your way. Therefore, you need to disable-deactivate SELinux… However, before you disable / disable SELinux, make sure you have a good reason why you are doing this.

How to temporarily disable / deactivate SELinux

Step 1: First of all, check the current SELinux status with the following command:

[[email protected] ~]# getenforce
Enforcing
[[email protected] ~]#

Using a different method with a command that does the same:

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

Step 2: In order to temporarily disable-deactivate SELinux, use the method below:

[[email protected] ~]# echo 0 > /selinux/enforce

Another method

[[email protected] ~]# setenforce 0

You can most likely set it to permissive mode. As a result, SELinux will issue warning messages rather than execute it. To do the same, use the following command:

[[email protected] ~]# setenforce Permissive

First of all, the described method works until reboot. As a result, it will work until the next reboot. Additionally, if you want to do this permanently through a reboot, follow the procedure below.

How to disable-disable SELinux permanently

To disable it permanently, change the value of the “SELinux” parameter to “disabled” in the file “/ etc / sysconfig / SELinux“ as shown below

save and exit the file using the “WQ!” command, you’re almost done, just reboot your system, that’s all.

Finally check back with the command below:

[[email protected] ~]# sestatus
SELinux status: disabled

How to disable-deactivate SELinux

Sidebar