xorl has asked for the wisdom of the Perl Monks concerning the following question:
The above is a sample script. If I run this on box 1 it gets all the way to the line with $ssh->cmd($cmd) and then dies with the following error:#!/usr/bin/perl use strict; use warnings; use Net::SCP::Expect; my $remote_host = "xxx.xxx.xxx.xxx"; my $password = "xxxxxx"; my $username = "xxxxxx"; my $ssh = Net::SSH::Perl->new($remote_host, protocol=>'1', options => +[ "UserKnownHostsFile /home/apache/.ssh/known_hosts" ]) or die("could + not connect"); print "ssh set\n"; $ssh->login($username, $password); print "login done\n"; my $test_dir = "/foo/bar/"; my $cmd = "if [ -d $test_dir ]; then echo 1; else echo 0; fi"; print "CMD: $cmd\n"; my($stdout, $stderr, $exit) = $ssh->cmd($cmd); print "STDOUT: $stdout STDERR: $stderr EXIT: $exit\n";
Connection closed by remote host. at /usr/lib/perl5/site_perl/5.8.5/Net/SSH/Perl/SSH1.pm line 75
If I change the protocol in the line starting with "my $ssh" from '1' to '1,2', It takes forever but eventually it runs without any errors. If I try '2,1' it again takes forever but eventually it runs without any errors. If I try '2' same extremely long delay but it eventually works. The delay every time is at the login line
Now on box2, the unmodified script (where protocol is just '1') runs just fine and is very speedy.
What could I have screwed up on box1 to cause this weirdness and how to I make it work like box2?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Net::SSH::Perl and SSH protocols
by Khen1950fx (Canon) on Mar 22, 2008 at 22:24 UTC | |
Re: Net::SSH::Perl and SSH protocols
by hipowls (Curate) on Mar 22, 2008 at 22:35 UTC | |
Re: Net::SSH::Perl and SSH protocols
by zentara (Cardinal) on Mar 23, 2008 at 14:13 UTC | |
by xorl (Deacon) on Mar 24, 2008 at 13:14 UTC | |
Re: Net::SSH::Perl and SSH protocols
by radiantmatrix (Parson) on Mar 24, 2008 at 14:56 UTC |