Disable SELinux on CentOS 7

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. ?

Software Engineer | Ethical Hacker & Cybersecurity...

Md Obydullah is a software engineer and full stack developer specialist at Laravel, Django, Vue.js, Node.js, Android, Linux Server, and Ethichal Hacking.