in reply to Re^3: Net::SFTP::Foreign key_path
in thread Net::SFTP::Foreign key_path

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

Replies are listed 'Best First'.
Re^5: Net::SFTP::Foreign key_path
by salva (Canon) on Feb 26, 2016 at 20:34 UTC
    debug1: Offering RSA public key: /export/home/secbatch/.ssh/id_rsa debug1: Authentications that can continue: publickey,password,keyboard +-interactive

    That means that the remote server doesn't like that key!

    What happens when you run the following command from the command line?

    ssh -i /export/home/secbatch/.ssh/id_rsa -o PreferredAuthentications=p +ublickey -v sftp.bloomberg.com

    Check your $PATH in order to ensure you run the same ssh binary as the script and also that you are logged as the same user.

      For ..

       ssh -i /export/home/secbatch/.ssh/id_rsa -o PreferredAuthentications=publickey -v sftp.bloomberg.com

      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).

      For ..

       ssh -i /export/home/secbatch/.ssh/id_rsa -o PreferredAuthentications=publickey -v username@sftp.bloomberg.com

      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: Server accepts key: pkalg ssh-rsa blen 279 debug1: read PEM private key done: type RSA debug1: Authentication succeeded (publickey). Authenticated to sftp.bloomberg.com (205.216.112.23:22). debug1: channel 0: new client-session debug1: Requesting no-more-sessions@openssh.com debug1: Entering interactive session. PTY allocation request failed on channel 0

      For ..

       sftp -i /export/home/secbatch/.ssh/id_rsa -o PreferredAuthentications=publickey -v username@sftp.bloomberg.com

      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: Server accepts key: pkalg ssh-rsa blen 279 debug1: read PEM private key done: type RSA debug1: Authentication succeeded (publickey). Authenticated to sftp.bloomberg.com (205.216.112.23:22). debug1: channel 0: new client-session debug1: Requesting no-more-sessions@openssh.com debug1: Entering interactive session. debug1: Sending subsystem: sftp Connected to sftp.bloomberg.com. sftp>

        So, the remote and local user names are different and you need to pass the correct one, right?