Linux Survival Basics
Read-onlyTrace Every Parent Directory on a Permission Denial
You need to inspect each directory component in a path to find where traversal permission fails.
Command
namei -l /srv/www/example/current/config/prod.token
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not stop at the final file mode; parent execute bits and symlink targets matter.
Expected output
A component-by-component ownership and mode trace for the full path.
System impact
Read-only. Nothing changes. The command shows each path component with owner and mode.
Recovery / rollback: no state is changed.
When to use it
Use when a process gets permission denied even though the final file looks readable.
When not to use it
Do not stop at the final file mode; parent execute bits and symlink targets matter.
next steps
Related commands
Trace Nginx Web Path Permissions
A 403 is often in a parent directory, not the file.
namei -l /srv/www/site/index.html
Audit a Symlink Permission Chain
A symlink can make the path you audited different from the file the app opens.
find /srv/www/example -type l -printf '%p -> %l\n' -exec namei -l {} \; 2>/dev/null
Check Owner and Mode in One Line
The file existed. The owner and mode explained why it still failed.
stat -c '%A %U:%G %n' /var/www/example/index.html
Check Web File Owner and Mode
The file can exist and still be unreadable to Nginx.
stat -c '%A %U:%G %n' /srv/www/site/index.html
Find Release Files Writable Outside the Owner
A release file that someone besides the owner can modify deserves a second look.
find /srv/www/example/releases/current -type f -perm /0022 -printf '%M %u:%g %p\n' 2>/dev/null | sort
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.