in reply to How do I generate a listing of all users who can access a directory?

"Unix directory access permission require someone to have access to every directory in the path leading up to a given directory,"

Be careful. A user needs execute permission on a directory to pass through, read permission to view contents. opendir will succeed on a directory where you have '--x' permissions but you will obviously not have access to directory contents. Make sure a component of your solution actually tries a read on each directory.

Update:

I was not clear, opendir will fail on a directory that doesn't have it's 'r' bit set (assuming non-root). However if I open a directory say /homes/insensate/allx/freeforallWhere  allx is  --x--x--x and freeforall is  rwxrwxrwx the opendir will succeed.

My point is to not let an assumption that access to a given directory implies access to parent directories stand.

Replies are listed 'Best First'.
Re: Re: How do I generate a listing of all users who can access a directory?
by sgifford (Prior) on May 04, 2004 at 19:55 UTC
    That's not how my copy of perl is behaving:
    $ ls -ld /tmp/test drwx--x--x 2 root root 1024 May 4 15:55 /tmp/test $ perl -e 'opendir(D,"/tmp/test") or die "opendir failed: $!\n";' opendir failed: Permission denied