Disable SELinux on CentOS 7

SELinux (Security Enhanced Linux) is a Linux kernel security module that allows administrators and users more control over access controls. It allows access based on SELinux policy rules.

SELinux policy rules specify how processes and users interact with each other as well as how processes and users interact with files.

If there is no SELinux policy rule that specifically allows access, such as for a process opening a file, access is denied.

SELinux has three modes:

  • Enforcing: SELinux allows access based on SELinux policy rules.
  • Permissive: SELinux only logs actions that would have been denied if running in enforcing mode.
  • Disabled: No SELinux policy is loaded.

By default in CentOS 7, SELinux is enabled and in enforcing mode.

It is recommended to keep SELinux in enforcing mode, but in some cases you may need to set it to permissive mode, or disable it completely.

In this article I’ll will show you how to disable SELinux on CentOS 7 systems.


Before starting, make sure you are logged in as a user with sudo privileges.

Check the SELinux Status

To view the current SELinux status and the SELinux policy that is being used on your system you can use the sestatus command:

You can see from the output above that SELinux is enabled and set to enforcing mode.

Disable SELinux

You can temporarily change the SELinux mode from targeted to permissive with the following command:

However this change will be valid for the current runtime session only.

To permanently disable SELinux on your CentOS 7 system, follow the steps below:

Open the /etc/selinux/config file and set the SELINUX mod to disabled:

Save the file and reboot your CentOS system with:

Once the system boots up, verify the change with the sestatus command:

The output should look like this:

News Source: Linuxize

About Lex van der Horst 201 Articles

Be the first to comment

Leave a Reply