I've got mate-screensaver installed on a machine running Linux Mint 16. On that machine, I can open up a terminal and query the state of the screensaver:

dan@box1 ~ $ echo $DISPLAY
dan@box1 ~ $ mate-screensaver-command -q
The screensaver is inactive
The screensaver is not inhibited

This all works fine and makes sense. However, when I SSH into that same machine, I don't get the results I expect:

dan@box2 ~ $ ssh box1
dan@box1 ~ $ export DISPLAY=:0.0
dan@box1 ~ $ echo $DISPLAY
dan@box1 ~ $ mate-screensaver-command -q
** Message: Screensaver is not running!

This same method works on all my other computers, all running various versions of Mint. Nothing strange is getting logged to my ~/.xsession-errors.

After reading this answer, I discovered that setting my DBUS_SESSION_BUS_ADDRESS to unix:abstract=/tmp/dbus-ToCuEUyLn0,guid=9296df6ba791b044d4236e45545fbe55 (its value in a local terminal) makes things work as I expect over SSH. However, ~/.dbus/session-bus/*-0 contains a different value, which doesn't work, and I can't find a file containing the correct value for that variable.

Why would one of my machines require that value to be changed, while the rest don't? If that behavior makes sense or is complicated to correct, where else would I look to find the correct value for that variable?

  • Well as a hack, you can just look it up in your process list, like this: DBUS_SESSION_BUS_ADDRESS=$(ps -fwu $(whoami) | sed -n 's/.*[d]bus.*--address=\(.*\)/\1/p') Not perfect, not reliable, but should work most of the time. – zeppelin Nov 1 '16 at 21:33

I use this to get it, but it relies on a running session:

if [[ -z $DBUS_SESSION_BUS_ADDRESS ]]; then
    pgrep "gnome-session" -u "$USER" | while read -r line; do
        exp=$(cat /proc/$line/environ | grep -z "^DBUS_SESSION_BUS_ADDRESS=")
        echo export "$exp" > ~/.exports.sh
    if [[ -f ~/.exports.sh ]]; then
        source ~/.exports.sh

Change 'gnome'to any other session you have (it has to be running).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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