LinuxMoz

Linux Stuff && Coffee

CentOS Disable SELinux

| Comments

CentOS disable SELinux, the following tutorial shows you how to disable SELinux without rebooting on CentOS 5 & 6 the guide also shows you how to permanently disable SELinux. I only recommend disabling SELinux during troubleshooting, keeping it enabled and configuring it correctly is by far the best option.

CentOS disable SELinux without rebooting

The following command ran as root will disable SELinux without rebooting on CentOS 6 & 5:

1
setenforce 0

Note, SELinux will return to enforcing (enabled) again on the next reboot, if you wish to permanently disable SELinux see the instructions below.

CentOS disable SELinux permanently

To permanently disable SELinux on CentOS (5 & 6) open /etc/selinux/config with:

1
vi /etc/selinux/config

Replace the line that reads:

1
SELINUX=enforcing

With:

1
SELINUX=disabled

Or optionally you can set it to permissive, this stops SELinux from enforcing but still allows it to warn you.

1
selinux=permissive

Your file should look like this:

1
2
3
4
5
6
7
8
9
10
# 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 - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

I do not recommend leaving SELinux disabled on CentOS as a permanent solution.

Comments