Program run in SSH accessing pulseaudio on the machine where it runs

In my case, the following worked for me:

pax11publish -r

The culprit is that ssh does not set DBUS_SESSION_BUS_ADDRESS which is used to connect to Pulseaudio. A solution (based on this post) was to add the following lines to my ~/.bashrc, which are used when connecting over ssh:

if [[ -n $SSH_CLIENT ]]; then
    export DBUS_SESSION_BUS_ADDRESS=`cat /proc/$(pidof nautilus)/environ | tr '\0' '\n' | grep DBUS_SESSION_BUS_ADDRESS | cut -d '=' -f2-`
fi

it uses the PID of nautilus (you may need to change that so to get some process which is always run in the session) and searches its environment variables for DBUS_SESSION_BUS_ADDRESS and exports it.

This make programs connecting to Pulse run fine. Other programs communicating over the session d-bus work as well (like audtool for driving audacious over command-line).

Tags:

Ssh

Pulseaudio