How to Disable SELinux on Almalinux

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. In Almalinux, SELinux is enabled and in enforcing mode by default.

SELinux policy rules specify how processes and users interact with each other as well as how processes and users interact with files. When no SELinux policy rule explicitly allows access, such as for a process opening a file, access is denied. SELinux has three modes:

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

Prerequisites:

You will need a user with with sudo privileges in order to perform this task and disable SELinux. Check the status of SELinux first to make sure it is not disabled.

You can check the status of SELinux using the following command at terminal.

Output example showing SELinux in enforcing state (enabled)

The output above shows that SELinux is enabled and is set to enforcing mode. Now follow the next step to disable SELinux.

Procedures to disable SELinux:

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

Edit the /etc/selinux/config file to set the SELINUX parameter to disabled, and then reboot the server. The contents of the /etc/selinux/config file should resemble the following example:

Make sure that there is only one enable SELINUX=disabled parameter, a parameter is enabled by removing "#" sign before it.

Save the SELinux configuration file and reboot the system.

Once the system has rebooted, check the status of SELinux.

Output example showing SELinux in disabled state.

You have successfully disabled SELinux.

Was this article helpful?

0 out of 0 liked this article

Still need help? Message Us