Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How do I generate a listing of all users who can access a directory?

by insensate (Hermit)
on May 04, 2004 at 19:40 UTC ( [id://350509]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-19 00:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found