Vagrant synced folder permissions

前端 未结 2 1773
情话喂你
情话喂你 2021-02-13 09:51

I have set up a synced folder in Vagrant, from my Windows host to the guest. Initially the permissions on the files were too open so I added the following mount options:

2条回答
  •  灰色年华
    2021-02-13 10:56

    In the end, I came up with two solutions:

    1) Accept all the files being executable

    config.vm.synced_folder "../my-folder", "/home/vagrant/my-folder",
        mount_options: ["dmode=775,fmode=777"]
    

    2) Use the rsync method to synchronise the folders

    config.vm.synced_folder "../ansible-provision", "/home/vagrant/ansible", type: "rsync",
        rsync__exclude: ".git/"
    

    Each method has its own drawbacks, but the first was quickest to implement and acceptable for my use case, so I went with that.

提交回复
热议问题