kabachaa has asked for the wisdom of the Perl Monks concerning the following question:
#!/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";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Net::SSH2 unable to connect
by McA (Priest) on Feb 26, 2013 at 21:04 UTC | |
|
Re: Perl Net::SSH2 unable to connect
by VinsWorldcom (Prior) on Feb 26, 2013 at 21:07 UTC | |
by kabachaa (Novice) on Feb 26, 2013 at 21:44 UTC | |
by VinsWorldcom (Prior) on Feb 27, 2013 at 13:59 UTC | |
|
Re: Perl Net::SSH2 unable to connect
by reisinge (Hermit) on Feb 26, 2013 at 23:07 UTC | |
|
Re: Perl Net::SSH2 unable to connect
by salva (Canon) on Feb 27, 2013 at 09:03 UTC |