in reply to Using Expect.pm and username/password to ssh to a host

Try updating your Expect module. I was able to reproduce your problem with the following code using Expect.pm 1.11, the default on Debian Woody. The problem went away with 1.15.

#!/usr/bin/perl -w use strict; use Expect; # version 1.11! my $ssh = Expect->new('ssh tilrman@localhost'); $ssh->debug(1); $ssh->expect(60, q{tilrman@localhost's password:}); $ssh->send("********\n"); $ssh->expect(60, '$'); $ssh->send("exit\n"); $ssh->close();

Strangely enough, if you add a single semicolon -- apparently causing Perl to hand off to the shell -- 1.11 works too:

my $ssh = Expect->new('ssh tilrman@localhost;');