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

Thanks for any recommendations

In reply to Net::OpenSSH - connection from out a CGI script fails by tgdaero

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.