我无法通过 ssh 连接到 DigitalOcean Ubuntu(20.04) 服务器?我的sshd_config和authorised_keys文件似乎还可以。详情如下


OpenSSH_8.6p1, OpenSSL 1.1.1k  25 Mar 2021
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 134.209.151.146 [134.209.151.146] port 22.
debug1: Connection established.
debug1: identity file /home/clive/.ssh/id_rsa type -1
debug1: identity file /home/clive/.ssh/id_rsa-cert type -1
debug1: identity file /home/clive/.ssh/id_dsa type -1
debug1: identity file /home/clive/.ssh/id_dsa-cert type -1
debug1: identity file /home/clive/.ssh/id_ecdsa type -1
debug1: identity file /home/clive/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/clive/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/clive/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/clive/.ssh/id_ed25519 type 3
debug1: identity file /home/clive/.ssh/id_ed25519-cert type -1
debug1: identity file /home/clive/.ssh/id_ed25519_sk type -1
debug1: identity file /home/clive/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/clive/.ssh/id_xmss type -1
debug1: identity file /home/clive/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.2
debug1: compat_banner: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 134.209.151.146:22 as 'clive'
debug1: load_hostkeys: fopen /home/clive/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:X9T8dMRejOJgTDfHZo5kRvoVTD1moCRzX0F2jJmgGRk
debug1: load_hostkeys: fopen /home/clive/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host '134.209.151.146' is known and matches the ED25519 host key.
debug1: Found key in /home/clive/.ssh/known_hosts:2
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/clive/.ssh/id_rsa
debug1: Will attempt key: /home/clive/.ssh/id_dsa
debug1: Will attempt key: /home/clive/.ssh/id_ecdsa
debug1: Will attempt key: /home/clive/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/clive/.ssh/id_ed25519 ED25519 SHA256:808r4DrP8TnWnnXssQLn1rV0/fgWlyq3eF2s4Po2KZw
debug1: Will attempt key: /home/clive/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/clive/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/clive/.ssh/id_rsa
debug1: Trying private key: /home/clive/.ssh/id_dsa
debug1: Trying private key: /home/clive/.ssh/id_ecdsa
debug1: Trying private key: /home/clive/.ssh/id_ecdsa_sk
debug1: Offering public key: /home/clive/.ssh/id_ed25519 ED25519 SHA256:808r4DrP8TnWnnXssQLn1rV0/fgWlyq3eF2s4Po2KZw
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/clive/.ssh/id_ed25519_sk
debug1: Trying private key: /home/clive/.ssh/id_xmss
debug1: No more authentication methods to try.
clive@134.209.151.146: Permission denied (publickey).

有人能帮我弄清楚吗?我试图在更新authorized_keys文件后禁用密码并重新连接,但每当我将PasswordAuthinition标志设置为否时,就会出现这种错误。我已经尝试过执行ssh-copy-id -i ~/.ssh/test2.pub username@hostip,其中test2是新生成的pub id。我有点不知道从哪里开始。我的本地机器似乎找不到一个名为known_hosts2的文件夹,但我知道如何继续。

  • 您是否使用适当的密钥(例如sh-copy-id -i ~/.ssh/test2 username@hostip(进行连接
  • 如果你的钥匙在/home/clive/.ssh/authorized-keys
  • 文件是否得到充分的保护

例如:

chmod 700 .ssh
chmod 600 .ssh/authorized_keys

还要检查服务器端调试日志(通常在/var/log中(,以了解导致登录失败的原因。

相关内容

  • 没有找到相关文章

最新更新