I've got a fair bit of music on local storage and I wanted to be able to play it through Sonos without paying for yet another streaming subscription. Turns out you can host a Samba share from a lightweight LXC container on Proxmox and point Sonos straight at it. The container idles at around 30–50 MB RAM, so it's basically free in terms of resources.
Here's exactly how I set it up.
The approach
- Store music on the Proxmox host's second drive
- Run a minimal Debian 12 LXC container with Samba
- Bind-mount the music folder into the container (read-only)
- Point Sonos at the Samba share
Stage 1 — Download the Debian 12 Template
In the Proxmox web UI:
- Click your node in the left panel
- Click local storage → CT Templates
- Click the Templates button
- Search for Debian 12 Standard and click Download
Stage 2 — Create the LXC Container
Click Create CT and use these settings:
| Setting | Value |
|---|---|
| Template | Debian 12 Standard |
| RAM | 256 MB |
| Swap | 512 MB |
| CPU | 1 core |
| Disk | 8 GB |
| Network | DHCP (set static IP after creation) |
| SSH public key | Paste your OpenSSH public key |
Getting your OpenSSH public key from PuTTYgen
If your key is in .ppk format, open PuTTYgen → Conversions → Import Key → load your .ppk. Copy the text from the box labelled "Public key for pasting into OpenSSH authorized_keys file" (starts with ssh-rsa or ssh-ed25519) and paste that into the Proxmox SSH public key field.
Don't use "Save public key" — that saves in PuTTY format which Proxmox won't accept. Copy directly from the text box.
Stage 3 — Fix Network (DHCP)
If the container has no IP after starting, the network interfaces file needs updating. Inside the container console:
# Check current IP (look for eth0)
ip a
# If no IPv4 address, request a lease
dhclient eth0
# Make DHCP persistent across reboots
nano /etc/network/interfaces
Add these lines:
auto eth0
iface eth0 inet dhcp
Then restart networking:
systemctl restart networking
Force IPv4 for apt (fixes IPv6 connection errors)
echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99force-ipv4
Set a static IP (recommended)
In the Proxmox UI: container → Network tab → edit eth0 → change IPv4 from DHCP to Static and set a fixed IP outside your router's DHCP range (e.g. 192.168.1.111/24) with your gateway (e.g. 192.168.1.1). A static IP ensures Sonos never loses the share.
Stage 4 — Prepare Music Storage on the Proxmox Host
Music is stored on the Proxmox host and mounted into the container. Run the following on the Proxmox host shell — not inside the container.
Create the music directory
mkdir -p /mnt/shared/music
Copy music from a USB drive
Plug in your USB drive, then find it:
lsblk
Look for the new device (e.g. /dev/sdb1). Mount it and copy:
mkdir -p /mnt/usb
mount /dev/sdb1 /mnt/usb
# Install rsync if needed
apt install rsync
# Copy music across (adjust source path if needed)
rsync -av --progress /mnt/usb/ /mnt/shared/music/
# Unmount USB when done
umount /mnt/usb
Fix permissions
This is critical — files copied from USB often arrive with restrictive permissions that prevent Samba from reading them:
chmod -R 755 /mnt/shared/music
Verify:
ls -la /mnt/shared/music/ | head -5
# Should show drwxr-xr-x for all folders
Stage 5 — Bind-Mount Music into the Container
On the Proxmox host shell, edit the container config (replace 103 with your container ID):
nano /etc/pve/lxc/103.conf
Add this line:
mp0: /mnt/shared/music,mp=/mnt/music,ro=1
The ro=1 enforces read-only at the mount level. Restart the container:
pct stop 103
pct start 103
Verify inside the container:
ls /mnt/music
# Should list your music folders
Stage 6 — Install and Configure Samba
SSH into the container and run:
apt update && apt install -y samba smbclient
Replace the entire Samba config:
nano /etc/samba/smb.conf
Delete all existing content and paste this (adjust the subnet to match your network):
[global]
workgroup = WORKGROUP
server string = Music
server min protocol = SMB2
server max protocol = SMB3
map to guest = Bad User
guest account = nobody
ntlm auth = yes
lanman auth = yes
raw NTLMv2 auth = yes
restrict anonymous = 0
log level = 0
hosts allow = 192.168.1.0/24
hosts deny = ALL
[Music]
path = /mnt/music
browseable = yes
read only = yes
guest ok = yes
guest only = yes
force user = nobody
Change192.168.1.0/24to match your network. If your IP addresses are192.168.0.xuse192.168.0.0/24.
Start and enable Samba:
systemctl restart smbd nmbd
systemctl enable smbd nmbd
Verify it's running:
systemctl status smbd
Verify the share is accessible:
smbclient -L 192.168.1.111 -N
# Should list the Music share
Stage 7 — Add to Sonos
In the Sonos S2 app:
- Settings → Services & Voice → Music Library
- Tap Add Music Library (or the
+icon) - Enter the path:
//192.168.1.111/Music - Leave username and password blank
- Tap Add
Sonos will index your library — this may take a few minutes depending on library size. Once complete it appears under Music Library in your sources.
Troubleshooting
Container has no network
Check /etc/network/interfaces has auto eth0 and iface eth0 inet dhcp. Run dhclient eth0 to get a lease manually.
apt update fails with IPv6 errors
echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99force-ipv4
Samba share not visible
Test from inside the container:
smbclient -L 192.168.1.111 -N
Check Samba is listening:
ss -tlnp | grep -E "445|139"
Sonos connects but fails to add library
Almost certainly a permissions issue. On the Proxmox host:
chmod -R 755 /mnt/shared/music
ls -la /mnt/shared/music/ | head -5
# Verify drwxr-xr-x on all folders
Bind-mount shows empty inside container
Use stop and start rather than restart:
pct stop 103
pct start 103
Update the container IP and paths above to match your setup. Drop any questions in the comments and I'll do my best to help.
No comments:
Post a Comment