now i am user "lawrence.li" ,I can see directory "lijunda" with "read" privilege

enter image description here

but now i have no "read" privilege,why can i still see this directory?

enter image description here

I am confused that what is the difference between "r" and "-"(no read privilege),can anybody tell me why? thank you very much

  • Because that directory inside /tmp directory, which you did have permission.
    – cuonglm
    Dec 24, 2015 at 4:15
  • 3
    Please don't post screenshots of text, paste the actual text...
    – jasonwryan
    Dec 24, 2015 at 4:43

2 Answers 2


Try ls -l /tmp/lijunda and all you will see is the names of the files within—you won't be able to open the files, or even see the file size, permissions, etc. about the files within that directory.

This is because the directory itself only contains filenames and inode numbers—that's all.

Read access to the filenames is controlled by the read permission.

Access to the inodes pointed to by the directory is controlled by the execute permission—not the read permission. The inodes contain all the actual details about the file, such as filesize, owner, permissions, time last modified, and the physical location (on your physical hard disk) of the binary data which comprises the file's contents.

To view the names of the files in the directory—you need read permission on the directory. You don't need execute or write permissions for this.

To view the details of the files in the directory i.e. to view the inode contents—you need execute permissions on the directory. Read permissions on the directory makes no difference for viewing details of a file if you already know the file's name.

To view the details of files that you don't already know the names of, you need read and execute permissions.

And finally, to view the contents of a file—you need:

  1. read permissions on the file itself,
  2. execute permissions on the directory that contains the file*, and
  3. at least one of: read permissions on the directory containing the file OR the knowledge of the name of the file through some other means.

See below for example.

$ whoami
$ ls -l
total 12
drwxrwx--x 2 pete pete 4096 Dec 24 08:51 execute_only
drwxrwxr-x 2 pete pete 4096 Dec 24 08:52 read_and_execute
drwxrwxr-- 2 pete pete 4096 Dec 24 08:52 read_only
$ ls -l read_only/
ls: cannot access read_only/mysterious_file: Permission denied
total 0
-????????? ? ? ? ?            ? mysterious_file
$ cat read_only/mysterious_file 
cat: read_only/mysterious_file: Permission denied
$ ls -l execute_only/
ls: cannot open directory execute_only/: Permission denied
$ ls -l execute_only/unicorn_file
-rw-rw-r-- 1 pete pete 55 Dec 24 08:51 execute_only/unicorn_file
$ cat execute_only/unicorn_file
This file only exists for you if you know it's here ;)
$ ls -l read_and_execute/
total 4
-rw-rw-r-- 1 pete pete 83 Dec 24 08:52 jack_sparrow
$ cat read_and_execute/jack_sparrow 
"After the reading, you will be executed."
"That's *Captain* Jack Sparrow to you!"

*You also need execute permissions on all the parent directories all the way up to root, by the way.

  • 2
    Thorough job. Well done. Dec 24, 2015 at 18:06

The read permission refers to the ability to read the contents of the file. The ability to see what files/directory, you have to remove the users execute permission on the directory itself. This would, of course, mean that the user could no longer see any files/directories within that directory.

See this link for example:

Directory permissions

The chmod command can also be used to control the access permissions for directories. In most ways, the permissions scheme for directories works the same way as they do with files. However, the execution permission is used in a different way. It provides control for access to file listing and other things.

Edit: It would seem I did a poor job of explaining this, as I was meaning to reference the parent directory (tmp) and not the lijunda directory. @Wildcard does a much better (and more in-depth) job in answering this in their answer here

  • 1
    I do not see how this explained the OP's problem. Although you explain the right thing about directory permission, you missed the point that the problem came from the parent directory of lijunda directory, not itself.
    – cuonglm
    Dec 24, 2015 at 4:28
  • This is misleading and, as @cuonglm says, not really related. If you remove execute permissions but not read permissions on a directory you'll still be able to (a) see the directory itself, assuming proper permissions on the parent directory, and (b) see the names of the files in that directory. See my answer for details.
    – Wildcard
    Dec 24, 2015 at 9:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .