Re: help with making an sftp connection
Brent Wood via beginners <[email protected]> Mon, 17 Apr 2023 09:12:33 +0000 (UTC)
| Newsgroups | gmane.comp.lang.perl.beginners |
|---|---|
| Message-ID | <[email protected]> |
More detail, thanks for your time... This is to test the Perl script on a local (Linux) system, copying a file from /tmp to another directory. I can use command line sftp to copy a file fine with the user/password connection, so there is not a problem with sftp, user/password etc on the system. This Perl script executes without error, but hangs on $sftp = Net::... (prints start, never prints done) If I take out the password assignment, I'm prompted for a password and it then works fine. With it there, it hangs. Can anyone help me get this working with a password passed as a parameter? use Net::SFTP::Foreign; use IO::Pty; use feature say; $host = "127.0.0.1"; $user = "baw"; $pass = "......"; say "start"; $sftp = Net::SFTP::Foreign->new($host, user => $user, password => $pass, more => [qw(-o PreferredAuthentications=password -o PasswordAuthentication=yes -o BatchMode=yes)] ); say "done";