- What is the difference between user name, display name and log-in name?
- What are the consequences of modifying each of them if a substantial difference holds?
- How do I modify these?
I understand that usermod
is relevant here, but interpreting its options is not immediate without having that terminology clear. And there might be other commands that serve the same or similar purposes.
Pass. Thanks for clarifying this.
Best Answer
Which is which
User name is an ambiguous term that could refer
John Smith
.For that reason, we have more specific terms like login name, which informs us that this is the character string that is used for logging in, like
jsmith
, and notJohn Smith
.User ID also serves this purpose, but it is ambiguous against a numeric user ID. That has to be clear from context. For instance in Unix, users don't usually deal with numeric user IDs; if a prompt asks for a "user ID", people just know that they aren't supposed to enter
1003
butjsmith
.Display name (also called the real user name) informs us that this is a name of some software object (such as a user account) used for referring to it in user interfaces and program output such as diagnostic or debug messages. The implication is that a display name is not necessarily unique among such objects and cannot be used as a key to unambiguously refer to an object. It is literally for display purposes only. A "display name" is not necessarily a user name; that has to be established by the context. Anything that can have a name can potentially have a display name.
In traditional Unix, the
/etc/passwd
file associates your numeric user ID with the login name (the textual user ID), and with a display name.Changing and consequences
The
chfn
utility is used for changing the display name aka real user name and related information. Doing this should have no consequence.Changing the textual user ID aka login name requires privilege;
root
can edit the password file to edit this. The effect will be instant: the new name will appear anywhere in the system where numeric user IDs are displayed as their text equivalent. For instance, if someone lists a directory usingls -l
and that directory contains files owned by that user, they will immediately see the new name, since thels
program picks it out of the password database.The change will break or potentially break various things in the system, and so is a bad idea:
As an example
sudo
utility exists in the system and is configured via the/etc/sudoers
file. Suppose the/etc/sudoers
file grants userbob
the privilege to run some dangerous administrative command with superuser credentials.bob
torobert
in the password file and don't update this entry. Nowrobert
is not able to run that command any more; thesudoers
file grants the privilege tobob
not torobert
.bob
. Thisbob
now has the privilege to run that administrative command as root.