forumone / web-starter

Starting place for developing Drupal, Wordpress and other web applications
http://forumone.github.io/web-starter/
22 stars 11 forks source link

Broken user:group mappings #202

Closed arh1 closed 8 years ago

arh1 commented 8 years ago

The user and group aren't set correctly within the VM, which causes problems. Here's what I see inside the VM after provision:

[vagrant@localhost vagrant]$ ls -la /vagrant
total 700
drwxrwxr-x  16 1000 1000   4096 May 28 03:22 .
dr-xr-xr-x. 25 root root   4096 May 27 19:58 ..
-rw-rw-r--   1 1000 1000    791 May 27 15:55 Capfile
drwxrwxr-x   3 1000 1000   4096 May 27 15:55 capistrano
[snip]
[vagrant@localhost vagrant]$

1000 is the uid and gid of my user on the host machine.

This has been the case for me for a long time, but I got used to working around it. (Thought it was Linux-specific.) However today I realized that it's effecting at least some folks on Macs, too.

Symptoms of the problem include:

Presumably this has to do with these lines, but not sure of the fix yet: https://github.com/forumone/web-starter/blob/1.1.x/Vagrantfile#L51-L52

arh1 commented 8 years ago

Oops, meant to ping you on this @TrevorScheitrum per our chat yesterday.

arh1 commented 8 years ago

I admit I'm unclear on the desired changes here... What should the final uid:gid look like inside the VM? And is it possible to have that be different than what's seen in the host machine? (Limitations of my understanding of NFS.)

The ultimate goals are ensuring we can manipulate the file system inside the webroot as needed during the course of normal site operations, and executing files / manipulating the file system as needed during setup/provisioning tasks.

The Vagrant NFS docs have left me a little more confused on this...

map_uid and map_gid (int) - The UID/GID, respectively, to map all read/write requests too. This will not affect the owner/group within the guest machine itself, but any writes will behave as if they were written as this UID/GID on the host. This defaults to the current user running Vagrant.

gustavderdrache commented 8 years ago

map_uid and map_gid (int) - The UID/GID, respectively, to map all read/write requests too. This will not affect the owner/group within the guest machine itself, but any writes will behave as if they were written as this UID/GID on the host. This defaults to the current user running Vagrant. (emphasis mine)

I think the easiest intuition would be that NFS lets you "impersonate" a specific user/group when making requests, and Vagrant's defaults make it so that regardless of the user inside the VM, all file actions seen by the host are made by the user who typed vagrant up.

I wonder if we should be attempting to resolve our NFS drama by removing some of our own configuration (trying to set things like map_root and whatever) and seeing what Vagrant's defaults get us.

gustavderdrache commented 8 years ago

@arh1 we just merged #210, which may address this. Do you mind kicking the tires on the latest 1.1.x?

arh1 commented 8 years ago

Per our chat just now, looks good from my end!

After a vagrant reload --provision , I'm able to:

[vagrant@localhost ~]$ touch /vagrant/foo
[vagrant@localhost ~]$