Loading learning content...
We've examined the mechanisms of access control—permission bits, ACLs, capabilities. But mechanisms are just tools. The meaningful question is: What security policy do you want to enforce?
A permission model defines how access control decisions are made—the rules, the actors, the relationships. Different models optimize for different concerns: flexibility, central control, auditability, or simplicity. This page synthesizes everything we've learned and places it in the broader context of security policy frameworks used in modern systems.
Understanding these models enables you to choose the right approach for your security requirements, whether you're configuring a single server, designing a multi-tenant cloud platform, or implementing an enterprise security architecture.
By the end of this page, you will understand: the distinction between Discretionary (DAC) and Mandatory (MAC) access control, how Role-Based Access Control (RBAC) simplifies permission management, Attribute-Based Access Control (ABAC) for policy-based decisions, how these models compose in real systems (SELinux, AppArmor, Windows), and how to choose the right model for your security requirements.
Discretionary Access Control is the model we've studied throughout this module. "Discretionary" means that the resource owner has discretion—complete control—over who can access their resources.
In DAC:
Unix permissions and ACLs are DAC:
When you create a file, you own it. You can chmod it to be world-readable, or restrict it to yourself. You can add ACL entries granting specific users access. The system doesn't question your choices.
The fundamental weakness of DAC:
DAC cannot enforce global policies. If the security goal is "classified documents must never leave the secure network," DAC can't guarantee it. An owner with access to a classified file can simply chmod it to world-readable, or copy it somewhere accessible. DAC trusts owners completely—problematic when owners might be compromised, malicious, or simply careless.
If Alice has read access to secret.txt, she can copy its contents to public.txt (which she owns and makes world-readable). DAC checks permissions on each operation but cannot track data flow. Once you can read data, you can copy it anywhere you have write access. This is called the information flow problem.
Mandatory Access Control is the counterpoint to DAC. "Mandatory" means the system—not users—enforces access policy. Owners cannot override system-level rules, regardless of their desires or even their ownership.
MAC was developed for military and government systems where data classification (Top Secret, Secret, Unclassified) must be enforced regardless of user actions. Even if an administrator owns a Top Secret file, they cannot make it accessible to Unclassified users.
| Aspect | DAC | MAC |
|---|---|---|
| Who controls access? | Resource owner | System policy |
| Can owner override? | Yes (owner is god) | No (system overrides owner) |
| Policy location | Per-object (ACLs) | System-wide rules |
| Trust model | Trust owners to be competent | Trust only the security administrator |
| Information flow | Not controlled | Strictly controlled (no write-down, no read-up) |
| Typical use case | General-purpose systems | Classified environments, high-security systems |
| User freedom | High | Restricted |
| Admin complexity | Lower | Higher (policy maintenance) |
The Bell-LaPadula Model:
The classic MAC model assigns security labels (clearances) to subjects and objects. Rules:
This prevents both direct access violations and indirect information flow (copying Secret data to Unclassified files).
123456789101112131415161718192021222324252627282930313233343536
Bell-LaPadula Model Example: Security Levels (Hierarchy): TOP SECRET (TS) ↑ SECRET (S) ↑ CONFIDENTIAL (C) ↑ UNCLASSIFIED (U) Subject (User) Clearances: General: TOP SECRET Colonel: SECRET Private: UNCLASSIFIED Object (File) Classifications: battle_plans.txt: SECRET personnel.txt: CONFIDENTIAL cafeteria_menu.txt: UNCLASSIFIED Access Matrix (Bell-LaPadula Rules): TOP SECRET SECRET CONFIDENTIAL UNCLASSIFIED files files files filesGeneral (TS) Read/Write Read/Write Read-Only Read-OnlyColonel (S) ✗ Read/Write Read-Only Read-OnlyPrivate (U) ✗ ✗ ✗ Read/Write Key Rules:• No Read Up: Colonel cannot read TOP SECRET files• No Write Down: General cannot write to UNCLASSIFIED files (This prevents copying TOP SECRET content to UNCLASSIFIED!) Even if General OWNS cafeteria_menu.txt, they cannot write to it!The mandatory policy overrides ownership.Pure Bell-LaPadula is rare outside classified environments. But MAC principles appear in: SELinux (type enforcement), AppArmor (path-based restrictions), Windows Mandatory Integrity Control (MIC), and iOS/Android app sandboxing. These systems layer mandatory restrictions over DAC.
Role-Based Access Control introduces an abstraction layer between users and permissions. Instead of granting permissions directly to users, you:
This decoupling dramatically simplifies administration, especially in large organizations where permissions map to job functions.
123456789101112131415161718192021222324252627282930313233343536
RBAC Structure: ┌─────────────────────────────────────────────────────────────────┐│ USERS ││ alice bob carol dave eve frank grace │└─────────┬──────┬──────────────┬──────────┬──────────────────────┘ │ │ │ │ ┌────▼──────▼───┐ ┌────▼────┐ ┌──▼────────┐ │ developer │ │ manager │ │ auditor │ │ (ROLE) │ │ (ROLE) │ │ (ROLE) │ └───────┬───────┘ └────┬────┘ └─────┬─────┘ │ │ │ Permissions: Permissions: Permissions: - read code - read code - read logs - write code - read reports - read reports - run builds - approve PRs - view metadata - read docs - view budgets - (read-only everywhere) Compared to Direct Assignment (no roles): Without RBAC: alice: read_code, write_code, run_builds, read_docs bob: read_code, write_code, run_builds, read_docs carol: read_code, write_code, run_builds, read_docs ... (If permissions change, update every user) With RBAC: alice → developer bob → developer carol → developer (If permissions change, update the role once) When alice gets promoted to manager: Just: remove alice from developer, add alice to manager (All permission changes happen automatically)RBAC advantages:
RBAC in operating systems:
Advanced RBAC supports role hierarchies: senior_developer inherits all permissions from developer plus additional ones. This mirrors organizational hierarchies and reduces permission overlap management.
Attribute-Based Access Control is the most flexible model. Instead of fixed roles or ACLs, access decisions are made by evaluating policies against attributes of:
123456789101112131415161718192021222324252627282930313233343536
ABAC Policy Examples (pseudocode): Policy 1: "Employees can only access their department's files"───────────────────────────────────────────────────────────PERMIT IF: subject.type == "employee" AND subject.department == resource.department Policy 2: "Contractors can only access during business hours"───────────────────────────────────────────────────────────PERMIT IF: subject.type == "contractor" AND environment.time >= 09:00 AND environment.time <= 17:00 AND environment.day NOT IN ("Saturday", "Sunday") Policy 3: "Sensitive documents require encrypted connection"─────────────────────────────────────────────────────────── PERMIT IF: resource.sensitivity_level == "high" IMPLIES environment.connection_encrypted == true Policy 4: "Managers can approve expenses up to their limit"───────────────────────────────────────────────────────────PERMIT IF: action == "approve_expense" AND subject.role == "manager" AND resource.amount <= subject.expense_limit Policy 5: "Medical records require patient consent or emergency"───────────────────────────────────────────────────────────PERMIT IF: resource.type == "medical_record" AND (subject.id == resource.patient_id OR resource.has_patient_consent == true OR environment.emergency_mode == true)ABAC compared to other models:
| Model | Decision Based On | Flexibility | Complexity | Best For |
|---|---|---|---|---|
| DAC | Owner's discretion | Medium | Low | Personal files, small teams |
| MAC | Classification labels | Low (rigid) | Medium | Military, classified systems |
| RBAC | Role membership | Medium | Medium | Enterprises, defined job functions |
| ABAC | Dynamic attributes | Very High | High | Complex policies, dynamic environments |
XACML — The ABAC standard:
The eXtensible Access Control Markup Language (XACML) is an OASIS standard for expressing ABAC policies. It defines:
Cloud platforms increasingly use ABAC:
Operating systems rarely use pure ABAC, but conditional policies in SELinux and AppArmor incorporate ABAC concepts.
Security-Enhanced Linux (SELinux) is the most comprehensive MAC implementation for Linux. Developed by the NSA, it adds mandatory access control that operates alongside (and supersedes) traditional DAC.
SELinux security contexts:
Every process and file has a security context with four components:
user:role:type:level
12345678910111213141516171819202122232425262728293031323334353637
# Viewing SELinux contexts $ ls -Z /etc/passwd /var/www/html/index.htmlsystem_u:object_r:passwd_file_t:s0 /etc/passwdsystem_u:object_r:httpd_sys_content_t:s0 /var/www/html/index.html $ ps -Z | grep httpdsystem_u:system_r:httpd_t:s0 1234 ? 00:00:01 httpd # The web server (httpd) runs in domain httpd_t# Web content files have type httpd_sys_content_t# Password file has type passwd_file_t # SELinux type enforcement rules (simplified):# allow httpd_t httpd_sys_content_t:file { read };# → httpd can read web content files## No rule for: httpd_t passwd_file_t:file { read };# → httpd CANNOT read passwd, even if DAC allows it! # Check if SELinux denied an operation$ ausearch -m AVC -ts recenttype=AVC msg=audit(...): avc: denied { read } for pid=1234 comm="httpd" name="secret.txt" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:user_home_t:s0 tclass=file # httpd tried to read a file in user's home directory# SELinux denied it: httpd_t has no access to user_home_t # Managing SELinux$ getenforce # Check mode: Enforcing, Permissive, DisabledEnforcing $ sudo setenforce 0 # Temporarily set to Permissive (for debugging)$ sudo setenforce 1 # Back to EnforcingHow SELinux protects against exploits:
If an attacker exploits a vulnerability in Apache (httpd) and gains code execution:
SELinux limits the blast radius of a successful exploit.
When SELinux blocks something, the correct response is NOT to disable it. Instead: (1) Check if your file has the wrong context (ls -Z), (2) Fix it with restorecon -R /path or chcon, (3) If custom policy is needed, use audit2allow to generate it. Disabling SELinux removes a vital security layer.
AppArmor is an alternative MAC system used by Ubuntu, SUSE, and Debian. While SELinux uses labels (types), AppArmor uses profiles that define what paths a program can access.
Key differences from SELinux:
| Aspect | SELinux | AppArmor |
|---|---|---|
| Basis | Labels (types) on objects | Paths (pathnames) |
| Scope | System-wide type enforcement | Per-program profiles |
| Complexity | Higher (policy language) | Lower (path patterns) |
| File systems | Any (labels in xattrs) | Only those with stable paths |
| Hard links | Same label, same access | Can bypass restrictions |
| Learning | Steeper curve | Easier to understand |
| Used by | Red Hat, Fedora, CentOS | Ubuntu, SUSE, Debian |
12345678910111213141516171819202122232425262728293031323334353637383940414243444546
# AppArmor profile for nginx# /etc/apparmor.d/usr.sbin.nginx #include <tunables/global> /usr/sbin/nginx { #include <abstractions/base> #include <abstractions/nameservice> # Network access network inet stream, network inet6 stream, # Configuration files (read only) /etc/nginx/** r, # Web content (read only) /var/www/html/** r, /srv/www/** r, # Log files (append only) /var/log/nginx/*.log w, # PID and socket files /run/nginx.pid rw, /run/nginx/*.sock rw, # SSL certificates (read only) /etc/ssl/certs/** r, /etc/ssl/private/** r, # Deny everything else by implicit default # Child processes /usr/sbin/nginx px, # Execute with this profile} # After creating profile:$ sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.nginx # Check status$ sudo aa-statusapparmor module is loaded.27 profiles are loaded.27 profiles are in enforce mode. /usr/sbin/nginxAppArmor modes:
Profile development workflow:
aa-complain /usr/sbin/nginxaa-enforce /usr/sbin/nginxAppArmor restricts by pathname, not inode. If /etc/sensitive is protected, an attacker who can create a hard link at /tmp/accessible pointing to the same inode might bypass the restriction (if /tmp/ is allowed). SELinux doesn't have this issue because labels are per-inode. Consider this when choosing between systems.
Windows uses a security model distinct from Unix, combining ACLs, mandatory integrity controls, and token-based access. Understanding Windows security is essential for cross-platform knowledge.
12345678910111213141516171819202122232425262728293031323334
# Viewing Windows security information # View ACL on a fileGet-Acl C:WindowsSystem32configSAM | Format-List Path : Microsoft.PowerShell.CoreFileSystem::C:WindowsSystem32configSAMOwner : NT AUTHORITYSYSTEMGroup : NT AUTHORITYSYSTEMAccess : NT AUTHORITYSYSTEM Allow FullControl BUILTINAdministrators Allow FullControl # View current user's token privilegeswhoami /priv PRIVILEGES INFORMATION----------------------Privilege Name Description State=============================== ============================== ========SeShutdownPrivilege Shut down the system DisabledSeChangeNotifyPrivilege Bypass traverse checking EnabledSeUndockPrivilege Remove computer from docking DisabledSeIncreaseWorkingSetPrivilege Increase a process working set DisabledSeTimeZonePrivilege Change the time zone Disabled # View process integrity levelwhoami /groups | findstr "Mandatory"Mandatory LabelMedium Mandatory Level Label S-1-16-8192 # Integrity Levels:# S-1-16-0 = Untrusted# S-1-16-4096 = Low (e.g., browser sandboxed tabs)# S-1-16-8192 = Medium (normal user)# S-1-16-12288 = High (elevated/admin)# S-1-16-16384 = SystemUnlike POSIX ACLs (which can only grant), Windows ACLs can explicitly DENY. DENY ACEs are evaluated first, so a DENY for a user takes precedence over ALLOW for their group. This enables fine-grained restrictions but can create confusing permission outcomes if not carefully managed.
With multiple models available, how do you choose? The answer depends on your security requirements, operational constraints, and threat model.
| Requirement | Recommended Model | Reasoning |
|---|---|---|
| Personal file management | DAC (Unix perms) | Simple, user-controlled, no admin overhead |
| Small team collaboration | DAC + groups | Group-based sharing sufficient; familiar tools |
| Enterprise with defined roles | RBAC (via groups or IAM) | Maps to org structure; scalable administration |
| Multiple groups per file | ACLs (POSIX or NTFS) | Flexible per-file permissions beyond owner/group |
| Contain compromised services | MAC (SELinux/AppArmor) | Limit blast radius of exploits |
| Data classification required | MAC (w/ MLS) | Enforce confidentiality levels system-wide |
| Context-dependent access | ABAC | Time/location/attribute based policies |
| Highly dynamic permissions | Capabilities | Fine-grained, delegable, ephemeral access tokens |
| Defense in depth | DAC + MAC + RBAC | Layer models for comprehensive protection |
Real systems layer models:
Production environments rarely use a single model:
Don't over-engineer access control. Start with DAC and good group design. Add MAC only if you need containment beyond what users can configure. Add RBAC when administrative overhead becomes a problem. Each layer adds complexity—make sure you need it before implementing it.
Module Complete:
You've now completed the File Protection module, covering:
With this comprehensive understanding of file protection, you can effectively secure systems at any scale—from personal workstations to enterprise data centers to cloud-native platforms.
You now have a world-class understanding of file protection mechanisms—from the theoretical foundations of access control to the practical implementation in Unix permissions, ACLs, capabilities, and MAC systems like SELinux. You understand when to apply each model and how they layer in production systems. This knowledge is fundamental to operating system security and system administration.