loginid vs. uid.

Mitch Patenaude g-patena at steer..calstate.edu
Sat Jul 14 05:20:55 AEST 1990


JEMilburn at lbl.gov (John Milburn) writes:

>jessea at dynasys.UUCP (Jesse W. Asher) writes:
>>I have learned to make a distinction between a loginid and the userid.
>[...]
>>My question is does anyone else view them this way, and if not what is
>>the relationship? 
>
>I have a number of different loginids one my system with the same
>uid. There are times when I want to be in a completely different
>environment from the one I normally use, so the easiest way to accomplish
>this while retaining access to all of my files is to login with another
>loginid, in a different home directory, but using the same uid.

  There is a danger here.   Aside from the fact that a loginid must have
an associated uid, it helps if this uid is uniqe to this loginid.
Many programs take the numeric uid returned by getuid() or geteuid() and
then look up the loginid (or login name.. as I call it) in the password
file. (I believe the routine is called getpwent(), but don't quote me on it,
I haven't used it in a while), if there is more than one entry with the
same uid, it retrieves the first in the password file.  While this method
returns a consistant value for uid, it will not match the entry in /etc/utmp
which could confuse certain programs.
   often on a unix system there are various administrative logins, all with
the same uid, (often 0) with varying levels of access, so administrive tasks
(backups, diagnostics, etc) can be performed by operators without the need
to give then root access, but these are not standard users, and often
have menu driven shells that specifically avoid the pitfalls associated with
sharing a uid.

    -- Mitch Patenaude  KB6HNH
       Humboldt State University, 3B2/400 Sytem Administrator (and student)
       g-patena at steer.calstate.edu   Gandalf at Calstate.BITNET



More information about the Comp.unix.questions mailing list