Permission troubleshooting
Quick answer
When Linux reports Permission denied, diagnose the requested operation and the full path before changing any mode. Start with read-only checks and use the smallest justified correction.
Prepare the practice environment
Use the chapter fixture described in lab-fixtures/permissions/README.md. Run setup as a normal user in a disposable Linux environment, enter the printed directory, check pwd, and run export LC_ALL=C; umask 022. Every example assumes a fresh fixture. Commands omit the terminal prompt; outputs below are not commands.
How it works
Check the effective user and groups with id; inspect file owner and mode with stat; use namei -l to inspect each path component and identify missing search permission. test -r and test -x are useful quick checks but do not guarantee a later operation will succeed. An ACL, read-only or noexec mount, immutable attribute, capabilities or a mandatory access-control policy may also affect access. The file itself may be readable while a parent prevents resolution. Fix the intended component rather than changing the whole tree; do not disable SELinux or AppArmor to make an error disappear.
For the example below, begin with the failed operation cat room/note.txt. Even if note.txt is readable, a missing search bit on room prevents access by name. Restore only the owner search bit in the known fixture, repeat the same cat operation and compare its output. If that still fails, inspect the remaining path components and additional access controls rather than granting broader access.
Try the examples
chmod 600 roomif cat room/note.txt 2> error.txt; then printf 'unexpected\n'; else printf 'blocked\n'; ficat error.txtchmod 700 roomActual diagnostic in the tested C locale. Restore access afterward.
Expected stdout:
blockedcat: room/note.txt: Permission deniedThe display filters user/group names, leaving mode and component. For diagnosis inspect the full namei output as well.
Expected stdout:
drwx------ room-rw-r--r-- note.txtchmod 600 roomchmod u+x roomcat room/note.txtstat -c %a roomOnly owner search permission is added to the known private directory.
Expected stdout:
hello700Common mistakes
Do not apply recursive chmod, grant every user access, or disable security policies as a universal repair. Capture the original error and confirm you are authorized to make the smallest change.
Practice
Diagnose room at mode 600 using stat and namei -l; explain why the file cannot be opened, restore owner search permission and confirm cat succeeds.
Related references
Study: namei, stat. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Permission troubleshooting — Knowledge Check
Apply the lesson concepts to the controlled permission fixture.
Which command shows components of a path with modes?
A readable file has an inaccessible parent. What should you inspect?
Which is a reasonable first action after Permission denied?
What else may prevent execution even with x set?