On Tuesday 08 August 2006 2:27 pm, James D. Parra wrote:
Hello,
Short of rebooting, how to close an open session of a user who is logged in? If the user is logged in either via text mode or remotely, there is a controlling terminal. The who(1) command will tell you the controlling terminal of that user. All you need to do is to find out the top level shell and kill it:
[me@olduvai me]$ who
me pts/1 Aug 3 08:01 (sys254.aaa.bbb.ccc.com)
user1 pts/2 Aug 3 11:01 (bart.ddd.com)
user2 pts/3 Aug 5 02:47 (pool-141-149-182-8.bos.east.verizon.net)
[gaf@olduvai gaf]$ ps ax | grep pts/2
6224 ? S 0:00 sshd: user1@pts/2
6225 pts/2 S 0:00 -bash
407 pts/1 R 0:00 grep pts/2
As root you can kill either process 6224 or 6225. This will force that user
off.
If you want to log out the user who logged in via the x session on the
console, then kill the entire x session.
I prefer using the 'init 3' approach, but you can also kill the X session:
5196 tty7 Ss+ 55:34 /usr/X11R6/bin/X -br -nolisten tcp :0 vt7
-auth /var/lib/xdm/authdir/authfiles/A:0-WXGTlf
$ kill -TERM 5196
--
Jerry Feldman