in reply to SSH connection error
Neil Watson
watson-wilson.ca
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: SSH connection error
by dolavoie (Initiate) on Feb 22, 2006 at 19:52 UTC | |
use strict; use Net::SSH::Perl; my %params; $params{'protocol'} = '2'; $params{'port'} = '22'; $params{'debug'} = 'true'; my $ssh = Net::SSH::Perl->new("##", %params) or die "\n\nThere was an error : $!\n\n"; $ssh->login("##", "##"); my (my $stdout, my $stderr, my $exit2) = $ssh->cmd('ls -l'); if ($stdout){print "Output:\n$_\n\n";} if ($stderr){print "Error:\n$_\n\n";} print "Exit Code:\n$exit2\n\n"; The error is from the login line. | [reply] |
by u235sentinel (Hermit) on Feb 23, 2006 at 01:14 UTC | |
Usually I see this when creating a connection and debugging the session
Maybe I'm just being picky. Perhaps you can try spelling it out like this and see if it helps. Are you receiving any debug information? If so could you please provide it. Also you could simplify this with this Just some thoughts that might help. And don't forget the debug info. | [reply] [d/l] [select] |
by chargrill (Parson) on Feb 23, 2006 at 20:53 UTC | |
FWIW, $params{'debug') = 'true' spits out a lot of debug information as the script is running, which coincidentally takes a long time. I got a bunch of this, (trimmed for brevity, anyone who's watched the output of ssh -v hostname will appreciate that)
... and finally:
I've already changed the my( my $stdout, my $stderr, my $exit2 ) line to remove the superflous "my"s... and now I notice the following:
$_ doesn't contain anything at that point, so this would work better:
As far as your original problem, do you have any special characters in your password that might be gumming up the works? (%, @, $ would all need to be escaped out of your password, especially if you have it in double quotes as your example code above) --chargrill
| [reply] [d/l] [select] |
by leocharre (Priest) on Feb 22, 2006 at 20:43 UTC | |
i don't see this obviously means your object has not been made, made properly etc. so something is up with your %params, or the Net::SSH::Perl module, some dependency or something.. check the error log ofr the machine too! maybe the module is having an error or something else too. I would suggest first eliminate every simple explanation, and i think even 'hello world' should -w | [reply] |