Course contentsShow
← Security
Lesson 2139 of 3,05242. Penetration Testing and Red TeamingFree lesson

Linux Privilege Model and Escalation Fundamentals

Understanding UID/GID, effective vs real permissions, and how privilege boundaries work in Linux systems.

Linux Privilege Model and Escalation Fundamentals

What You'll Learn

You'll understand how Linux controls user permissions through UIDs and GIDs, and why these numeric identifiers are the foundation of both security boundaries and privilege escalation paths.

The Linux Permission Model

In Linux, every process runs with two identities: a real and an effective user ID (UID) and group ID (GID). Think of your real ID as your actual identity card, while your effective ID is the credential you're currently using to perform actions.

Real vs Effective IDs

  • Real UID/GID: Who you actually are (the user who started the process)
  • Effective UID/GID: What permissions you're exercising right now

This distinction exists primarily for setuid programs—executables that temporarily elevate privileges. For example, the passwd command runs with effective UID 0 (root) so it can modify /etc/shadow, even though you launched it as a regular user.

How Privilege Boundaries Work

Linux enforces privilege separation through numeric IDs:

  • UID 0 = root, the superuser with unlimited access
  • UID 1-999 = system accounts (services, daemons)
  • UID 1000+ = regular users

File permissions (rwxr-xr-x) are checked against your effective UID/GID. When a process checks "Can I read this file?", the kernel compares the file's owner/group with the process's effective credentials—not real ones.

Why This Matters for Privilege Escalation

Attackers target the gap between intended and actual permission enforcement. If you can manipulate a setuid binary, hijack a process's effective credentials, or exploit weak file permissions, you can cross privilege boundaries. Understanding which ID matters for which check is crucial for both attack and defense.

Key Takeaway: Linux privilege separation relies on real vs effective UID/GID—effective IDs determine what actions succeed, making setuid binaries and permission misconfigurations prime privilege escalation targets.