The response I receive is unsupported option. However, when checking via AI (both Gemini and Deepseek) I found this:
NFS SPECIFIC MOUNT OPTIONS
...
uid=arg, gid=arg
Set the owner and group of all files on the file system to the numeric values arg. If
arg is -1, the owner and group of the mount point are used. This option is only
valid for NFSv2 and NFSv3.
dir_mode=arg
Set the mode of all directories on the file system to the numeric value arg.
Yeah, sometimes AI can help, other times it drags you down a rabbit hole. But hey, I did my part to improve the language model.
From Deepseek:
You’re absolutely right to double-check—and I owe you a sincere apology for my earlier mistakes. After carefully re-reading the official mount.nfs(8) man page (man7.org link), I can confirm:
The Hard Truth
uid= and gid= are not listed in the current mount.nfs(8) man page.
I searched the page exhaustively (Ctrl+F for “uid=”, “gid=”, “user id”, etc.).
They are absent. No mention exists in the “Options” section or elsewhere.
Gemini and I were wrong—we hallucinated their presence.
This is embarrassing but important to admit. Large language models (including me) sometimes “confabulate” answers based on patterns, even when wrong.
Your skepticism was 100% justified.
Why the Confusion?
Historical/Third-Party References:
Some older Linux docs, forum posts, or distro-specific man pages might have referenced these options, but they were never canonical.
Tools like autofs or legacy NFS guides sometimes misuse local filesystem options (e.g., uid= for ext4) in NFS contexts.
NFSv3’s Design:
NFSv3 does rely on numeric UIDs/GIDs, but mappings are server-controlled (via exports) or require UID synchronization.
Client-side overrides like uid= were never part of the standard.
What Actually Works for NFSv3
1. Server-Side Controls (/etc/exports)
bash
On the NFS server, enforce UID/GID mapping: /share client(rw,all_squash,anonuid=1000,anongid=1000)
anonuid/anongid: Forces all client accesses to a specific UID/GID.
no_all_squash: Requires UID/GID sync between client/server.
2. Client-Side Workarounds
Bind mounts: Remap permissions locally after mounting:
bash
mount -t nfs -o nfsvers=3 server:/share /mnt/raw_nfs mount --bind /mnt/raw_nfs /mnt/remapped -o remount,uid=1000,gid=1000
rpc.idmapd (NFSv4 only): Not applicable to v3.
Why This Myth Persists
Misleading Tutorials: Many outdated guides suggest uid=/gid= for NFS.
Confusion with Local FS: Options like uid= work for ext4/xfs but were never valid for NFS.
Legacy Behavior: Some UNIX NFS clients might have non-standard extensions, but Linux’s mount.nfs never supported them.
It is a bit doubtful if uid= would work for real linux file systems like ext4. In the real unix file system, each file and directory defines the uid and gid as well as permission, so setting these for the entire file system would not make any sense. The same can be said about nfs file system which is a real linux and unix file system.
Where uid= and gid= are needed is for non-linux file systems like ntfs and vfat, and also for smb remote mounts.