tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: "Randy Rodgers" <rrodgers () fwi ! com>
To: tru64-unix-managers
Subject: SUMMARY: psuedo terminal with no processes for user
Date: Thu, 26 Sep 1996 12:51:33 +0000	[thread overview]
Message-ID: <96076339121694.tru64-unix-managers.marc@archive.invalid> (raw)

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@unh.edu
	Ross Alexander rwa@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@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@cs.athabascau.ca

=============================================================
    
[=================================
[ Randy Rodgers
[ rrodgers@fwi.com
[ System Administrator
[ Allen County/City of Fort Wayne
[ Information Systems
[ (219)449-7660
[=================================

                 reply	other threads:[~1996-09-26 12:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox