Remotely log off same user on a server

3

1

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?

Steve Nay

Posted 2010-09-21T16:09:13.057

Reputation: 255

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 – 2010-09-21T18:01:15.503

Answers

5

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.

Emil Sit

Posted 2010-09-21T16:09:13.057

Reputation: 1 013

0

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.

Rich Homolka

Posted 2010-09-21T16:09:13.057

Reputation: 27 121