First, run paprefs, go to Network Server and check Enable network access to local sound devices. This will load "module-native-protocol-tcp" in PulseAudio.
You can now access the PulseAudio server in several ways:
Manually forward the TCP connection over SSH
- Use
pax11publish to discover your PulseAudio listener port (usually 4713);
- Connect to another computer with
ssh -R 24713:localhost:4713 (the remote port '24713' was chosen arbitrarily);
- Copy your authentication cookie (~/.config/pulse/cookie) to that computer;
- Finally run
export PULSE_SERVER="tcp:localhost:24713" and test with pactl info.
Use automatic direct connection with X11-based discovery
Whenever you SSH with X11 forwarding enabled, PulseAudio programs use X11 to discover your sound server (use pax11publish or xprop -root PULSE_SERVER to see for yourself). They will try to establish a direct (non-SSH, unencrypted) connection to your computer for audio streaming.
Use automatic direct connection with DNS-SD discovery
If you have avahi-daemon and pulseaudio-zeroconf installed, you can activate "Allow other machines to discover local devices". This will load "module-zeroconf-publish".
Other computers, with the option "Make discoverable network devices available locally" enabled (module-zeroconf-discover), will automatically list outputs (sinks) that your computer exports. They will use a direct (unencrypted) connection for audio streaming.
This method also requires ~/.config/pulse/cookie to be identical across hosts.
~/.pulse_cookieexist? On the remote or locally? – HSchmale Dec 29 '15 at 00:29~/.config/pulse/cookie; if one doesn't work, try the other.) – u1686_grawity Dec 29 '15 at 15:29if test "$SSH_CLIENT" ; then pax11publish -i ; export PULSE_SERVER=tcp:localhost:24713 ; fito the remote .bashrc : this will set the pulsecookie and the env variable automatically when you ssh – am70 Jan 07 '21 at 11:05load-module module-native-protocol-tcpin/etc/pulse/default.pa, you cannot enable it withpaprefs– am70 Dec 22 '21 at 11:40paprefs: https://bugs.launchpad.net/ubuntu/+source/paprefs/+bug/1942949 – jarno Dec 23 '22 at 14:13pax11publish -i. because I use another method for access control: https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Network/#authorization – jarno Dec 23 '22 at 18:29