Why?
This tutorial is both technical and amusing. There was someone in a room I didn’t want in the room, so I had the idea “I wonder if I can ssh into the computer near them and play some audio out of the speakers and freak them out a bit?”
Turns out I can.
And it worked.
And here’s how to do it with Ubuntu with everything built in and ready to go
HOW – EASY WAY
- Make sure you have SSH access to the remote machine that you want to ‘amuse’ someone with.
- (OPTIONAL) For extra fun, if you have the time and ability to move your own custom audio files on there, great. Do that prior to the fun, or figure out a more creative version of this tutorial. Otherwise, …
- ssh into the remote machine
- navigate to /usr/share/sounds/
In here, depending on your ubuntu and distro version, there should be some folders with audio in them. In my case I have ‘alsa’ and ‘freedesktop’ but yours many be different.
- Navigate into one of these directories
- Simply type command (which is conveniently installed by default…)
paplay
and then type the audio file you want to trigger. In my case, it was the speaker testing files in the Alsa directory so I typed:
paplay Front_Center.wav
Done. The audio triggered and the person in the room got creeped out and wanted to leave quickly.
High five to self!
HOW – ADVANCED WAY
Some other more advanced thoughts I had, which I didn’t have time to do were, in no particular order:
- Setting up a quick http server on my local machine (see this tutorial] where I have more audio control, then with SSH running on the other machine navigate back to that directory and play it that way.. this worked
- On local machine, set up Http server
- On local machine run
ip address
command to note your local IP address (you’ll need it below) - On local machine set up, or have ready a dedicated folder for audio sounds, music, etc, that you want to play over the remote machine
- SSH into remote machine
- cd to a place that you’d like to download these audio files
- run this command which will download the whole directory from your local machine to your remote machine:
wget http://123.123.123.123:99
where 123.123.123.123 is your ip address and 99 is the port you chose to serve. This will download all the files and leave a directory with the ip address and port as the directory name. It also may leave quotation marks around file names so you’ll have to include those when running commands… - Navigate into the new directory of tunes
- Select the tune you want to play and run
paplay tune-name.mp3
- press control c to stop the command and stop playing the file
- when complete delete directory with
sudo rm -r directory name
OTHER IDEAS?
- Maybe some other easy command like
curl
orwget
can easily pull audio onto remote machine.. - Streaming youtube or something through there with VLC player which I think has a CLI
Enjoy!