mtnboy has asked for the wisdom of the Perl Monks concerning the following question:
So I have a condition where I will eventually setuid to other users (think root launching the httpd server as apache)
Obviously I can check the perms after I drop down in permissions, but that's not the idea here. I want to alert the admin before they get nasty failures, and potentially remedy the situation
I would like to check to see if my target user has write/read permissions for a specific set of files. And if not, then change things before I switch users.
Is there a perl way to do this?
if (! -w $file $user) { #do permission-ey things to fix that }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I check if another user can access a file?
by chrestomanci (Priest) on Aug 18, 2011 at 09:07 UTC | |
by thargas (Deacon) on Aug 18, 2011 at 13:45 UTC | |
|
Re: How do I check if another user can access a file?
by roboticus (Chancellor) on Aug 18, 2011 at 02:30 UTC | |
|
Re: How do I check if another user can access a file?
by i5513 (Pilgrim) on Aug 18, 2011 at 10:00 UTC | |
|
Re: How do I check if another user can access a file?
by locked_user sundialsvc4 (Abbot) on Aug 18, 2011 at 13:27 UTC | |
|
Re: How do I check if another user can access a file?
by Perlbotics (Archbishop) on Aug 18, 2011 at 15:46 UTC | |
|
Re: How do I check if another user can access a file?
by blue_cowdawg (Monsignor) on Aug 18, 2011 at 15:55 UTC | |
|
Re: How do I check if another user can access a file?
by slinky773 (Sexton) on Aug 18, 2011 at 17:30 UTC |