NFS mount as a specific user
by mrzapp from LinuxQuestions.org on (#4ZYKQ)
Can I mount an NFS share in a way that it will show up as owned by a specified user and group on the client? I want the client to decide which user the share is mounted as, so "all_squash" doesn't seem like an option, unless I'm misunderstanding something. I have read countless pages about NFS mapping, but never gotten a solid answer to this question.
Setup:
I have a NAS with a /data folder owned by data:data. This folder is exported via NFS on the local network like this:
/data 192.168.2.0/24(rw,sync,no_subtree_check,crossmnt,fsid=0)
I also have a client (my web server) that mounts this exported folder like this:
192.168.2.10:/data /data nfs defaults 0 0
All files show up on the client as owned by data:data, which is what I expect.
The client runs NextCloud and various other server software through Docker as the www-data user, so I want the /data NFS share to show up as owned by www-data:www-data
Thank you for your time.


Setup:
I have a NAS with a /data folder owned by data:data. This folder is exported via NFS on the local network like this:
/data 192.168.2.0/24(rw,sync,no_subtree_check,crossmnt,fsid=0)
I also have a client (my web server) that mounts this exported folder like this:
192.168.2.10:/data /data nfs defaults 0 0
All files show up on the client as owned by data:data, which is what I expect.
The client runs NextCloud and various other server software through Docker as the www-data user, so I want the /data NFS share to show up as owned by www-data:www-data
Thank you for your time.