For this question assume a file with 604 perms in a directory with 700 permissions. Assume this file exists: /test/file
A non-root user can techincally read that file but in practice to read it the process must be given the pathname to the file, and the kernel will check that the directory /test
has the executable bit set. Because it is not set, the read will fail.
If the one does a chmod o+x /test
, then a non-root user can do a cat /test/file
and read the file. Is there a way to read the file without setting the execute bit on the directory /test
.? For example, could one somehow pass the file to the fopen
function in C without giving it the full pathname. You could if the process was running the test
dir, but to be in that dir it would need the right permissions anyway.