$linuxjunkies
>

setenforce(8)

Set the current SELinux enforcement mode (Enforcing, Permissive, or Disabled).

UbuntuDebianFedoraArch

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

FlagWhat it does
Enforcing or 1Enable SELinux enforcement; policy violations are denied and logged
Permissive or 0Set SELinux to permissive mode; violations are logged but not blocked

Examples

Switch SELinux to enforcing mode, actively blocking policy violations

setenforce Enforcing

Enable enforcing mode using numeric notation (1 = Enforcing)

setenforce 1

Switch to permissive mode for troubleshooting without blocking access

setenforce Permissive

Switch to permissive mode (0 = Permissive) as root

sudo setenforce 0

Check current mode, then switch to permissive for testing

getenforce && setenforce Permissive

Related commands