Everyday Guidebooks
Cover of The Linux Guide to Permissions and Ownership

Cybersecurity & IT

The Linux Guide to Permissions and Ownership

A Hands-On Guide to Users, Groups, Permission Bits, ACLs, and Troubleshooting Access

by Todd Michael

Available now

A permission denied message tells you something went wrong—but not necessarily why. This linux guide gives you a practical method for finding the cause and choosing a fix that supports the job without granting unnecessary access.

Starting with users and groups, you’ll learn how Linux identifies a process, assigns file ownership, and evaluates read, write, and execute permissions. Worked command-line examples show how directory access differs from file access, how special permission bits affect shared work, and when access control lists offer a more precise solution.

Build your skills in a disposable practice environment, then tackle realistic scenarios involving shared folders, scripts, inherited permissions, and access that still fails after a seemingly correct change. Each exercise explains what to inspect, what the output means, and how to verify the result.

Ideal for certification study or on-the-job reference, this focused guide turns permission puzzles into a repeatable troubleshooting process.

Contents
  1. 1. Build a Safe Permissions Lab
  2. 2. Users, Groups, and Process Identity
  3. 3. Reading Ownership and Permission Listings
  4. Get a Long Listing
  5. Recognize the Object Type
  6. Separate the Permission Characters
  7. Read Owner, Group, and Link Count
  8. Inspect the Directory, Not Just Its Contents
  9. Show Numeric User and Group IDs
  10. Ask `stat` for Detailed Metadata
  11. Symbolic Links Need Careful Inspection
  12. Notice the Marker After the Mode
  13. Practice: Describe What You Know
  14. A Short Lab Check
  15. 4. Permission Bits: Read, Write, and Execute
  16. 5. Directory Permissions and Path Traversal
  17. 6. Changing Modes with chmod
  18. Begin with a Known State
  19. Symbolic Modes: Change What You Mean
  20. Octal Modes: Set the Whole Pattern
  21. Make a Script Executable
  22. Apply a Directory Requirement
  23. Symbolic or Octal?
  24. Be Careful with Recursive Changes
  25. Practice: Compare Requirements with Modes
  26. Verify the Work, Not Just the Bits
  27. 7. Changing Ownership with chown and chgrp
  28. 8. Defaults, umask, and New Files
  29. 9. Special Bits and Shared Directories
  30. 10. Access Control Lists
  31. file: tmp/acl-lab/notes.txt
  32. owner: maya
  33. group: editors
  34. 11. Default ACLs and Collaborative Workflows
  35. 12. Diagnosing Permission Denied
  36. 13. When Permissions Are Not the Whole Story
  37. 14. Practical Assessment: Repair and Verify
  38. Other Books by Todd Michael

Read a sample: 1. Build a Safe Permissions Lab

A permissions problem often begins with a simple question: “Why can’t I open this file?” The answer may involve the identity of the process making the request, the file’s owner and group, the permissions on a parent directory, or a separate access control mechanism.

The fastest way to learn those relationships is to work with files you can inspect, change, and rebuild. In this chapter, you will prepare a small Linux lab, establish a few habits that make experiments safer, and create a directory tree used for early practice.

You do not need to memorize every command on the first pass. The goal is to have a reliable place to experiment and a way to observe what each change does.

Use a Linux environment that does not contain important work. A virtual machine is a good choice because it gives you an isolated installation where you can create accounts and practice administrative tasks without deliberately changing your everyday system. A spare test machine can also work.

A container or a Linux environment integrated with another operating system can be useful for many exercises, but behavior may differ depending on its filesystem, configuration, and how it handles users or administrative privileges. If an exercise does not behave as expected, the environment itself may be part of the explanation. Chapter 13 returns to these boundaries.

For this chapter, you need:

- A Linux shell and a regular, non-root user account. - A home directory where that account can create files. - Basic tools such as pwd, ls, mkdir, touch, cat, and stat. - Administrative access through sudo for later chapters, if your lab provides it.

You do not need administrative privileges to build the initial tree. In fact, creating it as your regular user is a useful first lesson: the identity that creates a file matters.

If your virtualization software supports snapshots, consider taking one after installing and updating the lab system but before making extensive changes. A snapshot can provide a broader recovery point than the reset procedure in this chapter, which only rebuilds the practice directory. Follow the documentation for your environment, and do not treat a snapshot as a substitute for backups of anything you need to keep.

Open a terminal and start by finding out where you are:

bash pwd

The command prints the current working directory. Next, identify the account and groups associated with your current shell:

bash whoami id

A typical id result includes a username, a numeric user ID, a primary group, and any supplementary groups. Your names and numbers will almost certainly differ from those shown in examples elsewhere in the book.

Now inspect the home directory associated with your shell:

bash printf '%s\n' "$HOME" cd "$HOME" pwd

The HOME environment variable normally contains the path to your home directory. Quoting "$HOME" keeps the shell from splitting the value if the path contains spaces. After changing directories, pwd confirms where you actually landed.

Throughout the book, paths beginning with "$HOME" refer to your own lab account. Run the examples from that account unless an exercise explicitly tells you to use another identity. Avoid running a whole shell as root for ordinary practice; doing so makes it harder to see which operations your regular account can perform.

Check whether sudo is available:

bash command -v sudo

If the command prints a path, the program is installed. That alone does not prove your account is authorized to use it. If nothing is printed, or if your account cannot use sudo, you can still complete this chapter. Before later administrative exercises, consult the instructions for your lab environment or ask whoever manages it to provide suitable access.

Administrative privileges are powerful because they can allow a process to change files and account settings beyond the reach of an ordinary user. They are not a shortcut for understanding an access problem.

Before using sudo, make three checks:

1. Read the entire command. Know which program will run and which path it will affect. 2. Confirm the target. Inspect the directory or file before changing it, especially when using a recursive option. 3. Use privilege only for the operation that needs it. Return to unprivileged commands for inspection and verification whenever possible.

For example, prefixing a single command with sudo is easier to review than opening a root shell and continuing to work there. Even then, inspect the full command before pressing Enter. A mistyped path can affect a different location from the one you intended.

Do not add sudo merely because a command reports “Permission denied.” That message is evidence to investigate. The correct fix may be a group membership, a directory traversal permission, or a different target path—not broader privilege.

The following exercise creates a small workspace under your home directory. It contains a project area, a private area, and a shared area. These names describe the intended exercises; they do not by themselves guarantee privacy or sharing.

First, move to your home directory and check whether the proposed lab name is already in use:

bash cd "$HOME" ls -ld -- permissions-lab

If you see a message that the path cannot be accessed because it does not exist, you are ready to create it. If it already exists, inspect it and choose a different name rather than overwriting or removing something you may need. The examples below assume the name permissions-lab; if you choose another name, consistently…

More Cybersecurity & IT

Cover of The White Hat Bible, Volume 1The White Hat Bible, Volume 1Available nowCover of The White Hat Bible, Volume 2The White Hat Bible, Volume 2Available nowCover of The White Hat Bible, Volume 3The White Hat Bible, Volume 3Available nowCover of The White Hat Bible, Volume 4The White Hat Bible, Volume 4Available nowThe White Hat Bible, Volume 5Available nowCover of The White Hat Pocket GuideThe White Hat Pocket GuideAvailable now

About Todd Michael

Todd Michael is an American author and the founder of ToddMichael.tv. He writes practical, plain-English books on money, health, preparedness, technology, games, humor and more.

About the author Todd Michael · Todd Michael’s author site

Part of the ToddMichael.tv network.