user_contexts(5)
β¨ user_contexts(5) β the SELinux user contexts tea β¨
okay bestie, so this is a manual page for user_contexts β yes, that's the section 5 one, file formats, we love a file format moment π
β and it's literally about the SELinux user contexts configuration files. buckle up, it's giving sysadmin but make it cute π
πΈ NAME πΈ
user_contexts β the SELinux user contexts configuration files, no cap.
π DESCRIPTION π
So these files are optional (key word, bestie, optional) user context configuration files, and what they do is hold entries that let SELinux-aware login applications β think PAM(8), running in their own process context β figure out which context a user's login session should be running under. it's basically the group chat where your login session gets told what vibe to have β¨
SELinux-aware login applications generally use one or more of these libselinux functions, and those functions read these files from the active policy path:
get_default_context(3)get_ordered_context_list(3)get_ordered_context_list_with_level(3)get_default_context_with_level(3)get_default_context_with_role(3)get_default_context_with_rolelevel(3)query_user_context(3)manual_user_enter_context(3)
and here's the thing β there can be one file for each SELinux user configured on the system. one per user. iconic. π
the file path is formed using the path that selinux_user_contexts_path(3) returns for the active policy, and then the SELinux user name gets appended to it. for example:
/etc/selinux/{SELINUXTYPE}/contexts/users/unconfined_u
/etc/selinux/{SELINUXTYPE}/contexts/users/xguest_u
where {SELINUXTYPE} is the entry from the selinux configuration file config β go read selinux_config(5) if you need the deets on that one π«Ά
these files contain context information, and that's all described in the FILE FORMAT section below. keep scrolling bestie β¬οΈ
π¦ FILE FORMAT π¦
every single line in the user context configuration file is made up of the following:
login_process user_login_process
and here's what those mean, fr fr:
login_processβ this is arole:type[:range]entry that represents the login process context.user_login_processβ this is arole:type[:range]entry that represents the user login process context.
that's it, that's the whole format. slay π
π EXAMPLE π
here's a real one, an example for xguest_u at /etc/selinux/targeted/contexts/users/xguest_u:
# Example for xguest_u at /etc/selinux/targeted/contexts/users/xguest_u
system_r:crond_t:s0 xguest_r:xguest_t:s0
system_r:initrc_t:s0 xguest_r:xguest_t:s0
system_r:local_login_t:s0 xguest_r:xguest_t:s0
system_r:remote_login_t:s0 xguest_r:xguest_t:s0
system_r:sshd_t:s0 xguest_r:xguest_t:s0
system_r:xdm_t:s0 xguest_r:xguest_t:s0
xguest_r:xguest_t:s0 xguest_r:xguest_t:s0
look at those aligned columns. the way that it's formatted. ate and left no crumbs π
π SEE ALSO π
go read these too, bestie, they're all in the family:
selinux(8)selinux_user_contexts_path(3)PAM(8)get_ordered_context_list(3)get_ordered_context_list_with_level(3)get_default_context_with_level(3)get_default_context_with_role(3)get_default_context_with_rolelevel(3)query_user_context(3)manual_user_enter_context(3)selinux_config(5)
okay that's the whole page, mwah π this one came from Security Enhanced Linux, dated 28-Nov-2011, and it's filed under user_contexts(5) β periodt. now go configure your users, main character ππ¦β¨
π¦ 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 bookworm: selinux-utils 3.4-1+b6
- 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 jammy: selinux-utils 3.3-1build2
- ubuntu noble: selinux-utils 3.5-2ubuntu2 Β· LicenseRef-public-domain
- ubuntu noble: selinux-utils 3.5-2ubuntu2.1 Β· LicenseRef-public-domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms