setenforce(8)
Set the current SELinux enforcement mode (Enforcing, Permissive, or Disabled).
Synopsis
setenforce [ Enforcing | Permissive | 1 | 0 ]Description
setenforce sets the current SELinux enforcement mode for the running system. It allows switching between Enforcing mode (where SELinux policy is actively enforced) and Permissive mode (where violations are logged but not blocked). Changes take effect immediately but do not persist across reboots—use the SELINUX variable in /etc/selinux/config for permanent changes.
This command requires root privileges. You cannot change from Disabled mode without rebooting the system.
Common options
| Flag | What it does |
|---|---|
Enforcing or 1 | Enable SELinux enforcement; policy violations are denied and logged |
Permissive or 0 | Set SELinux to permissive mode; violations are logged but not blocked |
Examples
Switch SELinux to enforcing mode, actively blocking policy violations
setenforce EnforcingEnable enforcing mode using numeric notation (1 = Enforcing)
setenforce 1Switch to permissive mode for troubleshooting without blocking access
setenforce PermissiveSwitch to permissive mode (0 = Permissive) as root
sudo setenforce 0Check current mode, then switch to permissive for testing
getenforce && setenforce Permissive