Vagrant shared folder default mount on windows host


One of my co-workers attempted to run a Vagrantfile I wrote but has problems on the ansible_local provisionning step : the default folder (. -> /vagrant/) is mounted with 777 rights on the linux guest which makes the ssh keys unusable (this guest is used to configure the others).

I haven’t used windows for a super long time now so I can’t help him and I didn’t find anything on this problem in the documentation.

Any ideas ?


Hey there -

Generally by default, Vagrant will always mount your local working directory to the share /vagrant on your guest. You can disable this by adding the following to your Vagrantfile:

config.vm.synced_folder ".", "/vagrant", disabled: true

Additionally, if you just simply want to change the permissions, you can change them by using the various options for synced folders:

I hope that clears things up, thanks!

Hey Brian,

Thanks a lot. I’ve to keep mounting the working directory because the VM uses the ansible.cfg file and the private_keys in order to provision the other ones.

Following your advice I tried to mount it with other rights

config.vm.synced_folder ".", "/vagrant",  :mount_options => ["dmode=600","fmode=600"]

but it doesn’t seem to be taken into account and the rights are still 777 on every file.
Maybe the problem comes from the differences in permissions management on windows vs linux file systems…

I advised my co-worker to switch to linux :slight_smile: