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.

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

2 Answers 2

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

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.