Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Writeability of a file for a different user

by strredwolf (Chaplain)
on Aug 03, 2011 at 03:15 UTC ( #918166=note: print w/replies, xml ) Need Help??

in reply to Writeability of a file for a different user

What I would do is stat() the file, which will get you the mask and I think the ID# of the user and group. From that, you can parse through /etc/group and /etc/passwd on any Unix.
Information doesn't want to be free. It wants to be feline.
  • Comment on Re: Writeability of a file for a different user

Replies are listed 'Best First'.
Re^2: Writeability of a file for a different user
by JavaFan (Canon) on Aug 03, 2011 at 06:50 UTC
    That works fine if access control is done solely by the standard permission bits. It fails is access control is done via ACLs, which allows making a file writeable for more than the owner of a file, without having to resort to groups. (One can only be a member of a limited number of groups, a number that quickly exceeds the number of permutations of a small group of people wanting to share files)

    AFAIK, there's no way to ACL querying with just standard Perl. But I'd be surprised if there aren't CPAN modules available that will do ACL management for the more common systems out there (but I haven't checked).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://918166]
[moritz]: seems there's a size limit for hostenum, and the error message just sucks
[vrk]: None, other than the location of the error: auto/NetAddr/IP/
[vrk]: Aha, there's a reference to "bug report 82719" in NetAddr/'s sub _splitref.
[moritz]: wow, that's their idea of an "improved error message"
[moritz]: how about "This network is too large to enumerate all host addresses." or so?
[vrk]: Well, there's a call to notcontiguous() before the error, whose description is "counts the bit positions remaining in the mask when the rightmost '0's are removed"
[vrk]: Clear as mud!

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2017-04-25 07:41 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (449 votes). Check out past polls.