From owner-freebsd-questions Tue Jun 18 10:42: 8 2002 Delivered-To: freebsd-questions@freebsd.org Received: from cactus.fi.uba.ar (cactus.fi.uba.ar [157.92.49.108]) by hub.freebsd.org (Postfix) with ESMTP id 09CA837B407 for ; Tue, 18 Jun 2002 10:42:01 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by cactus.fi.uba.ar (8.11.6/8.11.6) with ESMTP id g5IHbsQ67643; Tue, 18 Jun 2002 14:37:55 -0300 (ART) (envelope-from fgleiser@cactus.fi.uba.ar) Date: Tue, 18 Jun 2002 14:37:54 -0300 (ART) From: Fernando Gleiser X-X-Sender: To: Dan Nelson Cc: Roman Neuhauser , Alexey Privalov , freebsd-questions Subject: Re: kicking users In-Reply-To: <20020618161438.GA84123@dan.emsphone.com> Message-ID: <20020618142307.N66694-100000@localhost> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 18 Jun 2002, Dan Nelson wrote: > In the last episode (Jun 18), Roman Neuhauser said: > > > > which is not exactly what i was after. i needed to cut off a user > > "right now, regardless of what they're doing" (or rather, just > > because of the stuff they're doing). > > In that case, just kill -9 their shell. Or to kill all processes > running under their userid, kill -9 $( ps -xU -o pid= ) Don't use kill -9. The shell ignores SIGTERM (-15) but responds to a SIGHUP. If you kill -HUP the login shell, it will kill all of his children and then exit. This is from the time when modem connected and serial terminals were common, the kernel sends a SIGHUP to the login shell if you 'hang up' the phone. Sending a SIGKILL (-9) is a last resort and should be used only when everyting else fails. You should give the process a chance to terminate gracefully and do the proper clean up. If you kill -9 a process, it just dies. You may need to do the clean up by hand later (delete stale lockfiles, delete temp files, kill the orphaned children and the like) and that is way more work than trying to kill it with a less drastic signal in the first place. Fer Fer > > -- > Dan Nelson > dnelson@allantgroup.com > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message