Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Oct 2000 11:34:33 +0000
From:      Jamie Heckford <heckfordj@psi-domain.co.uk>
To:        andrew@ugh.net.au
Cc:        freebsd-isp@freebsd.org
Subject:   Re: Logging users out
Message-ID:  <00103111391900.01594@freefire.psi-domain.co.uk>
In-Reply-To: <Pine.BSF.4.21.0010301452030.2043-100000@starbug.ugh.net.au>
References:  <Pine.BSF.4.21.0010301452030.2043-100000@starbug.ugh.net.au>

next in thread | previous in thread | raw e-mail | index | archive | help
I usually just do this:

% ps -aux | grep username

username   1637  1.3  0.7  1340  868  p1  Ds   11.36AM  0:00.09  csh

then I just do a:

% kill -KILL 1637

not the best or cleanest way of doing it, but its just a quick method ive stuck
with over the years.

-- 
Jamie Heckford
Chief Network Engineer
Psi-Domain - Innovative Linux Solutions. Ask Us How.

===================================
email:     heckfordj@psi-domain.co.uk
web:	 http://www.psi-domain.co.uk/

tel:	   +44 (0)1737 789 246
fax:	   +44 (0)1737 789 245
mobile:	   +44 (0)7779 646 529
===================================


On Mon, 30 Oct 2000, you wrote:
> Hi,
> 
> What is the best way to go about logging a user out given their tty? I had
> a couple of ideas:
> 
> (a) open their tty and set the baud rate to 0
> 
> (b) use tcgetpgrp to get the process group id of the foreground process
> group on that tty, then with that info use libkvm to find the session
> leader's pid and send it a SIGHUP
> 
> (c) use tcgetpgrp to get the process group id of the foreground process
> group on that tty then using killpg to kill all the members of that
> process group. I would need to do this in a loop to catch background
> process groups that come to the foreground after a process group is
> killed.
> 
> Whenever sending a signal I will have to verify the process exited,
> possibly sending TERM and KILL until it does.
> 
> Problems:
> 
> (a) a doesn't seem to work...I'm guessing it only works on serial lines.
> 
> (b) b would be quite unportable I would guess (although thats not a
> tragedy I would like to avoid it if it isn't too hard). Also if the
> session leader dies is there any guarentee everything else in the session
> goes as well? Or would I have to go through and kill every process group
> in the session?
> 
> (c) c just seemed to be a bit of a hack (assuming you haven't just read
> b). Out of all of them it seems the best so far however.
> 
> Does anyone have any suggestions or comments? Is there a "proper" way to
> do this?
> 
> Thanks,
> 
> Andrew
> 
> 
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-hackers" in the body of the message



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




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