How do I check the effective file permissions (including ACLs)/accessibility for/of a given file and a given user (including service/system accounts) without checking the whole path manually?
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. If joe doesn't have at least read access to all folders in the path, he can't access (read/write/execute) the file. So the effective permissions for him (as "world/all" user) are 0 and he can't access the file.
Alternatively: how do I get a list of the permissions (including ACLs) of all users (including service/system accounts) for a given file?
An app or a bash script are also welcome.
A similar question with a slightly different focus has already been asked at Unix & Linux: How to check if a user can access a given file?