Who gets ownership of a mounted file/folder in NFS?

Who gets ownership of a mounted file/folder in NFS?

I am stumped with a problem I raised over on superuser and I basically got around it by using NFS version 3. Now, although I no longer have the user 4294967294 problem, now the files I mount are all owned by a user other than that which I want (RaspberryPi's original pi instead of the one I created, raspi1). Both users have root access, so my question is how are ownerships assigned under NFS? Is there anyway to designate who owns a file or is it based on the mount location?

答案1

Apparently there is a map_static option which you can use in /etc/exports to specify mappings between client and server UIDs/GIDs, but that is deprecated. Turns out, the UID and GIDs must be identical on both machines. I find this a little silly, but can easily be achieved through a few commands such as usermod and groupmod.

答案2

You can use:

anonuid=1234,anongid=1234

in your /etc/exports, to define the user/group under which all files and folders will get written onto your NFS destination.

相关内容