*nix user permissions are really simple, but things can get messy when you have to take in account all the parent directory access before reaching a given file. How can I check if the user has enough privileges? If not, then which directory is denying access?
For example, suppose a user joe
, and the file /long/path/to/file.txt
. Even if file.txt
was chmoded to 777, joe still has to be able to access /long/
, and then /long/path/
and then /long/path/to/
before. What I need is a way to automatically check this. If joe
does not have access, I would also like to know where he has been denied. Maybe he can access /long/
, but not /long/path/
.