How do I see if a file is readable by a specific user on Linux?

I have a complicated file hierarchy and I don't want to check the permissions on each directory. Is there any way to find out immediately if one file is readable by a given user? (outside of logging in as that user)


This will only work if you have root privileges


if the user has a valid login shell

su username -c 'ls /long/dir/user/filename'

if the user has a nologin shell /sbin/nologin and similar:

su username -s /bin/sh -c 'ls /long/dir/user/filename'

To find out why a user cannot access a file (builds readable output tree with permissions):

# namei -om /home/someuserhomedir/Maildir/

f: /home/someuserhomedir/Maildir/
dr-xr-xr-x root     root      /
drwxr-xr-x root     root      home
drwx------ someuser somegroup someuserhomedir
drwx------ someuser somegroup Maildir