From owner-freebsd-questions Sat Dec 2 15: 3:37 2000 Delivered-To: freebsd-questions@freebsd.org Received: from bazooka.unixfreak.org (bazooka.unixfreak.org [63.198.170.138]) by hub.freebsd.org (Postfix) with ESMTP id 6ED6A37B400 for ; Sat, 2 Dec 2000 15:03:34 -0800 (PST) Received: by bazooka.unixfreak.org (Postfix, from userid 1000) id 966E93E09; Sat, 2 Dec 2000 15:03:33 -0800 (PST) Subject: Re: Ghosted logins To: chris@awww.jeah.net (Chris Byrnes) Date: Sat, 2 Dec 2000 15:03:33 -0800 (PST) Cc: questions@freebsd.org In-Reply-To: <200012021404.eB2E45j63561@awww.jeah.net> from "Chris Byrnes" at Dec 02, 2000 08:04:05 AM X-Mailer: ELM [version 2.5 PL3] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="%--multipart-mixed-boundary-1.91476.975798213--%" Message-Id: <20001202230333.966E93E09@bazooka.unixfreak.org> From: dima@unixfreak.org (Dima Dorfman) Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --%--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 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 #include #include #include int main(int argc, char *argv[]) { if (argc < 2) { printf("Usage: %s \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