Cyber Security • Systems and Endpoint Security

User & File System Privileges — Explain users, groups, permissions, and file system privileges (conceptual)

Understanding how operating systems enforce access control through users, groups, and permission models.

A protected digital shield with binary code and a secure lock for cyber security
Inside this lesson 10 sections 5 questions 7 figures

SECTION 1

Historical Context & Motivation

The concept of user privileges and file system permissions arose from a fundamental problem in computing: when multiple users share a single machine, how do you prevent one user from reading, modifying, or destroying another user's data? Early mainframe systems in the 1960s were among the first to confront this challenge, as universities and government agencies needed to allow dozens—sometimes hundreds—of concurrent users to operate on a single computing resource without interference. The solution was to embed access control directly into the operating system, creating a model that persists, in refined form, in every modern OS today.

1961 • CTSS at MIT

The Compatible Time-Sharing System introduced individual user accounts and password-based authentication, marking the first widespread implementation of per-user access separation on a shared mainframe.

1969 • Unix at Bell Labs

Ken Thompson and Dennis Ritchie developed Unix with a foundational user/group/other permission model. The owner-group-world triad and the rwx permission bits became the template for decades of file system security design.

1983 • Orange Book (TCSEC)

The U.S. Department of Defense published the Trusted Computer System Evaluation Criteria, formalizing Discretionary Access Control (DAC) and Mandatory Access Control (MAC) as distinct privilege paradigms for secure systems.

1992 • Windows NT & ACLs

Microsoft Windows NT introduced NTFS with Access Control Lists (ACLs), enabling fine-grained per-user and per-group permissions on files and directories, moving beyond the Unix rwx model.

2003–Present • SELinux & Modern MAC

Security-Enhanced Linux, developed by the NSA, brought Mandatory Access Control into the mainstream Linux kernel. Modern systems now layer MAC policies atop traditional DAC permissions for defense in depth.

The enduring question that these developments address is deceptively simple: who should be able to do what, and to which resources? Every security breach involving unauthorized file access, privilege escalation, or data exfiltration is ultimately a failure in the mechanisms designed to answer this question. Understanding the conceptual architecture of user accounts, group memberships, and permission models is therefore foundational to systems security—whether you are hardening a Linux server, administering a Windows domain, or designing a cloud-native application with role-based access.

SECTION 2

Core Principles & Definitions

Before examining any specific operating system's implementation, it is essential to establish the conceptual primitives that underlie all privilege systems. These primitives—subjects, objects, and operations—form the basis of every access control decision. A subject is any active entity requesting access (a user, a process, or a service). An object is any passive resource being accessed (a file, a directory, a device, or a network socket). An operation is the action requested (read, write, execute, delete). The privilege system's job is to consult a stored policy and determine whether a given subject may perform a given operation on a given object.

1

Users (UIDs)

Each human operator or system service is assigned a unique User Identifier (UID). The UID is the kernel-level identity used in all access control checks. UID 0 is conventionally the superuser (root), which bypasses most permission checks.
2

Groups (GIDs)

A Group Identifier (GID) aggregates multiple users under a shared label. Permissions granted to a group are inherited by all its members, dramatically simplifying administration. A user may belong to a primary group and multiple supplementary groups.
3

Permissions (rwx)

Permissions encode the allowed operations. In Unix-like systems, these are read (r), write (w), and execute (x). These are applied independently to three scopes: the file's owner, the file's group, and all other users.
4

Principle of Least Privilege

Every subject should operate with the minimum set of privileges necessary to complete its task. Granting excessive permissions enlarges the attack surface and increases the blast radius of a compromise.
5

DAC vs. MAC

In Discretionary Access Control (DAC), resource owners set permissions. In Mandatory Access Control (MAC), a central policy enforces access rules that even the resource owner cannot override, providing stronger guarantees against privilege abuse.
✦

KEY TAKEAWAY

Think of a file system privilege model like the key-card system of a modern office building. Your employee badge (UID) identifies you personally. Your department (GID) grants access to shared resources like conference rooms. Each door (object) has a policy that specifies which badges and departments can open it, and the building's security system (the kernel) enforces every check at every door—regardless of whether you think you should have access.

SECTION 3

Visual Explanation — The Unix Permission Model

The following diagram illustrates how a Unix-style permission string maps to its binary and octal representations, and how the kernel resolves an access request by checking the subject's UID and GID against the file's metadata (the inode). When a process issues a system call like open(), the kernel extracts the process's effective UID and GID, compares them to the file's owner UID and group GID stored in the inode, and then evaluates the corresponding permission bits.

