Vagrant 1.9.5: setting permissions for the default synced folders

1.1k views Asked by At

I need to set permissions and ownership to /vagrant in my ubuntu/xenial64 box, and I have found several great solutions for config options in the Vagrant file. My problem however is this - and I couldn't find an answer to it: My default Vagrant file (Vagrant 1.9.5) doesn't have any config on synced folders. Yet the the project dir gets synced alright to /vagrant in the guest. So that's fine.

But if I add any config to the Vagrant file, like for example:

    config.vm.synced_folder ".", "/vagrant",
    mount_options: ["dmode=755, fmode=644"]

I get an error on vagrant up, which basically tells me Guest Additions are not installed on the box. So obviously vagrant interprets my directives as referring to additional synced folders, which I don't need.

    Vagrant was unable to mount VirtualBox shared folders. This is usually
    because the filesystem "vboxsf" is not available. This filesystem is
    made available via the VirtualBox Guest Additions and kernel module.
    Please verify that these guest additions are properly installed in the
    guest...

Basically I don't understand where I can set options for the default synced folders?

1

There are 1 answers

1
Chransen On

So a solution to this question would be to just disable the default synced folder in the Vagrantfile, like so

config.vm.synced_folder ".", "/vagrant", disabled: true

and then specifically set the desired options for syncing the folders, like for example

config.vm.synced_folder ".", "/vagrant_dev_shg",
    owner: "vagrant",
    group: "www-data",
    mount_options: ["dmode=775,fmode=644"]