当vagrant ssh和ssh vagrant @ localhost -p2222有效时,Vagrant Up期间身份验证失败
我想在启动时使用Vagrant执行Shell脚本。在使用vagrant up
以下方法启动虚拟机时,Vagrant无法进行身份验证:
c:\temp\helloworld>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'helloworld'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: helloworld_default_1398419922203_60603
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> 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: Authentication failure. Retrying...
default: Error: Authentication failure. Retrying...
default: Error: Authentication failure. Retrying...
default: Error: Authentication failure. Retrying...
...
执行后CTRL + C
,可以使用vagrant ssh
和向VM进行身份验证ssh vagrant@localhost -p2222
流浪文件
我使用默认的Vagrantfile,并且只更改了主机名:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "helloworld"
...
流浪版本
c:\temp\helloworld>vagrant --version
Vagrant 1.5.1
题
如何使用对VM进行身份验证vagrant up
?