I have a server running Ubuntu 18.04 with NFS setup. I have couple of services putting/manipulating files in that share as well as other clients accessing it over network. I want NFS server to set default permissions on all new files/folders to 775.
I've set s flag on folder so all new created files and folders inherit same group, so all of users of that group could create and modify files in that folder. But I can't manage to force NFS to do it. It only created new files with 644 and folders with 2755.
Here's my /etc/exports/
/srv/nfs 192.168.11.0/24(ro,fsid=0,no_subtree_check,) /srv/nfs/lpt-2tb 192.168.1.0/24(rw,sync,all_squash,no_subtree_check,insecure,anonuid=1002,anongid=1002) 1002 is an id of nfs user.
I tried umask and acl, both to no avail.
I've created homedir for nfs user and placed umask 002 in it's ~/.profile.
I tried setting acl on share folder
/srv/nfs/lpt-2tb$ sudo setfacl -d --set u::rwx,g::rwx,o::r-x . /srv/nfs/lpt-2tb$ sudo setfacl -R -m u::rwx,g::rwx . /srv/nfs/lpt-2tb$ sudo getfacl . # file: . # owner: nfs # group: nfs # flags: -s- user::rwx group::rwx other::r-x default:user::rwx default:group::rwx default:other::r-x I've tried modifying nfs-server config located at /lib/systemd/system/nfs-server.service and adding there UMask=002 under [Service] section. This worked for some other services I've created myself, but not for NFS.
I restarting NFS service and even rebooting after all those modification, still, when I copy file to a share from my laptop it has 644 permissions
drwxr-sr-x+ 2 nfs nfs 4096 Apr 5 20:34 acl2 -rw-r--r-- 1 nfs nfs 434506 Mar 7 21:31 acl_test.png ---EDIT---
Here are acl output for file and folder
/srv/nfs/lpt-2tb$ sudo getfacl acl_test.png # file: acl_test.png # owner: nfs_share # group: kodi user::rw- group::r-- other::r-- /srv/nfs/lpt-2tb$ sudo getfacl acl2 # file: acl2 # owner: nfs_share # group: kodi # flags: -s- user::rwx group::r-x other::r-x default:user::rwx default:group::rwx default:other::r-x ---UPD---
I've verified that my server is running nfs v2-3-4 but my client connect via v3 and I can't override it. I'll try to verify if v4 fixes if when I manage to get it working.
I've gave up on finding a clean solution for now and will just do a cron job that will check and fix permission periodically.
getfacl acl_test.png?