Hi everyone,

I made a script using Net::SSH::Perl and I'm faced to some slow connexion times.
I use rsa key to connect and it seems to be very slow, but not all the time.
Sometimes it's very quick ( 1sec ), sometimes not (few minutes).
I tried to use password instead of a key, and it seems to be quicker.
You may have an idea to help me ....
Thanks

Here is the script :

#!/usr/bin/perl -w

use strict;
use Net::SSH::Perl;

my $server = '127.0.0.1';
my $user = 'vmx';
my $dsa = './vmx.key';
my $pwd = 'toto';
my $command = '/bin/pwd';
my $ssh;

if( $ARGV[0] && "$ARGV[0]" =~ m/key/ ) {
       my %params = ( identity_files => [$dsa] );
       $ssh = Net::SSH::Perl -> new($server, %params);
       $ssh -> login($user);
}
else {
       $ssh = Net::SSH::Perl -> new($server);
       $ssh -> login($user, $pwd);
}

my($stdout,$stderr,$exit) = $ssh -> cmd($command);
if($stderr) {
   print "stderr : "."$stderr";
}
print "stdout : "."$stdout";

--
Julien Collas
jul.col...@gmail.com


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to