≡ Menu

HowTo: Turn off SELinux

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

Tweet itFacebook itGoogle+ itPDF itFound an error/typo on this page?

{ 4 comments… add one }

  • Collin June 6, 2012, 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.

  • nixCraft June 6, 2012, 1:31 pm

    @Collin,

    The faq has been updated. I appreciate your feedback.

  • Map March 15, 2014, 10:46 am

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

  • ugis July 26, 2014, 7:51 pm

    Have same problem but SELinux is not even installed, Any other ideas to solve this problem?
    Thanks

Leave a Comment