[Israel.pm] check file privilage
gabor at perl.org.il
Wed Jun 30 17:46:45 PDT 2004
On Wed, 30 Jun 2004, Pinkhas Nisanov wrote:
> On Wed, 2004-06-30 at 05:24, Afgin Shlomit wrote:
> > I would like to know if I can know for a specific file if a specific user
> > have unix read/write permission. Not the user that run the program, a
> > different user.
> You need to use "stat" function, it will get
> permission of file and user and group ID of
> owner, then you compare it to UID and GID
> ( "$<" for UID and "$(" for GID ) of script
I am not sure but I think it might be a bit more complex than
that as a user can belong to more groups...
... and looking at perldoc perlvar (search for GID) you'll
see that $( can give you all the values.
there must be a solution somewhere already, look around
More information about the Perl