Application cannot create writable folder with Vagrant

I configured my own bonus box out of the Vagrant Official Precise64 box. I have a synced folder located here "/ var / www" and a shared folder located under "/ var / www / public".

For "/ var / www" my rights are:

drwxr-xr-x  1 vagrant vagrant 

      

For "/ var / www / public" my rights are:

drwxr-xr-x  1 vagrant vagrant

      

To illustrate my problem with WordPress applications, I manually set upload permissions to 777. WordPress can create a folder inside uploads in a month, for example, "/ var / www / public / wp-content / add / 10 /"; however, it cannot upload or write to the newly created folder unless I manually manually allow changing the permissions of the newly created "10" folder.

This happens with all applications, such as the Laravel Repository folder and basically any time a program tries to create a directory. Trying to force permissions on Vagrant Up during provisioning also doesn't work:

config.vm.synced_folder "/path/to/writable/folder", "/path/to/writable/folder", :mount_options => ["dmode=777","fmode=666"]

      

So what permissions do I need to set on the virtual server for this to work?

+3


source to share


3 answers


I used both WordPress and Laravel in Vagrant and set write permissions on Vagrantfile:

config.vm.synced_folder ".", "/vagrant", :mount_options => ['dmode=774','fmode=775']



And also add the default Apache user to the group vagrant

(I'm using a shell):

usermod -a -G vagrant www-data

+16


source


Try adding the following line to your vagrant file:



config.vm.synced_folder ".", "/vagrant", :group => "www-data", :mount_options => ['dmode=775','fmode=664']

      

+2


source


To expand on Jesse's answer , when using hometead (and therefore Homestead.yaml), you can pass these parameters as follows.

folders:
- map: ./
  to: /home/vagrant/code
  options:
    mount_options: ['dmode=777','fmode=777']

      

0


source







All Articles