2017-02-21 87 views
0

,当我在我的应用程序运行vagrant up过程中被卡在SSH和流浪

SSH auth method: private key 

Vagrantfile

Vagrant.configure(2) do |config| 
    config.vm.define :touch_rugby do |app_config| 
    app_config.vm.box = "bento/ubuntu-16.04" 
    app_config.vm.host_name = "touchrugby" 
    app_config.vm.network "private_network", ip: "33.32.1.2" 
    app_config.ssh.insert_key = true 
    end 
end 

当在另一个窗口

HostName 127.0.0.1 
User vagrant 
Port 2222 
UserKnownHostsFile /dev/null 
StrictHostKeyChecking no 
PasswordAuthentication no 
IdentityFile /Users/rich/.vagrant.d/insecure_private_key 
IdentitiesOnly yes 
LogLevel FATAL 

将在什么地方insecure_private_key运行vagrant ssh-config来自?并应该不是私钥

我可以看看什么来尝试和调试呢?我运行在调试模式vagrant,并发现这

INFO ssh: Attempting to connect to SSH... 
    INFO ssh:   - Host: 127.0.0.1 
    INFO ssh:   - Port: 2222 
    INFO ssh:   - Username: vagrant 
    INFO ssh:   - Password? false 
    INFO ssh:   - Key Path: ["/Users/rich/.vagrant.d/insecure_private_key"] 
    DEBUG ssh:   - connect_opts: {:auth_methods=> ["none "hostbased""publickey"], 
           :config=>false, 
           :forward_agent=>false, 
           :send_env=>false, 
           :keys_only=>true, 
           :paranoid=>false, 
           :password=>nil, 
           :port=>2222, 
           :timeout=>15 } 
INFO subprocess: Starting process: ["/usr/local/bin/VBoxManage", "showvminfo", "1f000e35-eee4-482d-8f76-91082f19c2ab", "--machinereadable"] 

有没有人有什么进一步的想法,我可以做什么?

感谢

回答

0

您在/Users/rich/.vagrant.d/insecure_private_key看到由无业游民产生,如果ssh.insert_key属性设置为true的私钥。

Looking at the documentation,您应该可以使用指定现有私钥的位置。

config.ssh.private_key_path

The path to the private key to use to SSH into the guest machine. By default this is the insecure private key that ships with Vagrant, since that is what public boxes use. If you make your own custom box with a custom SSH key, this should point to that private key. 
+0

我很感激我的更新问题,你的答案后,但我有'app_config.ssh.insert_key = TRUE;在我的配置应该替换这个关键 – Richlewis

+0

我不敢肯定我明白你的问题。通过将其设置为true,您会告诉流浪者生成自己的密钥。 –

0

通常情况下,流浪会自动使用一个公共的,“知名” SSH密钥,并会自动设置虚拟盒为使用该密钥。要获得该行为,请不要在您的Vagrantfile中设置app_config.ssh.insert_key = true选项。

我们在Vagrantfile设置这两个选项,因为我们不使用默认的vagrant帐户,但更好地模仿我们的AWS环境,我们创建了一个ec2-user账户,并指定自己的SSH私钥。

config.ssh.username = "ec2-user" 
config.ssh.private_key_path = "/Users/lance/git/devops/.vagrant_helpers/vagrant_private_key"