I am having a bit of trouble understanding what the execute permission means for directories. Do I understand it correctly that anything in a directory for which a user does not have x-rights is inaccessible even if the things inside the directory gives specific rights to the user?
Or will the user still have direct access to the things in the directory, but simply cannot list what is in the directory?
(What I am really trying to understand is how safe a directory is from access from other users if they do not have x-permission for it.)
x bit for directory is also called as search bit. Actually, it enables you to access the inodes of the files listed inside the folder. So if you want to access /home/user/foo/bar.txt then you must have search access on every ancestor of bar.txt
Quoting from the page
Please read more at file permission directory section.
Update: Leo raised a very good question. If we know the inode then can we access a file from a directory having it's x bit unset? I believe, we should not be able to do so. I did not test it by c program but rather used some handy bash commands to confirm it.
Since you are asking for directories:
read and execute permissions could be a bit tricky for directories.
For instance if you have read permissions but not execute, you can list the contents of the directory but can not drop into it. Also you can not list specific files or directories even though you know its names.
If you have execute permission but not read, you can drop into it but can not list the files directly. But, if you know names of the files or directories you can list them.
The execute permission on directories mean:
If you do not have the
x
right on your directory you cannot:cd
)Example:
Read Linux File Permission Confusion pt 2 for a good introduction on the topic.
The only thing that the
x
permission does not seem to prevent is to access the names of the files in that directory.Example: