Vagrant 流浪者流浪者文件配置

Vagrant 流浪者流浪者文件配置,vagrant,virtualbox,vagrantfile,vagrant-windows,Vagrant,Virtualbox,Vagrantfile,Vagrant Windows,我有这个用于“centos/7”盒子的文件 Vagrant.configure("2") do |config| config.vm.box = "centos/7" config.vm.network :private_network, ip: "192.168.33.10" config.vm.synced_folder ".", "/home/vagrant" config.vm.provision "shell", path: "./conf/bitrix-env.sh"

我有这个用于“centos/7”盒子的文件

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  config.vm.network :private_network, ip: "192.168.33.10"
  config.vm.synced_folder ".", "/home/vagrant"
  config.vm.provision "shell", path: "./conf/bitrix-env.sh"

  config.vm.boot_timeout = 100


 config.vm.provider :virtualbox do |vb|
   vb.gui = true
   vb.memory = "1024"
 end

end
vagrant up-命令可以正常工作,但规定中的脚本不会安装 在我尝试开始流浪规定后,出现了一个错误:

SSH is getting permission denied errors when attempting to connect
to the IP for SSH. This is usually caused by network rules and not being
able to connect to the specified IP. Please try changing the IP on
which the guest machine binds to for SSH.

如何修复此问题并安装所有设备?

问题是由于您的文件中的以下行造成的

  config.vm.synced_folder '.', '/home/vagrant' 
vagrant用户的授权密钥文件位于vagrant机器内的/home/vagrant/.ssh中,该文件允许ssh进入vagrant框

当您将当前目录装载到/home/vagrant时,/home/vagrant的所有内容都被重写,并且没有经过授权的密钥文件

将挂载路径更改为除/home/vagrant之外的任何其他路径,您将能够通过ssh连接到机器中。举例来说

  config.vm.synced_folder '.', '/home/vagrant/somepath'