Okay so I did a bit of research, and found a method of forwarding audio from your remote RDP Linux desktops.
The methods work for RDP connections on your local LAN, and also for connections to remote systems via ssh tunnels.
Here's how…
2012-04-19 Article Updated
Changelog:
- Added a section for how to get audio on Windows Clients from the linux RDP target
Prerequisites
- The client system needs PulseAudio – client and server – installed. These days it's installed by default if you've installed a full desktop Debian/Ubuntu distribution. Update : Also works for Windows, which also needs PulseAudio – see new section for Windows below!
- The target system needs the PulseAudio client libraries installed. No need for the PulseAudio server, although this is probably already installed if you've installed the Gnome Desktop and/or Unity.
A) Local LAN RDP connections…
Here's the basic setup; a client system and the target system running Xrdp/X11rdp.
The client system's IP address is 192.168.1.9.
The target systems's IP address is 192.168.1.254.
The system you're going to listen to audio on is the rdp client, but it's the PulseAudio server. The RDP target system will send all audio data to the PulseAudio server running on your client machine.
1) On the Client System
Ensure the PulseAudio TCP native protocol module is set up on your client system.
Open up a terminal window on your local system, and type the following;
pacmd list-modules | grep module-native-protocol-tcp
If the response is blank, then this module is not loaded. To load it, type the following;
pactl load-module module-native-protocol-tcp auth-ip-acl="<ip address or network range>"
Where <ip address or network range>
can be a single ip address – for example 192.168.1.254
– or a network range such as 192.168.1.0/24
. The former will limit access to the PulseAudio server running on your client system. The latter will grant PulseAudio server access to all systems on that network. You can also specify a list of IP addresses separated with a semicolon. For example; "192.168.1.101;192.168.1.102;192.168.1.254"
, which would limit access to the systems on the LAN with those addresses.
Once you've loaded this module successfully, you'll see a number returned – this is the module ID number. You can unload the module if you wish to try different configurations, by typing pactl unload-module <ID number>
.
2) On the Target RDP System
In the user's ~/.xsession
file, add this line BEFORE any lines which start your gnome or unity-2D session…
export PULSE_SERVER=<ip address of your client machine>
So for example, my client machine's address is 192.168.1.9. The line would read export PULSE_SERVER=192.168.1.9
Save the .xsession
file.
Here's what my .xsession file looks like;
export PULSE_SERVER=192.168.1.9:4713
gnome-session --session=gnome-fallback
3) Connect via RDP
From your client machine, use your favorite RDP client to connect to the target RDP system as usual.
Any audio output from programs running in the RDP session should now automatically be heard on your client system.
Also, if you right-click on the audio icon on your desktop (I'm using the gnome-classic desktop for my RDP sessions), then click on Sound Preferences, you can control the audio output of the RDP session, just as if the sound hardware were on the RDP target machine :)
Here's a screenshot of a gnome-classic session running on rdesktop. I brought up the Sound Preferences and clicked the Hardware tab. Thanks to Pulseaudio's magic, the sound card on my client machine appears – as if it's installed on the RDP server.
Magic, I say. Magic!
I'm running RhythmBox in that session as I type this, and the audio's coming through just fine ;)
And that's it for audio on RDP for the local LAN. Next up is doing the same on a truly remote system…
B) Audio on RDP on remote connections…
The method is similar to the above for LAN connections, except that we're going to be doing this through ssh tunnels.
Prerequisites
- The client system needs PulseAudio – client and server – installed. These days it's installed by default if you've installed a full desktop Debian/Ubuntu distribution.
- The target system needs the PulseAudio client libraries installed. No need for the PulseAudio server, although this is probably already installed if you've installed the Gnome Desktop and/or Unity.
1) On the Client System
We'll need an SSH tunnel between the client machine, and your target machine.
If you don't know how that's done, I suggest you read the article I wrote recently on how to do exactly that ;)
For the purposes of this article, I'm going to form an ssh tunnel between my client, and a machine on my LAN at 192.168.1.254 – the principle is exactly the same, and I've tried this on a remote VPS system too.
I've tried this procedure on a remote machine over the internet (a VPS), and the sound was choppy when playing sound from Google Chrome (a YouTube video. I don't know if that's a result of a bursty connection or what, so, your results may vary – your results for this might be brilliant, or just as bad as the result I achieved, so, be warned.
When I ran Rhythmbox though and played a radio station, the sound came through just fine.
Also, when I ran Gnome Terminal and caused an "audible bell" by pressing backspace when no characters were left to delete, the sound was choppy.
So, basically mixed results for remote audio over the internet – Your Mileage May Vary, etc etc
As with the LAN scenario, ensure the PulseAudio TCP native protocol module is set up on your client system.
Open up a terminal window on your local system, and type the following;
pacmd list-modules | grep module-native-protocol-tcp
If the response is blank, then this module is not loaded. To load it, type the following;
pactl load-module module-native-protocol-tcp auth-ip-acl="127.0.0.1"
Since we're going to use an SSH tunnel for this, all we need is access allowed on the locahost interface. You can, if you're going to be accessing RDP systems on the local LAN as well as remote, say "127.0.0.1;<ip address or range>" as we did above, though.
2) On the Target RDP System
In the user's ~/.xsession
file, add this line BEFORE the line(s) which start your gnome or unity-2D session…
export PULSE_SERVER=<localhost:4713>
.xsession
file.export PULSE_SERVER=localhost:4713
gnome-session --session=gnome-fallback
3) Form the SSH tunnel connection between your client system and the SSH target system.
ssh -c arcfour -R localhost:4713:localhost:4713 -L3390:localhost:3389 <ip address of ssh target system>
ssh -c arcfour -R localhost:4713:localhost:4713 -L3390:localhost:3389 192.168.1.254
ssh -c arcfour -R localhost:4713:<ip address of RDP server>:4713 -L localhost:3390:<ip address of RDP server>:3389 <ip address of ssh target system>
4) Connect to your RDP server via the ssh tunnel
rdesktop -a16 -g 1820x900 localhost:3390
for my connection as an example.And now for Windows clients :D
That's right, you read it right – you can get audio working from your Linux RDP server to your Windows RDP client machine, Like A Boss. Here's how…
A) Local LAN RDP connections…
Windows Client and Linux RDP target on local LAN
Same basic scenario as above.
I have a Linux target RDP server on my LAN at 192.168.1.249
I have a Windows client on the LAN at 192.168.1.10
1) On the Windows client system…
C:\PulseAudio
.C:\PulseAudio\etc\pulse\default.pa
#load-module module-null-sink
load-module module-native-protocol-tcp listen=0.0.0.0 auth-anonymous=1
C:\PulseAudio\etc\pulse\daemon.conf
exit-idle-time = -1
cd c:\PulseAudio\bin
pulseaudio.exe -p "C:\PulseAudio\lib\pulse-1.1\modules" -nF "C:\PulseAudio\etc\pulse\default.pa"
B) Audio on RDP on remote connections…
We'll need an SSH tunnel between the client machine, and your target machine.
If you don't know how that's done, I suggest you read the article I wrote recently on how to do exactly that ;)
For the purposes of this article, I'm going to form an ssh tunnel between my client, and a machine on my LAN at 192.168.1.254 – the principle is exactly the same as if the RDP server was at a remote location over the internet, and I've tried this on a remote VPS system too.
1) Configure puTTY On the Client System…
Configure a Session Name and enter the Host IP address.
Local
radio-button is selected as shown.Source port
is 3391
(Windows uses 3390 already).Destination
is localhost:3389
.Add
.Remote
radio-button is selected, as shown.Source
should be 4713
Destination
should be localhost:4713
Add
.export PULSE_SERVER=localhost:4713
Connect to the remote system via puTTY, using the session details you saved from above.
The two tunnels should now be active. Let's see…
4) Connect to an RDP session…
This time round, we're connecting to localhost:3391 – that's the RDP tunnel formed by the puTTY connection.
Good, the RDP tunnel is working, so let's log in…
And the PulseAudio tunnel is working :D
And bingo! The PulseAudio tunnel is working!
Play something and it should work – it did for me :)
Lastly, here's the SSH tunnel to my VPS. The above setup worled on that too, and audio was playing fine – you may get some distortion on a truly remote system if you're running the PulseAudio control panel like I am on the remote machine.
And that's it! :)
Please let me know how you got on with this!
The post Get audio with your xrdp/x11rdp connections, LAN or Remote! Updated! Windows Clients! appeared first on Scarygliders.