How to understand rwx permissions for directories?

2019-07-16 10:24发布

What does it mean to read, write, and execute a directory? It's intuitive on files, but I don't understand it for directories.

2条回答
劳资没心,怎么记你
2楼-- · 2019-07-16 10:53

A read in a directory implies you can do a ls in it -- thus reading what's in that directory.

A write enables you to write a file in the directory. This one is fairly intuitive.

An execute is a little bit less intuitive. An execute allows you to cd into a directory.

You could do a read in a directory without actually being in it. A possible use for execute only permissions on a directory would be if you want someone to be able to cd in a directory but you don't want him to be able to see what files/folders are in that directory (implying that the user knows the file/folder name to access within that directory)

查看更多
太酷不给撩
3楼-- · 2019-07-16 11:04

If you have write permission for a directory, you can create new entries (files/folders/etc).

If you have read permission for a directory, you may list ls the directories contents.

If you have execute permission for a directory, you may change chdir into that directory.

For more information, please see this thread: http://www.unix.com/unix-dummies-questions-answers/98744-about-read-write-execute-permissons-directory.html

查看更多
登录 后发表回答