Pcornel
Linux · SELinux

Disabled

Cheat sheet · https://pcornel.dk/topic.php?topic=2857

Back to the Topic

Answer

Disabled mode turns SELinux off entirely: no policy, no labels maintained. Re-enabling requires a full filesystem relabel.

Remember

Disabling is not recommended. To re-enable, set SELINUX=permissive first, touch /.autorelabel, reboot (relabel), check denials, then enforcing. On RHEL 9 disable is done with the kernel parameter selinux=0.

First checks

  • getenforce / sestatus — mode and policy
  • ls -Z <path> — file context
  • ps -eZ | grep <proc> — process context
  • ausearch -m AVC -ts recent — recent denials
  • semanage fcontext -l | grep <path> — context rules for a path

Verify in this order

disabled → permissive with relabel → denials fixed → enforcing

Where it usually breaks

First mismatch in identity/group resolution → Unix mode/ACL/capability → mount/sandbox constraint → SELinux/AppArmor policy → credential/TLS trust → protected operation; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2857

Confirmation

Confirm action

Continue?