Varying-Vagrant-Vagrants / VVV

An open source Vagrant configuration for developing with WordPress
https://varyingvagrantvagrants.org
MIT License
4.54k stars 847 forks source link

Permission issues with sync folders #768

Closed BartPichola closed 5 years ago

BartPichola commented 9 years ago

I'm having issues with vagrant not assigning proper permissions to files

If I run

    ls -l

This is what I get from local machine:

-rw-r--r-- 1 BPichola 1049089    130 May 20 15:46 400.shtml
-rw-r--r-- 1 BPichola 1049089    162 May 20 15:46 401.shtml
-rw-r--r-- 1 BPichola 1049089    201 May 20 15:46 403.shtml
-rw-r--r-- 1 BPichola 1049089     83 May 20 15:46 404.shtml
-rw-r--r-- 1 BPichola 1049089    461 May 20 15:46 500.php
-rw-r--r-- 1 BPichola 1049089     71 May 20 15:46 500.shtml
-rw-r--r-- 1 BPichola 1049089   3989 Sep 15 12:00 brand.php
-rw-r--r-- 1 BPichola 1049089   5752 Sep 15 12:00 category.php
drwxr-xr-x 1 BPichola 1049089      0 Oct 16 11:18 classes/
drwxr-xr-x 1 BPichola 1049089      0 Sep 30 15:49 css/
...

But this is what I get within vagrant (through vagrant ssh)

-rwxrwxrwx 1 vagrant vagrant    130 May 20 22:46 400.shtml
-rwxrwxrwx 1 vagrant vagrant    162 May 20 22:46 401.shtml
-rwxrwxrwx 1 vagrant vagrant    201 May 20 22:46 403.shtml
-rwxrwxrwx 1 vagrant vagrant     83 May 20 22:46 404.shtml
-rwxrwxrwx 1 vagrant vagrant    461 May 20 22:46 500.php
-rwxrwxrwx 1 vagrant vagrant     71 May 20 22:46 500.shtml
-rwxrwxrwx 1 vagrant vagrant   3989 Sep 15 19:00 brand.php
-rwxrwxrwx 1 vagrant vagrant   5752 Sep 15 19:00 category.php
drwxrwxrwx 1 vagrant vagrant   4096 Oct 16 18:18 classes
drwxrwxrwx 1 vagrant vagrant      0 Sep 30 22:49 css
...

in vagrantfile srv/www sync file is set to following:

  if vagrant_version >= "1.3.0"
    config.vm.synced_folder "www/", "/srv/www/", :owner => "www-data", :mount_options => [ "dmode=755", "fmode=644" ]
  else
    config.vm.synced_folder "www/", "/srv/www/", :owner => "www-data", :extra => 'dmode=755,fmode=644'
  end

However all files and folders still read 777.

This is an issue, because when I push files to production or staging via wordmove, all files get overwritten as 777. I then have to manually log into the server and do:

find -type d -exec chmod 755 {} \;

find -type f -exec chmod 644 {} \;

Any help is appreciated :+1:

brunoDegaspare commented 7 years ago

Is there a solution for this? I have the same issue here.

jeremyfelt commented 7 years ago

I think this may be one of those quirks that needs to be documented as I've lost track of what should be expected here. Anyone doing a deep dive on the hows and whys of shared directory user settings could help here. :)

Mte90 commented 5 years ago

I think that we can close this one with the 3 version now fixed a lot of problems, what do you think @tomjn?

tomjn commented 5 years ago

Folders inside guest the VM take on the ownership group and permissions provided to virtualbox, there's not a lot that can be done about that without moving to things like SMB or NFS shared folders.

Since we've made a lot of significant changes to our shared folder mounts since this issue was opened, I'm going to close it out, but feel free to reopen if it's still of concern

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.