March 22, 2009

Howto: Disable SELinux on Centos


How to Disable SELinux in Centos Linux

Occasionally, you will have trouble with selinux on Centos and need to temporarily disable selinux. Here is how you change selinux settings in centos and other red hat linux distributions:

  • Edit /etc/selinux/config (e.g. $sudo vi /etc/selinux/config)

  • Find the line:

    SELINUX=enforcing

    • a) If you simply want to set selinux to permissive mode - which will still warn you when something would have been denied

      change to

      SELINUX=permissive

    • b) If you are sure you want to completely disable selinux

      change to

      SELINUX=disabled


    and save (in vi type [Esc] :wq)

    centos disable selinux


  • SELinux will be disabled after reboot. To turn selinux off immediately, without rebooting use:

    $ sudo setenforce 0

  • If everything works, edit your /etc/grub.conf and change it from this:

    etcgrubconf


  • To this:

    completely disable selinux


That is how to disable selinux on Centos. Note: there is no way to uninstall selinux from Centos. This is as disabled as selinux gets.

You usually will not need to disable selinux completely. This may be useful for troubleshooting, but I would recommend trying to disable IPv6 and disable your firewall first (service ip6tables stop; service iptables stop) and see if you have another problem. Disabling selinux can come in handy for various testing environments and may solve a few obscure problems with certain software.



0 comments:

Post a Comment

Please enter some legible and hopefully relevant text: