Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Occasionally I'll be logged in to a GNOME session on a Linux box I have, but then I'll want to log myself out remotely later for various reasons. I can get in to the machine through SSH with my own account, but I don't have root access to it.

Is there a way to force my X session to log out with just the permissions that my user account has?

share|improve this question
Although not an answer, you may want to look at "screen" for linux. It is great to preserve applications and the like from your terminal. This way when you work remotely you can detach from your screen, when you get home you can re-attach to your screen session. Not sure if you are looking for this type of functionality but I thought I would toss it out there. – Chris Sep 21 '10 at 18:01
up vote 5 down vote accepted

After logging in with ssh, run:

env DISPLAY=:0.0 gnome-session-save --logout

This will force a logout on the remote machine just as if you had logged out from the menu (but without prompting). You may need to run with --force-logout if there's an application with, for example, un-saved work, that would otherwise prevent a clean logout.

share|improve this answer

Not technically 'log out' but couldn't you just kill the processes? Login over ssh, find your processes (pstree may be of help here) and kill them. This probably won't trigger the session management saves that a GUI triggered Logout would do.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .