SELinux canĀ be disabled temporarily and permanently based on our requirement.
Here I will show how to disable SELinnux temporarily and permanently.
To Disable SELinux Temporarily:
Login as root and run following command
$ setenforce 0
By default SELinux is enabled if it’s installed.
If we run setenforce 0 command SELinux will disabled until next reboot.
To Disable SELinux permanently:
To disable SELinux permanently we need to update file /etc/sysconfig/selinux.
Default configurations in /etc/sysconfig/selinux looks like below after disabling SELinux:
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Only targeted network daemons are protected. # strict - Full SELinux protection. SELINUXTYPE=targeted
The only line we modify in above config is SELINUX=disabled. This configuration will disable SELinux on boot.
-Sany