我正在尝试设置一个数字海洋水滴以便用网格进行部署,但出现了一些问题。
我在 Windows 上,使用 vagrant 在我的项目文件夹中,我尝试 ssh 到它并得到以下读数:
vagrant@recfishwa:~$ ssh 198.166.218.143
Permission denied (publickey).
vagrant@recfishwa:~$ ssh -v 198.166.218.143
OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 3: Applying options for *
debug1: /etc/ssh/ssh_config line 20: Deprecated option "useroaming"
debug1: Connecting to 189.166.218.143 [198.166.218.143] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/vagrant/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vagrant/.ssh/id_ed25519-cert type -1
debug1: identity file /home/vagrant/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/vagrant/.ssh/id_rsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.2 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 188.166.218.143:22 as 'vagrant'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: [email protected]
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: [email protected]
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-ed25519 SHA256:2R+kXXuJxz/ON3eeOmToiySqGtxCClQoXV98t9mmhNE
debug1: Host '188.166.218.143' is known and matches the ED25519 host key.
debug1: Found key in /home/vagrant/.ssh/known_hosts:6
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/vagrant/.ssh/id_ed25519
debug1: Offering RSA public key: /home/vagrant/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
我希望那里能有个线索,因为我的研究已经用完了。我最初确实使用我用 putty_gen 生成的 ssh 设置了 droplet,但后来删除了设置中的密钥并重置了 root 密码,试图获得访问权限,但没有成功。即使在重置后,出于某种原因,我甚至无法使用密码登录 DO 控制台。我重新加载了 vagrant。我不确定现在是否还有与 droplet 关联的密钥。调试日志中有什么明显的内容吗?
另外,有人可以确认当我在项目目录中运行 vagrant 并尝试连接到 DO 时,我应该在本地计算机上存储密钥的什么位置吗?
我也使用 openssh 和 Putty 配置了 cygwin,但无论我怎么尝试仍然无法连接。
答案1
检查/home/vagrant/.ssh/id_rsa
是否存在 RSA私人的SSH 密钥。确保民众密钥(应位于/home/vagrant/.ssh/id_rsa.pub
)存在于 上188.166.218.143
,或者查看命令的文档,ssh-copy-id
该命令将自动为您复制公钥,前提是您已启用 root(或您喜欢的任何用户)的密码身份验证。如果您没有密钥,请使用命令 生成它们ssh-keygen -t rsa
。
否则,如果您完全将自己锁定在 droplet 之外,则可能需要向 DigitalOcean 开具支持票...他们的响应时间通常相当快。
Vagrant 通常会将当前用户的 SSH 公钥复制到 vagrant box 中。如果此密钥损坏,请确保您的密钥确实存在于主目录 ( ~/.ssh
) 中,然后重新安装 vagrant(保存您的实例并重新安装包)。