Firewall Sync Permissions

I set the synchronized folder in Vagrant, from my Windows host to the guest. Initially, file permissions were too open, so I added the following mount options:

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

However, I need to add execute permissions for a single file in this folder. chmod +x file no effect. Is there a way to allow the execution of one item in the shared folder / have different permissions for the remaining items in the folder?

+5
source share
2 answers

In the end, I came up with two solutions:

1) Accept all executable files

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

2) Use rsync method to synchronize folders

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

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

+7
source

I had a similar problem with folder permissions. I am using virtualbox on Mac OSX. I added owner and group parameters that fixed my problem of being unable to write to the cache directory on the server. Refresh to enable folder and file mode.

 srv.vm.synced_folder server["synced_folder"]["src"], server["synced_folder"]["dest"], create: true, group:'vagrant', owner:'www-data', mount_options: ["dmode=775,fmode=664"] 
+1
source

Source: https://habr.com/ru/post/1244468/


All Articles