Bootstrap FreeKB - SELinux - Temporarily or Permanently change SELinux mode (enforcing permissive disabled)
SELinux - Temporarily or Permanently change SELinux mode (enforcing permissive disabled)

Updated:   |  SELinux articles

SELinux has 3 modes.

  • Enforcing
  • Disabled
  • Permissive (running but not enforcing)

 

The sestatus command can be used to determine if SELinux is enforcing, permissive, or disabled.


Temporary change

Setenforce Permissive or Setenforce Enforcing can be used to temporarily change the SELinux enforcing policy. If the machine is rebooted, the machine will return to the default SELinux policy. The setenforce command updates the /sys/fs/selinux/enforce file to have a 0 (permissive) or a 1 (enforcing).

~]# setenforce Permissive
~]# setenforce Enforcing

 

Or, the setenforce 0 command can be used to temporarily set SELinux to permissive for the entire system, or setenforce 1 for enforcing.

~]# setenforce 0
~]# setenforce 1

 

The policy can also be modified for a single daemon.

~]# setenforce 0 daemon_name
~]# setenforce 1 daemon_name

 


Permanent change

Selinux can permanently be set to enabling, permissive, or disabled for all daemons by editing the /etc/selinux/config file.

SELINUX=enforcing

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter a2fd36 in the box below so that we can be sure you are a human.