At home I have a Linux machine that serves as my development machine. It’s running on Ubuntu and also stores all my media files.
I realized that I want to be able to stream my media files (mainly music) from my Linux machine to my macbook when working at my balcony or away from my computer.
With this solution I was also able to stream large video files too. So far I’ve only streamed to other computers, but I am planning to also to try and stream videos on my Samsung Smart TV.
Here’s what this project solves for me:
- Stream video & music to any macbook in my household
- Allows me to manage files over the local network.
- Allows me read my eBooks/PDFs over the network
- Does not require installing any third party media management software (e.g. Plex, Kodi, OwnCloud etc.)
After doing some research online I found a brilliant answer on AskUbuntu by
jtd that served as my main guide for setting up my Ubuntu machine.
To learn more please refer to his answer here: https://askubuntu.com/questions/420652/how-to-setup-a-restricted-sftp-server-on-ubuntu#server
- Setup a
mediausruser on Ubuntu
- Install and setup the OpenSSH Server on Ubuntu
- Install and setup OSX FUSE to mount files from Ubuntu to your mac
Step 1 – Setup
mediausr user to Ubuntu
useradd mediausr sudo su mediausr
Create directory for media and return to your main Ubuntu user
mkdir /home/mediausr/Documents/mediasrv exit
Add your main Ubuntu user to the
sudo usermod -a -G mediausr $YOUR_MAIN_USER
Create a symlink to your main Ubuntu user of the media directory
sudo ln -s /home/mediausr/Documents/mediasrv /home/$YOUR_MAIN_USER/Documents
Step 2 – Install and setup OpenSSH on Ubuntu
Instal OpenSSH Server
sudo apt-get install openssh-server
Backup OpenSSH Configuration
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.factory-defaults sudo chmod a-w /etc/ssh/sshd_config.factory-defaults
Open the OpenSSH Configuration in a text editor
sudo nano /etc/ssh/sshd_config
Make the following changes to the config file:
- Comment out
- Add line
- Comment out
- Add new line
Port XXXX. Replace XXXX with your custom port.
- Find and set line
- Add line
AllowUsers mediausrto only allow
mediausruser to login via ssh.
- Save and close the text editor.
Restart the OpenSSH Service
sudo service ssh restart
Step 3 – Install OSX Fuse on macOS
Download and Install Fuse for macOS
- Go to https://osxfuse.github.io/
- Download the latest stable release
- Install FUSE as any other application
Create a folder to mount media files to
Mount the media files from your Ubuntu server
sshfs -p XXXX email@example.com.YYY.YYY:/home/mediausr/Documents/mediasrv /Users/$USER/Documents/mediasrc -o defer_permissions -o noappledouble
Make sure to set the correct port and ip of your Ubuntu server.
That’s it! Now you can access the files in your macOS finder. Enjoy!