Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am accessing the machine (OpenSuse 11 with KDE) over NX.

I cannot use the Alt-Ctrl-Del shortcuts as it is captured by my system. The regular logoff button just ends the NX session without ending the KDE session. I cant call kdm restart as I have no root privileges.

Other wild guesses like logout and exit do not work either, the first one complaining about not being in a login shell and the second one just closing the console.

My shell-fu is weak, so any help is appreciated.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

You can send a logout command via dbus to KDE, which should (if it can) terminate the session.

qdbus org.kde.ksmserver /KSMServer logout 0 0 0

dbus is a messaging system that lets applications communicate with each other, and the qdbus command is a utility for sending dbus messages to applications.

Applications register with dbus, and the ksmserver part of KDE is the session manager - it looks after who is logged in.

So we are sending a message to ksmserver to the /KSMServer interface and telling it to logout. The message we are sending is the exact same message that is sent to KSM when you click on the logout icon on your desktop.

The three zeros are parameters and can alter the type of logout we are doing:

First parameter:

  • 0 = Do not wait for confirmation
  • 1 = Wait for confirmation (with a 30 second timeout)

Second parameter:

  • -1 = Prompt for action, defaulting to shutdown (Only makes sense when waiting for confirmation.)
  • 0 = Logout
  • 1 = Restart
  • 2 = Shutdown

The third parameter is the "when" parameter, but it isn't clear what its impact is.

share|improve this answer
    
Can you please explain how and why that works? –  Kevin Panko Dec 10 '13 at 18:39
    
@KevinPanko Sure - done. –  Paul Dec 10 '13 at 22:31

Have found this post containing multiple ways to achieve log out from shell. Using skill -KILL -u 'whoami' works nicely

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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