Vagrant ssh 链接不上的处理方法通过vagrant ssh命令链接上面虚拟机,执行下面命令,reboot虚拟机,问题应该就解决了sudo /home/vagrant/vagrant.shre
Vagrant ssh 链接不上的处理方法
通过
vagrant ssh
命令链接上面虚拟机,执行下面命令,reboot虚拟机,问题应该就解决了
sudo /home/vagrant/vagrant.shreboot
/home/vagrant/vagrant.sh 内容如下:
# vim /home/vagrant/vagrant.sh# Vagrant specificdate > /etc/vagrant_box_build_time# Add vagrant user/usr/sbin/groupadd vagrant/usr/sbin/useradd vagrant -g vagrant -G wheelecho "vagrant"|passwd --stdin vagrantecho "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/vagrantchmod 0440 /etc/sudoers.d/vagrant# Installing vagrant keysmkdir -pm 700 /home/vagrant/.sshwget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O /home/vagrant/.ssh/authorized_keyschmod 0600 /home/vagrant/.ssh/authorized_keyschown -R vagrant /home/vagrant/.ssh# Customize the message of the dayecho 'Welcome to your Vagrant-built virtual machine.' > /etc/motd
关闭防火墙、启动sshd命令
systemctl start mysqld.servicesystemctl enable mysqld.servicesystemctl stop firewalld.servicesystemctl disable firewalld.servicesystemctl stop iptables.servicesystemctl disable iptables.servicesystemctl enable sshd.servicesystemctl enable crond.servicesystemctl enable messagebus.servicesystemctl restart sshd.service