Sudo is a Perl extension for running a command line sudo.
SYNOPSIS
use Sudo;
my $su;
$su = Sudo->new(
{
sudo => '/usr/bin/sudo',
sudo_args => '...',
username => $name,
password => $pass,
program => '/path/to/binary',
program_args => '...',
# and for remote execution ...
[hostname => 'remote_hostname',]
[username => 'remote_username']
}
);
$result = $su->sudo_run();
if (exists($result->{error}))
{
&handle_error($result);
}
else
{
printf "STDOUT: %sn",$result->{stdout};
printf "STDERR: %sn",$result->{stderr};
printf "return: %sn",$result->{rc};
}
Sudo runs commands as another user, provided the system sudo implementation is setup to enable this. This does not allow running applications securely, simply it allows the programmer to run a program as another user (suid) using the sudo tools rather than suidperl. Suidperl is not generally recommended for secure operation as another user. While sudo itself is a single point tool to enable one user to execute commands as another sudo does not itself make you any more or less secure.
Warning: This module does not make your code any more or less secure, it simply uses a different mechanism for running as a different user. This requires a properly configured sudo system to function. It has all the limitations/restrictions of sudo. It has an added vulnerability, in that you may need to provide a plain-text password in a variable. This may be attackable. Future versions of the module might try to address this.
This module specifically runs a single command to get output which is passed back to the user. The module does not currently allow for interactive bidirectional communication between the callee and caller. The module does not spool input into the callee.
Product's homepage
Requirements:
· Perl