[Trilug-ontopic] anyone using Net::SSH::Expect?

Greg Brown gwbrown1 at gmail.com
Mon Oct 18 12:05:54 EDT 2010


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:

#!/usr/bin/perl

use Net::SSH::Expect;

$ssh = Net::SSH::Expect->new {
       host=>'192.168.15.25',
       user=>'greg',
       password=>'b00ya',
       timeout=>'60'
);

$ssh->login();

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:

$ssh->port(3007);
$ssh->login();

## run some commands here

$ssh->close();  # close the ssh session

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.

Any thoughts?

Greg

Here's the Net::SSH::Expect support page..

http://search.cpan.org/~bnegrao/Net-SSH-Expect-0.08/lib/Net/SSH/Expect.pm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.trilug.org/pipermail/trilug-ontopic/attachments/20101018/9fa9f647/attachment.htm>


More information about the Trilug-ontopic mailing list