I have a bunch of old perl scripts that use SSH::Expect. When they get to the $ssh->login() stage they occasionally appear to fail on the password prompt. It will indicate a login failed and prompt for password again.
I havent been able to figure out why this started happening, but am wondering if there’s a workaround. I’m not able to change to a different SSH model (like openssh etc) at this time due to the large # that use SSH::Expect.
If it is sending the first password attempt too quickly, is there a way to make sure it waits for the full prompt to appear?
If that 2nd password prompt appears, is there a way to get it to send the password again?
this is the relevant code:
my $ssh = Net::SSH::Expect->new (
host => $deviceIpAddr,
timeout => 3,
log_stdout => 1,
password=> $passwd,
user => $username,
ssh_option => '-o UserKnownHostsFile=/dev/null',
);
$login_output = $ssh->login();