Sonos – Sharing Music Files on Linux Server

How to store a Music Library on a Linux Server to be used by a Sonos controller.

Many Sonos users have come across the issue of wanting to access their music files centrally on a remote computer such as a Linux server (we repurposed a pre-2012 iMac to use as a media server). The Ubuntu version is 22.04. This should be easy, but according to the multiple posts on the subject in the Sonos forums, it is not.

We accomplished the feat by first installing Ubuntu on an old iMac and then installing the “Samba” file server software on Ubuntu as follows:

Full instructions can be found here …. https://ubuntu.com/server/docs/samba-file-server for an easier guide, read on.

On Ubuntu open a terminal window and type:

sudo apt update
sudo apt install samba

After installing Samba, create a new folder for the samba share …in our example we’ve called this one “sambashare” . Use the mkdir command to create the folder and set permissions

sudo mkdir -p /home/john/Music/sambashare
sudo chown john:users /home/john/Music/sambashare

Create a user and password for Samba

sudo smbpasswd -a [yourusername]

Next, allow Samba thru the firewall

sudo ufw allow samba

Next, modify the samba config file to allow permissions

sudo nano /etc/samba/smb.conf, 

goto the bottom of the file and add the following (replace path and user name with your own)

[global]
workgroup = EXAMPLE
usershare owner only = false

[share]
   comment = Sambashare Shared Folder
   path = /home/john/Music/sambashare
   guest ok = yes
   browsable = yes
   read only = no
   force user = john
   force group = users
   create mask = 0755

Save the changes ^O and close ^X ,,, Agree to save the changes

Now restart samba to allow the changes to take effect

sudo systemctl restart smbd.service nmbd.service

On Ubuntu, copy all your music files to folders within “sambashare”

Then change “sambashare” folder properties (rightclick > properties)
Tick “Share This Folder” and “Guest Access” … then click “Modify Share”

This folder should now be visible to other computers

In Mac, open finder and Go > Connect to Server

By Browsing you should see the new Samba share “sambashare”

On your Mac, open the Sonos controller and goto , Settings > Music Library

add the “Sambashare” folder, such as this example

by adding a new folder, selecting “Network Device” and then the path to Sambashare

ie “\\john-iMac\sambashare”,

if you are prompted for a user name and password, enter one or leave blank for anonymous access

Sonos should start indexing all the music it finds under “sambashare”.

Your screen should look like the following. This process may take some time.

Once complete, you should find your newly index music on the Sonos controller under “Music Library”

Step-by-step guide to setting up a Linux media file server on a Mac

Leave a Comment

Your email address will not be published. Required fields are marked *