ecuguru has asked for the wisdom of the Perl Monks concerning the following question:
my $result = &SU("/bin/echo","hi");
#!/usr/bin/perl -w use strict; print CGI::header(); my $result = &SU("/bin/echo","hi"); print $result; exit; sub SU(){ my $app = $_[0]; my $args = $_[1]; $su = Sudo->new( { sudo => '/usr/bin/sudo', username => "root", password => "password", program => $app, program_args => $args } ); $result = $su->sudo_run(); if (exists($result->{error})) { print "Error is $result"; } else { if ($result->{stdout}eq""){ warn(); print "Null response"; } return ($result->{stdout}); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Executing Sudo Console via Web
by ELISHEVA (Prior) on May 21, 2009 at 08:17 UTC | |
|
Re: Executing Sudo Console via Web
by tilly (Archbishop) on May 21, 2009 at 06:01 UTC |