user_contexts(5)

πŸ“¦
version 3.11 Β· 2 versions
, in alpine 3.24, centos-stream 10, centos-stream 9, debian bookworm, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble

✨ 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:

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 a role:type[:range] entry that represents the login process context.
  • user_login_process β€” this is a role: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:


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 πŸ’œπŸ¦‹βœ¨