首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SSH和Vagrant

SSH和Vagrant
EN

Stack Overflow用户
提问于 2017-02-22 04:13:07
回答 2查看 196关注 0票数 0

当我在我的应用程序中运行vagrant up时,进程停滞不前

代码语言:javascript
复制
SSH auth method: private key

Vagrantfile

代码语言:javascript
复制
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

在另一个窗口中运行vagrant ssh-config

代码语言:javascript
复制
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从何而来?它不应该是一个private_key吗

我可以查看什么来尝试和调试它?我在调试模式下运行流浪,发现了这个

代码语言:javascript
复制
  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"]

有没有人对我能做什么有什么进一步的想法?

谢谢

EN

回答 2

Stack Overflow用户

发布于 2017-02-22 04:24:17

如果ssh.insert_key属性设置为true,那么您在/Users/rich/.vagrant.d/insecure_private_key看到的私钥是由vagrant生成的。

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

config.ssh.private_key_path

代码语言:javascript
复制
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
EN

Stack Overflow用户

发布于 2017-02-23 09:39:28

正常情况下,Vagrant将自动使用一个公共的、“众所周知的”ssh密钥,并自动将虚拟盒子设置为使用该密钥。要获得这种行为,只需在Vagrantfile中设置app_config.ssh.insert_key = true选项即可。

我们在Vagrantfile中设置了这两个选项,因为我们没有使用默认的vagrant帐户,但是为了更好地模拟我们的ec2-user环境,我们创建了一个ssh帐户并指定了我们自己的私有ssh密钥。

代码语言:javascript
复制
config.ssh.username = "ec2-user"
config.ssh.private_key_path = "/Users/lance/git/devops/.vagrant_helpers/vagrant_private_key"
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42377047

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档