Automatically set owner to new files in a NFS Folder

cn flag

I have a machine which acts as a NFS server, this machine shares files with others. Developers use the dev-user to upload files to the NFS server, but in the NFS client those files need to be owned by web-user, and devs don't have the credentials to log into the web servers everytime and do chown to those files. I want that everytime files are uploaded to the NFS client they are owned automatically by web-user.

I have tried with ACL with no result. And Nfsv4_ACL is confuse.

Is this possible? or do i have to seek other options?

de flag
does this help:
ar flag

Several hacks and work-arounds are possible. In no particular order:

  • synchronise the UID numbers used for the dev-user and web-user accounts.
    That may have impact elsewhere so that will take careful planning.

  • rather than using NFS use SMB to export and mount the file share.
    The CIFS (SMB) mount option supports the uid=arg, gid=arg and forceuid arguments to set the uid/gid that will own all files or directories on the mounted filesystem from the client. The ID's may be specified as either a name or a numeric uid/gid.

  • NFSv4 allows for ID mapping and translation. See for example man idmand.conf and Mapping UID and GID of local user to the mounted NFS share
    That should allow you to for example use on your web-servers:

    # /etc/idmapd.conf
    dev-user@NFS-SERVER.EXAMPLE.COM = web-user
de flag
The static mapping works only for kerberized access

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.