Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Syntax using user define $>

by bigal_george (Acolyte)
on Jan 01, 2020 at 01:24 UTC ( [id://11110810]=note: print w/replies, xml ) Need Help??


in reply to Re: Syntax using user define $>
in thread Syntax using user define $>

OK sorry if confusing.
Testing $> itself should be false when sudo - yes.
Goal is to allow sudo when needed by files permissions and user otherwise,
Info I had said that when running administrator these should be called:
use strict;
use warnings FATAL=>"all";
if($>)
{
exec { "/path-to-wrapper-program" }
( "/path-to-wrapper-program",$0,@ARGV);
}
My confusion was that Id assumed the exec call was for sudo but now seems pointless, as application runs fine without.

Replies are listed 'Best First'.
Re^3: Syntax using user define $>
by jcb (Parson) on Jan 01, 2020 at 02:47 UTC

    Programs should not automatically reinvoke themselves using sudo, ever. If the program needs to be run with privileges and does not have them, simply report the "Permission Denied" error you get from the system to the user and let the user take the hint to retry with sudo.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-24 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found