For the Life of me I can not figure out why I can't get the following code to work. I know the destination is running ssh 2 and I can SSH to it.

#!/usr/bin/perl -w use Net::SSH::Perl; use strict; my (%params, $ssherr, $sshexit); $params{'protocol'} = '2'; $params{'port'} = '22'; $params{'debug'} = 'true'; $params{'interactive'} = 'true'; $params{'compression'} = 'false'; $params{'identity_files'} = [$ENV{HOME}."/.ssh/id_rsa"]; $params{'options'} = ["RSAAuthentication yes", "PasswordAuthentication no", "ConnectTimeout 10", "BatchMode no", "FallBackToRsh no", "RhostsAuthentication no", "RhostsRSAAuthentication no", "KeepAlive yes"]; my $sshconn = Net::SSH::Perl->new("secsscsr01", %params); $sshconn->login('user', 'password'); my ($out1, $err1, $exit2) = $sshconn->cmd("ls -l"); if ($out1){print "Output:\n$_\n\n";} if ($err1){print "Error:\n$_\n\n";} print "Exit Code:\n$exit2\n\n";


I get the following when it is executed:
comops:~/tkl # perl -w ./sshtkl.pl comops: Reading configuration data /root/.ssh/config comops: Reading configuration data /etc/ssh_config comops: Allocated local port 1023. comops: Connecting to secsscsr01, port 22. comops: Remote protocol version 2.0, remote software version OpenSSH_3 +.6.1p2 comops: Net::SSH::Perl Version 1.25, protocol version 2.0. comops: No compat match: OpenSSH_3.6.1p2. comops: Connection established. comops: Sent key-exchange init (KEXINIT), wait response. comops: Algorithms, c->s: 3des-cbc hmac-sha1 zlib comops: Algorithms, s->c: 3des-cbc hmac-sha1 zlib comops: Entering Diffie-Hellman Group 1 key exchange. comops: Sent DH public key, waiting for reply. Connection closed by remote host. at /usr/lib/perl5/site_perl/5.8.3/Ne +t/SSH/Perl/Kex/DH1.pm line 41


Sparky
FMTEYEWTK

In reply to SSH2 Connection issue with Net::SSH:Perl by sparkyichi

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.