Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

namei

Follow a path step by step and show every directory and link on the way, with owner and permissions.

Niveau
Dagelijks Linux
Groep
Rechten
Root nodig
Nee
Pakket
util-linux

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

"Permission denied" often comes from a directory higher up in the path, not from the file. namei -l PATH lists each part of the path with its mode, owner and group, so you see at once where an x is missing. It also follows symbolic links and shows where they point.

Zo schrijf je het

namei [OPTION]... PATHNAME...

Opties 9

Meest gebruikt

-l, --long
Show mode, owner and group (same as -m -o -v).
-m, --modes
Show the mode (permissions) of each part.
-o, --owners
Show owner and group of each part.
-v, --vertical
Line up the modes in a column.
-x, --mountpoints
Show mount point directories with a D.
-Z, --context
Show the SELinux context of each part.
-h, --help
Show help.
-V, --version
Show the version.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1Check the whole path

    namei -l /srv/sales/plan.txt
    f: /srv/sales/plan.txt
    dr-xr-xr-x root root  /
    drwxr-xr-x root root  srv
    drwxrws--T root sales sales
    -rw-r--r-- anna sales plan.txt

    Others have no x on sales: they cannot reach plan.txt.

  2. 2Find where a link points

    namei /etc/localtime
    f: /etc/localtime
     d /
     d etc
     l localtime -> ../usr/share/zoneinfo/Europe/Amsterdam

    Follows every link to the real file.

  3. 3Debug a web server 403

    namei -l /var/www/html/app/index.html

    The apache user needs x on every directory and r on the file.

  4. 4Show SELinux labels on the way

    namei -Z /var/www/html/index.html

    Next step after the modes: the SELinux types.

  5. 5Show mount points in the path

    namei -x /home/lisa/data

    D marks a directory where another file system is mounted.

  6. 6Only modes, lined up

    namei -mv /etc/ssh/sshd_config

    Short view.

  7. 7Do not follow links

    namei -n /usr/bin/python3

    Shows the link itself only.

  8. 8Check an NFS home path

    namei -l /home/lisa/projects

    A root_squash export or a wrong mode on the mount point shows up here.

  9. 9Check a path for another user

    su - carol -c 'namei -l /data/sales/bob.txt'

    Run it as the user who has the problem.

  10. 10Find a broken link

    namei /opt/app/current

    "No such file or directory" shows which link target is missing.

Exitcodes

0Done.
1Error (for example a part of the path does not exist).

Volledige handleiding

Deze pagina legt het commando uit in eenvoudige woorden. De originele handleiding heeft elk detail.

In je terminal: man namei