How to fix NFS users and groups

You can use NFS to mount a drive on a different server. This is useful when you need to share a volume between different servers however in ext4, Linux group and user access rights to directories and files can cause issues like showing up a nogroup or nobody on the mounted drive.

To make sure both servers use the same group and user, first make sure the desired group and user exists on the destination server (the one mounting the remote NFS volume).

Now edit the /etc/idmapd.conf file:

sudo vi/etc/idmapd.conf

These are the important parts to change:

Domain under [General]: It needs to be the same on both servers.

Also add the following to the end of the file:

[Translation]Method=nsswitch

The end result will look something like this:

[General] Verbosity=7 Pipefs-Directory=/var/lib/nfs/rpc_pipefs Domain=gw.example.com
[Translation]Method=nsswitch

Once done, you need to restart the idmap service on both client and server:

service idmapd restart

And the NFS server on the server:

/etc/init.d/nfs-kernel-server restart

Try Cloud 66 for Free, No credit card required