Snippet. Linux. SELinux Turn Off, On and Disable

This Linux snippet shows how to turn off,on and disable SELinux. Tested on Fedora 15.

SELinux can cause some processes not to work. Here is how to turn it off and on, set it in permissive mode or disable it. All the snippets require the user to log as root first.

Turn Off SeLinux

echo 0 > /selinux/enforce

Turn On SeLinux

echo 1 > /selinux/enforce

Place SeLinux in Permissive Mode

To change SELinux's behavior to permissive mode you need to edit the configuration file. Usually the file is located at /etc/selinux/config.

SELINUX=permissive

Reboot the machine in order for the changes to take effect.

Disable SeLinux

To change SELinux's behavior to permissive mode you need to edit the configuration file. Usually the file is located at /etc/selinux/config.

SELINUX=disabled

Reboot the machine in order for the changes to take effect.


Updated on: 23 Nov 2024