Matt Joiner Matt Joiner - 1 year ago 38
Linux Question

Get reason for permission denied due to traversed directory not executable

I have a file

that is readable by a user
. But
does not provide executable permission by
, and thus the path
cannot traverse through
. For an arbitrarily long path, how would I determine the cause for not being able to access a given path due to an intermediate path not being accessible by the user?

Answer Source

Alternative answer to parsing the tree manually and pinpointing the error to a single row would be using namei tool.

namei -mo a/b/c/d
f: a/b/c/d
 drwxrw-rw- rasjani rasjani a
 drw-rwxr-x rasjani rasjani b
                        c - No such file or directory

This shows the whole tree structure and permissions up until the entry where the permission is denied.