Hi folks,
I have the following in a CGI script:
<code>
my $replace = Sudo->new(
{
sudo => $sudo,
debug => 3,
username => 'root',
program => '/bin/cp',
#program_args => '-f
/tmp/alias_maint/aliases.new /etc/mail/aliases',
program_args => '-f
/tmp/alias_maint/aliases.new /etc/mail/aliases.richf',
}
);
my $replace_rc = $replace->sudo_run;
if (exists $replace_rc->{error}) {
warn "ERROR: ", $replace_rc->{error}, "\n";
}
if (exists $replace_rc->{stdout}) {
warn "STDOUT: ", $replace_rc->{stdout}, "\n";
}
if (exists $replace_rc->{stderr}) {
warn "STDERR: ", $replace_rc->{stderr}, "\n";
}
if (exists $replace_rc->{rc}) {
warn "RC: ", $replace_rc->{rc}, "\n";
}
.
.
.
</code>
When this code gets run (via webpage) I get the following in the
error_log:
<snip>
> output:
> result: 256
STDOUT:
STDERR:
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these two things:
#1) Respect the privacy of others.
#2) Think before you type.
Password:
RC:
</snip>
In other words, it seems to be asking for a password. However when I run
this from a regular prompt as the webserver user, it works fine.
I have a check for the UID in the script, and it's the right one. I also
have NOPASSWD set in sudoers.
Any help is appreciated.
Thanks!
richf
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>