Another reason we can think of disabling SELinux is when you’re running Fedora Linux 39 on single-board computers (SBCs) like Raspberry Pis. Since these mini-computers have limited resources, disabling SELinux will improve the performance a bit.
We do not recommend disabling SELinux completely and leaving your system unprotected. But if it’s a test computer, a single-board computer (SBC) with limited resources, or just a computer in a private network that is not accessible from the outside in any way, you can disable SELinux.
In this article, we will show you how to disable SELinux completely on Fedora 39 in case you need it.
Topic of Contents:
- Checking the Current Status of SELinux
- Changing the SELinux Modes
- Disabling SELinux Completely Using the Kernel Boot Parameter
- Checking Whether SELinux Is Disabled
- Enabling SELinux Again
- Conclusion
Checking the Current Status of SELinux
To check the current status of SELinux, run the following command:
As you can see, SELinux is in “Enforcing” mode. This is the default mode of SELinux on Fedora 39. In this mode, SELinux is fully active and working.
Changing the SELinux Modes
SELinux has two modes: “Enforcing” mode and “Permissive” mode.
In “Enforcing” mode, SELinux enforces its security policies. In “Permissive” mode, SELinux only logs warnings; it does not enforce any policies. So, in “Permissive” mode, SELinux will let you do things just the way you would if it’s disabled.
Instead of disabling SELinux completely, you can set it to “Permissive” mode unless you have something else in mind.
To set SELinux to “Permissive” mode, run the following command:
For the changes to take effect, reboot your Fedora system:
As you can see, SELinux is set to “Permissive” mode.
You can change back SELinux to “Enforcing” mode with the following command:
Then, reboot your computer for the changes to take effect.
Disabling SELinux Completely Using the Kernel Boot Parameter
To disable SELinux completely on Fedora 39 using the kernel boot parameter, run the following command:
As you can see, the “selinux=0” kernel boot parameter is set for all the available GRUB boot entries of Fedora 39.
For the changes to take effect, reboot your computer.
Checking Whether SELinux Is Disabled
To check whether SELinux is disabled, run the following command:
As you can see, SELinux is disabled.
Enabling SELinux Again
To enable SELinux again, remove the “selinux=0” kernel boot parameter with the following command:
As you can see, the “selinux=0” kernel boot parameter is removed from all the GRUB boot entries of Fedora 39.
For the changes to take effect, reboot your computer.
Once your computer boots, SELinux should be enabled as you can see in the following screenshot:
Conclusion
In this article, we showed you how to change the SELinux modes (from “enforcing” to “permissive” and vice-versa) on Fedora 39. We also showed you how to disable SELinux completely on Fedora 39 using the “selinux=0” kernel parameter and how to re-enable SELinux on Fedora 39 as well.