Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parent folders of synced_folder are owned by root #2257

Closed
nathany opened this issue Sep 22, 2013 · 5 comments
Closed

Parent folders of synced_folder are owned by root #2257

nathany opened this issue Sep 22, 2013 · 5 comments

Comments

@nathany
Copy link

nathany commented Sep 22, 2013

"The second parameter must be an absolute path of where to share the folder within the guest machine. This folder will be created (recursively, if it must) if it doesn't exist."

When I setup a synced folder like so:

linux.vm.synced_folder src_path, "/home/vagrant/go/src"

The src folder is owned by vagrant:vagrant but the go folder is owned by root:root. This prevents the pkg and bin folders from being created later.

mkdir /home/vagrant/go/pkg: permission denied

Adding owner: "vagrant", group: "vagrant" did not remedy the situation.

Vagrant 1.3.3, VirtualBox 4.2.18 r88780, OS X 10.8.5, precise64, inline shell provisioning

@nathany
Copy link
Author

nathany commented Sep 23, 2013

For now, my solution is to make the synced_folder directly in the $HOME folder. This is my complete (working) Vagrantfile: https://gist.github.com/nathany/6662802

@mitchellh
Copy link
Contributor

This is working as intended. If you need to change the permissions, use an inline shell provisioner. The permissions you specify on shared folders will only apply to the deepest child. Otherwise, typical umask takes place.

@nathany
Copy link
Author

nathany commented Sep 29, 2013

Care to explain why or offer any advice? Thanks.

@mminer
Copy link

mminer commented Aug 26, 2014

@nathany I ran into the same problem. My solution was to run chown -R vagrant:vagrant /home/vagrant/go with an inline script.

(I realize I'm replying to a comment almost a year old, but I too expected that setting the owner and group would also apply to the parent folders created)

@fd0
Copy link

fd0 commented Jul 18, 2015

For the record: I also think that this is unexpected. I got bitten today, too.

mmwtsn added a commit to mmwtsn/vagrant that referenced this issue Jul 27, 2018
This is the intended behavior but it is not obvious. When setting up synced
folders that require parent folders (e.g. folders that live in Go's `GOPATH`)
this has the potential to catch users off guard. See hashicorp#2257.
@ghost ghost locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants