1. Why Access Control Exists (Start from First Principles)

Modern operating systems are designed to support multiple users, multiple applications, and shared resources simultaneously.

Consider a typical system:

  • Hundreds of files exist on disk

  • Multiple processes execute concurrently

  • Devices such as printers and disks are shared

  • Network resources are accessed by different users

Now imagine if every user and process could access every resource freely.

What Could Go Wrong?

  • Any user could modify system files

  • Malware could access confidential information

  • Processes could interfere with each other

  • Critical operating system files could be deleted

  • Sensitive databases could be exposed

The result would be complete system chaos.

The Fundamental Question

Whenever a resource is requested, the operating system must answer:

Who is requesting access?

Which resource is being accessed?

What operation is being attempted?

Should the operation be allowed?

The mechanism that answers these questions is called Access Control.


2. What is Access Control?

Definition

Access Control is the mechanism through which an operating system regulates access to resources by users, processes, or applications.

It determines:

  • Who can access a resource

  • Which resource can be accessed

  • What operations are permitted

  • Under what conditions access is allowed


Core Idea

Every access request can be represented as:

Subject + Object + Permission
            ↓
      Access Decision

The operating system evaluates the request and either:

GRANT ACCESS

or

DENY ACCESS

Key Insight

Access control is not about identifying users.

It is about determining:

"After identity is known, what actions are permitted?"


3. Subjects and Objects (Most Important Foundation)

Every access control system revolves around two entities:

3.1 Subjects

A subject is the entity requesting access.

Examples:

  • Users

  • Processes

  • Applications

  • Threads

  • Services


3.2 Objects

An object is the resource being accessed.

Examples:

  • Files

  • Directories

  • Memory regions

  • Devices

  • Databases

  • Network sockets


Example

User A → Read → File X

Here:

User A  = Subject

File X  = Object

Read    = Operation

Key Insight

Access control is fundamentally about:

Subject → Operation → Object

4. Access Rights

Access rights define what actions a subject may perform on an object.

Common Rights

Read (R)

Allows viewing data.

Example:

Open file
Read contents

Write (W)

Allows modification.

Example:

Edit file
Change configuration

Execute (X)

Allows execution.

Example:

Run program
Execute script

Delete

Allows removal of object.


Modify

Allows changing metadata or permissions.


Append

Allows adding data without modifying existing content.


Example

File1

User A → Read, Write

User B → Read

User C → Execute

5. Why Access Control is Necessary

Consider a university database server.

It contains:

  • Student records

  • Grades

  • Faculty information

  • Financial data

Without access control:

Student → Modify Grades ❌

Student → Delete Records ❌

Malware → Access Database ❌

The system would be unusable.


Access Control Prevents

Unauthorized Access

Protects sensitive information.

Unauthorized Modification

Protects integrity.

Unauthorized Deletion

Protects availability.

Resource Abuse

Prevents misuse of shared resources.


6. Goals of Access Control

Access control exists to achieve three major security objectives.


6.1 Confidentiality

Only authorized users can view data.

Example:

Payroll File

Manager → Allowed

Employee → Denied

6.2 Integrity

Only authorized users can modify data.

Example:

Grades Database

Professor → Modify

Student → Read Only

6.3 Availability

Legitimate users must retain access.

Example:

Hospital System

Doctors must always access records

6.4 Controlled Sharing

Allows collaboration without sacrificing security.

Example:

Project File

Team Members → Read/Write

Others → Denied

7. Access Control Process (How the OS Makes Decisions)

Whenever access is requested, the OS follows a sequence of checks.

Step 1: Identify Subject

Who is requesting access?

User?
Process?
Application?

Step 2: Identify Object

What resource is targeted?

File?
Directory?
Printer?
Memory?

Step 3: Determine Operation

What action is requested?

Read?
Write?
Execute?
Delete?

Step 4: Check Permissions

Consult:

  • ACLs

  • Permission bits

  • Security policies

  • Roles


Step 5: Grant or Deny

Permission Exists
      ↓
Grant Access

Permission Missing
      ↓
Deny Access

8. Access Control Models

Different operating systems use different strategies.


8.1 Discretionary Access Control (DAC)

Core Idea

The owner of a resource controls access permissions.


Example

You create:

report.txt

You decide:

Friend A → Read

Friend B → Read, Write

Friend C → No Access

Characteristics

  • Flexible

  • User-controlled

  • Common in UNIX/Linux


Advantages

✔ Easy to use

✔ Flexible

✔ Supports sharing


Disadvantages

Malware inherits user permissions.

If user has access:

Malware → also gets access

Real Example

Linux file permissions use DAC principles.


8.2 Mandatory Access Control (MAC)

Core Idea

Security policies are enforced by the system.

Users cannot override them.


Example

Military Classification:

Top Secret

Secret

Confidential

Public

A user cannot simply grant access.

Only the security policy determines permissions.


Characteristics

  • Centralized control

  • Extremely secure

  • Rigid


Advantages

✔ Strong security

✔ Prevents accidental permission changes

✔ Ideal for critical systems


Disadvantages

✘ Less flexible

✘ Harder administration


Real Example

  • SELinux

  • Military systems

  • Government systems


Key Insight

MAC prioritizes:

Security > Convenience

8.3 Role-Based Access Control (RBAC)

Core Idea

Permissions are assigned to roles rather than individual users.


Structure

Role
  ↓
Permissions
  ↓
Users

Example

Student

Read Course Material

Teacher

Read
Write Grades

Administrator

Full Control

Advantages

✔ Easier management

✔ Scalable

✔ Suitable for large organizations


Real Example

Corporate systems commonly use RBAC.


9. Access Control Lists (ACLs)

What is an ACL?

An Access Control List stores permissions associated with an object.


Example

File A

User1 → Read

User2 → Read, Write

User3 → Execute

Access Check

When User2 requests access:

Check ACL
     ↓
Permission Found
     ↓
Allow

Advantages

✔ Fine-grained control

✔ Flexible permissions


Disadvantages

✘ ACLs become large

✘ Harder to manage at scale


10. Capability-Based Access Control

ACLs attach permissions to objects.

Capabilities attach permissions to subjects.


ACL View

File → Who can access?

Capability View

User → What can they access?

Example

Process P

Capability:
Printer Access

The capability acts like a secure ticket.


Key Insight

Capabilities are:

Unforgeable permissions

11. File Permissions in UNIX/Linux

Linux uses three permission categories:

Owner

Group

Others

Permission Symbols

r = Read

w = Write

x = Execute

Example

rwxr-xr--

Breakdown:

CategoryPermission
Ownerrwx
Groupr-x
Othersr--

Meaning

Owner:

Read
Write
Execute

Group:

Read
Execute

Others:

Read Only

12. Principle of Least Privilege (Very Important)

One of the most important security principles.

Definition

A subject should receive only the minimum permissions required to perform its task.


Example

A text editor needs:

Read File

Write File

It does NOT need:

Modify Kernel

Manage Users

Benefits

✔ Reduces attack damage

✔ Prevents accidental misuse

✔ Improves security


Key Insight

Minimum Rights
Maximum Safety

13. Privilege Escalation

What is It?

Privilege escalation occurs when a user or process gains permissions beyond what it is authorized to have.


Examples

Vertical Escalation

Normal User
      ↓
Administrator

Horizontal Escalation

User A
      ↓
User B's Resources

Causes

  • Software bugs

  • Misconfigured permissions

  • Security vulnerabilities


Why Dangerous?

Attackers can gain:

Root Access

System Control

Sensitive Data

14. Modern Access Control Mechanisms

Modern operating systems implement advanced security systems.


SELinux

Uses MAC principles.

Provides:

  • Fine-grained control

  • Security labeling

  • Policy enforcement


AppArmor

Profile-based access control.

Restricts applications.


Windows ACLs

Very detailed permission management.

Supports:

  • User permissions

  • Group permissions

  • Inheritance


Sandboxing

Applications run in isolated environments.

Example:

Browser tab isolation

Container Isolation

Used in:

  • Docker

  • Kubernetes

Separates workloads securely.


15. Access Control vs Authentication

Many students confuse these.

Authentication

Answers:

Who are you?

Examples:

  • Password

  • Fingerprint

  • Face recognition


Access Control

Answers:

What are you allowed to do?

Flow

Login
   ↓
Authentication
   ↓
Identity Verified
   ↓
Access Control
   ↓
Permissions Enforced

16. Real-World Example (Complete Flow)

Suppose Alice opens:

grades.xlsx

Step 1

Alice logs in.

Authentication Success

Step 2

Alice requests:

Read grades.xlsx

Step 3

OS identifies:

Subject = Alice

Object = grades.xlsx

Operation = Read

Step 4

Permission check:

ACL

Role

Permission Bits

Step 5

Decision:

Permission Found
      ↓
Access Granted

or

Permission Missing
      ↓
Access Denied