In this short article, I’ll show you an easy way to disable SELinux in RHEL or CentOS 6 6. You only need to run the following command line. After that, make sure you reboot your CentOS server for changes to take effect.
[root@centos66 ~]# sestatus
SELinux status: enforcing
Check the config file :
[root@centos66 ~]# cat /etc/sysconfig/selinux
.. .. SELINUX=enforcing .. ..
[root@centos66 ~]# sed -i 's/(^SELINUX=).*/SELINUX=disabled/' /etc/sysconfig/selinux
[root@centos66 ~]# sestatus
SELinux status: disabled
Check the config file again :
[root@centos66 ~]# cat /etc/sysconfig/selinux
It will change the following, 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
[root@centos66 ~]# reboot