0

I have a vagrant instance setup e.g

~/Vagrants/devmachine

which has my webapp source code setup like

~/Vagrants/devmachine/htdocs/myapp

which is mapped to /var/www on instance/guest machine (symilink)

ls -al /var/www
lrwxrwxrwx 1 root root 25 Apr  4 10:16 /var/www -> /vagrant/htdocs/myapp/

The issue is that I am unable to change own of the /var/www files e.g

ls -al /var/www/
total 80
drwxrwxrwx 1 vagrant vagrant   782 Mar 20 06:43 .
drwxr-xr-x 1 vagrant vagrant   102 Apr  4 07:06 ..

What I am try to is change:

 sudo chown www-data:www-data -R /var/www

Command is executed without error but file user/group for /var/www does not change

The reason to keep files in this way is so I can edit files easily by IDE.

Edit

I added this to Vagrantfile, but still apache2 is unable to write to files

config.vm.share_folder("v-root", "/vagrant", ".", :owner => "vagrant", :group => "www-data") 
1

1 Answer 1

1

To do this sort of thing I add a second shared folder like so in my VagrantFile: config.vm.synced_folder "../project_folder", "/var/www/", owner: "apache", group: "apache"

so that I can explicitly set the permissions of that folder without effecting the default vagrant setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.