How to Check and Disable Selinux in Centos7/8, RHEL 7/8

How to Check and Disable Selinux  in Centos7/8, RHEL 7/8

How to check and disable Selinux  in Centos7/8, RHEL 7/8

SELinux – Security-Enhanced Linux

It is a security architecture that gives you more control over the system that others can access. It was integrated into Linux in 2003. SELinux is enabled by default and you can check SELinux status with the command sestaus. SELinux usage on AVC – access vector cache. You can configure SELinux for any subject or object.
Here in this article, we will talk about how to disable SELinux. As recommended do not disable it in the public domain if you do not have a firewall at the network level.
There are three modes of SELinux :
#     enforcing stand for – SELinux security policy is enforced.
#     permissive stands for –  SELinux prints warnings instead of enforcing.
#     disabled stand for – No SELinux policy is loaded.
Related Article:

How To Disable SELinux

Step 1- Check the Status with the below command

#  sestatus
sestatus
Now you can see in the above pic SELinux is in enforcing status. This means SELinux is active.

Step 2- Disable SELinux from the below command and check the status

# setenforce 0
setenforce 0
This will disable SELinux temporarily. For permanent you need to do an entry in the configuration file.

Step 3-  Make changes in the configuration file for permanent SELinux disable

There are two configuration files that we have to change to disable or permissive as per our requirement.

File -1 – Change by the below command

# vi /etc/sysconfig/selinux
/etc/selinux/config
Change permissive to disabled on SELINUX= *. This will disable SELinux permanently.

File -2 – Change by the below command

# vi /etc/selinux/config
/etc/selinux/config
Do the same as done in file -1. Save both files by (pressing the esc key):wq! Press enter.

4- Check now it will show disables in the config file.

# sestatus
SELinux disabled
Now at this point, you have successfully disabled SELinux and now you can check your services that are impacted by SELinux policy. Thanks, you can share this with your colleagues and request new articles in the comment section.

1 thought on “How to Check and Disable Selinux in Centos7/8, RHEL 7/8”

Leave a Comment

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