How to Disable SELinux on CentOS 7/6 & RHEL 7/6

1
Disable SELinux on CentOS 7
Disable SELinux on CentOS 7

SELinux is a set of extra security restrictions on top of the normal Linux security tools. It gives the systems administrator a finer grain of control than what the kernel typically provides.  Here is the small guide for disabling SELinux on CentOS 7/6 / RHEL 7/6.

Switch to the root user.

$ su -

Edit the /etc/selinux/config.

vi /etc/selinux/config

Change from SELinux=enforcing

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

To SELinux=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

This setup will disable SELinux on next reboot.

To disable SELinux without rebooting, use the following command.

setenforce 0

This command will disable SELinux until you reboot the system.

That’s All.

You might also like