SUMMARY: cleaning up utmp/wtmp

From: George Gallen <ggallen_at_slackinc.com>
Date: Thu, 29 May 97 15:39:00 EDT

The answers to my questions was best put by Tom Blinn.
the OS is 3.2c (DU).

original post
 ------------------

> How do I reset the utmp/wtmp/lastlogin/pacct cleanly?
>
> I want to start the accounting fresh. What what I read in the man's
just
> making new files is all that is needed (or thats how I read it). I rm +
> touched
> new files, everything seemed like it was working fine, util I did a
"w",
> which
> only showed me the users that were logged on SINCE I reset the wtmp.
and
> when anyone would log off their process became zombied, After a reboot
> everything was back to normal(?).
>
> To avoid rebooting in the future, (I'm mostly only concerned with
keeping
> 1
> to 2 months worth of login information) How does one reset the log
files
> and
> still keep the "w" command seeing everyone who is logged in, as well as
> not
> having their processes become zombied?
>
> George Gallen
> ggallen_at_slackinc.com


Hi, George. You didn't indicate which version of Digital UNIX you're
running, so it's hard to know for sure if you're being bitten by a bug or

if something else is involved. But in any case, I sent your message
along
to the person who does most of the maintenance/development work on the
set
of things that deal with the wtmp/utmp/lastlog files, and here's what he
says (with minor editing):

  INFO:
  1. The utmp file is reset on every boot.
  2. wtmp is cumulative.
  3. lastlog is based on the user id.

  To reset the lastlog and wtmp files, as root,
  cat /dev/null > /var/adm/wtmp
  cat /dev/null > /var/adm/lastlog

  There were problems with utmp prior to 3.2C. We applied several patches
  on 3.2C which affected /sbin/init, login, getty, rlogind, etc. If
  George is running a release prior to 3.2C, then he should expect some
  difficulties.

  The w command only uses the /var/adm/utmp. The utmp file should never,
  ever be reset by the user. Init creates it. It should only be updated
  via the libc function pututline().

So, to summarize, don't EVER try to remove or zero the utmp file; it is
bounded by the maximum number of logged in users, and lots of things are
dependent on its health.

If you want to reset wtmp and lastlog, do it as noted above -- just cat
an
empty file (/dev/null) into each of them. If you're concerned about
doing
this with users on the system, put the two commands on one line so that
you
are confirming it with a single return; they will happen essentially at
the
same time.

Tom
   

 Dr. Thomas P. Blinn, UNIX Software Group, Digital Equipment Corporation
  110 Spit Brook Road, MS ZKO3-2/U20 Nashua, New Hampshire 03062-2698
   Technology Partnership Engineering Phone: (603) 881-0646
    Internet: tpb_at_zk3.dec.com Digital's Easynet: alpha::tpb
     ACM Member: tpblinn_at_acm.org PC_at_Home: tom_at_felines.mv.net

  Worry kills more people than work because more people worry than work.

      Keep your stick on the ice. -- Steve Smith ("Red Green")

     My favorite palindrome is: Satan, oscillate my metallic sonatas.
                                         -- Phil Agre, pagre_at_ucsd.edu

  Opinions expressed herein are my own, and do not necessarily represent
  those of my employer or anyone else, living or dead, real or imagined.
   
Received on Fri May 30 1997 - 16:26:50 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:36 NZDT