Disabling SELinux in Oracle Linux 6
SELinux is a set of extra security restrictions on top of the normal Oracle Linux security tools. It gives the systems administrator a finer grain of control than what the kernel typically provides.
However, SELinux can sometimes get in your way. For example, I have had typical services, such as Apache HTTP server which appears to start up correctly, but remain inaccessible from the outside world because you forgot to allow the apache user rights to open that port.
Is SELinux running?
You can test to see if SELinux is currently enabled with the following command
which will return an exit status 0 if SELinux is enabled and 1 if it is disabled. In true Linux style a better example would be:
# selinuxenabled && echo enabled || echo disabled enabled
Temporary turn off (disable) SELinux
The easiest method to disable SELinux temporarily until you either re-enable it or perform a system reboot is to execute the following command as root on the system:
# echo 0 > /selinux/enforce
Temporary turn on (enable) SELinux
Likewise, to enable SELinux (if disabled at boot) you simply execute:
# echo 1 > /selinux/enforce
Permanently disabling (turrning off) SElinux
To completely disable SELinux at system startup, edit the configuration file /etc/selinux/config and change the SELINUX option to disabled, like so:
Note: The above changes will not take effect until the system is rebooted. You will need to reboot your system or temporarily set SELinux to non-enforcing mode to create the desired effect like the example above.