Varying-Vagrant-Vagrants / VVV

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

Incorrect permissions in /vagrant #1886

Closed paulschreiber closed 5 years ago

paulschreiber commented 5 years ago

Expected Behavior

File /vagrant/vvv-custom.yml is readable by www user.

Current Behavior

File /vagrant/vvv-custom.yml is readable only by root.

Steps to Reproduce (for bugs)

vagrant@vvv:/vagrant$ ls -l
total 12
lrwxrwxrwx 1 root root   17 Jun 27 22:34 certificates -> /srv/certificates
-rw-r--r-- 1 root root   16 Jun 27 22:34 provisioned_at
-rw-r--r-- 1 root root    5 Jun 27 22:34 version
-rw------- 1 root root 1483 Jun 27 22:34 vvv-custom.yml

Your Environment

ghost commented 5 years ago

those permissions are correct, when you are at /vagrant, these files don't get edited by the vagrant user, its provisioned beforehand.

by default, the /vagrant is disabled in the vagrantfile and its re-created with root, along with the files above. u shouldn't be editing this inside of VM, rather than the host. also, note that /vagrant folder is not a shared folder anymore.

paulschreiber commented 5 years ago

This prevents the dashboard (https://vvv.test) from working correctly: image

ghost commented 5 years ago

So, I just checked mine and have the same version as 3.1.0, It seems like I don't have that problem. Screenshot from 2019-06-27 17-13-10

looks fine to me.

ghost commented 5 years ago

maybe try a reload --provision and see if that fixes it. it could just be a bad provisioning

tomjn commented 5 years ago

Nope, it needs a chown to be done in a provisioner

ghost commented 5 years ago

chown -R vagrant:vagrant /vagrant should do it during the initial-setup when is creating the /vagrant folder.

ghost commented 5 years ago

@Mte90 I can do this one if you up for it.

Mte90 commented 5 years ago

ok, is not assigned to someone so you can do it and later we will test it

ghost commented 5 years ago

I'll work on this today

ghost commented 5 years ago

for some reason after creating a new branch locally and modify, I can't push my changes

ERROR: Permission to Varying-Vagrant-Vagrants/VVV.git denied to benlumia007.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
tomjn commented 5 years ago

That's expected, you'd have to fork and submit a PR that way

ghost commented 5 years ago

I have done and added a PR.

Thanks

ghost commented 5 years ago

1891 has been merged

paulschreiber commented 5 years ago

Still broken in 3.1:

vagrant@vvv:~$ ls -al
total 72
drwxr-xr-x 9 vagrant vagrant 4096 Aug  1 17:19 .
drwxr-xr-x 4 root    root    4096 Aug  1 15:50 ..
-rw------- 1 vagrant vagrant  282 Aug  1 15:50 .bash_aliases
-rw-r--r-- 1 vagrant vagrant  220 Jul 31 15:59 .bash_logout
-rw-r--r-- 1 vagrant vagrant 2214 Aug  1 15:50 .bash_profile
-rw-r--r-- 1 vagrant vagrant 3771 Jul 31 15:59 .bashrc
drwx------ 3 vagrant vagrant 4096 Aug  1 15:54 .cache
drwxr-xr-x 4 vagrant vagrant 4096 Aug  1 17:19 .config
drwx------ 3 vagrant vagrant 4096 Aug  1 15:50 .gnupg
drwxr-xr-x 3 vagrant vagrant 4096 Aug  1 15:54 .local
-rw------- 1 root    root     292 Aug  1 15:54 .my.cnf
drwxr-xr-x 4 vagrant vagrant 4096 Aug  1 17:20 .npm
-rw-r--r-- 1 vagrant vagrant  807 Jul 31 15:59 .profile
drwx------ 2 vagrant vagrant 4096 Jul 31 15:59 .ssh
drwxr-xr-x 3 vagrant vagrant 4096 Aug  1 15:54 .subversion
-rw-r--r-- 1 vagrant vagrant    5 Aug  1 15:50 version
-rw------- 1 vagrant vagrant 1016 Aug  1 15:50 .vimrc
-rw------- 1 vagrant vagrant 1507 Aug  1 15:50 vvv-custom.yml
Mte90 commented 5 years ago

as other ticket, did you tried with a vagrant destroy

paulschreiber commented 5 years ago

Yes, I updated to 3.1.0 (git co 3.1.0), and then ran vagrant destroy and vagrant up --provision.

tomjn commented 5 years ago

So ownership is set appropriately here:

https://github.com/Varying-Vagrant-Vagrants/VVV/blob/develop/Vagrantfile#L525

But permissions doesn't change, it needs a chmod, what should the permissions be?

GitHub
Varying-Vagrant-Vagrants/VVV
An open source Vagrant configuration for developing with WordPress - Varying-Vagrant-Vagrants/VVV
ghost commented 5 years ago

please note that this config.vm.provision "file", source: "#{vagrant_dir}/vvv-custom.yml", destination: "/home/vagrant/vvv-custom.yml" gets copy from source to destination /home/vagrant/, then, it gets copy to the /vagrant folder

# cleanup
rm -rf /vagrant/* 
mkdir -p /vagrant
cp -f /home/vagrant/vvv-custom.yml /vagrant

chown -R should relace root with vagrant inside of /vagrant folder.

tomjn commented 5 years ago

The ownership is correct it’s the file permissions that are the problem

On Fri, 2 Aug 2019 at 15:49, Benjamin Lu notifications@github.com wrote:

please note that this config.vm.provision "file", source: "#{vagrant_dir}/vvv-custom.yml", destination: "/home/vagrant/vvv-custom.yml" gets copy from source to destination /home/vagrant/, then, it gets copy to the /vagrant folder

cleanup

rm -rf /vagrant/* mkdir -p /vagrant cp -f /home/vagrant/vvv-custom.yml /vagrant

chown -R should relace root with vagrant inside of /vagrant folder.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/Varying-Vagrant-Vagrants/VVV/issues/1886?email_source=notifications&email_token=AAAOLZ72JTQZAZKQ25S4COLQCRCPVA5CNFSM4H4A2H42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3N6Y7A#issuecomment-517729404, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAOLZY5OCUQEVFJLTN67T3QCRCPVANCNFSM4H4A2H4Q .

ghost commented 5 years ago

similar to grunt issue, if some users' environment works fine with these settings and works every time, great, but the problem, we don't know who else has this is a problem and so far is only been, one user. if there were more users, we be hearing about it.

i have managed to test with root and vagrant without chmod and it works fine.

tomjn commented 5 years ago

Yes but what’s the ownership and file permissions on your machine? It’s clearly not working for Paul, so we need to know what those permissions should be

On Fri, 2 Aug 2019 at 15:57, Benjamin Lu notifications@github.com wrote:

similar to grunt issue, if some users' environment works fine with these settings and works every time, great, but the problem, we don't know who else has this is a problem and so far is only been, one user. if there were more users, we be hearing about it.

i have managed to test with root and vagrant without chmod and it works fine.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/Varying-Vagrant-Vagrants/VVV/issues/1886?email_source=notifications&email_token=AAAOLZ4TOQQKDCTXC3EF5ZLQCRDNFA5CNFSM4H4A2H42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3N7QBY#issuecomment-517732359, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAOLZYP6MUTUCIHAUJGFILQCRDNFANCNFSM4H4A2H4Q .

ghost commented 5 years ago

I'll give you that information shortly.

ghost commented 5 years ago
drwxr-xr-x 9 vagrant vagrant 4096 Aug  2 15:28 .
drwxr-xr-x 4 root    root    4096 Aug  2 15:12 ..
-rwxr-xr-x 1 vagrant vagrant  282 Aug  2 15:13 .bash_aliases
-rw-r--r-- 1 vagrant vagrant  220 Aug  1 16:28 .bash_logout
-rwxr-xr-x 1 vagrant vagrant 2214 Aug  2 15:13 .bash_profile
-rw-r--r-- 1 vagrant vagrant 3771 Aug  1 16:28 .bashrc
drwx------ 3 vagrant vagrant 4096 Aug  2 15:23 .cache
drwxr-xr-x 3 vagrant vagrant 4096 Aug  2 15:23 .config
drwx------ 3 vagrant vagrant 4096 Aug  2 15:13 .gnupg
drwxr-xr-x 3 vagrant vagrant 4096 Aug  2 15:23 .local
-rwxr-xr-x 1 root    root     292 Aug  2 15:25 .my.cnf
-rw-r--r-- 1 vagrant vagrant  807 Aug  1 16:28 .profile
drwx------ 2 vagrant vagrant 4096 Aug  1 16:28 .ssh
drwxr-xr-x 3 vagrant vagrant 4096 Aug  2 15:23 .subversion
-rwxr-xr-x 1 vagrant vagrant 1016 Aug  2 15:13 .vimrc
drwxr-xr-x 3 vagrant vagrant 4096 Aug  2 15:28 .wp-cli
-rw-rw-r-- 1 vagrant vagrant    5 Aug  2 15:13 version
-rw-rw-r-- 1 vagrant vagrant 3430 Aug  2 15:13 vvv-custom.yml
ghost commented 5 years ago

looks like is 664

ghost commented 5 years ago

plese check /vagrant folder too

drwxr-xr-x  2 vagrant vagrant 4096 Aug  2 15:13 .
drwxr-xr-x 24 root    root    4096 Aug  2 15:13 ..
lrwxrwxrwx  1 vagrant vagrant   17 Aug  2 15:13 certificates -> /srv/certificates
-rw-r--r--  1 vagrant vagrant   16 Aug  2 15:13 provisioned_at
-rw-r--r--  1 vagrant vagrant    5 Aug  2 15:13 version
-rw-r--r--  1 vagrant vagrant 3430 Aug  2 15:13 vvv-custom.yml
ghost commented 5 years ago

I would suggest vagrant destroy, back up the folder, reclone the project and try again.

tomjn commented 5 years ago

That’sa pretty destructive way to do things, we should chmod instead and then it only needs a git pull and a reprovision

On Fri, 2 Aug 2019 at 16:43, Benjamin Lu notifications@github.com wrote:

I would suggest vagrant destroy, back up the folder, reclone the project and try again.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/Varying-Vagrant-Vagrants/VVV/issues/1886?email_source=notifications&email_token=AAAOLZYAO554PDL5MIDR2VTQCRIYVA5CNFSM4H4A2H42YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3ODTAA#issuecomment-517749120, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAOLZ5LQCJ4W5B5L5NDDKDQCRIYVANCNFSM4H4A2H4Q .

ghost commented 5 years ago

I have check macOS, Windows, and Linux, all have the same permissions for both folders and files.

ghost commented 5 years ago

im not saying in a way to be destructive, of course we need to change it with chmod. i was just saying that, way without using chmod, because we don't have the problem. but yes, we would need to chmod to avoid the destructive way.

ghost commented 5 years ago

we should only change the vvv-custom.yml in /vagrant instead since that's where the shyaml and provision gets the information.

tomjn commented 5 years ago

In 3.2 I think we should move these config files to /srv/config or /srv/provision to avoid the file copy in the first place.

But in the meantime, we need to run chmod on /vagrant/vvv-custom.yml

ghost commented 5 years ago

what's the purpose of not using /vagrant in the first place.

tomjn commented 5 years ago

Anything involving /vagrant is only there for backwards compatibility reasons. Because we no longer mount that folder, there was no way to read the config file, so it was copied into place to keep the dashboard etc working

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.