Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!umich!samsung!usc!ucselx!steer!g-patena From: g-patena@steer..calstate.edu (Mitch Patenaude) Newsgroups: comp.unix.questions Subject: Re: loginid vs. uid. Message-ID: <1990Jul13.192055.2329@ucselx.sdsu.edu> Date: 13 Jul 90 19:20:55 GMT References: <316@dynasys.UUCP> <6174@helios.ee.lbl.gov> Sender: news@ucselx.sdsu.edu (News Admin) Organization: Humboldt State University, Arcata, Calif. USA Lines: 33 JEMilburn@lbl.gov (John Milburn) writes: >jessea@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@steer.calstate.edu Gandalf@Calstate.BITNET