SSH 连接时 RSA 密钥对失败

SSH 连接时 RSA 密钥对失败

密码验证工作完美,但我无法让 PubkeyAuthentication 工作。

这是我运行的。我添加了强制 Pubkey 身份验证的选项,因为这是无法连接的。

C:\Users\jerem>ssh -o PasswordAuthentication=no -o PubkeyAuthentication=yes [email protected]

[email protected]: Permission denied (publickey,password,keyboard-interactive).

设置

我在本地电脑上运行了ssh-keygen。我没有创建密码,保留了默认名称。例如id_rsa/id_rsa.pub

在远程PC上,我对配置文件做了以下添加:

*****config.txt*****      //This is supposed to be a txt file right?

PubkeyAuthentication yes
PasswordAuthentication no
ChallengeResponseAuthentication no
RSAAuthentication yes
KeepAlive yes
ClientAliveInterval 120
ClientAliveCountMax 2

我也在authorized_keys同一目录中创建了 ( C:/Users/jerem/.ssh/)。我将本地 PC 的id_rsa.pub内容逐字粘贴到其中(包括末尾的 PC 名称)。出于显而易见的原因,我不会显示这一点。

详细:

C:\Users\jerem>ssh -vv -o PasswordAuthentication=no -o PubkeyAuthentication=yes [email protected]
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug2: resolve_canonicalize: hostname 192.168.1.32 is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.1.32 [192.168.1.32] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\jerem/.ssh/id_rsa type 0
debug1: identity file C:\\Users\\jerem/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\jerem/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\jerem/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\jerem/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\jerem/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\jerem/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\jerem/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\jerem/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\jerem/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_8.1
debug1: match: OpenSSH_for_Windows_8.1 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 192.168.1.32:22 as 'admin'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:4hcl10QXQC9frrHhgVIRi6nl6i9MNcV840nlk92fUsg
debug1: Host '192.168.1.32' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\jerem/.ssh/known_hosts:4
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: C:\\Users\\jerem/.ssh/id_rsa RSA SHA256:5CRx6/Q5vaGvGn93kkG9FSBrbJnleYGvzqW3XjNbZg0
debug1: Will attempt key: C:\\Users\\jerem/.ssh/id_dsa
debug1: Will attempt key: C:\\Users\\jerem/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\jerem/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\jerem/.ssh/id_xmss
debug2: pubkey_prepare: done
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\jerem/.ssh/id_rsa RSA SHA256:5CRx6/Q5vaGvGn93kkG9FSBrbJnleYGvzqW3XjNbZg0
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: C:\\Users\\jerem/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\jerem/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\jerem/.ssh/id_ed25519
debug1: Trying private key: C:\\Users\\jerem/.ssh/id_xmss
debug2: we did not send a packet, disable method
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug2: we sent a keyboard-interactive packet, wait for reply
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey,password,keyboard-interactive).

相关内容