首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >迷途人1.7SSH在OSX上的身份验证失败-私钥未复制到VM

迷途人1.7SSH在OSX上的身份验证失败-私钥未复制到VM
EN

Stack Overflow用户
提问于 2015-09-11 10:09:17
回答 2查看 5.4K关注 0票数 4

首先,我知道这是一个重复的问题,但我与这个问题斗争了大约20个小时,因为没有其他问题的答案为我工作。这是Mac的具体问题和答案。虚拟提供者是VirtualBox 4.3和5.0。迷离版本1.7.1和1.7.4

这个SSH身份验证失败一直在发生。如果我等待或退出进程,我可以使用默认密码“迷航”在没有问题的“迷航”。但是由于这个SSH失败发生了,这意味着启动后的-scripts也没有被执行。

代码语言:javascript
复制
vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: homestead
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 80 => 8000 (adapter 1)
    default: 443 => 44300 (adapter 1)
    default: 3306 => 33060 (adapter 1)
    default: 5432 => 54320 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> 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: Warning: Connection timeout. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-09-11 10:09:17

迷走符1.7的默认配置设置为true: config.ssh.insert_key

迷航者将自动插入一个用于SSH的键盘,如果检测到,将替换默认的Vagrant的不安全密钥。链接到Vagrant设置

在流浪之后,我执行了迷航器ssh-config,我可以看到私钥路径是~/.vicrant.d/不安全_ key -但是该密钥也没有被复制到VM内部。

问题在于我在某种程度上搞砸了OS的SSH配置。当我运行命令 SSH -add -l在SSH代理中列出已加载的密钥时,这是显而易见的。有两把不同的钥匙在同一条路上!然而,我不能证实这是问题的主要原因,因为它持续了几天,在此期间我做了几次重新启动。

我备份了.ssh文件夹,并逐一复制了旧的配置行和文件。我做的另一件事是删除这个不明智的小费,在~/..ssh/config中添加这一行

代码语言:javascript
复制
Host *
 ForwardAgent yes

这种做法是吉突强烈建议反对

警告:您可能会尝试使用一个通配符(如Host *)来将此设置应用于所有SSH连接。这并不是一个好主意,因为您将与每个SSH进入的服务器共享本地SSH密钥。他们将无法直接访问密钥,但在建立连接时,他们将能够像您一样使用它们。您应该只添加您信任并打算用于代理转发的服务器。

在执行这些步骤之前,我清空了~/.vicrant.d文件夹,以确保之前没有设置全局信任。您还可以使用卸载脚本卸载Vagrant,然后重新安装。

重新启动。然后我创建了一个新的SSH密钥。

然后流浪供给或流浪汉毁灭&&流浪汉向上。,这就是我最终解决这个问题的方法!

票数 1
EN

Stack Overflow用户

发布于 2016-05-01 18:41:54

我的解决方案是,当Vagrant显示“默认:警告:身份验证失败.重试.”时,我的解决方案是.

在我的本地机器上,抓取公共ssh密钥,并将其插入流浪者内部的~/.ssh/authorized_ key中。这使得流浪汉可以无缝地进入盒子,并在我的情况下继续提供服务。不过,真希望我知道是什么引起了死亡。(我还删除了现有.vagrant和.vagrant.d文件夹的所有跟踪,然后发出游走命令。)

代码语言:javascript
复制
cat ~/.ssh/id_rsa.pub
vagrant ssh
echo 'your-public key' >> ~/.ssh/authorized_keys (or paste it in by hand so you don't accidentally delete any existing keys)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32520921

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档