How to Disable SELinux?

There are 2 ways to disable SELinux: temporary and permanent. First of all, to find out the current SELinux status on your server, use the following command:


sestatus


If the status is still enabled, then we will immediately disable it first.


If you want to disable SELinux temporarily then use the following command on your SSH terminal:


setenforce 0


Then if you want to disable SELinux permanently, then use the following command:


Edit file /etc/sysconfig/selinux


Then make sure the set SELINUX=disabled


# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

Then save.


For these changes to take effect, you must first reboot the server.


reboot


Then your SELinux status is permanently disabled.




Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.