Episode 36 — Users, groups, and identity: UID, GID, EUID, EGID explained simply

In Episode Thirty-Six, we explore the core of Linux security by looking at the fundamental concepts of identity, ensuring that you understand how the system perceives who you are so that permissions and access make sense. As a professional in the cybersecurity field, you must move beyond the surface level of usernames and passwords to understand the numeric identifiers that the kernel uses to enforce its security boundaries. Every process you run and every file you create is tied to a specific identity that dictates exactly what actions are permitted and what data is protected. By mastering the distinction between real and effective identities, you gain the ability to troubleshoot complex access issues and secure your systems against unauthorized privilege escalation. Today, we will break down the mechanics of user and group identification to provide you with a clear and technical framework for managing digital identity in a professional Linux environment.

Before we continue, a quick note: this audio course is a companion to our Linux Plus books. The first book is about the exam and provides detailed information on how to pass it best. The second book is a Kindle-only eBook that contains 1,000 flashcards that can be used on your mobile device or Kindle. Check them both out at Cyber Author dot me, in the Bare Metal Study Guides Series.

To build a solid foundation, we must define users by their User Identifiers, or U-I-Ds, and groups by their Group Identifiers, or G-I-Ds, which serve as the true numeric names used by the operating system. While we humans prefer to work with descriptive names like "admin" or "student," the Linux kernel exclusively utilizes these integers to track ownership and enforce the rules of the filesystem. When a user logs in, the system looks up their name in a local or network database and translates it into a specific U-I-D that will follow them through their entire session. Understanding that these numbers are the "source of truth" is essential for a cybersecurity professional, as it prevents you from being misled by names that might be identical across different systems but correspond to entirely different numeric identities.

It is vital to separate names from identifiers to avoid unexpected surprises when moving data or configurations across different systems that might not share a unified identity provider. If you move a physical disk from one server to another, the files on that disk will still be owned by the same numeric U-I-Ds, regardless of whether those numbers map to the same usernames on the new host. If U-I-D one-thousand corresponds to "alice" on the source but maps to "bob" on the destination, the files will suddenly and incorrectly appear to be owned by Bob. This mapping mismatch can lead to significant security breaches or administrative confusion if you are not careful when migrating users or storage volumes between environments. Recognizing the "numeric permanence" of file ownership is a key requirement for maintaining consistent and secure access controls across a distributed infrastructure.

You must also understand the difference between primary group memberships and supplementary group memberships to properly manage how users collaborate and access shared resources. Every user on a Linux system is assigned exactly one primary group, which is typically used as the default group for any new files or directories that the user creates during their session. However, to facilitate more complex workflows, a user can also be a member of multiple supplementary groups, which provide them with additional permissions to access specific project folders or system tools. For example, a developer might have a primary group named "dev" but also belong to supplementary groups for "web" and "database" access. Mastering this hierarchy allows you to build a granular security model where users have exactly the amount of access they need to perform their specific job functions.

To understand how the kernel handles temporary privilege changes, we must explain effective identifiers as the specific identity that a process is using to perform its tasks at this exact moment. While your real U-I-D represents who you are based on your login, your effective U-I-D, or E-U-I-D, represents the identity the kernel uses to check permissions for a specific action. This distinction allows the system to grant temporary administrative powers to a normal user so they can perform a specific, restricted task, such as changing their own password. The effective identity is what the filesystem looks at when you try to open a file or execute a program, making it the most critical component of real-time access control. Recognizing the difference between "who you are" and "who you are acting as" is the key to understanding advanced Linux security mechanisms.

We can relate the "set-u-i-d" and "set-g-i-d" bits to these effective identity changes, as these special permissions allow a program to run with the privileges of the file owner rather than the user who executed it. When you run a binary that has the "set-u-i-d" bit enabled, the kernel sets the effective U-I-D of the resulting process to match the U-I-D of the file itself, which is often the root user. This mechanism is what allows non-privileged users to interact with sensitive system files in a controlled and safe manner through specific, trusted applications. However, as a cybersecurity professional, you must view these bits as significant security risks, as any vulnerability in a "set-u-i-d" program can be exploited to gain full administrative control of the system. Auditing and managing these privileged binaries is a vital part of protecting your system's integrity from local threats.

To determine why a user can or cannot access a specific resource, you must be able to trace file ownership and group ownership to their respective access outcomes. When a user attempts to open a file, the kernel first compares their effective U-I-D to the owner of the file; if they match, the system applies the "owner" permissions and stops checking. If they do not match, the system then checks the user's primary and supplementary groups against the file's group ownership to see if a match exists there. If neither the user nor the group matches, the system finally applies the "other" or "world" permissions to the request. This "three-tier" check is the fundamental logic of Linux access control, and understanding this specific order is essential for troubleshooting "permission denied" errors in a multi-user environment.

You must also recognize the role of the user mask, or "u-mask," in shaping the default permissions for any new files or directories created by a user or a service. The "u-mask" is a numeric value that the kernel uses to "strip away" specific permissions from the default initial state whenever a new object is born on the filesystem. For example, if the default for a new file is "six-six-six" and your "u-mask" is "zero-two-two," the final permission for the file will be "six-four-four," effectively removing write access for the group and others. A seasoned educator will remind you that the "u-mask" is a "restrictive" tool, not a "granting" tool, and it ensures that sensitive data is not accidentally created with overly permissive access. Mastering the "u-mask" configuration is a vital part of establishing a secure-by-default environment for your organization's data.

Let us practice a recovery scenario where a user reports they cannot read a file despite being told they were granted access, and you must check the U-I-D and groups to find the cause. You would start by running the "id" command to see the user's current U-I-D and their list of supplementary group memberships to ensure they are actually in the group that owns the file. Next, you would examine the file itself using a numeric listing to see if the G-I-D on the file matches the G-I-D in the user's profile. You might discover that the user was added to the group recently but has not yet logged out and back in to refresh their effective group identities. This methodical check of the user's identity versus the file's metadata is the fastest way to resolve "mysterious" permission issues with technical certainty.

When designing collaboration spaces, you should consider utilizing shared directories that leverage group collaboration bits and the specialized "sticky" bit to manage user interaction safely. By setting the "set-g-i-d" bit on a directory, you ensure that every new file created inside it automatically inherits the group ownership of the directory rather than the user's primary group. This allows all members of a specific team to read and edit each other's work without having to manually change permissions every time a file is created. To prevent accidental or malicious deletion of another user's work in these shared spaces, you should also apply the "sticky bit," which restricts file deletion to only the file owner and the root user. This combination of special bits provides a robust and secure environment for team collaboration on a shared Linux server.

A vital rule for professional systems administration is to avoid changing numeric identifiers casually because doing so will break all existing ownership mappings across your filesystems. If you change a user's U-I-D from one-thousand to two-thousand, every file they currently own will still be tied to U-I-D one-thousand, effectively making the user a stranger to their own data. To fix this, you would have to perform a massive search across every disk and partition to update the ownership of thousands of files, which is a time-consuming and error-prone process. It is far better to plan your numeric identity space carefully from the beginning, especially when integrating with centralized services like Lightweight Directory Access Protocol. Consistency in your numeric identifiers is the foundation of a stable and manageable security model in a professional data center.

To help you remember these complex concepts during a high-pressure exam or a real-world crisis, you should use a simple memory hook: your "Real I-D" is who you are, and your "Effective I-D" is the hat you are wearing. Your Real U-I-D is established when you present your credentials at login and stays with you as your permanent signature on the system. Your Effective U-I-D is the "active" identity that you use to perform specific tasks, and it can change as you move between different programs or use privilege escalation tools. By keeping this simple analogy in mind, you can quickly visualize how the kernel is making its security decisions at any given moment. This mental model is a powerful tool for simplifying the abstract mechanics of Linux identity management into something intuitive and actionable.

For a quick mini review of this episode, can you state the technical meanings of U-I-D, G-I-D, E-U-I-D, and E-G-I-D from memory? You should recall that the U-I-D is the User Identifier, G-I-D is the Group Identifier, E-U-I-D is the Effective User Identifier, and E-G-I-D is the Effective Group Identifier. The first two represent your permanent identity and primary group, while the last two represent the identity currently being used for permission checks by your running processes. Understanding these four variables is the absolute minimum requirement for mastering Linux access control and security. By internalizing these definitions, you are preparing yourself for the advanced security and troubleshooting tasks that define a professional cybersecurity expert.

As we reach the conclusion of Episode Thirty-Six, I want you to describe one common permission issue you have encountered or can imagine, using these identity concepts to explain the root cause. Will you describe a "set-u-i-d" binary that failed because of a missing configuration, or perhaps a user who couldn't access a shared folder because of a "u-mask" conflict? By verbalizing your explanation using the technical language of U-I-Ds and Effective I-Ds, you are demonstrating the professional and structured mindset required for the Linux plus certification. Understanding the depth of identity is what allows you to command the operating system with true authority and precision. Tomorrow, we will move forward into the world of basic command-line operations, where we start using these identities to perform real administrative work. For now, reflect on the invisible numbers that define who you are on a Linux system.

Episode 36 — Users, groups, and identity: UID, GID, EUID, EGID explained simply
Broadcast by