loginid vs. uid.

Doug Gwyn gwyn at smoke.BRL.MIL
Wed Jul 18 00:11:41 AEST 1990


In article <316 at dynasys.UUCP> jessea at dynasys.UUCP (Jesse W. Asher) writes:
>I consider these two separate concepts - one is a name and the other a
>number and they are not interchangeable.
>My question is does anyone else view them this way, and if not what is
>the relationship?

The situation is considerably more complex than you described --
The fundamental notion is that of UID; however, the set-UID notion
splits UIDness into "real UID" and "effective UID".  A process has
both, and they may be the same or different.  The initial shell
provided when you log in has its real UID set according to an entry
in /etc/passwd; the only use made of the "login name" is to locate
the /etc/passwd entry.  However, that name is recorded in /etc/utmp
along with the terminal port that was used to connect to the system.
Privileged (set-UID root) processes can alter the contents of
/etc/utmp, which is usually the source of the login name reported by
utilities such as "write".  There need not be a name in /etc/utmp
for every "terminal" in use, especially in a windowing environment.
Other utilities may decide to try to derive a user name by searching
for the current real UID in /etc/passwd; however, there may be
several passwd entries with the same UID, so the derived user name
may not match the one used to log in.

The bottom line is that the real UID of a process is well defined,
but the "user name" is ill-defined.  To fix this would require a
massive overhaul of the way that terminals are assigned in UNIX,
among other things.



More information about the Comp.unix.questions mailing list