Linux – How to get password prompt from ssh in Perl script

linuxperlssh

When I execute this from command line, I get prompted for joe's password (which is what I want):

ssh -t 192.168.1.32 'scp joe@192.168.1.31:/etc/hosts /tmp'

When I try to run the same command from a perl script, it just hangs there (with no prompt):

`ssh -t 192.168.1.32 'scp joe\@192.168.1.31:/etc/hosts /tmp'`;

How can I make this work from a Perl script?

Note: No, I cannot use key-based authentication for this.

Related Topic