如何解决权限被拒绝(公钥)错误?

时间:2021-05-09 03:54:23

标签: ubuntu ssh

我正在克隆ghost open blog cms,有一个选项可以通过数字海洋运行vps。选择此方法将创建液滴。下一步是以 root@XXXXX 身份登录

这样做时,我得到了可怕的权限被拒绝(公钥)。我重新创建了 ssh 密钥并在数字海洋中进行了更新,但这并没有解决问题。

运行 ssh -v root@xxxx 命令时,输出如下:

OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to xxx [xxx] port 22.
debug1: Connection established.
debug1: identity file /Users/dad/.ssh/id_rsa type 0
debug1: identity file /Users/dad/.ssh/id_rsa-cert type -1
debug1: identity file /Users/dad/.ssh/id_dsa type -1
debug1: identity file /Users/dad/.ssh/id_dsa-cert type -1
debug1: identity file /Users/dad/.ssh/id_ecdsa type -1
debug1: identity file /Users/dad/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/dad/.ssh/id_ed25519 type -1
debug1: identity file /Users/dad/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/dad/.ssh/id_xmss type -1
debug1: identity file /Users/dad/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.2
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to xxx as 'root'
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: 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: Server host key: ecdsa-sha2-nistp256 SHA256:ecNEC3rocsntZyTMyGGH7MHfMoMufrPOmG8hPRgkwzs
debug1: Host 'xxx' is known and matches the ECDSA host key.
debug1: Found key in /Users/dad/.ssh/known_hosts:1
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: /Users/dad/.ssh/id_rsa RSA SHA256:/2EjDyRz3HYYyLqEegdjzEy2PfgIGnMNXvwbPzMgRqg
debug1: Will attempt key: /Users/dad/.ssh/id_dsa
debug1: Will attempt key: /Users/dad/.ssh/id_ecdsa
debug1: Will attempt key: /Users/dad/.ssh/id_ed25519
debug1: Will attempt key: /Users/dad/.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: Offering public key: /Users/dad/.ssh/id_rsa RSA SHA256:/2EjDyRz3HYYyLqEegdjzEy2PfgIGnMNXvwbPzMgRqg
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/dad/.ssh/id_dsa
debug1: Trying private key: /Users/dad/.ssh/id_ecdsa
debug1: Trying private key: /Users/dad/.ssh/id_ed25519
debug1: Trying private key: /Users/dad/.ssh/id_xmss
debug1: No more authentication methods to try.
root@xxxxx: Permission denied (publickey).

知道如何处理这个问题吗?

1 个答案:

答案 0 :(得分:0)

我已经能够解决这个问题并将解释如何解决。

我的问题是即使在 Droplet 中重置密码后,我的密码也没有被接受。

可以在此处找到“控制台中不接受密码”信息https://docs.digitalocean.com/products/droplets/resources/troubleshooting-ssh/authentication/

我按照引导进入此处链接的恢复过程:https://docs.digitalocean.com/products/droplets/resources/recovery-iso/#boot-into-the-recovery-iso

  • 关闭电源或停止液滴
  • 选择从恢复 ISO 启动
  • 再次打开水滴
  • 点击控制台

在这个阶段,我看到了一个选项列表。

  1. 挂载您的磁盘映像 [未挂载]
  2. 检查文件系统
  3. 重置 Droplet 根密码
  4. 配置键盘
  5. 尝试“chroot”进入已安装的系统
  6. 交互式外壳 [/bin/bash] 选择 (1-6) 并按 Enter 继续。
  • 我选择了选项 1,然后是 3,然后是 6。

  • 在此之后,我关闭了 Droplet 并选择了从硬盘启动。

  • 访问控制台,我能够登录并输入接受的密码,ghost 安装开始并成功完成。

我希望这对遇到相同问题的人有所帮助。