Perl Net::SSH2 Connect not able to authenticate I have small script to connect to server and then run my Perl script on it but I keep getting this error message. I can connect to the same machine when I run a command - SSH username@hostname using the same credentials. I am new to Perl and Linux so not sure how to debug. Error message : ssh auth failed. Net::SSH2::DESTROY object 0x16393c80 Script:
#!/usr/bin/perl use warnings; use strict; use lib qw(/usr/lib/perl5/site_perl/5.8.8/Net/SSH/Perl); use Net::SSH2; my $host = "server"; my $user = "user"; # your account my $pass = "pasword"; # your password my $cmd; my $ssh2 = Net::SSH2->new(); $ssh2->debug(1); if ($ssh2->connect($host)) { #if ($ssh2->auth_password($user,$pass)) { if ($ssh2->auth_keyboard($user,$pass)) { print "\n Executing command...\n"; $cmd = "ls"; print " ==> Running $cmd\n"; if(is_sshalive($ssh2) == 1) { print "\nSSH connection died"; exit 1; } else { run_testsuite($cmd, $ssh2); } } else { warn "ssh auth failed.\n"; exit 1; } } else { warn "Unable to connect Host $host \n"; exit 1; } print "test passed done 0\n";

In reply to Perl Net::SSH2 unable to connect by kabachaa

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.