https://drive.google.com/file/d/1LuXnYYHT0TWk9OhIlA8lfiQWNmYC779o/view?usp=sharing
Every SELinux context has 4 components (user:role:type:level):
| Component | Purpose | Example |
|---|---|---|
| SELinux User | Maps Linux users to SELinux roles | user_u, root, system_u |
| Role | Defines which domains a user can enter | object_r (files), system_r (processes) |
| Type | Most criticalβdefines access permissions | user_home_t, httpd_t, shadow_t |
| Level | MLS/MCS security level (sensitivity:category) | s0, s0-s15:c0.c1023 |
# File context
ls -Z file.txt
# Directory context (note -d flag)
ls -Zd /tmp
# Process context
ps -eZ
semanage login -l)# View user mappings
semanage login -l
# Example output:
# __default__ user_u
# root root
# zybi user_u
π‘ Key Insight:
unconfined_u= Can access almost anything (like traditional Linux)
user_u= Restricted user (common for regular accounts)
object_r (no role-based access for files)system_r (system processes), user_r (user processes)π Example:
Web server runs in
httpd_tdomain β Can only accesshttpd_sys_content_tfilesEven if hacked, can't read
/etc/shadow(shadow_ttype)