How to understand rwx permissions for directories?

2019-07-16 11:02发布

问题:

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

回答1:

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



回答2:

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)