Linux Survival Basics
Read-onlyCheck Web File Owner and Mode
You need owner, group, and mode for one web file.
Command
stat -c '%A %U:%G %n' /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 change owner or mode before confirming the Nginx worker user.
Expected output
Mode, owner, group, and path for the target file.
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 after tracing parent directories.
When not to use it
Do not change owner or mode before confirming the Nginx worker user.
Example run
Commands shown
These are the commands shown for inspection. Treat them as an example, not proof that your system will behave identically.
stat -c '%A %U:%G %n' /srv/www/site/index.htmlstat -c '%A %U:%G %n' /srv/www/site/index.html
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
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
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
Test Apache Config Without Reloading
Apache can check syntax before you reload a live site.
sudo apachectl configtest
Find Nginx root alias and access rules
One deny or alias can explain the whole 403.
grep -RInE 'root|alias|deny|allow' /etc/nginx/sites-enabled /etc/nginx/conf.d 2>/dev/null
next diagnostic step
Where to go from this command
- Nginx 403 hub Use for file-mode branch.
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.