nfsidmap(8)

πŸ“¦
version 3.1.1 Β· 2 versions
  • 3.1.1 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 2.5.4 Β· centos-stream 9
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– nfsidmap(8) β€” the NFS idmapper upcall program πŸ’–

okay bestie, sit down, hydrate, and let's talk about nfsidmap β€” it's a System Manager's Manual situation and honestly it's giving "quietly holding your entire NFSv4 mount together" energy. 🫢


✨ NAME ✨

nfsidmap β€” the NFS idmapper upcall program. literally that's her whole job title. πŸ’…


🌸 SYNOPSIS 🌸

nfsidmap [-v] [-t timeout] key desc
nfsidmap [-v] [-c]
nfsidmap [-v] [-u|-g|-r user]
nfsidmap -d
nfsidmap -l
nfsidmap -h

six whole moods. pick your vibe. ⭐


πŸ¦‹ DESCRIPTION πŸ¦‹

So. The NFSv4 protocol does NOT put your local system's UID and GID values on the wire as numbers, bestie. It sends them as strings that look like user@domain. And the whole process of translating from UID β†’ string and string β†’ UID? That's called "ID mapping." periodt.

The system gets the user part of that string by doing a password or group lookup. And where does the lookup mechanism live? It's configured in /etc/idmapd.conf. πŸŽ€

By default, the domain part of the string is just the system's DNS domain name. BUT β€” and this is the lowkey important part β€” you can also specify it in /etc/idmapd.conf if your system is multi-homed, or if your system's DNS domain name doesn't match the name of your system's Kerberos realm. πŸ™ˆ

When the domain is not specified in /etc/idmapd.conf, the local DNS server gets queried for the _nfsv4idmapdomain text record. If that record exists, that's what gets used as the domain. If the record doesn't exist, then the domain part of the DNS domain gets used. no cap. 🧚

Now the main character: the /usr/sbin/nfsidmap program performs translations on behalf of the kernel. The kernel uses the request-key mechanism to perform an upcall. So /usr/sbin/nfsidmap gets invoked by /sbin/request-key, does the translation, and initializes a key with the resulting information. Then the kernel caches the translation results in that key. teamwork! πŸ‘‘

nfsidmap can also clear cached ID map results in the kernel, or revoke one particular key. And why do we care? Because an incorrect cached key can result in file and directory ownership reverting to "nobody" on NFSv4 mount points. which is... the villain origin story of your afternoon. πŸ’€

Plus, the -d and -l options are there to help diagnose misconfigurations. They have no effect on the keyring containing ID mapping results β€” they're just here to snoop and tell you the truth. 🌈


πŸ’… OPTIONS πŸ’…

  • -c β€” Clear the keyring of all the keys. bye bye everything πŸ‘‹
  • -d β€” Display the system's effective NFSv4 domain name on stdout.
  • -g user β€” Revoke the gid key of the given user.
  • -h β€” Display usage message.
  • -l β€” Display on stdout all keys currently in the keyring used to cache ID mapping results. Heads up bestie: these keys are visible only to the superuser. πŸ”
  • -r user β€” Revoke both the uid and gid key of the given user. both. at once. ruthless.
  • -t timeout β€” Set the expiration timer, in seconds, on the key. The default is 600 seconds (10 mins). ⏰
  • -u user β€” Revoke the uid key of the given user.
  • -v β€” Increases the verbosity of the output to syslog (can be specified multiple times). say it louder for the syslog πŸ“’

πŸŽ€ CONFIGURING πŸŽ€

Okay so here's the setup part, and it's not optional, it's necessary. The file /etc/request-key.conf will need to be modified so /sbin/request-key can properly direct the upcall. The following line should be added before a call to keyctl negate:

create    id_resolver    *    *    /usr/sbin/nfsidmap -t 600 %k %d

This will direct all id_resolver requests to the program /usr/sbin/nfsidmap. The -t 600 defines how many seconds into the future the key will expire. This is an optional parameter for /usr/sbin/nfsidmap and will default to 600 seconds when not specified. πŸ’«

The idmapper system uses four key descriptions:

  • uid: β€” Find the UID for the given user
  • gid: β€” Find the GID for the given group
  • user: β€” Find the user name for the given UID
  • group: β€” Find the group name for the given GID

You can choose to handle any of these individually, rather than using the generic upcall program. Iconic behavior honestly. So if you would like to use your own program for a uid lookup, then you would edit your request-key.conf so it looks similar to this:

create    id_resolver    uid:*     *    /some/other/program %k %d
create    id_resolver    *         *    /usr/sbin/nfsidmap %k %d

Notice that the new line was added above the line for the generic program. request-key will find the first matching line and run the corresponding program. In this case, /some/other/program will handle all uid lookups, and /usr/sbin/nfsidmap will handle gid, user, and group lookups. order matters, bestie, always. ⭐


πŸ“ FILES πŸ“

  • /etc/idmapd.conf β€” ID mapping configuration file
  • /etc/request-key.conf β€” Request key configuration file

🌈 SEE ALSO 🌈

idmapd.conf(5), request-key(8)


πŸ‘‘ AUTHOR πŸ‘‘

Bryan Schumaker, <bjschuma@netapp.com>


and that's the whole page, bestie!! 🫢 this one is from the System Manager's Manual, dated 1 October 2010, and it's the nfsidmap(8) manual page β€” go forth and map those IDs, you absolute legend. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from