in reply to Net::SFTP::Foreign key_path

What do you get when you enable debugging?
$Net::SFTP::Foreign::debug = -1;

Replies are listed 'Best First'.
Re^2: Net::SFTP::Foreign key_path
by Vita (Novice) on Feb 26, 2016 at 19:07 UTC
    $sftp = Net::SFTP::Foreign->new( $remnode,key_path => '/export/home/secbatch/.ssh/id_rsa', stderr_discard => 1, more => '-v', );

    and added $Net::SFTP::Foreign::debug = -1;

    Output is ....

    20160226135158 Connecting to Remote System: sftp.bloomberg.com ... #2997 1456512718.00000 new: This is Net::SFTP::Foreign 1.81

    #2997 1456512718.00000 new: Loaded from /appl/perl_5.12.3/lib/site_perl/5.12.3/Net/SFTP/Foreign.pm

    #2997 1456512718.00000 new: Running on Perl v5.12.3 for solaris

    #2997 1456512718.00000 new: debug set to -1

    #2997 1456512718.00000 new: ~0 is 4294967295

    #2997 1456512718.00000 new: Using backend Net::SFTP::Foreign::Backend::Unix 1.76_03

    #2997 1456512718.00000 autodisconnect: setting disconnecting pid to 2997 and thread to 1

    #2997 1456512718.00000 _init_transport: ssh cmd: ssh -i /export/home/secbatch/.ssh/id_rsa -o PreferredAuthentications=publickey -v sftp.bloomberg.com -s sftp

    #2997 1456512718.00000 _queue_msg: queueing msg len: 5, code:1, id:3 ... 1

    00 00 00 05 01 00 00 00 03 | .........

    #2997 1456512718.00000 _get_msg: waiting for message... 1

    #2997 1456512718.00000 _do_io: _do_io connected: 1

    #2997 1456512718.00000 _do_io: _do_io select(-,-,-, undef)

    #2997 1456512718.00000 _do_io: _do_io write queue: 9, syswrite: 9, max: 65536, $!:

    00 00 00 05 01 00 00 00 03 | .........

    #2997 1456512718.00000 _do_io: _do_io select(-,-,-, undef)

    #2997 1456512718.00000 _do_io: _do_io read sysread: 0, total read: 0, $!:

    #2997 1456512718.00000 _conn_lost: _conn_lost

    #2997 1456512718.00000 _set_status: _set_status code: 7, str: Connection lost

    #2997 1456512718.00000 _set_error: _set_err code: 37, str: Connection to remote server is broken

    #2997 1456512718.00000 _conn_lost: _conn_lost

    Connect Failed!

    Connect error: Connection to remote server is broken

    Connect status: Connection lost

      do not discard the stderr output so that we can also see what the ssh process reports.

        20160226141953 Connecting to Remote System: sftp.bloomberg.com ... #20733 1456514393.00000 new: This is Net::SFTP::Foreign 1.81

        #20733 1456514393.00000 new: Loaded from /appl/perl_5.12.3/lib/site_perl/5.12.3/Net/SFTP/Foreign.pm

        #20733 1456514393.00000 new: Running on Perl v5.12.3 for solaris

        #20733 1456514393.00000 new: debug set to -1

        #20733 1456514393.00000 new: ~0 is 4294967295

        #20733 1456514393.00000 new: Using backend Net::SFTP::Foreign::Backend::Unix 1.76_03

        #20733 1456514393.00000 autodisconnect: setting disconnecting pid to 20733 and thread to 1

        #20733 1456514393.00000 _init_transport: ssh cmd: ssh -i /export/home/secbatch/.ssh/id_rsa -o PreferredAuthentications=publickey -v sftp.bloomberg.com -s sftp

        #20733 1456514393.00000 _queue_msg: queueing msg len: 5, code:1, id:3 ... 1

        00 00 00 05 01 00 00 00 03 | .........

        #20733 1456514393.00000 _get_msg: waiting for message... 1

        #20733 1456514393.00000 _do_io: _do_io connected: 1

        #20733 1456514393.00000 _do_io: _do_io select(-,-,-, undef)

        #20733 1456514393.00000 _do_io: _do_io write queue: 9, syswrite: 9, max: 65536, $!:

        00 00 00 05 01 00 00 00 03 | .........

        #20733 1456514393.00000 _do_io: _do_io select(-,-,-, undef)

        OpenSSH_5.6p1, OpenSSL 1.0.0d 8 Feb 2011

        debug1: Reading configuration data /usr/local/etc/ssh_config

        debug1: Connecting to sftp.bloomberg.com 205.216.112.23 port 22.

        debug1: Connection established.

        debug1: identity file /export/home/secbatch/.ssh/id_rsa type 1

        debug1: identity file /export/home/secbatch/.ssh/id_rsa-cert type -1

        debug1: Remote protocol version 2.0, remote software version OpenSSH_6.1

        debug1: match: OpenSSH_6.1 pat OpenSSH*

        debug1: Enabling compatibility mode for protocol 2.0

        debug1: Local version string SSH-2.0-OpenSSH_5.6

        debug1: SSH2_MSG_KEXINIT sent

        debug1: SSH2_MSG_KEXINIT received

        debug1: kex: server->client aes128-ctr hmac-md5 none

        debug1: kex: client->server aes128-ctr hmac-md5 none

        debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent

        debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP

        debug1: SSH2_MSG_KEX_DH_GEX_INIT sent

        debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY

        debug1: Host 'sftp.bloomberg.com' is known and matches the RSA host key.

        debug1: Found key in /export/home/secbatch/.ssh/known_hosts:13

        debug1: ssh_rsa_verify: signature correct

        debug1: SSH2_MSG_NEWKEYS sent

        debug1: expecting SSH2_MSG_NEWKEYS

        debug1: SSH2_MSG_NEWKEYS received

        debug1: Roaming not allowed by server

        debug1: SSH2_MSG_SERVICE_REQUEST sent

        debug1: SSH2_MSG_SERVICE_ACCEPT received

        debug1: Authentications that can continue: publickey,password,keyboard-interactive

        debug1: Next authentication method: publickey

        debug1: Offering RSA public key: /export/home/secbatch/.ssh/id_rsa

        debug1: Authentications that can continue: publickey,password,keyboard-interactive

        debug1: No more authentication methods to try.

        Permission denied (publickey,password,keyboard-interactive).

        #20733 1456514394.00000 _do_io: _do_io read sysread: 0, total read: 0, $!:

        #20733 1456514394.00000 _conn_lost: _conn_lost

        #20733 1456514394.00000 _set_status: _set_status code: 7, str: Connection lost

        #20733 1456514394.00000 _set_error: _set_err code: 37, str: Connection to remote server is broken

        #20733 1456514394.00000 _conn_lost: _conn_lost

        Connect Failed!

        Connect error: Connection to remote server is broken

        Connect status: Connection lost