Net-SSH-Perl - Net::SSH:W32Perl Hangs after login

Posted on Tue Mar 18 20:19:52 2008 by rupprath
Net::SSH:W32Perl Hangs after login
I can connect to the system just fine and installed the BigInt modules to speed up the performance. However, once I am connected, the program just hangs. Here is the output from the debug:
: Reading configuration data C:/tmp/.ssh/config : Reading configuration data /etc/ssh_config : Connecting to XXXX.com, port 22. : Socket created, turning on blocking... : Remote version string: SSH-2.0-OpenSSH_4.2 : Remote protocol version 2.0, remote software version Ope : Net::SSH::Perl Version 1.30, protocol version 2.0. : No compat match: OpenSSH_4.2. : Connection established. : Sent key-exchange init (KEXINIT), wait response. : Algorithms, c->s: 3des-cbc hmac-sha1 none : Algorithms, s->c: 3des-cbc hmac-sha1 none : Entering Diffie-Hellman Group 1 key exchange. : Sent DH public key, waiting for reply. : Received host key, type 'ssh-dss'. : Host 'ats.vzbi.com' is known and matches the host key. : Computing shared secret key. : Verifying server signature. : Waiting for NEWKEYS message. : Enabling incoming encryption/MAC/compression. : Send NEWKEYS, enable outgoing encryption/MAC/compression : Sending request for user-authentication service. : Service accepted: ssh-userauth. : Trying empty user-authentication request. : Authentication methods that can continue: publickey,gssaic,password. : Next method to try is publickey. : Next method to try is password. : Trying password authentication. : Login completed, opening dummy shell channel. : channel 0: new [client-session] : Requesting channel_open for channel 0. : channel 0: open confirm rwindow 0 rmax 32768 : Got channel open confirmation, requesting shell. : Requesting service shell on channel 0. Executing show running-config : channel 1: new [client-session] : Requesting channel_open for channel 1. : Entering interactive session. : Sending command: ls : Requesting service exec on channel 1. : channel 1: open confirm rwindow 0 rmax 32768
At which point it hangs (I've waited several minutes without any response). The code looks like this:
#!/usr/bin/perl use Net::SSH::W32Perl; $ENV{HOME} = "C:/tmp"; # Configuration Section $username = "USERNAME"; $password = "PASSWORD"; $hostname = "XXXX.COM"; print("Connecting to $hostname\n"); my $ssh = Net::SSH::W32Perl->new($hostname, debug => '1'); $ssh->login($username, $password); my ($out, $err, $exit) = $ssh-> cmd("ls"); print("$out\n"); $ssh->close;
Write a response