Disable SELinux on CentOS 7

Published on April 11, 2019 48 sec read

Security-Enhanced Linux (SELinux) is a Linux kernel security module that provides a mechanism for supporting access control security policies, including mandatory access controls (MAC).

In Laravel, we have to face the “log file permission problem” for SELinux. At this situation by disabling SELinux, this issue can be solved.

Check SELinux Status

SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      31

Disable SELinux

By this command you can disbale SELinux temporarily:

sudo setenforce 0

To disable permanently, open /etc/selinux/config file and set SELINUX mod to disabled:

# 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.
# SELINUXTYPE= can take one of these two values:
#       targeted - Targeted processes are protected,
#       mls - Multi Level Security protection.

Now reboot your server:

sudo shutdown -r now

Once the system boots up, check the status again:

SELinux status: disabled


I don’t recommend to disable SELinux. Search on the web and try to find the perfect solution to that problem. Thank you. 🙂

Monthly Newsletter

One email a month, packed with the latest tutorials, delivered straight to your inbox.
We'll never send any spam or promotional emails.

Hey, I'm Md Obydullah. I build open-source projects and write article on Laravel, Linux server, modern JavaScript and more on web development.