Vagrant ssh 身份验证失败 [英] Vagrant ssh authentication failure

查看:77
本文介绍了Vagrant ssh 身份验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ssh 认证的问题:

==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: bridged
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Connection timeout. Retrying...
    default: Error: Authentication failure. Retrying...
    default: Error: Authentication failure. Retrying...
    default: Error: Authentication failure. Retrying...
    default: Error: Authentication failure. Retrying...
    default: Error: Authentication failure. Retrying...

我可以Ctrl+C退出身份验证循环,然后手动成功通过ssh进入.

I can Ctrl+C out of the authentication loop and then successfully ssh in manually.

我在来宾盒上执行了以下步骤:

I performed the following steps on the guest box:

  • 所有用户启用远程登录.

使用0700权限创建~/.ssh目录.

使用 0600 权限创建 ~/.ssh/authorized_keys 文件.

Created the ~/.ssh/authorized_keys file with 0600 permissions.

粘贴此公钥进入~/.ssh/authorized_keys

我也尝试过使用私有(仅主机)网络而不是公共(桥接)网络,在 Vagrantfile 中使用这一行:

I've also tried using a private (hostonly) network instead of the public (bridged) network, using this line in the Vagrantfile:

config.vm.network "private_network", ip: "172.16.177.7"

我得到相同的输出(Adapter 2: hostonly 除外),但无法手动 ssh.

I get the same output (except Adapter 2: hostonly) but then cannot ssh in manually.

我也试过config.vm.network "private_network", ip: "10.0.0.100".

我还尝试在 Vagrantfile 中设置 config.ssh.password.这确实输出 SSH auth method: password 但仍然不进行身份验证.

I also tried setting config.ssh.password in the Vagrantfile. This does output SSH auth method: password but still doesn't authenticate.

而且我还尝试重建盒子并重新检查以上所有内容.

And I also tried rebuilding the box and rechecking all the above.

看起来其他人在此配置上取得了成功,所以一定是我做错了什么.

It looks like others have had success with this configuration, so there must be something I'm doing wrong.

找到此线程并启用了 GUI,但这没有帮助.

I found this thread and enabled the GUI, but that doesn't help.

推荐答案

确保您的第一个网络接口是 NAT.当您构建盒子时,另一个第二个网络接口可以是任何您想要的.不要忘记 Vagrant 用户,如 Google 线程中所述.

Make sure your first network interface is NAT. The other second network interface can be anything you want when you're building box. Don't forget the Vagrant user, as discussed in the Google thread.

祝你好运.

这篇关于Vagrant ssh 身份验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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