Linux – Multiple *NIX Accounts with Identical UID

linuxSecurityunix

I am curious whether there is a standard expected behavior and whether it is considered bad practice when creating more than one account on Linux/Unix that have the same UID. I've done some testing on RHEL5 with this and it behaved as I expected, but I don't know if I'm tempting fate using this trick.

As an example, let's say I have two accounts with the same IDs:

a1:$1$4zIl1:5000:5000::/home/a1:/bin/bash
a2:$1$bmh92:5000:5000::/home/a2:/bin/bash

What this means is:

  • I can log in to each account using its own password.
  • Files I create will have the same UID.
  • Tools such as "ls -l" will list the UID as the first entry in the file (a1 in this case).
  • I avoid any permissions or ownership problems between the two accounts because they are really the same user.
  • I get login auditing for each account, so I have better granularity into tracking what is happening on the system.

So my questions are:

  • Is this ability designed or is it just the way it happens to work?
  • Is this going to be consistent across *nix variants?
  • Is this accepted practice?
  • Are there unintended consequences to this practice?

Note, the idea here is to use this for system accounts and not normal user accounts.

Best Answer

My opinion:

Is this ability designed or is it just the way it happens to work?

It is designed. Since I started using *NIX, you have been able to place users on common groups. The ability to have the UID be the same without problems is just an intended result that, like everything, might bring problems if incorrectly managed.

Is this going to be consistent across *nix variants?

I believe so.

Is this accepted practice?

Accepted as in generally used in one way or another, yes.

Are there unintended consequences to this practice?

Other than login auditing, you have nothing else. Unless you wanted exactly that, to start with.