Search code examples
virtualboxvagrantnfs

Vagrant: Is it possible to share files and alter permissions inside the guest?


I have been banging my head against a wall for a week and a half trying to work out how to properly share files between a host and guest using Vagrant and VirtualBox.

What I need to achieve is an auto-provisioning box that downloads our codebase from github. The codebase permissions need to vary from file to file (PHP files, shell scripts, tmp folders, log folders, etc). The codebase files also need to be accessible from the host box for editing.

So far I have tried normal virtualbox sharing, NFS sharing, NFS sharing with bindFS. None of these seem to allow changing the individual file permissions.

This seems to be an absolute showstopper for Vagrant. I honestly do not understand how Vagrant is useful for the purpose of sharing development environments.

Does anyone know how to properly set this up? Is it even possible?

For reference:

  • host OS : Ubuntu 12.04
  • guest OS : Debian 6 (squeeze)
  • vagrant : 1.2.2
  • VirtualBox : 4.2.12

Solution

  • Im not sure if this quite answers your question, but I had issue with my applications not being able to write to the disk on a shared folder system so I used the following in my Vagrantfile to allow r/w access to any shared files from within the client.

    config.vm.synced_folder "./vhosts/", "/var/www/vhosts/", id: "vagrant-root", extra: "dmode=777,fmode=777"