{"action":"created","issue":{"url":"https://api.github.com/repos/mitchellh/vagrant/issues/936","labels_url":"https://api.github.com/repos/mitchellh/vagrant/issues/936/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/vagrant/issues/936/comments","events_url":"https://api.github.com/repos/mitchellh/vagrant/issues/936/events","html_url":"https://github.com/mitchellh/vagrant/issues/936","id":4632928,"number":936,"title":"Add feature to mount folders post-provisioning?","user":{"login":"tmotley","id":945642,"avatar_url":"https://avatars.githubusercontent.com/u/945642?v=3","gravatar_id":"","url":"https://api.github.com/users/tmotley","html_url":"https://github.com/tmotley","followers_url":"https://api.github.com/users/tmotley/followers","following_url":"https://api.github.com/users/tmotley/following{/other_user}","gists_url":"https://api.github.com/users/tmotley/gists{/gist_id}","starred_url":"https://api.github.com/users/tmotley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmotley/subscriptions","organizations_url":"https://api.github.com/users/tmotley/orgs","repos_url":"https://api.github.com/users/tmotley/repos","events_url":"https://api.github.com/users/tmotley/events{/privacy}","received_events_url":"https://api.github.com/users/tmotley/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":44,"created_at":"2012-05-17T21:57:25Z","updated_at":"2016-01-29T17:26:04Z","closed_at":"2013-08-29T04:57:39Z","body":"I don't think this feature or config setting exists having perused the docs and support.  My Vagrant file mounts shared folders, and assigns them a group and user ownership. However, if the case of a new box, the user and group I assign the mounted folder ownership do not exist until the chef provisioning is done on the box.  I tried to control the order of provisioning and mounting, but the mounting is always attempted first, which obviously breaks if the provisioning has not occurred yet.\n\nFor example:\n\nconfig.vm.define :dpils_slave_1, :primary => false do |cfg|\n    cfg.vm.forward_port 8080, 8081\n    #cfg.vm.network :hostonly, \"1.1.1.11\"\n    cfg.vm.provision :chef_solo do |chef|\n      chef.cookbooks_path = [\"chef/cookbooks\", \"chef/site-cookbooks\", \"chef/site-cookbooks-tk\"]\n      chef.roles_path = [\"chef/roles-tk\"]\n      chef.add_role \"jboss\"\n      # chef.log_level = :debug\n    end\n\n    cfg.vm.share_folder 'crx_node_2', '/foo/bar/dpils_repository/dpils_whq_02/crx', 'foo/bar/crx_node_2', :owner => \"jboss\", :group => \"jboss\", :create => true\n  end\n\nWhich gives this error on a clean vagrant load:\n\n[dpils_slave_1] -- v-csr-4: /tmp/vagrant-chef-1/chef-solo-4/roles\n[dpils_slave_1] -- v-csc-1: /tmp/vagrant-chef-1/chef-solo-1/cookbooks\n[dpils_slave_1] -- v-csc-2: /tmp/vagrant-chef-1/chef-solo-2/cookbooks\n[dpils_slave_1] -- v-csc-3: /tmp/vagrant-chef-1/chef-solo-3/cookbooks\n[dpils_slave_1] -- crx_node_2: /nike/vault/dpils_repository/dpils_whq_02/crx\nThe following SSH command responded with a non-zero exit status.\nVagrant assumes that this means the command failed!\n\nmount -t vboxsf -o uid=`id -u jboss`,gid=`id -g jboss` crx_node_2 /nike/vault/dpils_repository/dpils_whq_02/crx"},"comment":{"url":"https://api.github.com/repos/mitchellh/vagrant/issues/comments/176872198","html_url":"https://github.com/mitchellh/vagrant/issues/936#issuecomment-176872198","issue_url":"https://api.github.com/repos/mitchellh/vagrant/issues/936","id":176872198,"user":{"login":"dreki","id":563345,"avatar_url":"https://avatars.githubusercontent.com/u/563345?v=3","gravatar_id":"","url":"https://api.github.com/users/dreki","html_url":"https://github.com/dreki","followers_url":"https://api.github.com/users/dreki/followers","following_url":"https://api.github.com/users/dreki/following{/other_user}","gists_url":"https://api.github.com/users/dreki/gists{/gist_id}","starred_url":"https://api.github.com/users/dreki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dreki/subscriptions","organizations_url":"https://api.github.com/users/dreki/orgs","repos_url":"https://api.github.com/users/dreki/repos","events_url":"https://api.github.com/users/dreki/events{/privacy}","received_events_url":"https://api.github.com/users/dreki/received_events","type":"User","site_admin":false},"created_at":"2016-01-29T17:26:04Z","updated_at":"2016-01-29T17:26:04Z","body":"Here's the workaround I landed on:\r\n```\r\nconfig.vm.synced_folder /opt/somedir, /opt/somedir, mount_options: [\"uid=1010,gid=1010\"]\r\n```\r\nTo do this you must create the desired user and group with the UID specified (`useradd -u 1010 cooluser` in this case). The folder will be synced, and when the user is actually created, its UID will match and it will have permission on the synced dir."}}