How to kill a logged in user?

Marko Hausalo marko.hausalo at iki.fi
Tue Nov 9 12:07:36 UTC 2004


Mostafa Z. Afgani wrote:
> So, I would like to know if there is any way to kill those
> sessions/users? I have tried googling for an answer but couldn't find
> anything satisfactory.

Check with who who is online:
# who
root     pts/49       Nov  9 13:10 (hostname.domain.xx)

where you see that there's an connection to pts/49 in my case.
Then make an ps command like this to see if there's an active
shell:
# ps ax | grep "pts/49"
32265 ?        S      0:00 sshd: root at pts/49
32267 pts/49   S      0:00 -bash
32663 pts/49   R      0:00 ps ax
32664 pts/49   R      0:00 grep pts/49

Here you see there's active connections thru sshd and an shell
-> 32267 pts/49   S      0:00 -bash
then just as root give the command
# kill -9 32267
and the connection should drop. If there's no shell for the
connection try killing the sshd or whatever process that is
hanging there.

Hope this helps and I hope I did understand your problem
correctly!

Regards,
   Marko




More information about the users mailing list