Vagrant Version 1.6.3
Virtual Box 4.3.12
VBoxGuestAdditions-4.3.2
主机操作系统 - > Windows 8
访客操作系统 - > CentOS 6.5
当这是Vagrent文件的内容时,Vagrant synced_folder工作正常
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/var/www"
但是我无法更改synced_folder(/ var / www)中文件或目录的权限。 https://github.com/mitchellh/vagrant/issues/897
为了解决这个问题,我在Vagrentfile中进行了以下更改 https://serverfault.com/questions/398414/vagrant-set-default-share-permissions
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/var/www",
:owner=> 'shiva',
:group=> 'shiva',
:mount_options=> ['dmode=>777', 'fmode=>666']
(其中' shiva'是我创建的用户,我删除了默认用户' vagrant')
现在问题是当我尝试做流浪汉时,它显示了这个错误
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (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: shiva
default: SSH auth method: password
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
default: /var/www => C:/Users/Shiva/CentOSDevEnv_v1_1
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t vboxsf -o uid=`id -u shiva`,gid=`getent group shiva | cut -d: -
f3`,dmode=>777,fmode=>666 var_www /var/www
mount -t vboxsf -o uid=`id -u shiva`,gid=`id -g shiva`,dmode=>777,fmode=
>666 var_www /var/www
我已经完成了这个链接 https://github.com/mitchellh/vagrant/issues/3341
我不知道ruby语法(Vagrantfile语法)。 我真的被困在这里,请帮助。
答案 0 :(得分:2)
错误出现在我的Vagrantfile语法中,我的错误:(
这是正确的语法
:mount_options=> ['dmode=777', 'fmode=666']
但如果流浪者能够显示正确的错误信息会更有帮助,例如
"Error in Vagrantfile syntax"
而不是
"This is usually because the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and can work properly."