May 25, 2013, Saturday, 144

Disable SELinux on CentOS 6

From ezUnix

Jump to: navigation, search
                                    pdf_icon.png Download this article as a single PDF document 

Introduction

You need to be aware that by disabling SELinux you will be removing a security mechanism on your CentOS system.
Think about this carefully, and if your system is on the Internet and accessed by the public, then think about it some more.

Applications should be fixed to work with SELinux, rather than disabling the OS security mechanism.

You could even switch to Permissive mode where every operation is allowed. Operations that would be denied are allowed and a message is logged identifying that it would be denied.


Execution

  • Edit /etc/selinux/config

Change SELINUX=enforcing 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 - 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

This will disable SELinux on your next reboot.

To diable SELinux, without having to reboot, you can use the setenforce command like so:

# setenforce 0

This will revert to enforcing once you reboot


That's all folks.
Marcin



You are not allowed to post comments. Login or register first.


Talk:Disable SELinux on CentOS 6