On Monday 24 November 2008, David C. Rankin wrote:
If I want to log a user out from a kde session after I have connected to the box via ssh, how is the right way to do it? I would like to do it gracefully so applications close and aren't just crashed. Would 'kill /bin/sh /usr/bin/startkde3' be a way to do that?
I don't know much about being graceful... :-) But there's several options available to you, as far as I see it. First, and the most graceful way I can think of: -> kdeinit_shutdown. First of all, you need to be root to do this. 1) Find out which terminal a user is running on: # who user1 :0 2008-11-24 10:19 user2 pts/1 2008-11-24 10:21 etc. 2) Become the user you want to log off # su - user1 3) Export the DISPLAY variable to match that user's display: # erport DISPLAY=:0 (don' forget the colon) 4) Kill the session: # kdeinit_shutdown. And that takes care of that session. :-) Second and less graceful: -> The skill command (be root) Kill and logout user user1: # skill -KILL -u user1 And that really takes care of that session. Okay, so I am not one for grace, but it gets the job done. Plus, if I need to interrupt a user's session like that, you can bet it's for a reason ;-) HTH, Joop