≡ 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
# 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:
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

Share this tutorial on:

Like this? Follow us on Twitter OR support us by using Patreon

{ 7 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


    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?

  • Divo January 31, 2016, 1:34 pm

    Thanks for the post. This problem took many hours.

  • kindyslam March 31, 2016, 2:01 am

    Thanks a bunch. This post was really helpful

  • Steve Savasky December 11, 2016, 12:39 am

    Samba 3 will not authenticate if SELINUX
    is enabled.

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , , , , , , , , , , ,