[ale] Perl 'Expect' timeout question

Chris Fowler cfowler at outpostsentinel.com
Mon Oct 4 10:20:43 EDT 2010


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




More information about the Ale mailing list