Despite the power of SELinux, sometimes it was the most complicated thing to overcome when we doing daily work or when we installing new software (eg: setup a website with content outside document root). In this post, I will show you how to disable SELinux temporarily/permanently.
First of all, if you don’t know what SELinux is, here is the short introduction of SELinux from the Red Hat website:
Security-Enhanced Linux (SELinux) is a security architecture for Linux® systems that allows administrators to have more control over who can access the system.What is SELinux? from Red Hat website
You can check SELinux status by running the following command:
Sometimes, you only need to disable SELinux for a login session. Use this command:
To enable SELinux again:
To disable SELinux permanently, you need to have
root privilege to modify the configuration file
/etc/sysconfig/selinux. So we can use
sudo command to edit this file as a
sudo vi /etc/sysconfig/selinux
Insert on your keyboard to begin editing the file. Change the
SELINUX directive to
disabled as an above image. Then press
Esc, type command
:wq , and press
After modifying the SELinux configuration file, you need to REBOOT your computer to apply this new configuration.
After reboot, check the SELinux again you will see:
Those are some simple steps to disable SELinux that you can follow. If your Linux OS is using for daily basic works or regular works, you can disable SELinux right after the installation. Otherwise, please consider it carefully before do this disable.