getenforce
Overview
getenforce prints the current SELinux mode: Enforcing, Permissive, or Disabled. Standard on Fedora/RHEL/CentOS; on Ubuntu SELinux is usually inactive in favor of AppArmor (aa-status). Use this before debugging “AVC denied” issues.
# RHEL family
sudo dnf install policycoreutilsSyntax
getenforceExamples with Explanations
Check mode
getenforce
# Enforcing | Permissive | DisabledNotes & Pitfalls
Disabledrequires a reboot to re-enable on traditional setups (prefer permissive for troubleshooting).
- Containers may show different SELinux visibility than the host.
Additional Resources
man getenforce
- RHEL SELinux documentation