Vagrant挂起"SSH身份验证方法:私钥

Nis*_*xit 10 ssh ubuntu virtualbox virtual-machine vagrant

我正在运行VirtualBox 5.0.24和Vagrant 1.8.5在数字海洋VPS上运行Ubuntu 14.04 LTS Precise 我正在使用的盒子ubuntu/precise64 一切正常,但当我这样做vagrant up时挂在

SSH auth method: Private key
Run Code Online (Sandbox Code Playgroud)

并退出给予时间.现在,我可以考虑增加执行时间,但在发出错误之前已经花了很长时间.我不知道我做错了什么.这是我的VAGRANTFILE

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.

# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "ubuntu/precise64"

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080

# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"

# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"

# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
#   # Display the VirtualBox GUI when booting the machine
#   vb.gui = true
#
#   # Customize the amount of memory on the VM:
#   vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.

# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
#   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end

# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
#   apt-get update
#   apt-get install -y apache2
# SHELL
  config.vm.provider :virtualbox do |vb|
    vb.customize ['modifyvm', :'1cf9e703-607e-4338-9162-20abbeca94b0', '--pae', 'on']
    vb.customize ['modifyvm', :'1cf9e703-607e-4338-9162-20abbeca94b0', '--hwvirtex', 'off']
    vb.customize ['modifyvm', :'1cf9e703-607e-4338-9162-20abbeca94b0', '--vtxvpid', 'off']
end

end
Run Code Online (Sandbox Code Playgroud)

Lam*_*row 11

我也有这个问题,我通过打开"Oracle Virtual Box Manager"GUI并转到"设置" - >"网络"并选择"适配器1"来修复它,然后通过单击箭头展开选项并确保检查"电缆连接".

  • 被困了4个小时后,我发现了这个评论。它已被选中,但我只是取消选中它并再次检查它,并且在后台配置继续并解除。太感谢了。 (5认同)
  • 默认情况下选中“已连接电缆”选项。我仍然面临同样的问题。 (4认同)
  • 非常感谢这个提示.我被困在这个问题上大约一天,这解决了我. (2认同)

Dan*_*rdt 6

在一些神秘的论坛上找到了以下解决方案,它的工作原理是将它添加到您的底部,Vagrantfile就在下面的行之前end

    config.vm.provider "virtualbox" do |vb|
        vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
    end
Run Code Online (Sandbox Code Playgroud)

与手动更改 VirtualBox AFAIK 中的设置相同,但我个人更喜欢将基础设施作为代码解决方案。这样同事就不必在下线的某个地方处理相同的问题。


Mr *_*yur 6

在此输入图像描述

我发现我的 WSL 在 Windows 10 上启用,因此使用此命令禁用它

bcdedit /set hypervisorlaunchtype off
Run Code Online (Sandbox Code Playgroud)

但这对我没有帮助,所以我浏览了 Windows 功能,发现虚拟机平台已打开,所以我查找它,它链接到 WSL,所以我将其关闭,我的 ssh 密钥问题解决了。


Nis*_*xit 1

最新版本似乎无法在 VPS 上运行。我必须选择旧版本的软件才能在这个 ubuntu VPS 上运行它们 我选择的版本是

VirtualBox >= 4.3.12
Run Code Online (Sandbox Code Playgroud)

Vagrant >= 1.5.3
Run Code Online (Sandbox Code Playgroud)

这可行,但你必须配置 ssh