selinux(8)
โจ NAME โจ
SELinux โ Security-Enhanced Linux, aka the thing that's been lurking in your kernel this whole time bestie ๐
๐ฆ DESCRIPTION ๐ฆ
okay so. Security-Enhanced Linux (SELinux) is an implementation of a flexible mandatory access control architecture in the Linux operating system. like, it's the bouncer at the club, but for literally every operation on your system. no cap.
The SELinux architecture provides general support for the enforcement of many kinds of mandatory access control policies, including those based on the concepts of:
- Type Enforcementยฎ โ yes with the little ยฎ, it's giving trademarked โจ
- Role-Based Access Control
- Multi-Level Security
Background information and technical documentation about SELinux can be found at https://github.com/SELinuxProject โ go read it, i believe in you ๐ซถ
The /etc/selinux/config configuration file controls whether SELinux is enabled or disabled, and if enabled, whether SELinux operates in permissive mode or enforcing mode. The SELINUX variable may be set to any one of disabled, permissive, or enforcing to select one of these options. let's break it down:
disabledโ disables most of the SELinux kernel and application code, leaving the system running without any SELinux protection. she's off duty, no security guard tonight ๐ญpermissiveโ enables the SELinux code, but causes it to operate in a mode where accesses that would be denied by policy are permitted but audited. so it's like "i saw what you did, and i'm writing it down, but i'm not gonna stop you" ๐enforcingโ enables the SELinux code and causes it to enforce access denials as well as auditing them. she's got the clipboard AND the handcuffs, periodt ๐ฅ
permissive mode may yield a different set of denials than enforcing mode, both because enforcing mode will prevent an operation from proceeding past the first denial and because some application code will fall back to a less privileged mode of operation if denied access. yeah. the vibes really do differ between modes, iykyk.
NOTE: Disabling SELinux by settingSELINUX=disabledin/etc/selinux/configis deprecated and depending on kernel version and configuration it might not lead to SELinux being completely disabled. Specifically, the SELinux hooks will still be executed internally, but the SELinux policy will not be loaded and no operation will be denied. In such state, the system will act as if SELinux was disabled, although some operations might behave slightly differently. To properly disable SELinux, it is recommended to use theselinux=0kernel boot option instead. In that case SELinux will be disabled regardless of what is set in the/etc/selinux/configfile. ๐
The /etc/selinux/config configuration file also controls what policy is active on the system. SELinux allows for multiple policies to be installed on the system, but only one policy may be active at any given time. main character energy only, no ensemble cast ๐
At present, multiple kinds of SELinux policy exist: targeted, mls for example.
targetedโ designed as a policy where most user processes operate without restrictions, and only specific services are placed into distinct security domains that are confined by the policy. For example, the user would run in a completely unconfined domain while thenameddaemon orapachedaemon would run in a specific domain tailored to its operation. so like, you get to roam free but apache has a curfew ๐mls(Multi-Level Security) โ designed as a policy where all processes are partitioned into fine-grained security domains and confined by policy. MLS also supports the Bell And LaPadula model, where processes are not only confined by the type but also the level of the data. everyone gets a lanyard, everyone gets a clearance tier, nobody is special ๐
You can define which policy you will run by setting the SELINUXTYPE environment variable within /etc/selinux/config. You must reboot and possibly relabel if you change the policy type to have it take effect on the system. The corresponding policy configuration for each such policy must be installed in the /etc/selinux/{SELINUXTYPE}/ directories.
A given SELinux policy can be customized further based on a set of compile-time tunable options and a set of runtime policy booleans. system-config-selinux allows customization of these booleans and tunables. โจ
Many domains that are protected by SELinux also include SELinux man pages explaining how to customize their policy. yes queen, each one gets her own page ๐
๐ FILE LABELING ๐
All files, directories, devices ... have a security context/label associated with them. These context are stored in the extended attributes of the file system.
Problems with SELinux often arise from the file system being mislabeled. This can be caused by booting the machine with a non SELinux kernel. If you see an error message containing file_t, that is usually a good indicator that you have a serious problem with file system labeling. ๐ not the file_t jumpscare.
The best way to relabel the file system is to create the flag file /.autorelabel and reboot. system-config-selinux also has this capability. The restorecon/fixfiles commands are also available for relabeling files. pick your fighter, they all slay ๐
Please note that using mount flagnosuidalso disables SELinux domain transitions, unless permissionnosuid_transitionis used in the policy to allow this, which in turn needs also policy capabilitynnp_nosuid_transition. okay that one's a mouthful but write it down bestie, it matters ๐ซถ
๐ AUTHOR ๐
This manual page was written by Dan Walsh <dwalsh@redhat.com>. king behavior honestly ๐
๐ FILES ๐
/etc/selinux/config
๐ธ SEE ALSO ๐ธ
booleans(8)setsebool(8)sepolicy(8)system-config-selinux(8)togglesebool(8)restorecon(8)fixfiles(8)setfiles(8)semanage(8)sepolicy(8)
Every confined service on the system has a man page in the following format:
<servicename>_selinux(8)
For example, httpd has the httpd_selinux(8) man page.
man -k selinux
Will list all SELinux man pages. go on, run it, it's giving โจdiscoveryโจ
okay that's the whole page bestie!! this one came from the SELinux Command Line documentation set, and the OG footer said it was by dwalsh@redhat.com dated 29 Apr 2005 โ so this page is old enough to be your cool older cousin who's been running enforcing mode since before you were born. respect her. ๐
๐ฆ where this page comes from
- alpine 3.24: libselinux-doc 3.10-r1 ยท Public-Domain
- centos-stream 10: libselinux-utils 3.11-3.el10 ยท LicenseRef-Fedora-Public-Domain
- centos-stream 9: libselinux-utils 3.6-5.el9 ยท Public Domain
- debian trixie: selinux-utils 3.8.1-1 ยท LicenseRef-public-domain
- fedora 43: libselinux-utils 3.9-5.fc43 ยท LicenseRef-Fedora-Public-Domain
- fedora 44: libselinux-utils 3.10-1.fc44 ยท LicenseRef-Fedora-Public-Domain
- fedora 44: libselinux-utils 3.11-2.fc44 ยท LicenseRef-Fedora-Public-Domain
- nixos 26.05: libselinux 3.10
- nixpkgs unstable: libselinux 3.11
- opensuse-leap 16.0: selinux-tools 3.8.1-160000.4.1 ยท SUSE-Public-Domain
- opensuse-leap 16.0: selinux-tools 3.8.1-160000.4.1 ยท SUSE-Public-Domain
- opensuse-leap 16.0: selinux-tools 3.8.1-160000.4.1 ยท SUSE-Public-Domain
- opensuse-leap 16.0: selinux-tools 3.8.1-160000.4.1 ยท SUSE-Public-Domain
- ubuntu questing: selinux-utils 3.8.1-1build1
- ubuntu resolute: selinux-utils 3.9-4build1 ยท LicenseRef-public-domain
- ubuntu stonking: selinux-utils 3.11-2.1 ยท LicenseRef-public-domain
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms