Force a UNIX or Linux User to Logout

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.

5 thoughts on “Force a UNIX or Linux User to Logout”

  1. 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.

  2. “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”.

  3. skill -KILL -t /dev/pts/*
    //Kill users on PTY devices.

    skill -STOP -u viro -u lm -u davem
    //Stop three users.

Leave a Reply