Linux

Easy Tutorial To Disable SELinux On CentOS 7

Easy Tutorial To Disable SELinux On CentOS 7

Insight: Tutorial To Disable SELinux On CentOs 7

What Is SELinux ?

Security Enhanced Linux or SELinux is a Linux kernel security module. SELinux allows users and administrators more control over access control. SELinux access controls are determined by a policy loaded on your system.

By default in CentOS 7, SELinux is enabled and also in enforcing mode. In this tutorial, we are going to show you the easy tutorial to disable SELinux on CentOS 7.

Easy Tutorial To Disable SELinux On CentOS 7

Easy Tutorial To Disable SELinux On CentOS 7

sudo sestatus

You will see something like this:

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

To permanently disable SELinux on your CentOS 7 system, Go through the following steps:

At first, Open the /etc/selinux/config file and change the 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, save the file and shut down your system with the command below:

sudo shutdown -r now

Boot your system and verify the change with the sestatus command:

sudo sestatus

The output should look something like this:

SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux

Quick Tip:

READ THIS ALSO  List Of Most Used Linux Applications In 2018: Part I
sudo setenforce 0

This change is only applicable for the current session.

Important note: It is recommended to put SELinux in enforcing mode.