Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

While it is possible to use X applications remotely by using -X switch in ssh, the sound is being played in remote machine's speaker only. For example if I view a film in VLC/Totem only video is visible and I can't hear the audio. Is there a way to forward audio too? [without digging through Pulse-audio's setup, I mean; Like how ssh understands X forwarding by itself.]

I have tried this only in Ubuntu (in various Ubuntu versions from 9.10 through 10.10), if that helps.

share|improve this question

The easy way: Run paprefs, go to Network Server and check Enable network access to local sound devices.

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). Just tell PulseAudio to listen for network connections (paprefs as described above), and all X11 programs will be able to use it.

(Other users will not have access to your sound server, unless you allow it yourself in paprefs. The authentication data is carried over in the X11 PULSE_COOKIE property, or you can copy ~/.pulse_cookie manually.)

Note however, that the PulseAudio stream is not encrypted this way, so it is okay for use at home, but not over the Internet.


The slightly more complicated way: Enable network access as above, but tunnel PulseAudio over SSH TCP forwarding. Use pax11publish to discover your PulseAudio port (usually 4713), connect with ssh -R 24713:localhost:4713, then run export PULSE_SERVER="tcp:localhost:24713". This will be slightly slower due to SSH overhead, but is safe to use over the Internet.

share|improve this answer
    
Where does ~/.pulse_cookie exist? On the remote or locally? – HSchmale Dec 29 '15 at 0:29
    
Both. It's generated by the pulseaudio daemon, then read by connecting clients (like a password), so you'll want to copy it from the server to clients. (Note that the path has since been changed to ~/.config/pulse/cookie; if one doesn't work, try the other.) – grawity Dec 29 '15 at 15:29
    
Note that after changing the settings in paprefs, you must manually restart at least pulseaudio. In my case, after spending hours trying to figure out what was wrong, I just rebooted, and then everything worked :). – crazy2be Jun 1 at 23:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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