If I have a folder with e.g. the following permissions (0700):
drwx------ 2 patrick patrick 4096 Sep 12 00:00 test
If I understand it correctly, this means only the folders owner can:
- read: list files
- write: create, delete and rename files (but this only works if execute is set as well)
- execute: access file contents and meta-information
If I now add a file to the folder with the permission (0777):
-rwxrwxrwx 1 patrick patrick 0 Sep 12 00:00 testfile
There is no way another user can access the file, even as the file itself can be read, written and executed by all users. Am I correct or am missing some finer points of the Unix permission system?
If I'm correct, is there any reason (except keeping things nice and tidy) to still worry about correct file permissions in that folder? Are there cases (e.g. accesses via relative paths?) where other users may still access the said file?
x
permission ondir
gives you permission to accessdir/file
, which is independent of whether you're able to list the content ofdir
or not (for which you need ther
permission).--x
access to a folder, he can access the content of the all the files in that folder? Isn't "search" not just another term for read, as to search you need to read the file.x
) is not another term for read (r
). Being able to read the content of a directory (iels
it) doesn't mean you're able to access its files. Just try it:mkdir dir; echo yup > dir/yup; chmod 400 dir; ls dir; cat dir/yup
x
on the directory allows the user to enter and traverse the directory. What they can do with the file inside depends on the permissions of the file itself. They can runls
directly against the file or read the contents withcat
or a text editor as I've explained in my answer.