2
votes

From my research I understand that VirtualBox synced folders have permissions set up during the mounting process. Later, I am unable to change it therefore permissions for the whole synced folder MUST be same for every single file/folder in the shared folder. When trying to change with or without superuser permissions, changes are reverted straight away.

How this can work with for example Symfony PHP framework where there are several different permissions for different files/folders? (i.e. app/console needs execute rights but I don't want to have 7XX everywhere).

I have found in different but similar question (Vagrant and symfony2) that I could set the permissions to 777 for everything in the Vagrantfile, however this is not desirable as I need to use GIT behind my source code which is than deployed to the live environment. Running everything under 777 in the production is, nicely put, not correct.

How do you people cope with this? What are yours permissions setups?

3
I have never had these issues, as Git is ran on the host machine, and it correctly uses file permissions from the host filesystem. Can you describe your set-up more specifically? - Gerry
@Gerry thank you, that's what I am doing at the moment and seems like only reasonable solution. I am operating Git from the host system (Windows 7) and everything else realated to development/testing from the guest (behat, composer etc.). - Patrik Fuhrmann

3 Answers

0
votes

A possible solution could be using the rsync synced folder strategy, along with the vagrant rsync and vagrant rsync-auto commands.

In this way you'll lose bidirectional sync, but you can manage file permission and ownership.

0
votes

I am in a similar situation. I started using Vagrant mount options, and found out that as I upgraded parts of my tech stack (Kernel, Virtualbox, Vagrant, Guest Additions) I started getting different behavior while trying to set permissions in synced folders.

At some point, I was perfectly fine updating a few of the permissions in my shell provisioner. At first, the changes were being reflected in the guest and the host. At another point in time, it was being done the way I expected, with the changes being reflected only in the guest and not the host file-system. After updating the kernel and VB on my host, I noticed that permission changes in the guest are being reflected on the host only.

I was trying to use DKMS to compile VBOX against an older version of my Kernel. No luck yet.

0
votes

Now when I have little more experience, I can actually answer this question.

There are 3 solution to this problem:

  • Use Git in your host system because vagrant basic shared folders setup somehow forces 777 (at least on Windows hosts)
  • Use NFS shared folders option from the vagrant (not available on Windows out of the box)
  • Configure more complex rsync as mentioned in Emyl's answer (slower sync speeds).