Linux Survival Basics
Read-onlyCheck Owner and Mode in One Line
A path exists but access fails, and you need owner, group, and mode quickly.
Command
stat -c '%A %U:%G %n' /var/www/example/index.html
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 file if parent directories may block access.
Expected output
A compact permission and ownership line.
System impact
Read-only. Nothing changes. The command prints permissions, owner, group, and filename.
May require elevated permissions on protected paths or service-owned files.
Recovery / rollback: no state is changed.
When to use it
Use this before changing file permissions or ownership.
When not to use it
Do not stop at the file if parent directories may block access.
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
Trace Nginx Web Path Permissions
A 403 is often in a parent directory, not the file.
namei -l /srv/www/site/index.html
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
Read Recent Nginx Error Log Lines
The error log often names the denied path.
sudo tail -80 /var/log/nginx/error.log
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.