now i am user lawrence.li ,I can see directory lijunda with read privilegebut now i have no read privilege,why can i still see this directory?I am confused that what is the difference between r and -no read privilege,can anybody tell me why? thank you very much
why can I see the directory without read privilege?
linux;shell
Try ls -l /tmp/lijunda and all you will see is the names of the files withinyou 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 numbersthat'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 permissionnot 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 directoryyou 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 contentsyou 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 fileyou need:read permissions on the file itself,execute permissions on the directory that contains the file*, andat 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.$ whoamivagrant$ ls -ltotal 12drwxrwx--x 2 pete pete 4096 Dec 24 08:51 execute_onlydrwxrwxr-x 2 pete pete 4096 Dec 24 08:52 read_and_executedrwxrwxr-- 2 pete pete 4096 Dec 24 08:52 read_only$ ls -l read_only/ls: cannot access read_only/mysterious_file: Permission deniedtotal 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_fileThis 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.