I'm trying to use Net::SSH::Perl to establish a secure connection to a server through CGI. I'm the VERY first to admit that perhaps this may not be the way to go but I'm a new and needing advice. Please PLEASE offer any!

I created a form with a 'post' to a cgi script. The cgi script tries to use Net::SSH::Perl to login to the server. It won't complete and returns the following error:

Software error: Can't write to /.ssh/known_hosts2: Permission denied at /usr/lib/perl5 +/site_perl/5.8.5/Net/SSH/Perl.pm line 380
Here is the script that I would like to try (unless I can be told it's better to be done another route - and I'm WAY willing to go there!):
#!/usr/bin/perl -wT use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); use strict; print header; print start_html("Thank You"); print h2("Thank You"); my %form; foreach my $p (param()) { $form{$p} = param($p); #print "$p = $form{$p}<br>\n"; } print end_html; my $mypassword; $mypassword = '******'; my $var; my $val; print header; foreach $var (sort(keys(%ENV))) { $val = $ENV{$var}; $val =~ s|\n|\\n|g; $val =~ s|"|\\"|g; #print "${var}=\"${val}\"\n"; } use Net::SSH::Perl; print "<br / > Here is where we try to make the ssh<br / >"; my $ssh = Net::SSH::Perl->new('my_personal_box'); print "<br / >here is the ssh part: $ssh <br / >"; $ssh->login("my_userid", $mypassword); print end_html;
Thank you for ANY advice you may offer. Trust me! It is sincerely appreciated! Ronni

CODE tags added by Arunbear


In reply to Net::SSH::Perl - looking for someone to point me in the right direction by Anonymous Monk

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.