As @StephenKing suggests you can change the options of the whole directory.
The relevant function is not documented but the source tells us:
# File 'lib/vagrant/config/vm.rb', line 53
def share_folder(name, guestpath, hostpath, opts=nil)
@shared_folders[name] = {
:guestpath => guestpath.to_s,
:hostpath => hostpath.to_s,
:create => false,
:owner => nil,
:group => nil,
:nfs => false,
:transient => false,
:extra => nil
}.merge(opts || {})
end
Basically you can set group, owner and acl for the whole folder which is way better than setting everything to world writable on the host. I have not found any method to change the ownership of a nested directory.
Here is a quickfix:
config.vm.share_folder "v-wordpress", "/var/www/wordpress", "/host/path", :owner => "www-data", :group => "www-data"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…