Vagrant 在 SSH 密钥更新后要求输入密码 [英] Vagrant asks for password after SSH key update

查看:64
本文介绍了Vagrant 在 SSH 密钥更新后要求输入密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

切换到新机器后,我重新制作了我的 SSH 密钥,并复制了我打包的现有定制 Vagrant 盒子.

I remade my SSH key after switching to a new machine and just copied over my existing customized Vagrant box I packaged up.

当我尝试通过 ssh 进入该框时,出现 REMOTE HOST IDENTIFICATION HAS CHANGED 错误.因此,我清除了 known_hosts 中的条目,然后通过 ssh 返回到框中.新密钥已被接受,但现在每次 ssh 登录时,我都需要输入默认的 vagrant 密码,而不仅仅是使用我的 ssh 密钥.

When I tried to ssh into the box, I got the REMOTE HOST IDENTIFICATION HAS CHANGED error. So I cleared the entry out of the known_hosts and ssh'd back into the box. The new key was accepted, but now every time I ssh in I am required to enter the default vagrant password instead of just using my ssh key.

我在这里遗漏了什么?

推荐答案

新密钥已被接受"?
您是否验证过 Host 上的私钥和 Guest 上的公钥是否配对?
如果密钥被接受,则不会弹出密码提示.

"The new key was accepted"?
Have you verified that the private key on Host and the public key on Guest paired?
If the key was accepted, no password prompt should pop up.

要验证您的私钥/公钥:

To verify your private/public keys:

在主机操作系统上找到你的私钥(流浪者的身份文件):

Locate your private key on Host OS(IdentityFile for vagrant):

vagrant ssh-config

从私钥生成公钥:

ssh-keygen -y -f private_key > public_key
cat public_key

比较生成的public_key和Guest OS上的public_key(可以用密码登录).

Compare the generated public_key with the public_key on Guest OS(you can login by password).

cat ~/.ssh/authorized_keys

这篇关于Vagrant 在 SSH 密钥更新后要求输入密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