You got it backwards. See how confusing this is? $ ls -ld x dr-x------ 2 f4185 users 4096 Jun 5 08:41 x $ ls x data $ cat x/data Thu Jun 5 08:41:36 PDT 2008 $ chmod 400 x $ ls -ld x dr-------- 2 f4185 users 4096 Jun 5 08:41 x $ ls x data $ cat x/data cat: x/data: Permission denied $ chmod 100 x $ ls -ld x d--x------ 2 f4185 users 4096 Jun 5 08:41 x $ ls x /bin/ls: x: Permission denied $ cat x/data Thu Jun 5 08:41:36 PDT 2008 $
-----Original Message----- From: Linux on 390 Port [mailto:[EMAIL PROTECTED] Behalf Of Edmund R. MacKenty Sent: Thursday, June 05, 2008 8:30 AM To: [email protected] Subject: Re: Ignorance question about access list on a directory On Thursday 05 June 2008 11:14, McKown, John wrote: >I am constantly getting confused about the "r" and "x" access bits on a >directory. Unless I am off again, the "r" bit allows me to sequentially >read the contents of a directory (like reading a sequential text file, >sort of). The "x bit allows me to "search" a directory for a specific >file name (like doing a keyed read on an ISAM type file). In any case, >is there any real reason why I would have an "r" and not an "x" or vice >versa? Does an "r" allow me to list the files in a directory, but not >open any of them? I.e. do I need "x" authority in a directory to read a >file contained in that directory? As you can see, I am confused. You're close, but just a bit off. :-) The 'r' (read) permission does not let you read sequentially through a directory. That's what 'x' (search) does. What 'r' gives you is the ability to look in the directory for a specific name and get its inode. That is, you can stat(2) a name within that directory. For example, if /bin only granted me read permission, but not search (say it had mode 0751 for some reason), I would be able to run /bin/cp from my shell, even if I just typed "cp", because it would be doing a stat() call on a specific name. But command completion would not work (if I typed 'c' then a tab, I would not see "cp" listed in the output), and I could not do wildcard matches (doing "echo /bin/c*" would output "/bin/c*"). Does that make sense? - MacK. ----- Edmund R. MacKenty Software Architect Rocket Software, Inc. Newton, MA USA ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390 __________________________________________________________________________________________________ CONFIDENTIALITY NOTICE: This email from the State of California is for the sole use of the intended recipient and may contain confidential and privileged information. Any unauthorized review or use, including disclosure or distribution, is prohibited. If you are not the intended recipient, please contact the sender and destroy all copies of this email. ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390