Unix Permission String Anatomy-Typer w xOWNER (u)r - xGROUP (g)r - -OTHERS (o)Binary & Octal Mappingr=1 w=1 x=1 → 111₂ → 7₈r=1 w=0 x=1 → 101₂ → 5₈r=1 w=0 x=0 → 100₂ → 4₈= 0754Kernel Access Check FlowProcess RequesteUID=1001 eGID=100Is eUID == 0?(Superuser?)NoYes → GRANTALLOWeUID == owner?Check owner bitsNoeGID ∈ groups?Check group bits
Top: The permission string -rwxr-xr-- decomposed into owner (cyan), group (violet), and others (pink) scopes, with binary-to-octal conversion yielding 0754. Bottom: The kernel's access check flow—starting with a superuser bypass, then cascading through owner, group, and others bit checks.

The key insight from the diagram is that the kernel performs its checks in a strict order: it first tests whether the effective UID is 0 (root), in which case nearly all checks are bypassed. If the process is not running as root, the kernel checks whether the effective UID matches the file's owner UID. If it does, only the owner permission bits are evaluated—the group and other bits are ignored entirely. If the UID does not match but the process's effective GID (or supplementary groups) matches the file's GID, then only the group permission bits are checked. Finally, if neither UID nor GID matches, the others bits determine access. This cascading logic means that it is possible for a file's owner to have fewer permissions than the group, a subtlety that occasionally surprises even experienced administrators.

SECTION 4

How Permissions Work — Octal Encoding & Special Bits

Each of the three permission scopes (owner, group, others) is encoded as a 3-bit binary number, yielding an octal digit between 0 and 7. Together, the three digits form the familiar octal permission mode. An optional leading digit encodes special permission bits—setuid, setgid, and the sticky bit—which modify execution and deletion behavior in security-critical ways.

OCTAL PERMISSION ENCODING

mode=(r×4)+(w×2)+(x×1)foreachscopemode = (r × 4) + (w × 2) + (x × 1) for each scope

Where r, w, x ∈ {0, 1}. Example: rwx = 4 + 2 + 1 = 7; r-x = 4 + 0 + 1 = 5; r-- = 4 + 0 + 0 = 4.

EFFECTIVE PERMISSION (with umask)

effectivepermission=requestedmodeAND(NOTumask)effective_permission = requested_mode AND (NOT umask)

The umask is a bitmask that specifies which permission bits to clear when creating new files. For example, a umask of 022 removes write permission for group and others, so a requested mode of 0777 yields 0755.

Special BitOctal ValueEffect on FilesEffect on Directories
Setuid4000Process runs with the file owner's UID rather than the invoking user's UID (e.g., /usr/bin/passwd).Typically ignored on directories in most Unix implementations.
Setgid2000Process runs with the file's GID. Useful for shared executables.New files created in the directory inherit the directory's GID, enabling team collaboration.
Sticky Bit1000Originally kept the program in swap memory; now largely historical for files.Only the file owner (or root) can delete or rename files within the directory—critical for /tmp.

Special permission bits and their effects on files and directories.

⚠

Security Implication

The setuid bit is one of the most security-sensitive mechanisms in Unix-like systems. A misconfigured setuid binary owned by root gives any local user the ability to execute arbitrary code as the superuser. Privilege escalation exploits frequently target setuid programs—auditing them (e.g., via find / -perm -4000) is a fundamental hardening step.

SECTION 5

Access Control Models & File System Structures

Operating systems implement access control through distinct models, each with different trust assumptions and granularity. The choice of model has profound implications for both usability and security. Unix-like systems traditionally rely on Discretionary Access Control (DAC), where the resource owner decides who gets access. Windows NTFS extends this with Access Control Lists (ACLs) that allow arbitrary per-user and per-group entries. Higher-security environments employ Mandatory Access Control (MAC) or Role-Based Access Control (RBAC) to enforce organization-wide policies that individual users cannot override.

Access Control Models ComparisonDACDiscretionary Access Control• Owner sets permissions• Unix rwx model• Simple to manage• Vulnerable to TrojansTrust model: Owner-centricGranularityMACMandatory Access Control• System-enforced policy• Labels on subjects/objects• SELinux, AppArmor• Complex to configureTrust model: System-centricGranularityRBACRole-Based Access Control• Users assigned to roles• Roles have permissions• Scalable for orgs• Role explosion riskTrust model: Role-centricGranularityNTFS ACL StructureSecurity Descriptor:Owner SID | Group SID | DACL | SACLDACL (Discretionary ACL)ACE 1: Allow alice Read,WriteACE 2: Allow devs ReadExecuteACE 3: Deny guest FullControlSACL (System ACL)Audit: Success/Fail Write by *Audit: Fail Read by guestsGenerates security event logs
Top row: Comparison of DAC, MAC, and RBAC models showing trust assumptions and relative granularity. Bottom: Structure of an NTFS security descriptor with a DACL containing Access Control Entries (ACEs) and a SACL for auditing.

In Windows NTFS, every file and directory carries a security descriptor containing the owner's Security Identifier (SID), the group SID, a Discretionary Access Control List (DACL), and a System Access Control List (SACL). The DACL is an ordered list of Access Control Entries (ACEs), each specifying a trustee (user or group SID), an access mask (the specific permissions), and a type (Allow or Deny). The SACL controls auditing—which access attempts generate log entries. Critically, Deny ACEs are evaluated before Allow ACEs, so an explicit denial always wins. This stands in contrast to the Unix model, where the first matching scope (owner, group, other) determines the result and there is no native concept of an explicit Deny entry without extended ACLs.

SECTION 6

Worked Example — Setting & Interpreting Permissions

Consider the following scenario: a web server running as the user www-data (UID 33, primary group www-data GID 33) must serve static HTML files from /var/www/html/. Developers in the webdev group (GID 1010) need to read and write files in this directory. No other users should have any access. We need to determine the correct ownership and permissions.

Configuring Web Server Directory Permissions

  1. 1

    Step 1 — Identify Subjects and Required Operations

    We have two subjects: the web server process (www-data) which needs read and execute (to traverse directories and serve files), and the developer group (webdev) which needs read, write, and execute (to create, edit, and manage files). All other users should receive no permissions.
    Owner: read + execute; Group: read + write + execute; Others: none.
  2. 2

    Step 2 — Assign Ownership

    We set the directory's owner to www-data and its group to webdev. This is accomplished with: chown www-data:webdev /var/www/html/. The owner (www-data) will use the owner permission bits, while developers (members of webdev) will match on the group bits.
    Owner = www-data (UID 33), Group = webdev (GID 1010).
  3. 3

    Step 3 — Calculate Octal Permissions

    Owner needs r-x: 4 + 0 + 1 = 5. Group needs rwx: 4 + 2 + 1 = 7. Others need no access: 0 + 0 + 0 = 0. The combined mode is therefore 0570.
    chmod 0570 /var/www/html/
  4. 4

    Step 4 — Apply Setgid for Inheritance

    Without the setgid bit, new files created by developers would inherit their personal primary group, not webdev. Setting the setgid bit on the directory ensures all new files inherit the directory's GID. The special bit adds 2000 to the mode: 2570.
    chmod 2570 /var/www/html/
  5. 5

    Step 5 — Verify & Validate the Principle of Least Privilege

    Running ls -ld /var/www/html/ should display dr-xrws--- 2 www-data webdev. The 's' in the group execute position confirms setgid is active. The web server can read and traverse but cannot modify files (reducing impact if the server process is compromised). Developers can manage content. No other users can access the directory. This configuration satisfies the principle of least privilege.
    Final permission string: dr-xrws--- (octal 2570).

SECTION 7

Strengths & Limitations of Permission Models

No single access control model is universally optimal. The traditional Unix DAC model trades granularity for simplicity, while NTFS ACLs and MAC frameworks offer precision at the cost of administrative complexity. Understanding these trade-offs is essential when designing or auditing a system's security posture.

