tgdaero has asked for the wisdom of the Perl Monks concerning the following question:
Error: bad password or master process exited unexpectedly
Apache/2.2.17 using suexec; perl, v5.10.0 built for sun4-solaris; OpenSSH_5.3p1 OpenPKG-CURRENT, OpenSSL 0.9.8k 25 Mar 2009;
Apache runs as user AP, while my CGI runs via suexec as user U2.
My Module contains the following method and is called from the main CGI script. If the same code is used directly in a .pl on the command line it works.
# Create / Remove ZFS-Directories sub changeZFS { my $type = shift; my $UID = shift; my $IDname = shift; my $ou = shift; my $msg; my ($stdout, $stderr, $exit) = undef; my $ssh = Net::OpenSSH->new("$ZFS_HOST", ctl_dir => $SSH_CTLDIR, u +ser => $SSH_USER, passwd => $SSH_PWD); $ssh->error and return "Cannot Create Homedirectory $ZFS_HOST: + " . $ssh->error(); print LOG "changeZFS(): $ZFS_HOST: $ZFS_CMD $type $UID $IDname $ou +\n"; ($stdout, $stderr, $exit) = $ssh->capture({timeout => 20}, "$ZFS_C +MD $type $UID $IDname $ou:"); $ssh->error and print LOG "Command $ZFS_CMD failed: " . $ssh-> +error; print LOG "OUT=$stdout, ERR=$stderr, EXIT=$exit\n"; print LOG "changeZFS() msg:$stdout\n"; return $stdout; }
I assume the Net::OpenSSH uses user=AP as I needed to change the CTL_DIR away from the HOME of AP. This user is very restricted and has no ~/.ssh directory.
Running from CLI as AP works as well but fails adding known_hosts
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::OpenSSH - connection from out a CGI script fails
by salva (Canon) on Jan 20, 2012 at 10:10 UTC | |
|
Re: Net::OpenSSH - connection from out a CGI script fails
by pklausner (Scribe) on Jan 20, 2012 at 10:40 UTC | |
by logicalheart (Initiate) on Feb 13, 2014 at 19:17 UTC | |
|
Re: Net::OpenSSH - connection from out a CGI script fails
by jethro (Monsignor) on Jan 20, 2012 at 10:11 UTC | |
by salva (Canon) on Jan 20, 2012 at 10:17 UTC | |
by jethro (Monsignor) on Jan 20, 2012 at 12:20 UTC | |
by jero2528 (Initiate) on Mar 14, 2017 at 14:16 UTC |