To begin with: Normal boring NFS does not have an ID translation mechanism, neither for the identity itself (you can't have user "fred" be 500 on the server and 1000 on the client), nor for the files and directories (if a file says that it's owned by 500 on the server, it will be owned by 500 on the client). If you want one user to have a particular ID on one NFS participant (client or server), that user will have to have the same ID on clients and server, otherwise confusion will rule supreme and you will go insane (been there, done that, not pretty).
OK, I found this thread:
https://forums.freebsd.org/threads/52910/
It seems that if I change the username I just need to update the ownership of the home directory.
Yes, you need to first edit
/etc/passwd and
/etc/group (don't do that directly, use
vipw
) and make sure your user has all the same user and group ID numbers on all systems. Since you have multiple Linux clients where you are 1000, the path of least resistance is to change the single FreeBSD server to have 1000 there too.
The problem is that I don't want to change the ownership, just the underlying IDs associated with the user and the matching group id.
Sorry, this is not Burger King, you can't have it your way! Every file has an associated user and group ID, which is simply transported without modification by NFS. If a file is owned by 1001 on your server, then the clients will see it as owned by 1001, and there is nothing you can do about that (other than by using more complex file sharing mechanisms that have built-in ID translation mechanisms). If you want things to work "normally", then you better make sure that the user/group ID numbering (which is stored in
/etc/passwd and
/etc/group) exactly matches the actual ownership of files and directories.
So I fear the second step is unavoidable: Log out as the affected user (because weird things will happen if you have a running process whose numeric ID to name mapping suddenly changes), log in as root, change
/etc/passwd and
/etc/group, and then do the following: Find all the files/directories owned by 1001 (most likely that is exactly the home directory and stuff underneath it), and change it. That's most easily done with
chown
, which you can use with the "-R" flag to do a whole directory tree at once, and to change both user and group simultaneously. Most likely, you need just a single command, something like
chown -R /home/foo
, done.
If you want to find all other files owned by that user, and if you fear that they have spread in strange places in the file system hierarchy (which can happen), the easy but time-consuming way is to run
find / \( -user 1001 -o -group 1001 \) -print
, save the output in a file, and go have a coffee (or a long lunch, on a big system this might run for many hours).