Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^5: Net::SFTP::Foreign key_path

by salva (Canon)
on Feb 26, 2016 at 20:34 UTC ( [id://1156276]=note: print w/replies, xml ) Need Help??


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

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.

Replies are listed 'Best First'.
Re^6: Net::SFTP::Foreign key_path
by Vita (Novice) on Feb 26, 2016 at 21:20 UTC

    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?

        That was it ... the names ... DUH! I was not providing the username

        Changed

         $sftp = Net::SFTP::Foreign->new( $remnode,key_path => '/export/home/secbatch/.ssh/id_rsa', more => '-v', );

        To

        %args = ( "user" => $remuser, key_path => '/export/home/secbatch/.ssh/ +id_rsa' ); $sftp = Net::SFTP::Foreign->new( $remnode,%args, more => '-v', );

        Thank you so much. Enjoy your weekend.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1156276]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-23 14:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found