Is there a simple way for me to force another user off of a linux box, while I am logged in as root? I understand that I could determine what type of session they have open, and kill the pid - but I'm thinking there must be a command to do this that I don't know about.
Any ideas?
You can simply
slay(1)
him. :-)You can kill all of an user's processes via
skill
. Example:will send SIGTERM to all of
username
's processes. To kill them for good (via SIGKILL) use -KILL instead of -TERM - please note, though, that you will most likely cause them to lose data that way. It's highly effective, mind you...skill
is part of theprocps
package which is installed by all distributions by default.The
pkill
andkillall
are preferred overskill
. This is from theskill
man page:This should do the trick:
or
Another easy way to do it is to run
kill -1 <pid>
where pid is the process ID number of the SSH session.By running this command, you can see all the sshd process trees, by killing the parent process ID you will effectively kill the user session associated with it:
Look for sshd and then run:
Where 39383 is an example of an arbitrary process ID number.