How to Disable SELinux

Security-Enhanced Linux (SELinux) is a security module specifically made for the Linux kernel, which enables features that support security policies for access control, including mandatory access control (MAC).

SELinux can sometimes get in your way. Before you turn off SELinux make sure you know why you are turning it off and the security concerns you might be opening yourself up to. By disabling SELinux you will be removing a security mechanism on your system.

Disabling SELinux could lead to problems if you want to re-enable it again later. When the system runs with file labelling disable it will create files with no label – which could cause problems if the system is booted into Enforcement mode. A full re-labelling of the file system will be necessary.

This will only work in CentOS, Fedora and RedHat Enterprise Linux systems.

Check status of SElinux

You can check the status of SELinux on your system by running the following command:


Or


Disable SELinux Temporarily

You can disable SELinux temporarily by issuing the following command:


You can also use the setenforce command to effectively disable it, enter:


Or


The above commands will switch off SELinux enforcement temporarily until the machine is rebooted.

Disable SELinux Permanently

If you would like to make it permanently, edit /etc/sysconfig/selinux using your favourite editor, enter:


And set / update it as follows:



# 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=<strong>disabled</strong>

# 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=<strong>disabled</strong>

# 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=<strong>disabled</strong>

Save and close the file.

Finally, reboot the system:


Your need to reboot your system in order for changes to effect.

Ready for a more resilient infrastructure?

Stop settling for slow support and generic security. Get a free, no-obligation Security & Cloud Audit from our Manchester-based engineers.

Ready for a more resilient infrastructure?

Stop settling for slow support and generic security. Get a free, no-obligation Security & Cloud Audit from our Manchester-based engineers.

Ready for a more resilient infrastructure?

Stop settling for slow support and generic security. Get a free, no-obligation Security & Cloud Audit from our Manchester-based engineers.