Date: Mon, 30 Oct 2000 09:14:04 -0600 (CST) From: Joe Greco <jgreco@ns.sol.net> To: hackers@freebsd.org Cc: ryan@sasknow.com, andrew@ugh.net.au Subject: Re: Logging users out Message-ID: <200010301514.JAA55088@aurora.sol.net> In-Reply-To: <200010301506.JAA02389@earth.execpc.com> from "jgreco@execpc.com" at Oct 30, 2000 09:06:44 AM
next in thread | previous in thread | raw e-mail | index | archive | help
> a) Kill the controlling shell. This will leave some processes behind that > are no longer part of the user's session (like programs that have > detatched from the terminal and become daemons), and processes that > were never part of the user's session (like processes that they started > on a different terminal) > > b) kill -<signal> `ps -axo user,pid | grep user | awk '{print $2}'` > Kills every process owned by ``user''. Sending SIGKILL does so > in a non-catchable way. > > c) /sbin/halt is pretty much guaranteed to do the trick ;-) d) revoke() their tty I used to do variations on a) and b) above, but it's messy, time consuming, error prone, and requires ugly changes every time someone changes ps output, features, or whatever. I wrote a little line program to do a revoke(), it was basically int main(int argc, char *argv[]) { revoke(argv[1]); } Now this doesn't kill a darn thing. And you should be aware of it! But it does forcibly "close" any open fd's pointing at the tty in question, and most programs will get the hint and go away. For some uses, especially predictable uses, this is probably a lot simpler and a lot more foolproof. -- ... Joe ------------------------------------------------------------------------------- Joe Greco - Systems Administrator jgreco@ns.sol.net Solaria Public Access UNIX - Milwaukee, WI 414/342-4847 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010301514.JAA55088>