What are the side effects of having several UNIX users share one UID?

You can't have several users with the same UID. If they have the same UID, then they're the same user.

What you have is multiple entries in the user database for the same user. That's possible in all unix variants I've seen. The user name determines which entry is used and thus which password, home directory and shell applies at login time. The first entry determines what id-based lookups to the user database will return. Some applications look up the user database by name (using perhaps $USER), others by UID; if they use the UID, then they'll get the first entry and you can't do anything about it.

This is a cute setup, but it's one of these cute but mostly useless things. It's unusual: if you have any fellow administrator, they won't thank you for it; many applications won't bother to cover this case and may behave suboptimally (e.g. depend on your $LOGNAME for some functionality, resulting in using different data depending on what user name you logged in as). It's also error-prone: you need to use root access to create the second entry, you need to remember to edit both entries in passwd or shadow (e.g. to change your password, which will require root access unlike normal passwd invocation). You should do that only if you have a very good reason.

If all you wanted was to have the same username for SSH, then the way everybody else does it is with aliases in .ssh/config. That's what they're for. It's simpler to set up, doesn't require more privileges, and doesn't set up an unusual and potentially confusing configuration.

One useful use of multiple entries for the same user is a rescue user when things go wrong. For example, a toor account (traditional name) whose shell is a statically-linked binary, which you use only for system repair.

Tags:

Alias

Login

Users