Playing sound remotely through ssh connection

1

Scenario. I am sitting on a laptop at my work station (windows with putty). My target is sitting in another room with his own ubuntu laptop with his own user.

I want to use the mpg321 program to play a wav file on HIS machine on his user, by logging in via ssh with my user and executing mpg321.

I have tried using sudo -u his_username, normal sudo, no sudo, but for some reason the sound does not play.

HELP!

Martin

Posted 2011-05-11T19:51:51.977

Reputation: 41

Answers

0

Probably to late to get confirmation from the asker, but likely the reason is that either

(1) with ALSA only, the Ubuntu laptop user is logged in, and ALSA has taken exclusive ownership of the audio devices; or

(2) with Pulseaudio, Pulseaudio runs as the logged user on the Ubuntu machine and has taken exclusive ownership of the audio devices; which means a second Pulseaudio started as a new user can't take over.

This is as it should be: The person actually sitting at the machine (or at least the person hat logged in first) should have ownership of the local devices like audio. You can't prank him remotely by suddenly playing sounds on the machine. To enable that, one has to configure some kind of "sound sharing" (there are several ways to do that).

dirkt

Posted 2011-05-11T19:51:51.977

Reputation: 11 627

0

If it's just a simple .wav file, why not use play instead? For a while I had this set up on my (Ubuntu) workstation to play the Star Trek "Red Alert" klaxon if a cron'd script detected a particular (and, sadly, common) failure condition on our production database server. It works quite well!

You may have to sudo apt-get install sox if it isn't already on the system. Have fun!

Kromey

Posted 2011-05-11T19:51:51.977

Reputation: 4 377

0

Another interesting program is speaker-test. It allows you to play all kinds of noises out of the speakers, everything from smooth sine waves to white noise. You can choose the frequency and channel. It won't play actual audio files but it's REALLY good for annoying people!

charliehorse55

Posted 2011-05-11T19:51:51.977

Reputation: 673