The answer is apparently a bug in OpenWindows 3.0 which does not clear /etc/utmp after closing all the command tools. You all were right, I had tried checking the output from ps and users and could find nothing. The program which was posted previously on sun-managers (before I subscribed) did the trick, and many sent me the code-- thanks a lot!
I put the command in the .login file, right after the openwin command. This way, if I exit OW and then want to Control-C before logging out, the confusing entries will be gone. Works like a charm! Thanks again....
ivan@fac.anu.edu.au
pete@physchem.ox.ac.uk
leon@orbot.co.il
meisner@dlrtcs.da.op.dlr.de
montjoy@thor.ece.uc.EDU
don@mars.dgrc.doc.ca
chip@allegra.att.com
bbrandt1@pms037.pms.ford.com
cross@eng.umd.edu
danny@ews7.dseg.ti.com
era@niwot.scd.ucar.EDU
alc.com!hoogs@alc.com
c3314jcl@mercury.nwac.sea06.navy.mil
pln@egret1.Stanford.EDU
Original problem:
----- Begin Included Message -----
This is a minor problem, but I wonder if anyone has seen it. When I exit OpenWindows, the (default) .login file automatically logs me out. But if I then login to the system as root, I find that the logins did not all go away. I am concerned that this may be a security hole, or it will bog down my system if I login again and start OW. (The system, as you can guess, is already slow) Below are the outputs from "who" and "w". Thanks in advance!
------------------------------------
d3385# who
root console Nov 4 13:04
ekurgpol ttyp0 Oct 30 11:20
ekurgpol ttyp1 Oct 29 10:38
ekurgpol ttyp2 Oct 29 10:39
ekurgpol ttyp3 Nov 2 10:23
ekurgpol ttyp4 Oct 29 10:39
ekurgpol ttyp5 Oct 29 10:39
ekurgpol ttyp7 Oct 29 10:40
ekurgpol ttyp8 Oct 29 10:40
ekurgpol ttyp9 Oct 29 10:44
ekurgpol ttypa Nov 2 12:32
d3385# w
1:05pm up 6 days, 2:19, 1 user, load average: 3.68, 4.05, 3.24
User tty login@ idle JCPU PCPU what
root console 1:04pm 4 w
ekurgpol ttyp0 Fri11am 2 -
ekurgpol ttyp1 Thu10am 5 -
ekurgpol ttyp2 Thu10am 2 -
ekurgpol ttyp3 Mon10am 25:13 -
ekurgpol ttyp4 Thu10am 2days -
ekurgpol ttyp5 Thu10am 2 -
ekurgpol ttyp7 Thu10am 2 -
ekurgpol ttyp8 Thu10am 1 -
ekurgpol ttyp9 Thu10am 2days -
ekurgpol ttypa Mon12pm 1 -
d3385#
----- End Included Message -----
...And here is the code:
/*
* From Sun-Spots Digest, v6n9 (Fri 29 Jan 1988)
* Date: Wed, 20 Jan 88 11:37:51 EST
* From: Graham Campbell <gc@bnl-ewok.arpa>
* Subject: Program to help keep utmp clean
*
* Since the question of cleaning out the pseudo-tty entries from utmp has
* arisen again (Sun-Spots v6n5), I will contribute a small program that I
* run from my .logout that does this.
*
* Graham
*/
#include <utmp.h>
#include <sys/file.h>
#include <stdio.h>
char master[11] = "/dev/pty??";
main()
{
struct utmp ut;
int utmp, pty;
long posn;
utmp = open("/etc/utmp", O_RDWR);
if (utmp == -1)
{
perror("Cannot open utmp");
exit (1);
}
while (posn = lseek(utmp, 0L, L_INCR), read(utmp, &ut, sizeof(ut)) != 0)
{
if (ut.ut_name[0] == 0)
continue;
if (strncmp(ut.ut_line, "tty", 3) == 0 && (ut.ut_line[3] == 'p' ||
ut.ut_line[3] == 'q' || ut.ut_line[3] == 'r'))
{
master[8] = ut.ut_line[3];
master[9] = ut.ut_line[4];
pty = open(master, O_RDWR);
if (pty >= 0)
{
close(pty);
lseek(utmp, posn, L_SET);
ut.ut_name[0] = 0;
ut.ut_host[0] = 0;
write(utmp, &ut, sizeof(ut));
}
}
}
}
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:52 CDT