namei
Overview
namei walks a path component by component, showing whether each element is a file, directory, or symlink — and optionally the permission checks a process would face. Excellent for debugging “permission denied” on deep paths and symlink loops.
Package: usually util-linux (preinstalled on Ubuntu).
Syntax
namei [options] pathname...Common Options
| Option | Description |
|---|---|
-l |
Long listing (mode, owner, group) |
-m |
Mode bits only style (see man) |
-o |
Show owner |
-v |
Vertical layout |
-x |
Show mount point crossings |
-n |
Don’t follow symlinks (show link itself) |
Examples with Explanations
Diagnose a path
namei -l /var/www/html/index.htmlReveals which directory lacks x for your user or which symlink target is wrong.
Follow ownership along the way
namei -l /home/alice/.ssh/authorized_keysClassic SSH “modes are too open” / wrong ownership investigations.
Mount boundaries
namei -x /mnt/data/subdir/fileShows when a path crosses into another mount.
Notes & Pitfalls
- Interprets the path as the calling user would for access checks when using modes.
- Symlink cycles are reported instead of hanging forever.
- Still verify with
ls -ldon each component for ACLs (getfacl).
Additional Resources
man namei