Linux Survival Basics
Read-onlyTrace Nginx Web Path Permissions
Nginx can see the file path only if each parent directory allows traversal.
Command
namei -l /srv/www/site/index.html
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not chmod recursively from this output; identify the specific blocking component.
Expected output
Each path component with owner, group, and mode bits.
System impact
Read-only. Nothing changes. The command reads current state and prints diagnostic evidence.
Recovery / rollback: no state is changed.
When to use it
Use when Nginx returns 403 for a file that exists.
When not to use it
Do not chmod recursively from this output; identify the specific blocking component.
Example run
Commands shown
These are the commands shown for inspection. Treat them as an example, not proof that your system will behave identically.
namei -l /srv/www/site/index.htmlnamei -l /srv/www/site/index.html
next steps
Related commands
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
Trace Every Parent Directory on a Permission Denial
The file mode can look fine while a parent directory blocks the whole path.
namei -l /srv/www/example/current/config/prod.token
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
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
Inspect Permissions Before Changing Them
The permission fix was easy. Knowing what not to chmod was the hard part.
namei -l /var/www/example/index.html
next diagnostic step
Where to go from this command
- Nginx 403 hub Use when path permissions cause 403.
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.