Writing to vagrant synced folders
I had a problem writing to the cache directory in my vagrant project due to file permissions. Fortunately Jeremy Kendall has already solved this problem in his Vagrant Synced Folders Permissions article.
He presents two different solutions:
- Setting permissions via the Vagrantfile.
- Changing the web user in the VM to be the vagrant user.
I went with the first option and added this setting in my Vagrant file:
config.vm.synced_folder "./", "/vagrant", id: "vagrant-root", owner: "vagrant", group: "www-data", mount_options: ["dmode=775,fmode=664"]