[英]Vagrant 1.7 SSH authentication failure on OSX – private key not copied to VM
[英]SSH and Vagrant
當我在應用程序中運行vagrant up
,流程陷入
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
在另一個窗口中運行vagrant ssh-config
時
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
我可以看一下以嘗試調試它? 我在調試模式下跑了流浪漢,發現了這個
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"]
有誰對我能做什么有進一步的想法?
謝謝
如果ssh.insert_key
屬性設置為true,則在ssh.insert_key
看到的/Users/rich/.vagrant.d/insecure_private_key
是由vagrant生成的。
查看文檔 ,您應該能夠使用來指定現有私鑰的位置。
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.
通常,Vagrant將自動使用公共的“知名” ssh密鑰,並將自動設置虛擬盒以使用該密鑰。 要獲得該行為,只需在app_config.ssh.insert_key = true
不設置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"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.