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

#!/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}\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 "Here is where we try to make the ssh"; my $ssh = Net::SSH::Perl->new('my_personal_box'); print "here is the ssh part: $ssh"; $ssh->login("my_userid", $mypassword); print end_html;

If you put your code samples inside code tags then it's easier to read.

So, what have you tried to fix the 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? This is a message that SSH wants to update your known hosts file. Fix that problem, and the error should go away.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Replies are listed 'Best First'.
Re^2: Net::SSH::Perl - looking for someone to point me in the right direction
by Anonymous Monk on Oct 04, 2005 at 20:11 UTC
    Sorry about the tags. I tried that but I think I'm use impaired.

    Well, nothing, really. I work the ssh by hand and can see where the key information tries to write. I looked at all the files and found that I have a ./ssh in root and my_userid (which is expected). I turned on total use permissions for each just to see if it is trying to access one of these - but it's not.

    So I went into the Hosts.pm file until Net::SSH::Perl and discovered the routine "sub _add_host_to_hostfile" is the one containing the check and error.

    The code in there that errors is the following:

    unless (-d $dir) { print "Inside the 'unless'". "<br / >"; require File::Path; File::Path::mkpath([ $dir ])


    Now I'm pretty much stuck. I feel like the dullest person in the world right now. I apologize!

    Thank you for the help. I AM happy to have it! REALLY!!

      Why don't we back up a bit -- what are you trying to do, log on to an SSH session through a form?

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

        Yes. From my original post:

        "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."

        If there is a better way to do this than I am game.

        In the long run I hope to use an HTML form to submit a job under a userid/password so that a job can execute as that user and return data to a directory owned by them.

        Does anyone else do this?