ModelStrengthsLimitations
Unix DAC (rwx)Simple, well-understood, low overhead. Three scopes (owner/group/other) cover most use cases. Decades of tooling support.Only three scopes—cannot grant unique permissions to two different groups on the same file. Vulnerable to Trojan horse attacks where malicious programs inherit the invoking user's privileges.
POSIX ACLsExtend Unix DAC with named user and named group entries. Backward-compatible with traditional rwx. Supported on ext4, XFS, and other Linux filesystems.Added complexity in administration and debugging. ACL mask can silently restrict effective permissions. Not all tools preserve ACLs during file copy or backup.
NTFS ACLsFine-grained per-user and per-group entries with explicit Allow and Deny. Inheritance from parent directories. Integrated auditing via SACLs.Complex ACL inheritance can lead to unintended permission propagation. Difficult to audit at scale without specialized tools. Deny rules can create confusing 'hidden' access blocks.
MAC (SELinux)System-wide mandatory policies immune to user override. Confines even root-owned processes. Provides defense in depth against privilege escalation.Steep learning curve. Misconfigured policies frequently lead administrators to disable SELinux entirely, negating its benefits. Policy development requires specialized expertise.
RBACMaps naturally to organizational hierarchies. Simplifies administration for large user populations. Supports separation of duties and hierarchical roles.Risk of role explosion (too many fine-grained roles). Requires careful role engineering. Dynamic or context-sensitive access decisions may not fit cleanly into static role definitions.

Comparison of major access control models by strengths and limitations.

✦

KEY TAKEAWAY

In practice, production systems rarely rely on a single access control model. A well-hardened Linux server might use Unix DAC for routine file permissions, POSIX ACLs for shared project directories, SELinux (MAC) to confine web server processes, and an external RBAC system (like LDAP groups mapped to sudoers rules) for administrative privilege management. Security architecture is about layering complementary models—much like combining a lock, a deadbolt, and an alarm system rather than relying on any one mechanism alone.

SECTION 8

Connection to Advanced Access Control Theory

The concepts covered in this lesson—users, groups, and permission bits—represent the practical surface of a deeper theoretical framework in computer security. The formal study of access control centers on two classical models: the Bell-LaPadula model (1973), which enforces confidentiality through "no read up, no write down" rules, and the Biba model (1977), which enforces integrity through the dual "no read down, no write up" principle. These models formalize what practical permission systems approximate through labels, clearance levels, and policy enforcement.

Concept (This Lesson)Advanced CounterpartKey Difference
Unix rwx permissions (DAC)Access Control Matrix / HRU ModelThe HRU model proves that the general safety problem for DAC systems ("can a subject ever obtain a given right?") is undecidable, motivating MAC approaches.
Superuser (root / UID 0)Linux Capabilities (CAP_*)Modern kernels decompose root's monolithic power into ~40 distinct capabilities (e.g., CAP_NET_BIND_SERVICE), enabling fine-grained privilege assignment.
Groups (GIDs)Attribute-Based Access Control (ABAC)ABAC generalizes group membership to arbitrary attributes (time of day, IP address, department, clearance level), enabling context-sensitive policy decisions.
File-level permissionsNamespaces & Containers (cgroups)Containers provide isolation at the process level using kernel namespaces, making the file system view per-container rather than per-user—a paradigm shift from traditional permission models.

Mapping foundational concepts to their advanced counterparts.

As you advance in systems security, you will encounter scenarios where traditional user/group/permission models are insufficient. Cloud-native environments introduce identity federation (OAuth, SAML), short-lived credentials, and policy-as-code frameworks like Open Policy Agent (OPA). Container orchestration platforms like Kubernetes implement their own RBAC layer atop the kernel's access controls. Understanding the foundational model presented here is essential because every advanced mechanism is ultimately an extension, refinement, or replacement of the subject–object–operation paradigm.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

Explain why the Unix kernel checks permission scopes (owner, group, other) in a strict order rather than combining them. What security-relevant consequence arises if a file's owner permission bits are r-- but its group permission bits are rwx, and the invoking user is both the owner and a member of the group?
Show answer
The kernel checks scopes in order: if the process's effective UID matches the file's owner UID, only the owner bits are evaluated—the group and other bits are never consulted. This means the invoking user, despite being a member of the group with rwx, will only receive r-- permissions because their identity matches the owner scope first. This cascading design prevents ambiguity: each access decision is determined by exactly one scope. The consequence is that a file owner can inadvertently have fewer effective permissions than group members, a common source of misconfigurations.

Question 2: BASIC CALCULATION

Convert the symbolic permission string -rwxr-x--- to its octal representation. Then, given a umask of 027, calculate the effective permissions that would result if a process with this umask creates a new regular file with the default requested mode of 0666.
Show answer
The string -rwxr-x--- converts as follows: owner rwx = 4+2+1 = 7, group r-x = 4+0+1 = 5, others --- = 0. Octal: 0750. For the umask calculation: effective = 0666 AND (NOT 027). NOT 027 = 750, so 0666 AND 0750 = 0640. The resulting file would have permissions -rw-r----- (owner: read/write, group: read-only, others: none). Note that the umask operates at file creation time and does not retroactively affect existing files.

