$ export `grep ^DBUS_SESSION_BUS_ADDRESS \ $HOME/.dbus/session-bus/$(dbus-uuidgen --get)-$(echo $DISPLAY \ | sed -e 's/\([^:]*:\)//g' -e 's/\..*$//g')`
From: http://machine-cycle.blogspot.com/2010/12/ssh-and-dbus-sessions.html
If you don’t need interprocess communication, you can spawn a session each time, but don’t forget to include the exit-with-session option to your dbus-launch otherwise you’ll end up spawning a new session each time that never dies. The strangest behavior i’ve seen is shell’s missing every other character after launching a second dbus-launch. In the shell, I could type 1234567890 and only the characters 24680 would show up. It wasn’t just a local display problem, because by double typing each key, I could still navigate and execute commands.
You can also get the variable from running sessions in /proc/
dbus-launch
$ dbus-launch --sh-syntax \
| grep DBUS_SESSION_BUS_ADDRESS > /tmp/dbus-session-bus-address
Depending on your application, you can use dbus-launch in a user’s profile or system wide in rc.local and share the same session bus for all your apps.
$ export `cat /tmp/dbus-session-bus-address`