剛剛創建了一個最小的centos 7的新vagrant盒。不能ssh到新創建的流浪盒
我遵循本指南。 https://blog.engineyard.com/2014/building-a-vagrant-box
我也有到位的一切,在官方流浪者提到的導向件here和here
然而,當我嘗試做無業遊民了。它試圖ssh到盒子時超時。
什麼可能導致這種情況? VM中的我的網絡適配器是NAT。 我試圖設置私網IP
config.vm.network "private_network", ip: "192.168.50.4"
我能夠使用此IP和流浪漢的用戶名和密碼爲SSH。我想知道爲什麼流浪漢不能ssh? 這裏是vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'my'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: my_box_default_1475351710988_24744
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
輸出,並且很長一段時間後,給出了這樣的錯誤。
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
SSH密鑰使用以下命令
mkdir -p /home/vagrant/.ssh
chmod 0700 /home/vagrant/.ssh
wget --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys
chmod 0600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant:vagrant /home/vagrant/.ssh
我升級到1.8.6。重建盒子。但同樣的問題。 – kausar
您可以在創建vagrant用戶的位置共享腳本,並在添加authorized_keys之後在ssh目錄中設置權限? – kikitux
我將這些命令添加到問題中。只是爲了讓你知道我也試着用ssh使用密碼。 – kausar