Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

Is there a way to carry audio over ssh?

Say after connecting to remote machine through ssh -X I opened a browser and want to watch a youtube video. Currently I could only able to watch the video without any audio. But I want to hear the audio too. How to do that?

share|improve this question
I'm just curious: How do you watch a video trough ssh? – Radu Rădeanu Nov 5 '13 at 19:19
@RaduRădeanu he's forwarding the Xserver ;) – Braiam Nov 5 '13 at 19:24
I was saying about youtube video. after connecting I just open a browser and watch youtube there. It works but gives several error messages about pulse audio. I have tried vlc to open .mp4 and .avi files. vlc stops working saying "Audio output failed: The audio device "default" could not be used: Connection refused." – souravc Nov 5 '13 at 19:36

Stolen answer from grawity in SuperUsers:

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

You need to install it using sudo apt-get install paprefs

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

Your Answer


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.