刚刚创建了一个最小的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