[Ssh-sftp-perl-users] Slow connections with ssh key but quick with password
Brought to you by:
dbrobins
From: Miky J <mi...@ya...> - 2006-02-23 15:50:59
|
Hello, I have a public key id_rsa in my .ssh directory. When I use it it's very slow to connect to the second, thrid,... host. If I rename this id_rsa, then I use passwords everything and it's quick. I have modules IO::Handle Math::BigInt::GMP Any hint ? #!/usr/bin/perl use IO::Handle; use Net::SSH::Perl; use Net::DNS; use Getopt::Std; use strict; my $login='root'; my $password1='pass1'; my $password=$password1; my ($ok,$notok,$total); $total=$ok=$notok=0; my %cmd=(); $cmd{1}="uname -a"; login('host1',%cmd); login('host2',%cmd); sub login { my ($host,%mes_cmd) = @_; my $ssh; $ssh = Net::SSH::Perl->new($host, debug=>1, protocol=>'2', port=>22, PreferredAuthentications=>'publickey,password', identity_files => ["/home/mikydeb/.ssh/id_rsa"]); $ssh->login($login, $password); my $resultat; print "$host"; print "\t"; print "\t$password\n"; for (keys %mes_cmd) { ($resultat) = $ssh->cmd($mes_cmd{$_}); print "$host\t$resultat" if $resultat; } $password=$password1; $ok++; } print "\n---------------------------------------\n"; print "Nb total of machines: $total\n"; print "Nb machines ok: $ok\n"; print "Nb machines unreachable: $notok\n"; print "---------------------------------------\n"; ___________________________________________________________________________ Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international. Téléchargez sur http://fr.messenger.yahoo.com |