semanage-login(8)
π semanage-login β the SELinux login mapping glow-up π
okay bestie, welcome to semanage-login(8) β yes that's the manual name, it's part of the semanage family, and it's literally the tool that tells your system "hey, this Linux user logs in as this SELinux user". Let's get into it π¦
β¨ NAME β¨
semanage-login β SELinux Policy Management linux user to SELinux User mapping tool
π SYNOPSIS π
semanage login [-h] [-n] [-N] [-S STORE] [ --add -s SEUSER -r RANGE
LOGIN | --delete LOGIN | --deleteall | --extract | --list [-C] |
--modify -s SEUSER -r RANGE LOGIN ]
πΈ DESCRIPTION πΈ
So semanage is the whole vibe for configuring certain elements of SELinux policy without needing to modify or recompile anything from policy sources. no cap. π
And semanage login specifically? It controls the mapping between a Linux User and the SELinux User. That's it, that's the whole job, and it's kind of a big deal because it can be used to turn on confined users π
For example β and this is the fun part β you could define that a particular user, or a whole group of users, will login to a system as the user_u user. cute, right?
pro tip from the manpage itself: prefix the group name with a % sign to indicate a group name π
π OPTIONS π
-h,--helpβ Show this help message and exit. the classic escape hatch π«Ά-n,--noheadingβ Do not print heading when listing the specified object type-N,--noreloadβ Do not reload policy after commit-C,--locallistβ List local customizations-S STORE,--store STOREβ Select an alternate SELinux Policy Store to manage-a,--addβ Add a record of the specified object type-d,--deleteβ Delete a record of the specified object type-m,--modifyβ Modify a record of the specified object type-l,--listβ List records of the specified object type-E,--extractβ Extract customizable commands, for use within a transaction-D,--deleteallβ Remove all local customizations-s SEUSER,--seuser SEUSERβ SELinux user name-r RANGE,--range RANGEβ MLS/MCS Security Range (MLS/MCS Systems only). SELinux Range for SELinux login mapping defaults to the SELinux user record range. SELinux Range for SELinux user defaults tos0.
π EXAMPLE π
Set the default SELinux user on the system to guest_u
# semanage login -m -s guest_u __default__
Map user gijoe to SELinux user staff_u and assign MLS range SystemLow-Secret
# semanage login -a -s staff_u -rSystemLow-Secret gijoe
Map all users in the engineering group to SELinux user staff_u
# semanage login -a -s staff_u %engineering
π SEE ALSO π
selinux(8), semanage(8), semanage-user(8)
π«Ά AUTHOR π«Ά
This man page was written by Daniel Walsh <dwalsh@redhat.com> β thank you for your service, king π
and that's the whole page, bestie!! this version is dated 20130617 and it lives in the semanage-login(8) manual, so if you ever forget where you read it, that's the citation right there π mwah, go map some users, you're doing amazing π
π¦ where this page comes from
- centos-stream 10: policycoreutils-python-utils 3.10-2.el10 Β· GPL-2.0-or-later
- centos-stream 10: policycoreutils-python-utils 3.11-1.el10 Β· GPL-2.0-or-later
- centos-stream 9: policycoreutils-python-utils 3.6-7.el9 Β· GPL-2.0-or-later
- centos-stream 9: policycoreutils-python-utils 3.6-9.el9 Β· GPL-2.0-or-later
- debian trixie: policycoreutils-python-utils 3.8.1-2 Β· GPL-2.0-or-later
- fedora 43: policycoreutils-python-utils 3.9-5.fc43 Β· GPL-2.0-or-later
- fedora 43: policycoreutils-python-utils 3.9-7.fc43 Β· GPL-2.0-or-later
- fedora 44: policycoreutils-python-utils 3.10-1.fc44 Β· GPL-2.0-or-later
- fedora 44: policycoreutils-python-utils 3.11-2.fc44 Β· GPL-2.0-or-later
- nixos 26.05: selinux-python 3.10
- nixpkgs unstable: selinux-python 3.10
- opensuse-leap 16.0: policycoreutils-python-utils 3.8.1-160000.5.1 Β· GPL-2.0-or-later
- ubuntu questing: policycoreutils-python-utils 3.8.1-2
- ubuntu resolute: policycoreutils-python-utils 3.9-2 Β· GPL-2.0-or-later
- ubuntu stonking: policycoreutils-python-utils 3.11-2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms