SUMMARY: psuedo terminal with no processes for user

From: Randy Rodgers <rrodgers_at_fwi.com>
Date: Thu, 26 Sep 1996 07:51:33 -0500

Managers,

My original question was:

>I have run across something I have never seen before. When I execute the
>"w" command or the "f -i" command, it shows a user with a telnet session
on
>"ttyr9", but I cannot find any process for the user. Does anyone know how
>to clear this up.

I got responses from the following:
        Paul A Sand pas_at_unh.edu
        Ross Alexander rwa_at_cs.athabascau.ca

I used Paul's perl script & it worked fine. I have included both responses
below:

=============================================================

When this happens to me,
I remove the entry from the utmp file with a Perl script:

#!/usr/bin/perl
#
# osfzaputmp --
# Delete bogus entry in /var/adm/utmp specified by user & tty name
#

($#ARGV == 1) || die "Usage: $0 <user> <tty>\n";
open(UTMP, "+</var/adm/utmp") || die "Can't open /var/adm/utmp: $!\n";
$utmp_t = "A32 A14 A32 S I S S I A64";
$utmp_len = length(pack($utmp_t, '', '', '', 0, 0, 0, 0, 0, ''));
# print "$utmp_len\n";
$utmp_pos = tell(UTMP);
$done = 0;
while (read(UTMP, $utrec, $utmp_len)) {
    ($user, $utid, $line, $utyp, $pid, $eterm, $eex, $time, $host) =
        unpack($utmp_t, $utrec);
    if ($user eq $ARGV[0] && $line eq $ARGV[1]) {
        seek(UTMP, $utmp_pos, 0) || die "seek to byte $utmp_pos failed:
$!\n";
        print UTMP pack($utmp_t, '', $utid, $line, 8,$pid, $eterm, $eex,
$time, $host);
        $done = 1;
        last;
    }
    $utmp_pos = tell(UTMP);
}
close(UTMP);
$done || warn "$0: user $ARGV[0] on $ARGV[1] not found\n";



-- 
-- Paul A. Sand                 | Unfortunately, it doesn't really look
like 
-- University of New Hampshire  | a duck *or* walk like a duck, so blindly 
-- pas_at_unh.edu                  | calling it a duck is an error.
-- http://pubpages.unh.edu/~pas |    (J. Greely, comp.admin.policy)
=============================================================
Edit the bogus entry out of the utmp file.  It's a binary file, so don't
use vi for the job ;).  `Man utmp' for details.
regards,
Ross
-- 
Ross Alexander, ve6pdq  --  (403) 675 6311  --  rwa_at_cs.athabascau.ca
=============================================================
    
[=================================
[ Randy Rodgers
[ rrodgers_at_fwi.com
[ System Administrator
[ Allen County/City of Fort Wayne
[ Information Systems
[ (219)449-7660
[=================================
Received on Thu Sep 26 1996 - 15:55:52 NZST

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