From what I understand about the read permission on directories, it allows listing of which files are in a directory and that's about it.
Given a directory with 0744 permissions, owned by
[userA@localhost ~]$ mkdir -m 0744 /tmp/semi-secret [userA@localhost ~]$ ls -ld /tmp/semi-secret/ drwxr--r--. 2 userA userA 6 Aug 29 10:15 /tmp/semi-secret/ [userA@localhost tmp]$ touch semi-secret/foobar.txt [userA@localhost tmp]$ chmod 0600 semi-secret/foobar.txt
userB, The existence of the file
foobar.txt is apparent from the
[userB@localhost ~]$ ls -l /tmp/semi-secret/ ls: cannot access /tmp/semi-secret/foobar.txt: Permission denied total 0 -????????? ? ? ? ? ? foobar.txt
But why does the
test -e command exit with a non-zero status?! Its only job is to confirm if a file exists or not, and directory permissions are supposed to allow that.
[userB@localhost ~]$ test -e /tmp/semi-secret/foobar.txt || echo "The file doesn't exist." The file doesn't exist.