If you're using RedHat or CentOS Linux distros (or sporting a Fedora Linux desktop), you probably have SElinux enabled by default. SElinux is a Security-Enhanced Linux – a framework for securely managing processes, users and files on your RedHat OS.
Confirm current SElinux mode
Just run the getenforce command to see what the story is. Most likely it will say "Enforcing" which is really good – means your OS is under solid protection:
[root@rhel8 ~]# getenforce Enforcing
Temporarily Disable SElinux
If you need to disable SElinux just for a few minutes to debug some issue (mind you, there are better ways to debug than disabling SElinux!), you should use the setenforce command:
[root@rhel8 ~]# setenforce 0
As you can see, getenfore will now report that your system is running in a Permissive mode – not very safe:
[root@rhel8 ~]# getenforce Permissive
IMPORTANT: This change won't survive a reboot, so next time you restart your system it will come back with SElinux enabled and enforcing again.
Permanently Disable SElinux
If you're serious about disabling SElinux altogether, you'll have to do two things:
- Update /etc/selinux/config file (change SELINUX=enforcing to SELINUX=disabled)
- Reboot your Linux system