NFS permissions problem

I have a media server running Ubuntu 24.04.1 that provides an NFS share.

I access this from a macOS desktop machine on the same LAN, to move media files there.

I’ve been having issues with permissions, and discovered that the files I copy to the NFS share are being created with -rw-r--r-- permissions.

I need these files to be created with g+rw permissions, but I can’t figure out how to make this happen.

My /etc/exports file contains this share:

/media/me *(anonuid=1000,crossmnt,anongid=1000,async,insecure,no_subtree_check,all_squash,rw)

How can I fix this issue?

Thanks !

EDIT: A friend pointed out that the permissions of the file on my client machine are just being copied along with the file itself, so it’s inheriting g+r. So, it seems I need a way to somehow cause g+rw permissions to happen on the NFS server filesystem, but that’s where I’m stuck.

1 Like

The permissions are not going to change in the copying process. If you want the group members to have rw persmissions on all file on the nfs share, you would simply run chmod 664 on the parent directory recursively. sudo chmod -R 664 /nfsmount as an example should do it. You need the correct mount point ( /media/me?).

1 Like

Thanks for your message. I tried that just now, but it breaks everything because there is no longer the execute permission for directories, so it is no longer possible to run ls.

I also tried 764 which does include execute permission for owner, but that also fails (idk why).

1 Like

I would change the permissions like this -

find /media/me -type d -exec chmod -c 0775 {} +
find /media/me -type f -exec chmod -c 0664 {} +

Replace /media/me with the actual exact mount point under which you want these permissions for everything

1 Like

Thanks. I tried that, but the problem persists.

As expected, these two commands set all the file permissions to -rw-rw-r--. So far so good.

But if I copy a new file from the client (i.e., drag and drop from a folder on the mac desktop), it gets created with -rw-r--r-- permission, which is the same permission as the file has on the mac.

If I chmod g+w that file, and then copy it to the NFS share, I see that its permissions are now -rw-rw-r--.

So, empirically, what I am seeing is that the permissions are not being set using those of the NFS share, but rather those of the source.

The problem is: it’s not practical to run this chmod script every time I copy files, or chmod every file I copy from the mac, and if I use tinyMediaManager on the mac, it gets permission failures trying to write to the NFS share.

And this is where I am still stuck.

Following up… after messing around for two days, I finally got it working.

In the end, using chmod was not enough, nor was setting groups correctly.

In case anybody else ends up here, the solution was to change the NFS configuration on the Ubuntu machine providing the share.

By default, macOS Monterey was using NFSv3, but NFSv4 is needed for ACL, and this involved tweaking /etc/exports on the Ubuntu server , e.g.:

/media/share *(fsid=0,rw,no_subtree_check,all_squash,insecure,crossmnt,anongid=1000,anonuid=1000)

I’m stuck using macOS Monterey, so the fsid=0 was necessary.

Next, on the mac, edit /etc/nfs.conf to include vers=4, e.g.:

nfs.client.mount.options = vers=4,resvport,nfc,tcp,rwsize=65536,rdirplus,intr,readahead=128

…and mount the share on the mac, like this:

sudo mount -t nfs -o vers=4 <server-ip>:/ /Users/me/sharePoint

It doesn’t work unless you mount only the root directory, i.e., <server-ip>:/ , but NFS will map this to /media/share per the /etc/exports file, so it works.

Voilà