Back to commands

Dangerous Commands

Read-only

Inspect Permissions Before Changing Them

A file or directory has a permission issue, but recursive fixes could break more than they repair.

Command

namei -l /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 use inspection as the final fix; it only identifies where the permission problem is.

Expected output

A component-by-component permission and owner listing for the path.

System impact

Read-only. Nothing changes. The command shows permissions for each path component.

May require elevated permissions on protected paths or service-owned files.

Recovery / rollback: no state is changed.

When to use it

Use this before `chmod -R` or `chown -R` so you know which layer actually blocks access.

When not to use it

Do not use inspection as the final fix; it only identifies where the permission problem is.

next steps

Related commands

Linux Survival Basics Read-only

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
Hosting Operations Can be slow

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
Cybersecurity Triage Can be slow

Find Writable Directories Missing the Sticky Bit

A writable log directory is not the same thing as a safe shared directory.

find /srv/www/example -type d -perm -0002 ! -perm -1000 -printf '%m %u:%g %p\n' 2>/dev/null | sort
Cybersecurity Triage Can be slow

Find Loose Private Key Permissions

SSH private keys should not be readable like ordinary files.

find /home -type f -name 'id_*' -printf '%m %p\n' 2>/dev/null | awk '$1 > 600'
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.

  • LPIC-1 style command-line practice
  • LFCS style performance-task practice
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.