in reply to Re: Failed to connect the server using Net::SSH::Perl
in thread Failed to connect the server using Net::SSH::Perl

$ssh->login($username,$password); this is the 57th line. If I'm using system "ssh ... " it will work fine. I'm trying to use it through Net:SSH::Perl I dont want to use the shell script inside the perl script.
  • Comment on Re^2: Failed to connect the server using Net::SSH::Perl

Replies are listed 'Best First'.
Re^3: Failed to connect the server using Net::SSH::Perl
by salva (Canon) on Apr 19, 2010 at 14:56 UTC
    You only need to run the code I posted before once in order to populate ~/.ssh/known_hosts, after that, your script using Net::SSH::Perl would be able to connect to any host.

    update: it seems that Net::SSH::Perl looks for the host keys in ~/.ssh/known_hosts2. I don't know if just copying the entries saved by your system SSH client from ~/.ssh/known_hosts to ~/.ssh/known_hosts2 will work.