How to Disable SELinux on CentOS 8

Disable SELinux on CentOS 8

In this article, we will have explained the necessary steps to Disable SELinux on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

SELinux, also known as Security-Enhanced Linux. SELinux mainly used to control access to files, users, applications and network resources in the Linux. It allows access to files, users, etc. following SELinux rules. In the CentOS system, SELinux by default enabled.

SELinux has three modes:

  • Enforcing – This is SELinux’s default installation at Installation. It enforces default policies on the system, logs actions, and denies access to some services.
  • Permissive – In this mode, policies will not be enforced, but violations will be logged and a warning triggered
  • Disabled – As the name suggests, this implies that SELinux is turned off and security polices will no longer protect the server.

Disable SELinux on CentOS 8

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

Step 2. Checking the Current Status and Mode of SELinux.

Use the sestatus command to check the status and the mode in which SELinux is running:

Step 3. Temporarily Disable SELinux on CentOS.

You can run the following command to set SELinux to permissive mode temporarily:

Verify the change with the sestatus command:

Step 4. Permanently Disable SELinux on CentOS 8.

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

Now reboot your system running below command to make changes permanent:

When the system is booted, use the sestatus command to verify that SELinux has been disabled:

Congratulation, you have learned how to Disable SELinux on CentOS 8. If you have any question, please leave a comment below.