I have 4-5 Ubuntu 14.04 servers in my network and I want to share a common /home
directory between them. I have setup the nfs server, and I can mount the directory on various clients. However my problem is that of user IDs.
Example: A user on the nfs server is UID 1003, but on an nfs client this same user is UID 1002, on another nfs client 1005.
What are my options in resolving this conflict? I've had quite an extensive google search around looking for options and can't find clear answers. Can I map users from one UID to another, or do I have manually change UIDs across all boxes?
This is my current /etc/exports
home 192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check)
The best solution is of course to migrate your users to a single user database such as LDAP, FreeIPA etc. That is a little effort now but will save you a lot of grief in the future.
But you're in "luck" because as of NFS version 4 you don't need matching UID's anymore. The NFSv4 calls between client and server use names and
idmapd
is used translate those user/group names to local user and group IDs, and vice versa.At least that is the theory.
The default security option though,
sec=sys
still uses the local UID/GID's to authenticate NFS operations and those still need to match up between server and client :(The alternative options
sec=krb5
,sec=krb5i
orsec=krb5p
, as their names imply, all require you to set up Kerberos... And if you're going that route you might as well synchronise UID/GID's as well.So yes, you can have different UID's between the NFSv4 server and the clients with NFSv4 but that requires setting up Kerberos.