Pseudo-Terminals Forever

Chris Torek chris at mimsy.UUCP
Thu Apr 21 08:50:59 AEST 1988


[Another article to which I never saw a correct answer:]

In article <38 at etl.ARPA> richr at etl.ARPA (Rich Rosenthal) writes:
>On VAX BSD4.3 I ran UW and I created a couple of pseudo-terminals.
>... on one of the pseudo-terminals I exec'ed login and latter logged out.
>Result.  The account 'news' is still logged in 5 days latter, but,
>there are zero (0) processes associated with the login.
>How do I get rid of the appearance that 'news' is still logged in?

By way of explanation:

The windows you create with UW have no associated login record
(unless UW runs setuid root so that it can write /etc/utmp and
/usr/adm/wtmp, which seems unlikely).  This is normal, if annoying.
Only true `login windows' have login records.

Now, when you ran login, it allowed the user `news' in on that pty,
so it wrote a login record in /usr/adm/wtmp and in /etc/utmp.
Normally, these records are replaced only by another `login' on
the same terminal (which writes a new one) or by /etc/init (which
erases the utmp entry and closes the wtmp one with a logout record)
when the process it spawned on that terminal finally exits.

Since UW was not run directly by init, init did not know to clear
the entry for ttyqe.

>    Here is the output of 'w':
>
>      8:19am  up 6 days, 17:47,  9 users,  load average: 0.18, 0.16, 0.22
>    User     tty       login@  idle   JCPU   PCPU  what
[stuff deleted]
>    news     ttyqe    Wed10am 5days                -
>
>    The ps command shows no (0) processes associated with the news
>    logged in on ttyqe.

Right---there is nothing there.  The easiest way to make the entry go
away is to use telnet or rlogin to log in many times, using up one pty
each time, until you take ttyqe.  Since rlogind and telnetd start at
ptyp0, if no one else is on, you may have to log in 30 times.  (Some
other program could be using ptypX, which would make this number smaller.)

Incidentally, rlogin and telnet login records are erased by rlogind and
telnetd, since init cannot do this for them.

(4.4BSD is likely to have a new method for deciding who is logged in,
etc., since the current system is starting to break down.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.questions mailing list