How to do it...

Once we have a working SELinux system, we can choose how to use it:

  1. SELinux can operate in two different ways: Enforcing and Permissive.
  2. Let's check the current mode by using the getenforce command:

As we can see, SELinux is currently working in Permissive mode.

  1. Now, if we wish to toggle the mode, we can use the setenforce command:

When we run the preceding command with option 1, the mode changes to Enforcing.

  1. If we want to toggle back to Permissive mode, we can again use the setenforce command with option 0:

Now, the mode has changed back to Permissive.

  1. This change will not survive system reboot. If we want to change the mode permanently, we have to edit the /etc/selinux/config file and change the SELinux variable to what we want: enforcing, permissive or disabled.
  2. Whenever an application is misbehaving or not working as expected, as part of the troubleshooting, we should try toggling between SELinux modes (from Enforcing to Permissive, or vice versa). This will help us understand if the application works after changing to Permissive mode or not. If it does, then we know that it's an SElinux permission issue.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.200.66