Monday, June 1, 2015

Set up Samba on Linux for Sonos

Sonos without Windows


I have a Linux server running Debian, a close relation of Ubuntu and a laptop running Ubuntu. I bought a Sonos ZP90 but not the controller. I found various bits and pieces on the internet on how to get this working but no complete howto so I thought it would be useful to others if I created a detailed guide for Google to find :-)

Physical set-up
The Sonos and server are connected to my ADSL modem with ethernet cables. The laptop connects via wireless.

Sharing the music
On the server create a new users sonos
Code:
sudo adduser sonos
sudo passwd sonos
and enter a new password.
Check that user sonos can read your music files
Code:
su - sonos
cd 
ls
cd 
ls
exit
check you have Samba installed
Code:
dpkg --get-selections | grep samba
If you have it returns
Code:
samba-common                                   install
If not install it with
Code:
sudo apt-get install samba
Back up the config
Code:
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.orig
then create /etc/samba/smb.conf to look like this
Code:
[global]
workgroup = server
netbios name = server
server string = Samba Server %v
load printers = no
log file = /var/log/samba/log.%m
max log size = 50
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
interfaces = lo eth0
security = user
password level = 12
username level = 12
encrypt passwords = yes
username map = /etc/samba/smbusers

[musicshare]
path = 
valid users = sonos
read only = yes
printable = no
only guest = no
and create a samba users file /etc/samba/smbusers
to look like this
Code:
root = administrator admin
nobody = guest pcguest smbguest
sonos = sonos
This next is a new feature for Samba that some of the older howto's didn't need:
Code:
sudo smbpasswd -a sonos
and enter a password. This is the one you will use below during the Sonos set-up.

Restart samba to use the new config
Code:
sudo /etc/init.d/samba restart
Check it's working
Code:
sudo vi /var/log/samba/log.?mbd