ls mystery

Michael Abbott michael at araneidae.co.uk
Mon Feb 16 08:54:44 GMT 2004


> # ls -al /usr/ports/distfiles | grep xc
> drw-r--r--   2 root   wheel       512 Oct 31 03:03 xc
     ^
     No "execute" access on this directory.

> $ ls -al /usr/ports/distfiles/xc
>
> <zilch>

In this context "x" means ability to search directory, so this is normal.
Of course, root being root gets to ignore this flag.

> Why can't I read the dir as a user (group wheel) with permissions of
> 644 but I can with permissions of 755? What the hell have the
> executable bits got to do with reading a dir? I'm confused... :(

To be precise, on a directory the "r" bit allows you to access a file *if*
you know its name, while the "x" bit allows you to list the files in the
directory.  Not quite sure what it's used for in practical security
application, but that's the standard protection model.

> I think I saw some ls stuff going in when I cvs-upped the other night
> to 4.9 RELEASE. Anybody aware of a problem or am I getting something
> wrong?

There's definitely nothing wrong here, this is standard behaviour.




More information about the Ukfreebsd mailing list