Hi,

Can you edit the constructor to include `more => [ -v ]` so we can get more
feedback from the SSH connection and send the output from that.

$sftp = Net::SFTP::Foreign->new($host,
        user     => $user,
        password => $pass,
        more => [
            qw(
            -v
            -o PreferredAuthentications=password
            -o PasswordAuthentication=yes
            -o BatchMode=yes
            )
       ]
)  or $sftp->error;

The clue to what is going wrong will be in the output from ssh.
Thanks,
Dermot

On Mon, 17 Apr 2023 at 10:13, Brent Wood via beginners <beginners@perl.org>
wrote:

> 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";
>
>

Reply via email to