Vagrant OS X host nfs share permissions error - Failed to set owner to '1000'
Solution 1:
To get rid of this permissions issue, here is what I added to my Vagrantfile
:
if (/darwin/ =~ RUBY_PLATFORM) != nil
config.vm.synced_folder ".", "/host/path/to/shared/folder", nfs: true, :bsd__nfs_options => ["-maproot=0:0"]
else
config.vm.synced_folder ".", "/host/path/to/shared/folder", nfs: true, :linux__nfs_options => ["no_root_squash"]
end
It will adapt the NFS options according to your host OS (OSX or Linux).
Solution 2:
This might be caused by "root squashing" on the NFS server.
When the root user on an NFS client machine tries to manipulate files on an exported NFS filesystem, it does so with the permissions of an unprivileged user (usually nobody or nfsnobody). In this case, if I'm reading correctly, it may be that Puppet (running as root) cannot manipulate files on the NFS server because its permissions are being mapped to this unprivileged user.
To remove root squashing, edit /etc/exports on the NFS server, and add no_root_squash
to the options for the exported filesystem, then run exportfs -av
to re-export the filesystems.
Example /etc/exports line:
/srv 192.168.0.0/24 (rw,no_root_squash)
Solution 3:
mbarthelemy answer got me halfway there, but in the end, I had to tweak a little more:
In my VagrantFile, I added this to the mapping to get it to work:
:linux__nfs_options => ["no_root_squash"], :map_uid => 0, :map_gid => 0