I tried turning on debugging in SSH2 and I'm not sure what it is telling me but there seems to be a hint at the problem.

d:\Desktop>sshtest libssh2_knownhost_init(ss->session) -> 0x294be38 Net::SSH2::KnownHosts::DESTROY Authentication failed (username/password) (-18 LIBSSH2_ERROR_PUBLICKEY +_UNRECOGNI ZED) at D:\Desktop\sshtest.pl line 13. Net::SSH2::DESTROY object 0x247cf08

It looks almost as though the problem is that the knownhost info is being destroyed before I get to the auth step. The code is

my $ssh2 = Net::SSH2->new(debug => 1); $ssh2->connect("shell02.theworld.com") or $ssh2->die_with_error ; $ssh2->check_hostkey('ask', "d:/profiles/known_hosts.pub") or $ssh2->die_with_error ; $ssh2->auth_password($login{user}, $login{password}) or $ssh2->die_with_error;

As if the check_hostkey works and so doesn't "die" but the fact that it works is lost before I do the auth. It is probably a rough trip, but I guess I should take a look at the code for auth_password and see what it is expecting for its public key check, and then work backwards to see what check_hostkey is supposed to leave behind to make auth_password happy. Everything is so hard...:o)


In reply to Re^2: Can't get $ssh2->check_hostkey to work by BernieC
in thread Can't get $ssh2->check_hostkey to work by BernieC

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.