Xref: utzoo comp.sys.att:3990 unix-pc.general:1247 comp.unix.questions:8786
Path: utzoo!utgpu!water!watmath!clyde!att!icus!lenny
From: lenny@icus.UUCP (Lenny Tropiano)
Newsgroups: comp.sys.att,unix-pc.general,comp.unix.questions
Subject: getlogin() problem (was Re: username problem)
Message-ID: <467@icus.UUCP>
Date: 15 Aug 88 02:02:40 GMT
References: <578@proxftl.UUCP>
Reply-To: lenny@icus.UUCP (Lenny Tropiano)
Organization: ICUS Software Systems, Islip, New York
Lines: 52

In article <578@proxftl.UUCP> aaron@proxftl.UUCP (Aaron Zimmerman) writes:
|>I have a curious problem on my 3b1...
|>
...
|>$ who am i
|>aaron      w4           Aug 12 08:01
|>$ passwd
|>Changing password for LOGIN
|>Permission denied.
...

The problem occurs not in passwd (or the /etc/passwd file), but in the
getlogin(3C) function call.    This problem occurs if you use multiple
getty's on /dev/window, or you have something running on w1 when the
getty respawns for /dev/window.

The following example with show this:

lenny    + w1           Aug 14 20:05   .     4428  
root     + w4           Aug 14 21:51   .     5623  

(Note:  I'm logged in with two gettys, the current one is w4).

# tty
/dev/w4
# passwd
Changing password for lenny
New password: [...]

getlogin(3C) looks up the /dev/window login finding the first entry in
/etc/utmp it finds.  I maybe logged in on w4 as root, but getlogin thinks
I am logged in as lenny on w1.  In your case with user LOGIN, it found was a
LOGIN_PROCESS.	(A "getty" process waiting for login)

Something like:

LOGIN    + window       Aug 14 21:54   .     5880  
root     + w4           Aug 14 21:51   .     5623  

Those are the disadvantages in running multiple gettys, although having
the capability to login more than once is nice. (Something I'm working into
the window-manager I am rewriting).

-Lenny
-- 
Paper-net: Lenny Tropiano          | @-net:         lenny@icus.UUCP
           ICUS Software Systems   | !-net:      ...sbcs   \
           PO Box 1                |                boulder \
           Islip Terrace, NY 11752 |                talcott  !icus!lenny
Vocal-net: (516) 582-5525 [work]   |                pacbell /
           (516) 968-8576 [home]   |                hombre /
Telex-net: 154232428 ICUS          | Another-net:   attmail!icus!lenny