Hema
Hema

Reputation: 167

How to specify StrictHostKeyChecking as no while using Net::SSH::Perl?

I tried using StrictHostKeyChecking for Net::SSH::Perl as below and it didn't work.

my $ssh = Net::SSH::Perl->new("$server", debug => 1, protocol => 2, StrictHostKeyChecking => "no") or die "Error connecting server $server";

Please let me know how to make it work.

Upvotes: 0

Views: 2756

Answers (2)

sateesh
sateesh

Reputation: 28693

StrictHostKeyChecking is not one of the named parameters accepted by method "new". In such cases as mentioned in the documentation of Net::SSH::Perl you can pass value for that parameter using the options parameter. Say something like below would work:

my $ssh = Net::SSH::Perl->new("$server",
                               debug => 1, protocol => 2,
                               options=> ["StrictHostKeyChecking  no"]);

Upvotes: 2

mpapec
mpapec

Reputation: 50667

Perhaps,

my $ssh = Net::SSH::Perl->new($server,
  debug => 1, 
  protocol => 2,
  strict_host_key_checking => "no"
) or die "Error connecting server $server";

Upvotes: 3

Related Questions