Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Streaming music from server using cmus/ssh

I got a server running at home, and I want to stream music from it at work. I dont want to mount a samba-folder or something.

Is it possible to playback music via cmus (running on server) and ssh (ssh command or putty on win)? The sound output needs to be the speakers of the remote-pc, not the server. Is this possible?

I dont get this working.

Thanks in advance :)

like image 414
Fabian Avatar asked Dec 16 '22 16:12

Fabian


1 Answers

Tutorial I wrote up for Linux:


Play music over SSH using CMUS and SSHFS

Note: This works great for Chromebooks using Crouton

1. Install sshfs:

sudo apt-get install sshfs

2. Install cmus:

sudo apt-get install cmus

3. Add ssh key with home computer:

ssh-copy-id is your friend.

(see some other tutorial)

4. Create a mount folder:

sudo mkdir -p /mnt/example/mount/location

(edit this location to reflect a directory structure you want. ie if you want to mount a music folder, mount something like /mnt/example/music)

5. Mount folder with sshfs

sudo sshfs -p PORT_NUMBER -o allow_other -o IdentityFile=~/.ssh/id_rsa [email protected]:./folder/to/mount /mnt/example/location

The -o allow_other parameter is very important, as you won't have access to the mount otherwise. PORT_NUMBER can be ignored if you use the standard 443 port, else set it to the correct value.

6. Add music to your collection:

From terminal, launch cmus:

$ cmus

Type : to bring up the cmus command line and type:

add /mnt/example/location

This will add music to your collection. For the ins-and-outs of cmus keyboard shortcuts type man cmus from terminal.

7. Unmount drive when done:

sudo umount /mnt/example/location

Other notes:

Might need to make sure cmus is configured to use pulse audio, not alsa. I think this is done by editing ~/.cmus/autosave and setting the parameter set output_plugin=pulse, but I didn't have to do this so I think you can safely ignore this.

like image 186
Alex Luecke Avatar answered Dec 21 '22 18:12

Alex Luecke