Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am working in a lab with three Ubuntu systems, and I would like to cross-mount some filesystems via NFS. However, while the systems have some of the same usernames, the UIDs and GIDs don't match, because the three systems were set up separately. When I mount an NFS filesystem from one system to another, the ownership shows up wrong. For example, if UID 1000 is alice on server1 and the same UID, 1000, is bob on server2, then when server1 mounts server2's exported filesystem, bob's files appear to be owned by alice.

So Is there any way to make NFS (v4) convert UID's between servers via their associated user names? Googling for this, I've seen lots of references to Kerberos, LDAP, or NIS, which seems like massive overkill for such a simple task, and might not be possible since these systems are not centrally-managed. This link seems to indicate that what I ask is impossible. Is it correct?

Edit: I've tried every configuration for /etc/idmapd.conf that I can think of or find on the internet, and while the idmapd process is clearly running, so far I have not seen any evidence that NFS is making any attempt to use it at all, and it has never had any effect whatsoever on the user ID's reported on NFS mounts.

share|improve this question
    
I believe that the easiest thing for you is to bring all your stuff in order. You may stay with your current auth scheme as you have only three boxes, but you need to sync all users UIDs/GIDs across your boxes. this is not a difficult task actually. –  Serge Sep 22 '12 at 17:57
    
Yes, that is what I finally ended up doing. –  Ryan Thompson Sep 24 '12 at 23:28
add comment

1 Answer

With no centralized user administration, the "best" way I see is for you to force all servers to use the same GID and UID for each user. Now ... I'm only talking about files and/or directories.

What I would do in this case is:

  • Register each UID and GID currently in use.
  • Edit /etc/passwd and /etc/group and match the groups on all servers. Preferably to new UIDs and GIDs so the next step will be faster
  • Run this (it will take some time):

    find / -type d -group <OLD_GID> |chgroup -R <NEW_GID>
    find / -type d -user <OLD_UID> |chown -R <NEW_UID>
    

I did a search for only directories; remove -type d to search everything

share|improve this answer
    
Ummm, the "find" statement is starting from the root directory. The command is changing the ownership of every directory on the system. The suggested changes to these commands will include every file on the system. I suggest you limit which directories this command runs against or you will have a very bad day. –  kpaden Jan 20 at 20:05
    
From find man: -group gname True if the file belongs to the group gname. If gname is numeric and does not appear in the group(4) database, it is taken as a group ID. –  BitsOfNix Jan 21 at 9:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.