I have a (graphical) login session running on an office computer, and I'd like to log it out to save on a few computer resources.
I can ssh to the office box, but when I try gnome-session-quit
I get this:
$ gnome-session-quit --logout --no-prompt
** (gnome-session-quit:18500): WARNING **: Command line `dbus-launch --autolaunch=fca99a51622d1930b068883b00000005 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
** (gnome-session-quit:18500): WARNING **: Unable to start: Cannot open display:
Makes sense as my $DISPLAY
is empty (as it's a headless ssh session). When I run w
, I see that the gnome-session
is running on tty7
. Is there a way I can pretend to be tty7
and initiate a logout? Is there a better way to do this?
w
, I see some line to this effect:muru :0 Wed20 ?xdm? 11:15m 1.10s gdm-session-worker [pam/gdm-password]
, the:0
being my relevant$DISPLAY
. Don't you? You can also trypgrep -fa X
and see what X is running with.w
withgnome-session
hadtty7
as the display, but the session had several other entries with:0
(terminals open I guess?). Checking the time column fromw
I realised:0
was the graphical session for sure (: