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. :-)

  • Ha! Neat. I'd never heard of this command before. Is it available on all systems? Sure looks like it beats killing their shell process. – Jonathon Watney May 5 '09 at 19:27
  • It's probably packaged for all distros, but if you need something that works everywhere, skill from procps---as Mihai points out---might be a better choice. It has less style though ;-) – David Schmitt May 6 '09 at 7:31
  • 1
    openSuse 11.4 - slay: command not found :( :( – usr-local-ΕΨΗΕΛΩΝ May 25 '12 at 20:39
  • Not installed on the Ubuntu 12.04 or RHEL 3 hosts that I have currently available, I do have the skill command detailed by Mihai Limbăşan. YMMV – David Feb 27 '13 at 9:16
  • Install it from universe: packages.ubuntu.com/search?keywords=slay – David Schmitt Feb 28 '13 at 11:11

You can kill all of an user's processes via skill. Example:

  • skill -TERM -u username

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 the procps package which is installed by all distributions by default.

  • For others that want to do this for all remote user session, the -v flag (-v pts/*), which is from the man page might be useful. – David Feb 27 '13 at 9:14

The pkill and killall are preferred over skill. This is from the skill man page:

These tools are probably obsolete and unportable. The command syntax is poorly defined. Consider using the killall, pkill, and pgrep commands instead.

This should do the trick:

sudo pkill -KILL -u [user]


sudo killall -u [user]

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:

$ ptree -p

Look for sshd and then run:

$ kill -1 39383

Where 39383 is an example of an arbitrary process ID number.

protected by MadHatter Feb 27 '13 at 9:43

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.