3 clarified title
| link

How to get NFSv4 idmap working with sec=sys mounts?

2 clarified title, tags
| link

Wrong user mapping in a NFS share. Is How to get NFSv4 idmap broken or just configured wrongworking with sec=sys mounts?

source | link

Wrong user mapping in a NFS share. Is idmap broken or just configured wrong?

I have a Server (Debian) that is serving some folders trough NFS and a Client (Debian) that connects to the NFS Server (With NFSv4) and mounts that exported folder. So far everything is fine, I can connect and modify the content of the folders. But the users are completely messed up. From what I understand this is due to NFS using the UIDs to set the permissions, and as the UIDs of the users from the Client and the Server differ, then this happens, which is still expected. But from what I understood, by enabling NFSv4, IDMAPD should kick in and use the username instead of the UIDs. The users do exist on the Server and Client side, they just have different UIDs. But for whatever reason IDMAPD doesn't work or doesn't seem to do anything.

So here is what I've done so far:

On Server Side:

  • installed nfs-kernel-server
  • populated the /etc/exports with the proper export settings --> /rfolder ip/24(rw,sync,no_subtree_check,no_root_squash)
  • and changed /etc/default/nfs-common to have NEED_IDMAPD=yes

On the Client Side

  • installed nfs-common
  • and changed /etc/default/nfs-common to have NEED_IDMAPD=yes
  • and mount the folder with "mount -t nfs4 ip:/rfolder /media/lfolder"

Rebooted and restarted both several times, but still nothing. When I create from the Server a folder with user A, on the Client I see that the folder owner is some user X. When I create a file from the Client with user A, on the Server side it says its from some user Y.

I checked with HTOP that the rpc.idmap process is running on the Server and it is indeed. Although on the Client it doesn't appears to be running. By trying to manually start the service on the Client I just got an error message stating that IDMAP requires the nfs-kernel-server dependency to run. So I installed it on the Client side, and now I have the rpc.idmap process running on both Client and Server. Restarted both, and the issue still persists.

Any idea what is wrong here? Or how to configure this properly?