[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-24 13:30:55
|
When i do strace on the program it get stuck there 5822 open("/dev/random", O_RDONLY|O_LARGEFILE) = 4 5822 ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfbdf468) = -1 EINVAL (Invalid argument) 5822 _llseek(4, 0, [0], SEEK_CUR) = 0 5822 fstat64(4, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 8), ...}) = 0 5822 fcntl64(4, F_SETFD, FD_CLOEXEC) = 0 5822 read(4, "$\327\364\v\342", 21) = 5 5822 read(4, "\20\235@\1\310W\2668", 16) = 8 5822 read(4, "\2203\356\254\354]\266 ", 8) = 8 5822 close(4) = 0 around the 2nd and 3rd read instruction. --- Miky J <mi...@ya...> a écrit : > 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. Appelez le monde entier à partir de 0,012 /minute ! Téléchargez sur http://fr.messenger.yahoo.com |