0

In short: If I change my UID what are the complications I can run into?

In context: I am trying to share files between two Ubuntu machines using NFS. Currently each machine has it's own username, but the same UID. For arguments sake, machine 1 has a user mac1, with a UID of 1000, and machine 2 has a user mac2, with a UID of 1000. People advise me that in order to lock down permissions on my file shares, it's good practise to create the same user account on both machines along with the same UID. So I was thinking that on machine 1 I need to keep user mac1, UID 1000, but create user mac2, UID 1001. Then on machine 2 I need to create user mac1, UID 1000, and change user mac2 to UID 1001. However, as it stands both user mac1 (on machine1) & mac2 (on machine 2) are using UID 1000,. So I will need to change the UID of mac2 on machine 2 to be 1001 instead. I've never changed my UID, so I'm worried that other stuff might stop working. Can anyone see some obvious pitfalls I'm going to run into by doing this?

1 Answer 1

1

Don't change the user ID on these hosts! This is a brittle operation that will require all kinds of maintenance, and introduce many subtle problems.

Let the NFS server hosting the exports do the UID mapping for you.

e.g.: https://serverfault.com/questions/520276/nfs-user-mapping

The tricky part is what version of nfsd is being used, and the specific implementation. I'd start with the man page for Ubuntu nfsd and see if it talks about it, or if it needs another daemon running that maps IDs.

It looks like the best reference for this is here: https://help.ubuntu.com/community/SettingUpNFSHowTo

But, the take-away is that you should let the daemon(s) handle this for you, and not try to maintain the same UIDs across all hosts, which is difficult and error-prone (and may not actually work as you need it to, anyway.)

2
  • Have you got any other references. I can't work out what you want me to do from that thread.
    – john smith
    Oct 28, 2015 at 18:41
  • The idea is that you can map specific UIDs and GIDs to others so that a remote host sees the one it expects for a specific user name. I believe you can also map a range of IDs to a specific or another range. My advice would be to check the man page for nfsd as a start.
    – user459652
    Oct 28, 2015 at 18:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .