12

Is there a tool in Linux that will take a path such as /var/log/httpd/error_log, and print the permission for each branch of the path, i.e.:

/var:                     root:root,         0755
/var/log:                 root:root,         0755
/var/log/httpd:           www-data:root,     0700
/var/log/httpd/error_log: www-data:www-data, 0644

Such a tool would make permission troubleshooting much easier, especially with exceptionally long paths like on file servers and such.

23

You want namei.

# namei -l /var/log/nginx/error.log
f: /var/log/nginx/error.log
drwxr-xr-x root  root  /
drwxr-xr-x root  root  var
drwxr-xr-x root  root  log
drwx------ nginx nginx nginx
-rw-r--r-- nginx nginx error.log

Note that this command is Linux-specific and may not exist on other operating systems. Also do not confuse it with the namei() system call.

  • 2
    adds to list of handy commands – Nathan C Oct 23 '14 at 18:30
  • That worked perfectly for my purposes, one "accept" and a +1 for you. – Soviero Oct 24 '14 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.