Vagrant ssh' private_key_path`文件必须存在

时间:2014-07-29 14:16:35

标签: vagrant

我在流浪汉期间收到此错误

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

如何设置私钥以便使用vagrant ssh?我正在使用Windows 7。

我的流浪档案

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

2 个答案:

答案 0 :(得分:8)

所以在我的情况下,我在Windows上使用 cygwin ,我收到了:

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

经过几分钟的调查后,我意识到VAGRANT_HOME环境变量不正常,因此导出正确的环境变量完成了这项工作:

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

答案 1 :(得分:2)

insecure_key应该是包含SSH密钥的文件。该文件应位于vagrant up所在的文件夹中。 following是另一种选择:

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