How to Disable SELinux on CentOS
SELinux or Security-Enhanced Linux is a mechanism or security module that provides access control security policies. In simple terms, it’s a feature or service used for restricting users to certain policies and rules set by the systems administrator.
How to Temporarily Disable SELinux on CentOS
Before you start disabling SELinux on CentOS , it’s prudent that you first check the status of SELinux.
To do so, run the command:
# sestatus
To temporarily disable SELinux run the command.
# setenforce 0
Either of these commands will temporarily disable SELinux only until the next reboot.
How to Permanently Disable SELinux on CentOS
The configuration file for SElinux is located at /etc/selinux/config. Therefore, we need to make a few modifications to the file.
# vi /etc/selinux/config
Set the SELinux attribute to disabled
:
SELINUX=disabled
Save and exit the configuration file and reboot your CentOS Linux system using any of the commands below.
# reboot # init 0 # telinit 0
Now check the status of SELinux using the command.
# sestatus