How to logout another user in 10.8?

With 10.6 I used to kill the process loginwindow to logout another user, but with 10.8 I noticed that even if I do so, many processes from that user stay active.

So, is there a way to logout another user in 10.8, other than logging him in or manually killing all his processes?


As an administrator:

sudo su - user_to_be_logged_out
kill -9 -1

That will log out any user by ending all of the user processes. Use care to not issue the kill -9 -1 as root else some work would be expected to be lost as the system would immediately self-destroy all processes.

There are of course one line commands, but I like having a pause to look and make sure I switched to the correct user before issuing a powerful command like kill -9 -1 and I also avoid at all costs having sudo appear before that kill since I don't even want to kill all processes as root.


Like bmike mentioned but combining the commands into an alias that can be used in /bin/tcsh shell. Again this is nice and fast but be careful. Don’t do this on root or yourself.

alias ku "sudo su user_to_be_logged_out -c 'kill -9 -1'"