Hi list,
While experimenting with vagrant NFS share from OSX host, I faced an issue with the chown command, where it fails with Operation not permitted unless the user is changing ownership of a file to himself:
vagrant@box:~$ touch /vagrant-nfs/foo
vagrant@box:~$ ls -l /vagrant-nfs/foo
-rw-rw-r-- 1 501 dialout 0 Sep 9 07:34 /vagrant-nfs/foo
vagrant@box:~$ chown vagrant /vagrant-nfs/foo
vagrant@box:~$ echo $?
0
vagrant@box:~$ ls -l /vagrant-nfs/foo
-rw-rw-r-- 1 501 dialout 0 Sep 9 07:34 /vagrant-nfs/foo
vagrant@box:~$ sudo chown vagrant /vagrant-nfs/foo
chown: changing ownership of ‘/vagrant-nfs/foo’: Operation not permitted
vagrant@box:~$ sudo chown root /vagrant-nfs/foo
vagrant@box:~$ echo $?
0
This is problematic for me since I'm running a script that stops at the first error.
At the moment I solved the issue by providing a replacement command for chown that does a noop when the target is in my NFS mount, but doesn't seem like the right approach to me and I was wondering if there is a better one. Hopefully, I'm simply missing the right NFS mount option. I'm using default mount options from Vagrant.
On the host:
$ cat /etc/exports
[snip]
"/path/to/share" 20.20.20.10 -alldirs -mapall=501:20
On the VM:
$ mount
[snip]
20.20.20.1:/path/to/share on /vagrant-nfs type nfs (rw,vers=3,udp,addr=20.20.20.1)
Has anybody experience with this problem?
Martin