teluzia.Cloud Engineer · Day 8
CHAPTER 02 · LINUX ADMINISTRATION AND SHELL SCRIPTING

Users, groups and sudo

4–5 hours including independent practice3 topics
LET’S MAKE THIS SIMPLE

What you’re learning today

Inspect identity and privilege boundaries without modifying system users. You will compare your username, numeric IDs, groups and sudo authorization, then create a private file. A deliberately restricted file demonstrates that ordinary access checks matter even when you can sometimes elevate privileges. Linux uses numeric user IDs to associate processes and file ownership with accounts. Usernames are human-readable mappings to those numbers. id prints the current UID, primary GID and supplementary groups; whoami prints the effective username. A process can run under a different effective identity from the login account. A group lets multiple users share access without opening permissions to everyone. Files have one owning group, while a user may belong to several groups. Group membership changes may require a new login session before existing processes use the updated membership list. Directory permissions still govern traversal.

Think of it this way

A user is an identity badge, groups are shared access lists, and sudo is a logged request for a stronger badge.

TOPIC 01 / 03Step by step

Users and numeric identity

Linux uses numeric user IDs to associate processes and file ownership with accounts. Usernames are human-readable mappings to those numbers. id prints the current UID, primary GID and supplementary groups; whoami prints the effective username. A process can run under a different effective identity from the login account. Compare id, whoami and stat -c "%U %u" private.txt to connect process identity with file ownership in a normal-user terminal. Numeric identity explains ownership across services and mounted filesystems and helps distinguish an account-name mismatch from a genuine authorization failure when diagnosing access. Renaming a username does not make every numeric ownership association disappear; inspect UID values rather than assuming names alone control access to files.

WORKED EXAMPLE
Compare id, whoami and stat -c "%U %u" private.txt to connect process identity with file ownership in a normal-user terminal.
Why this matters

Numeric identity explains ownership across services and mounted filesystems and helps distinguish an account-name mismatch from a genuine authorization failure when diagnosing access.

A common trap

Renaming a username does not make every numeric ownership association disappear; inspect UID values rather than assuming names alone control access to files.

MAKE IT VISIBLE

Build the permission you mean

READ. WRITE. EXECUTE.

Who should be allowed to do what?

File permissions apply to the owner, group, and everyone else. Toggle a permission to see its symbolic and numeric forms.

Owner

rw-

Group

r--

Others

---
chmod 640 notes.txtrw-r-----
What this grants

Owner: read, write. Group: read. Others: no permissions. For a directory, execute means traversal; for a file, execute means permission to run it.

Read all topics in this lesson

A complete reference to revisit alongside the guided steps above.

Users and numeric identity

Linux uses numeric user IDs to associate processes and file ownership with accounts. Usernames are human-readable mappings to those numbers. id prints the current UID, primary GID and supplementary groups; whoami prints the effective username. A process can run under a different effective identity from the login account. Compare id, whoami and stat -c "%U %u" private.txt to connect process identity with file ownership in a normal-user terminal. Numeric identity explains ownership across services and mounted filesystems and helps distinguish an account-name mismatch from a genuine authorization failure when diagnosing access. Renaming a username does not make every numeric ownership association disappear; inspect UID values rather than assuming names alone control access to files.

WORKED EXAMPLE
Compare id, whoami and stat -c "%U %u" private.txt to connect process identity with file ownership in a normal-user terminal.

Why this matters

Numeric identity explains ownership across services and mounted filesystems and helps distinguish an account-name mismatch from a genuine authorization failure when diagnosing access.

A common trap

Renaming a username does not make every numeric ownership association disappear; inspect UID values rather than assuming names alone control access to files.

Groups and shared access

A group lets multiple users share access without opening permissions to everyone. Files have one owning group, while a user may belong to several groups. Group membership changes may require a new login session before existing processes use the updated membership list. Directory permissions still govern traversal. id -nG shows your active group names; ls -ld "$HOME" reveals whether another group could traverse your home directory using current permissions. Groups provide manageable shared access boundaries and reduce the need for broad permissions when teams or service accounts collaborate on files inside Linux environments. Adding a user to a group does not alter already running process credentials automatically; start a fresh session before diagnosing an apparent membership failure.

WORKED EXAMPLE
id -nG shows your active group names; ls -ld "$HOME" reveals whether another group could traverse your home directory using current permissions.

Why this matters

Groups provide manageable shared access boundaries and reduce the need for broad permissions when teams or service accounts collaborate on files inside Linux environments.

A common trap

Adding a user to a group does not alter already running process credentials automatically; start a fresh session before diagnosing an apparent membership failure.

sudo and least privilege

sudo executes an allowed command under another identity, usually root, subject to configured policy. sudo -l lists permissions available to your account; it may request your password. Root can bypass many file checks, so testing everything with sudo can conceal unsafe ownership. Configuration changes should use validated tools such as visudo. Run sudo -l only if you administer this practice machine; read the permitted commands instead of executing a privileged change for this inspection exercise. Using privilege only when a specific operation requires it limits accidental damage and makes authorization failures useful evidence instead of an inconvenience to bypass. Editing sudoers with an ordinary text editor can break administrative access; use visudo and avoid changing system privilege policy during a beginner inspection lab.

WORKED EXAMPLE
Run sudo -l only if you administer this practice machine; read the permitted commands instead of executing a privileged change for this inspection exercise.

Why this matters

Using privilege only when a specific operation requires it limits accidental damage and makes authorization failures useful evidence instead of an inconvenience to bypass.

A common trap

Editing sudoers with an ordinary text editor can break administrative access; use visudo and avoid changing system privilege policy during a beginner inspection lab.

KEEP THESE WITH YOU

Today’s takeaways

Connect names to numeric identities.

Groups provide scoped sharing.

Use sudo deliberately and inspect its policy.

CLOSE THE LOOP

Ready to complete this day?

Verify the practical steps and pass the knowledge check (at least two thirds correct).

Lab steps verifiedKnowledge check passed