Md. Obydullah Howdy, I am Md. Obydullah from Bangladesh. I love to write the article which may help others. It's my passion.

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

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

Now reboot your server:

sudo shutdown -r now

Once the system boots up, check the status again:

sestatus
Output
SELinux status: disabled

Note

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

Md. Obydullah Howdy, I am Md. Obydullah from Bangladesh. I love to write the article which may help others. It's my passion.

Leave a Reply

Your email address will not be published. Required fields are marked *