【问题标题】:Vagrant ssh 'private_key_path` file must existVagrant ssh 'private_key_path` 文件必须存在
【发布时间】:2014-09-20 23:04:50
【问题描述】:

我在 vagrant up 期间遇到了这个错误

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

如何设置私钥以使用 ssh 来使用 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

【问题讨论】:

    标签: vagrant


    【解决方案1】:

    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

    【解决方案2】:

    所以在我的情况下,我在 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
    

    【讨论】:

    • 感谢您的回答,这正是我的问题。我将此添加到我的 .bash_profile 中,它运行良好,谢谢!
    • 2 小时后,这终于解决了我的问题。在 Windows(powershell)上,您可以执行 setx VAGRANT_HOME "/cygdrive/c/Users/Bob"
    猜你喜欢
    • 2015-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-16
    • 2016-04-09
    • 2017-12-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多