我的电脑运行的是 Lubuntu 20.04。
我正在尝试 ssh 到运行 Ubuntu Server 22.04 的树莓派 4。
我已按照设置说明进行操作,但看到以下内容:
ssh -v [email protected]
OpenSSH_8.2p1 Ubuntu-4ubuntu0.11, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /home/paul/.ssh/config
debug1: /home/paul/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 192.168.1.121 [192.168.1.121] port 22.
debug1: Connection established.
debug1: identity file /home/paul/.ssh/id_rsa type 0
debug1: identity file /home/paul/.ssh/id_rsa-cert type -1
debug1: identity file /home/paul/.ssh/id_dsa type -1
debug1: identity file /home/paul/.ssh/id_dsa-cert type -1
debug1: identity file /home/paul/.ssh/id_ecdsa type -1
debug1: identity file /home/paul/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/paul/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/paul/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/paul/.ssh/id_ed25519 type -1
debug1: identity file /home/paul/.ssh/id_ed25519-cert type -1
debug1: identity file /home/paul/.ssh/id_ed25519_sk type -1
debug1: identity file /home/paul/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/paul/.ssh/id_xmss type -1
debug1: identity file /home/paul/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.11
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.9p1 Ubuntu-3ubuntu0.6
debug1: match: OpenSSH_8.9p1 Ubuntu-3ubuntu0.6 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.1.121:22 as 'paul'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
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:hB5vu/iLN16xccrKvXJVhJcCL09bFePcmv/GwEwNEL0
debug1: Host '192.168.1.121' is known and matches the ECDSA host key.
debug1: Found key in /home/paul/.ssh/known_hosts:9
debug1: resetting send seqnr 3
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: resetting read seqnr 3
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/paul/.ssh/id_rsa RSA SHA256:o4u2FI6udyWLZqKgV2itDrRJaTQYn65ochhOFkPYfd4
debug1: Will attempt key: /home/paul/.ssh/id_dsa
debug1: Will attempt key: /home/paul/.ssh/id_ecdsa
debug1: Will attempt key: /home/paul/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/paul/.ssh/id_ed25519
debug1: Will attempt key: /home/paul/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/paul/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
debug1: kex_input_ext_info: [email protected] (unrecognised)
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/paul/.ssh/id_rsa RSA SHA256:o4u2FI6udyWLZqKgV2itDrRJaTQYn65ochhOFkPYfd4
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/paul/.ssh/id_dsa
debug1: Trying private key: /home/paul/.ssh/id_ecdsa
debug1: Trying private key: /home/paul/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/paul/.ssh/id_ed25519
debug1: Trying private key: /home/paul/.ssh/id_ed25519_sk
debug1: Trying private key: /home/paul/.ssh/id_xmss
debug1: No more authentication methods to try.
[email protected]: Permission denied (publickey).
我按照各种帖子的建议在 ~/.ssh/config 中添加了一些选项(无济于事)。这是:
Host *
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
当我得到一个新的 Pi 时,我大约每年都会使用一次这个东西(每年都会对我所做的事情做大量的笔记),但每年它都会以不同的方式失败。任何解决方案都将非常受欢迎。
感谢 user68186 - 他的解决方案有效。
我制作了 ed25519 密钥(在客户端和服务器上)并将两个密钥复制到其对应的计算机上。准确地说:
在电脑上:
在 rpi4 上