#!/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";
In reply to Perl Net::SSH2 unable to connect by kabachaa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |