How to Disabled SELinux using Command Line on CentOS 6/RHEL 6

Share this Article :

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.

1. Verify the SELINUX setting before changes :

[root@centos66 ~]# sestatus
SELinux status:                 enforcing

Check the config file :

[root@centos66 ~]# cat /etc/sysconfig/selinux

2. Issue the following command to changes the config file :

[root@centos66 ~]# sed -i 's/(^SELINUX=).*/SELINUX=disabled/' /etc/sysconfig/selinux

3. Verify the SELINUX status again :

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

4. Reboot the CentOS/RHEL server :

[root@centos66 ~]# reboot

Leave a Reply