How to set NFSv4 domain in /etc/idmapd.conf without requiring reboot

Solution In Progress - Updated -

Environment

  • Red Hat Enterprise Linux
  • NFSv4

Issue

  • For NFSv4 mounts to work correctly, it is necessary to set the NFS domain in the file /etc/idmapd.conf.

Resolution

  • After adding the domain to the /etc/idmapd.conf file, you must issue the following command: nfsidmap -c .
    Then unmount, and re-mount the filesystem.
  • The issue is caused by stale ID map results in the kernel.
    Issuing the command above clears the keys in the keyring which are used for caching ID map results.

Diagnostic Steps

  • After adding the line:
    Domain = nfsdomain
  • we can see that files are still owned by nobody:
bash-4.2$ dd if=/dev/zero of=/mnt/test/myfile bs=1M count=10
bash-4.2$ ls -l /mnt/test/myfile
-rw-r--r--. 1 nobody 1200162317 10485760 Nov 10 09:21 /mnt/test/myfile
  • The file is owned by nobody rather than the user creating the file.
  • After rebooting the system:
bash-4.2$ dd if=/dev/zero of=/mnt/test/myfile2 bs=1M count=10
bash-4.2$ ls -l /mnt/test/myfile2
-rw-r--r--. 1 testuser 1200162317 10485760 Nov 10 09:11 /mnt/test/myfile2

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments