2

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?

Chransen
  • 41
  • 4

1 Answers1

2

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"]
Chransen
  • 41
  • 4
  • Excellent tip for disabling the default share via the `Vagrantfile` so it can be overridden elsewhere. I'd like to add that the `mount_options` are specific to the Shared Folder `type`, and would be `['dir_mode=0775', 'file_mode=0644']` for the `smb` type, for example. – Ben Johnson Dec 10 '18 at 21:30