Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: More Directory Permissions

by questor (Acolyte)
on May 03, 2000 at 21:16 UTC ( #10131=note: print w/ replies, xml ) Need Help??

in reply to More Directory Permissions

There are only three bits, r, w, and x, for each of the groups of users (u, g, o) in the Unix permission scheme, so the meanings of these bits get a bit convoluted at times. (Actually, there's three more, setuid, setgid, and sticky, but they're even worse.) For directories, r is the ability to read the directory, to list its contents. If you don't have this, ls directoryname fails. w for write means adding, deleting, or renaming (moving) files; if you've got w permission, you can remove a file even if you're not the owner of the file (unless the sticky bit is on -- like I said, worse).

The x bit is probably the most interesting to the person who posed this question: this bit being on allows (and is necessary for) two things: "cd"'ing to the directory, and moving though the directory to access files and subdirectories. If you have x but not r, you can't read the directory but if you know a file/subdirectory is there, you can operate on that file/subdirectory according to your permissions on that item. Conversely, if you have r but not x, you can see the item but can't do anything to it: ls will show it exists, but ls -l will fail on trying to give you any of the attributes of it, it can't go through the directory to get at the file and find its attributes.

x without r, or r without x, is generally not too useful; so directory permissions tend to be (numerically) 7s or 5s where access is desired (depending on whether write is on or not). Having just x on isn't much of a security hole, since it doesn't provide any information, and one still needs still needs permissions granted on the subitems to do anything with them, so frequently one will just leave x on (1 numerically). So directory permissions will tend to be all-odd (751, 711, etc.), while non-executable files are all even (644, 640, etc.) (since you don't want to have your letter to your mother treated as an executable shell script).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://10131]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2016-07-02 09:08 GMT
Find Nodes?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?

    Results (19 votes). Check out past polls.