Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Dec 2000 15:03:33 -0800 (PST)
From:      dima@unixfreak.org (Dima Dorfman)
To:        chris@awww.jeah.net (Chris Byrnes)
Cc:        questions@freebsd.org
Subject:   Re: Ghosted logins
Message-ID:  <20001202230333.966E93E09@bazooka.unixfreak.org>
In-Reply-To: <200012021404.eB2E45j63561@awww.jeah.net> from "Chris Byrnes" at Dec 02, 2000 08:04:05 AM

next in thread | previous in thread | raw e-mail | index | archive | help

--%--multipart-mixed-boundary-1.91476.975798213--%
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Chris Byrnes wrote:
> 
> nessun           qk       nas-75-66.indy-t Thu05PM 1day  -
> 
> That person hasnt been actually logged in for over a day.
> 
> I know you can telnet localhost a bunch of times to grab and use
> the tty the ghost in "w" is on, but with such a high one like
> "qk", it would take awhile.
> 
> Is there an easier way to get rid of a ghosted login in "w"?

Sure.  Compile (with libutil, using `gcc -o logout logout.c -lutil`)
and run (`./logout ttyqk`) the attached program.  It uses the
logout(3) function to clear the utmp entry for the specified tty.

-- 
Dima Dorfman <dima@unixfreak.org>
Finger dima@unixfreak.org for PGP public key.

--%--multipart-mixed-boundary-1.91476.975798213--%
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Description: C program text
Content-Disposition: attachment; filename="logout.c"

#include <sys/types.h>
#include <err.h>
#include <libutil.h>
#include <stdio.h>

int
main(int argc, char *argv[])
{

	if (argc < 2)
	{
		printf("Usage: %s <tty>\n", argv[0]);
		return (1);
	}

	if (logout(argv[1]) != 1)
		err(1, "logout");
	else
		printf("utmp entry for %s has been cleared\n", argv[1]);

	return (0);
}

--%--multipart-mixed-boundary-1.91476.975798213--%--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001202230333.966E93E09>