Course contentsShow
← Linux
Lesson 354 of 1,8194. Advanced Access Control ModelsFree lesson

Understanding Effective vs Real UID Contexts

Differentiate between the identity of a process initiator and the identity required for specific syscall execution.

In this lesson, you will learn how Linux distinguishes between who you are and the privileges you currently wield when running a process.

The Dual Identity of a Process

In Linux, a process doesn't just have one identity; it maintains two distinct User IDs (UIDs) to balance security and functionality. These are known as the Real UID and the Effective UID (EUID).

The Real UID: Your True Identity

The Real UID represents the actual user who started the process. It is the "source of truth" regarding the ownership of the task. If you log into your terminal and start a script, the Real UID is yours. Its primary purpose is to identify who should be held accountable for the process or who is allowed to send it signals (like killing the process).

The Effective UID: Your Privilege Level

The Effective UID (EUID) is the identity the system checks when you try to perform a specific action, such as accessing a restricted file or opening a network port. Usually, the Real UID and EUID are identical. However, special mechanisms (like the setuid bit on executable files) allow a process to adopt an EUID that is different from its Real UID.

Consider a password-changing utility, passwd. Even though you (a regular user) run it, the system needs that process to have the authority to write to /etc/shadow, which is a file only the root user can modify.

# Example logic flow:
# Real UID: student (You)
# Effective UID: root (The authority granted by the setuid bit)
# Result: Process can update security files while knowing it's "you" who requested the change.

When you attempt a syscall, the kernel ignores your Real UID and looks exclusively at your EUID to decide if you have permission to proceed. This separation allows Linux to grant temporary, scoped elevated powers to a process without granting you, the user, full administrative control over the entire system.

Key Takeaway: The Real UID identifies the user who started the process, while the Effective UID serves as the active set of credentials the kernel uses to authorize individual system actions.