HowTo: Turn off SELinux

by on December 6, 2009 · 3 comments· LAST UPDATED June 6, 2012

in

How do I turn off SELinux (Security-Enhanced Linux) under Linux operating systems?

Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following command. Alternatively, you can login using ssh to remote system and type the same command. You must be root to type the following command:
# echo 0 >/selinux/enforce
You can also use the setenforce command to effectively disable it, enter:
# setenforce Permissive
OR
# setenforce 0
The above commands will switch off SELinux enforcement temporarily until the machine is rebooted. If you would like to make it permanently, edit /etc/sysconfig/selinux, enter:
# vi /etc/sysconfig/selinux
And set / update it as follows:
SELINUX=disabled
Save and close the file. The above will only work in CentOS, Fedora and RedHat Enterprise Linux systems. For all other Linux distros edit your boot loader config file (LILO or GRUB boot loader config file such as /boot/grub/grub.conf). Find the kernel line, append enforcing=0 at the end:

title Red Hat Enterprise Linux Server (2.6.18-194.26.1.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-194.26.1.el5 ro root=LABEL=/ console=tty0 console=ttyS1,19200n8 enforcing=0
        initrd /initrd-2.6.18-194.26.1.el5.img

Finally, reboot the system:
# reboot

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 3 comments… read them below or add one }

1 Collin June 6, 2012 at 1:13 pm

Your intro has a typo, you put of instead of off.

How do I turn of SELinux (Security-Enhanced Linux) under Linux operating systems?

Great website, keep it up.

Reply

2 nixCraft June 6, 2012 at 1:31 pm

@Collin,

The faq has been updated. I appreciate your feedback.

Reply

3 Map March 15, 2014 at 10:46 am

Is it possible to disable selinux for specific filesystem or directory ? And rest of system will use selinux in enforncing mode.

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: