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

Reply via email to