SELinux is an access control program that is installed and activated by default on Linux distributions such as RHEL (Red Hat Enterprise Linux), CentOS, and Fedora.
If you installed a new system or installed a new application and it did not work, then you need to test SELinux, as it is likely that it could be the cause of this problem.
From this article, you will learn how to check the current status of SELinux, how to disable or enable SELinux temporarily or permanently.
Check SELinux Status
Run the following command to see if SELinux is running :
1 |
# getenforce |
getenforce
informs in what standing is SELinux: Enforcing (on), Permissive (included in notification mode), or Disabled (disabled).
Temporarily Disable SELinux
The following changes are temporary and will be lost after the reboot.
Temporarily Disable SELinux
Use the following command to temporarily disable SElinux.
1 |
# setenforce 0 |
Temporarily Enable SELinux
Use the following command to temporarily enable SElinux.
1 |
# setenforce 1 |
Permanently Disable SELinux
Open the file to edit /etc/selinux/config
.
1 2 3 4 5 6 7 8 9 10 11 |
$ cat /etc/selinux/config # 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. <strong>SELINUX=disabled</strong> # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted |
Permanently Disable SELinux
Edit strobe SELINUX = in a file /etc/selinux/config
of:
1 |
SELINUX=disabled |
Permanently Enable SELinux
Edit strobe SELINUX = in a file /etc/selinux/config
of:
1 |
SELINUX=enforcing |