Vagrant ssh file 'private_key_path` must exist

I get this error while strolling.

There are errors in the configuration of this machine. Please fix
the following errors and try again:

SSH:
* `private_key_path` file must exist: insecure_key

How to configure a private key to use ssh in using vagrant ssh? I am using Windows 7.

My roaming file

Vagrant.configure("2") do |config|
    config.vm.define "phusion" do |v|
        v.vm.provider "docker" do |d|
          d.cmd = ["/sbin/my_init", "--enable-insecure-key"]
          d.image = "phusion/baseimage"
          d.name = 'dockerizedvm'
          d.has_ssh = true
          #d.force_host_vm = true
        end
        v.ssh.port = 22
        v.ssh.username = 'root'
        v.ssh.private_key_path = 'insecure_key'
        v.vm.provision "shell", inline: "echo hello"
        #v.vm.synced_folder "./keys", "/vagrant"
    end
end
+4
source share
2 answers

insecure_keyThere must be a file containing the SSH key. The file should be in the same folder as you vagrant up. below is an alternative:

curl -o insecure_key -fSL https://github.com/phusion/baseimage-docker/raw/master/image/insecure_key chmod 600 insecure_key vagrant ssh

+2
source

So, in my case, I used cygwin with windows, and I got:

* `private_key_path` file must exist: 
C:\cygwin64\home\basic.user/.vagrant.d/insecure_private_key

After several minutes of investigation, I realized that the environment variable VAGRANT_HOME was not normal, so exporting the correct environment variable completed the task:

VAGRANT_HOME=/cygdrive/c/Users/basic.user
export VAGRANT_HOME
+8