Lullabot / trusty32-lamp

An Ubuntu 14.04 VM for PHP with built in profiling
GNU General Public License v3.0
32 stars 10 forks source link

www permissions. #3

Closed e0ipso closed 10 years ago

e0ipso commented 10 years ago

I'm seeing that the www is not owned by vagrant:www-data but by vagrant:vagrant and I can't change the group of those.

That forces me to give write permissions to everyone if I want Apache to write in some directory.

deviantintegral commented 10 years ago

Yeah, I thought this was something I'd addressed, but I've had the same problems - but, I can change the group with sudo chgrp.

Either way, I want this to be pain-free, so I'm going to take a look.

deviantintegral commented 10 years ago

Well, this turned out to be more complex than I thought!

At first, I attempted to use rsync__args with --no-group to preserve the default group ownership. But, it turns out that Vagrant does two things:

  1. It runs rsync with sudo on the server side.
  2. It turns out that Vagrant explicitly overrides rsync owner (but not permissions) configuration after the rsync is done. So, the rsync command you see in ps doesn't result in the final owner.

Luckily, there's undocumented 'owner' and 'group' flags that we can put directly in the synced_folder config.

deviantintegral commented 10 years ago

Turns out the option is documented, but not clearly. I filed an upstream docs PR over at https://github.com/mitchellh/vagrant/pull/4112

@mateu-aguilo-bosch I just pushed up a commit setting group to www-data; feel free to reopen this if it doesn't work for you.