So.. I'm having to now use Net::SSH::Expect rather than the regular Expect perl module (long story, blah blah). Regardless I'm having some problems passing port other than the default. Here's how to connect using regular Net::SSH::Expect code:<div>
<br></div><div>#!/usr/bin/perl</div><div><br></div><div>use Net::SSH::Expect;</div><div><br></div><div>$ssh = Net::SSH::Expect->new {</div><div> host=>'192.168.15.25',</div><div> user=>'greg',</div>
<div> password=>'b00ya',</div><div> timeout=>'60'</div><div>);</div><div><br></div><div>$ssh->login();</div><div><br></div><div>I've tried connecting to a different port (3007 in this case) in a couple different ways.. one way was before the "login()" command using:</div>
<div><br></div><div>$ssh->port(3007);</div><div>$ssh->login();</div><div><br></div><div>## run some commands here</div><div><br></div><div>$ssh->close(); # close the ssh session</div><div><br></div><div>Another was to put the port number after the password above that. Neither seem to work. I can ssh from the command line to port 3007 of this router with no problems from the same machine where the script lives.</div>
<div><br></div><div>Any thoughts?</div><div><br></div><div>Greg</div><div><br></div><div>Here's the Net::SSH::Expect support page..</div><div><br></div><div><a href="http://search.cpan.org/~bnegrao/Net-SSH-Expect-0.08/lib/Net/SSH/Expect.pm">http://search.cpan.org/~bnegrao/Net-SSH-Expect-0.08/lib/Net/SSH/Expect.pm</a></div>
<div><br></div>