Net-SSH-Perl - Re: net-ssh-perl hangs an excessive cpu usage

Posted on Sun Jan 14 01:25:40 2007 by samnelson in response to 2751 (See the whole thread of 4)
Re: net-ssh-perl hangs an excessive cpu usage

I was also seeing this same problem with the script I have listed below. After trying the advice in post 2689 which says to downgrade the Crypt-DH module, I was able to stop my script from hanging on these debug messages:

localhost: Sent key-exchange init (KEXINIT), wait response. localhost: Algorithms, c->s: 3des-cbc hmac-sha1 none localhost: Algorithms, s->c: 3des-cbc hmac-sha1 none

However, the script now hung for about 1 to 2 minutes on another debug message:

localhost: Verifying server signature.

As a last ditch I tried downgrading the Crypt-DSA module and that fixed the problem!

In order that I did it, here are the modules I downgraded:

Crypt-DH 0.06 to Crypt-DH 0.03
Crypt-Random 1.25 to Crypt-Random 1.23 (I'm not sure if this one was really neccesary)
Crypt-DSA 0.14 to Crypt-DSA 0.12

I don't know if there are any issues with Crypt-RSA as I was not using that module for authentication. You might try downgrading that one if you still experience problems.

Hope that helps,

Sam

#!/usr/bin/perl use Net::SSH::Perl; my $host = "localhost"; my $user = "username"; my $pass = "password"; my $cmd = "ls"; my $ssh = Net::SSH::Perl->new($host, debug => 1, protocol => '2,1', options => ['PasswordAuthentication yes', 'HostbasedAuthentication no']); print "Connecting to host: $host"; $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd($cmd); print $stdout;
Direct Responses: 4032 | Write a response