Question 3: INTERMEDIATE

A shared project directory /opt/project/ is owned by root:developers with permissions drwxrwsr-x. User alice (UID 1001) is a member of the developers group. She creates a new file report.txt in this directory with her default umask of 022. What are the resulting ownership and permissions of report.txt? Explain the role of the setgid bit.
Show answer
The setgid bit (indicated by 's' in the group execute position) on the directory causes newly created files to inherit the directory's GID (developers) rather than Alice's primary group. The file's owner will be alice (UID 1001) because the setuid bit is not set on the directory. For permissions: the default creation mode for a regular file is 0666, and Alice's umask of 022 yields 0666 AND (NOT 022) = 0644, so -rw-r--r--. The resulting file is owned by alice:developers with permissions 0644. This is the key benefit of setgid on directories: it ensures group ownership consistency for collaborative workflows without requiring users to manually chgrp every file they create.

Question 4: APPLIED

You are hardening a multi-user Linux server. An audit reveals 47 setuid-root binaries, including /usr/local/bin/legacy_tool, an internally developed tool that only needs the ability to bind to port 80 (a privileged port < 1024). Describe a strategy to reduce the privilege exposure of this binary using Linux capabilities instead of the setuid bit, and explain why this is a security improvement.
Show answer
Instead of granting full root privileges via setuid, you can remove the setuid bit (chmod u-s /usr/local/bin/legacy_tool) and assign only the specific capability needed: setcap cap_net_bind_service=+ep /usr/local/bin/legacy_tool. This grants the binary the ability to bind to privileged ports without conferring any other root powers. The security improvement is significant: if the binary contains a vulnerability (e.g., a buffer overflow), an attacker who exploits it gains only the cap_net_bind_service capability—not full root access. This exemplifies the principle of least privilege at the kernel level. The attack surface is reduced from the complete set of root capabilities (~40 capabilities) to exactly one.

Question 5: CRITICAL THINKING

Consider an enterprise environment that uses NTFS ACLs with inheritance enabled on a deep directory hierarchy. A security analyst discovers that a Deny ACE on a parent folder is being inherited by thousands of subdirectories, inadvertently blocking a service account from accessing log files three levels deep. The analyst proposes removing the Deny ACE and relying solely on the absence of Allow ACEs for that account. Evaluate this proposal: under what conditions does it achieve equivalent security, and under what conditions might it introduce a vulnerability? Reference the concepts of explicit Deny, implicit Deny, and ACL inheritance in your analysis.
Show answer
In NTFS, the absence of an Allow ACE for a trustee results in implicit Deny—access is denied by default if no matching Allow ACE exists. Removing the explicit Deny ACE would achieve equivalent security only if no other ACE (direct or inherited) grants that service account access—either by name or through group membership. The vulnerability arises if the service account is a member of a group (e.g., Authenticated Users or Domain Users) that has an Allow ACE somewhere in the inheritance chain. In that case, the implicit Deny disappears because a matching Allow ACE exists, and the previously blocked access is now granted. Explicit Deny ACEs exist precisely to override such inherited Allow entries. The analyst's proposal is therefore risky in environments with broad group-based Allow rules. A safer approach would be to break inheritance at the specific subdirectory and construct a minimal ACL, or to scope the Deny ACE more narrowly using inheritance flags (e.g., applying it only to the parent container, not inheriting to children).

SUMMARY

Lesson Summary

Summary

User and file system privileges form the foundational layer of endpoint security. Every access control decision reduces to three elements: a subject (identified by a UID and one or more GIDs), an object (a file, directory, or resource), and an operation (read, write, or execute). The Unix rwx permission model encodes access rights as octal digits across three scopes (owner, group, others), while the umask governs default permissions at file creation time. Special bits—setuid, setgid, and the sticky bit—modify execution and deletion semantics in security-critical ways.

Beyond Unix DAC, modern systems employ NTFS Access Control Lists with fine-grained Allow/Deny ACEs, Mandatory Access Control (MAC) frameworks like SELinux for policy-driven confinement, and Role-Based Access Control (RBAC) for scalable organizational permission management. The overarching principle unifying all these models is the principle of least privilege: grant the minimum access required, audit aggressively, and layer complementary controls for defense in depth. Advanced topics—Linux capabilities, ABAC, and container namespaces—extend these foundations into the modern cloud-native landscape.

Varsity Tutors • Cyber Security • User & File System Privileges