我对使用sshing时这种对讲意味着什么感到困惑。“提供RSA公钥:”在ssh中找不到正确的密钥给我的AWS实例
我觉得如果我能理解,我可以解决我遇到的问题,这就是,我越来越
debug1: No more authentication methods to try. Permission denied (publickey).
这里的对讲:
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to ec2-xx-xx-x-xx.us-west-2.compute.amazonaws.com [xx.xx.x.xx] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /me/key_B.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file /me/key_Bt type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to ec2-xx-xx-x-xx.us-west-2.compute.amazonaws.com:22 as 'ec2-user'
debug3: hostkeys_foreach: reading file "/me/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /me/.ssh/known_hosts:9
debug3: load_hostkeys: loaded 1 keys from ec2-xx-xx-x-xx.us-west-2.compute.amazonaws.com
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-nistp256,ecdsa-nistp384,ecdsa-nistp521
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: [email protected],ecdh-nistp256,ecdh-nistp384,ecdh-nistp521,diffie-hellman-group-exchange-56,diffie-hellman-group-exchange-1,diffie-hellman-group14-sha1,diffie-hellman-group1-
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],ecdsa-nistp256,ecdsa-sha2-nistp384,ecdsa-nistp521,[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],arc256,arc128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arc,[email protected]
debug2: kex_parse_kexinit: [email protected],aes-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected],arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1,[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1,[email protected],[email protected],[email protected],[email protected],hmac-md5,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
debug2: kex_parse_kexinit: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: kex_parse_kexinit: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: kex_parse_kexinit: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: kex_parse_kexinit: none,[email protected]
debug2: kex_parse_kexinit: none,[email protected]
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug1: kex: server->client [email protected] <implicit> none
debug1: kex: client->server [email protected] <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:OWvg35+ziszO+1muZwu+vwk8awGkedK4/N7iAy4l93A
debug3: hostkeys_foreach: reading file "me/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /me/.ssh/known_hosts:9
debug3: load_hostkeys: loaded 1 keys from ec2-xx-xx-x-xx.us-east-2.compute.amazonaws.com
debug3: hostkeys_foreach: reading file "/me/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /me/.ssh/known_hosts:9
debug3: load_hostkeys: loaded 1 keys from 52.43.3.81
debug1: Host 'ec2-xx-xx-x-xx.us-west-2.compute.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /me/.ssh/known_hosts:9
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: me/.ssh/mobrien_mac_20161019 (0x7f9da3f00080),
debug2: key: /Users/matthewobrien/Dropbox/key_B (0x0), explicit
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
**debug1: Offering RSA public key: /me/.ssh/key_A**
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
**debug1: Trying private key: /me/key_B**
debug3: sign_and_send_pubkey: RSA SHA256:WAZzLsdfdsfasdfaspTYXXXXXXiS4wzvTasdfasdfTB/q0B0
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).
第一粗体线显示ssh正试图提供一个私钥,key_A
。但是key_A是一个不同的密钥,与完全不同的服务器有关。它与我尝试访问的AWS实例无关。
第二个加粗的行找到正确的密钥key_B
。但是,等一下,这是一个私钥?这是我从AWS控制台生成的密钥,并且正在尝试在登录时使用。
为什么ssh试图首先访问随机公钥,然后开始寻找私钥?它没有找到正确的公钥。
我的SSH是:
ssh -i /me/somedir/key_B.pem [email protected]
为什么不会SSH看在正确的地方?
在此先感谢。
好的,我会发布整个日志... –
我在'〜/ .ssh',只有'authorized_keys'和'known-hosts'目录没有配置文件。非常感谢你的帮助!! –
使用'-vvv'获取更详细的日志。信息可能隐藏在更详细的日志中。您正在寻找'IdentityFile'选项,但环境很重要。看一看'/ etc/ssh/ssh_config'。 – Jakuje