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

Khash Sajadi

Khash is the founder and CEO of Cloud 66, a full stack container management as a service. Follow him on @khash

London, UK and San Francisco, US
Subscribe and get updates

Have feedback? Please get in touch @cloud66 on Twitter.

Everything you need to build, manage and maintain containers in production on your own servers and any cloud

Try Cloud 66 — 14 Days Free Trial, No credit card required