From: James Henrickson (ujlh@pool.info.sunyit.edu)
Date: 07/22/92


From: ujlh@pool.info.sunyit.edu (James Henrickson)
Subject: Re: problems with who and w
Date: Wed, 22 Jul 1992 21:54:19 GMT

In article <1992Jul21.223916.18114@ifi.uio.no> janl@ifi.uio.no (Jan Nicolai Langfeldt) writes:
>
>In article <1992Jul20.170722.1@mcclb0.med.nyu.edu>, ramirez@mcclb0.med.nyu.edu writes:
>> I am having a problem with who and w. It is telling me that there are
>> two users when there is only one. It also says under the tty entry that the
>> user is connected to ttyp1. I've reset the machine and that user is still
>> there. Is there anything that I can do to get it off?
>
>This seems to be ripe for adding to the faq.
>
>The problem comes from a earlier improper logout (crash?), that left
>the /etc/[uw]tmp files unupdated. I haven't seen (can't remember) a
>better solutions so I offer this one: login as root, then type 'cd
>/etc;', then 'rm [uw]tmp; touch [uw]tmp', then logout. The [wu]tmp
>files are now empty, and when you login again 'w' and 'who' will
>report the right number of users.

We used to have the same problem with a Xenix system until I wrote a little
C program to add a logout entry in wtmp. Unfortunately, I can't access
that machine at the moment so I can't convert the program for Linux. A
suggestion for anyone thinking about writing a program that deals with
important system files: test your programs on a COPY of the files involved,
and make a backup of the files when you test the finished product. I didn't
learn this the hard way, but you can easily make a mess if people rely on
these system files. :-)

Just a helpful suggestion for new programmers.

-- 
Jim H.
*
* James L. Henrickson                                 ujlh@sunyit.edu
* "Yet another Jim in the Linux world."  :-)