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

Post your script source code and its output so we can see what you are doing at line 57, please!

Anyway, I guess your problem is that your host keys are not listed on ~/.ssh/known_hosts. You can add them as follows:

my @hosts = qw(foo1.bar.com foo2.bar.com ...); for (@hosts) { system "ssh $_ -o PreferredAuthentications=publickey -o StrictHostKe +yChecking=no true" }

Replies are listed 'Best First'.
Re^2: Failed to connect the server using Net::SSH::Perl
by saji (Initiate) on Apr 19, 2010 at 14:49 UTC
    $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.
      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.