How to disable SELinux on CentOS 7

Check selinux status

First, let's check the status of SELinux. To check current state of SELinux and the SELinux policy that is used on your system, use the sestatus command:


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

1. Open file /etc/selinux/config and set SELINUX mode 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.

2. Safe file and restart system Centos

sudo shutdown -r now

3. When system reload, please check your changings with sestatus command


In the end you will see that Selinux disabled on your server - SELinux status: disabled


SELinux is a great tool that is designed for security in CentOS 7. In this article we will go into detail on how to disable SELinux on centOS OS for user needs.