[ale] Perl 'Expect' timeout question

Jerald Sheets questy at gmail.com
Mon Oct 4 11:04:26 EDT 2010


I'm with Chris on this one.

I've found Net::SSH::Expect to be somewhat buggy and never verbose about what its problems are.  I always have to wrap sessions in my own logic to allow me to figure out what the error is and to be able to log or continue on gracefully.  

If you're looking to just perform a function, spawning ssh inside of Expect is just as secure to use, and removes some of the bugginess.

--j


On Oct 4, 2010, at 10:20 AM, Chris Fowler wrote:

> Use just Expect.
> 
> use Expect;
> use strict;
> 
> my $exp = Expect->spawn('ssh user at host');
> $exp->expect(10, 'password:');
> $exp->send("password\r");
> $exp->expect(5, "]$ ") or die "password authentication failed";
> $exp->send("command\r");
> ....
> 
> $exp->close();
> 
> On Mon, 2010-10-04 at 10:12 -0400, Mills John M-NPHW64 wrote:
>> ALErs -
>> 
>> I wrote a Perl script that uses net-SSH::Expect to connect with a
>> remote target by SSH. I can establish the connection manually without
>> any problem, but my scripts (which had been working) now fail with the
>> message:
>> "SSHAuthenticationError Login timed out" coming from ".../Expect.pm
>> line 813". This line is in the function '_multi_expect($$@)' and the
>> timeout is presumably passed when the function is called.
>> 
>> This response is almost immediate so I suspect that no useful timeout
>> has been applied. Is there some way to force a reasonable timeout on
>> ssh->login(), or some temporary file I may need to delete? (I rebooted
>> both client and server without seeing any change in the behavior.) Any
>> diagnostic suggestions?
>> 
>> I have seen this before as transient behavior but it seems persistent
>> this time!
>> 
>> TIA.
>> 
>> - Mills
>> 
>> 
>> 
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
> 
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo




More information about the Ale mailing list