Phoenix.pm: UNIX permissions

Kevin Buettner kev at primenet.com
Fri Nov 12 15:21:59 CST 1999


On Nov 12,  3:22pm, Phaedrus wrote:

> The chmod 111 or ugo+x bit is sort of "overloaded". For files, it means
> you can run them like a program. For a directory, it means that you may
> search the directory (cd into it, etc).

In order to search a directory, you must also have the 'r' bit set as
well.  It it true though that you can access files in the directory if
you already know their name.

E.g,

    ocotillo:kev$ mkdir tmp
    ocotillo:kev$ ls -ld tmp
    drwxrwxr-x   2 kev      kev          1024 Nov 12 14:17 tmp
    ocotillo:kev$ echo 'Hello' >tmp/foo
    ocotillo:kev$ cat tmp/foo
    Hello
    ocotillo:kev$ chmod 111 tmp
    ocotillo:kev$ cat tmp/foo
    Hello
    ocotillo:kev$ ls tmp
    ls: tmp: Permission denied
    ocotillo:kev$ chmod 755 tmp
    ocotillo:kev$ ls tmp
    foo
    ocotillo:kev$ chmod 111 tmp
    ocotillo:kev$ cd tmp
    ocotillo:tmp$ cat foo
    Hello
    ocotillo:tmp$ ls
    ls: .: Permission denied
    ocotillo:tmp$ cd ..
    ocotillo:kev$ rm -rf tmp
    rm: tmp/.: Permission denied
    rm: cannot remove directory `tmp': Directory not empty
    ocotillo:kev$ chmod 755 tmp
    ocotillo:kev$ rm -rf tmp


-- 
Kevin Buettner
kev at primenet.com, kevinb at cygnus.com



More information about the Phoenix-pm mailing list