Force a UNIX or Linux User to Logout

Posted on October 17, 2008 by nseidm1.
Categories: kill, linux, logout, UNIX, user, who, zombie.

If you have a zombie user logged into a server, or you want to force a user to logout use the “who” command. Type “w” or “who” in a command prompt to see which users are logged in, and then use the pkill command to force them out. pkill -KILL -u “username” Pop in a particular username and boot them out the door.

3 comments.

Comment on April 4th, 2012.

WARNING: by all means DON’T use this on Root cuz it kills -everything- running under Root’s name, requiring a reboot !

At least on my Debian 6 Dedicated Machine I couldn’t connect by any means, so I had to use remote reboot.

Comment on September 9th, 2012.

I wish I would’ve read your comment earlier :D Of course just did
pkill -KILL -u root
and had to reboot the machine ;p

Benoit
Comment on December 4th, 2012.

“pkill -KILL -u username” sends the unforgiving KILL signal to all processes owned by that user. So, OK, it logs the user off, as a side effect, but it does a lot more! Use wisely. To just logoff someone, kill his shell process. Find it with “ps u username”.

Leave a comment

Names and email addresses are required (email addresses aren't displayed), url's are optional.

Comments may contain the following xhtml tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>