Vagrant SSH default key passphrase?

2019-06-16 20:30发布

问题:

I think I messed up something simple, normally you should be able to instantly connect to your Vagrant VM using vagrant ssh. However, it's currently different for me.

C:\Users\Sem\Documents\timeline>vagrant ssh
Enter passphrase for key 'C:/Users/Sem/Documents/timeline/.vagrant/machines/default/virtualbox/private_key':
vagrant@127.0.0.1's password:
vagrant@127.0.0.1's password:
vagrant@127.0.0.1's password:
Permission denied (publickey,password).

I found one other person having the same issue: https://github.com/coreos/docs/issues/10#issuecomment-48903893

OS: Windows 8.1 Pro

Vagrant version: 1.7.2

Vagrantfile:

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

Vagrant.configure("2") do |config|
    config.vm.box = "ubuntu/trusty64"
end

I did try multiple settings before, but if I use this Vagrantfile with vagrant destroy and vagrant up the problem remains.

If there is any information missing, please tell me.

回答1:

Very new to vagrant and linux in general so this is for those who are like me. By default there is no passphrase so simply hitting enter will work. It will then ask you for the password which by default is 'vagrant'.



回答2:

Even though I was searching for something else I found the solution to this problem.

I Added this to my Vagrantfile:

config.vm.provider "virtualbox" do |v|
    v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end

It also made the internet connection in my vagrant VM super fast! :)



回答3:

Check permissions on your key file. I had the same problem and it was caused by OpenSSH rejecting my key file due to too open permissions. Also you can troubleshoot any Vagrant command with --debug key.