Why can the ls
command of Ubuntu list the files of a directory with no execution permission set ?
The Test
directory has read and write permissions set but no execution permission set. I understand that the x
attribute of the directory specify whether the directory can be accessed, and if it is not set then it doesn't matter whether r
or w
is set (please correct me if I'm wrong).
The cd
and cat
commands works as expected, i.e. that cannot do their job, since they cannot access the directory.
Edit:
Apologies, after re-reading the original post, I have a better understanding of the question. The files can be listed even though there is no execute permission because you have read permission on the directory. The
x
bit controls access to the inode, which contains the file metadata such as permissions info. This is why the files can be listed, but no permission data is available.https://askubuntu.com/questions/83788/accessing-files-in-a-directory-without-x-permission
See also:
https://unix.stackexchange.com/questions/21251/how-do-directory-permissions-in-linux-work