After Hours

Music server via Samba

Jack Wallen set up a Samba music server for his family's use. He takes you through the setup and configuration to get it working.

With the recent migration from all of our iPods to different types of MP3 players here at home, I found it possible to set up a music "server" so that each member of the family could access our rather large music collection without having to waste cd-rws or having to upload to an ftp server first. No, I wanted each member of the family to simply be able to have a directory (or shortcut/favorite to a directory) that would allow them to access the entire contents of the music library. Enter Sandman. Erm, I mean...Samba.

It was actually quite simple. I've set up Samba plenty of times and knew that it wouldn't take more than 10 or so minutes to get everyone connected. I had a Linux PC (where the library would be housed via an external 115 gig SATA drive mounted to /media/music), a Mac, and a Windows 2000 machine. And now that the iPods were out of the way, iTunes was no longer necessary so each members' MP3 player was either attached as a flash drive or had software (in the case of the Creative ZEN) that would map to the library. NOTE: Yes, I know that iTunes can map to external sources, but I have had enough experiences with iTunes mucking up the file names/structures that I didn't want to chance it.

The Samba setup

Here's the smb.conf file:

[global]
            netbios name = MONKEYPANTZ
            workgroup = MONKEYPANTZ
            security = user
            encrypt passwords = yes
            smb passwd file = /etc/samba/smbpasswd
            interfaces = 192.168.1.1/8
[WALLEN MUSIC]
            comment Wallen music library
            path = /media/music
            writeable = yes
            create mode = 0600
            directory mode = 0700
            locking = yes

After the smb.conf file was correctly working I had to create a global user with the smbpasswd program. To do this, I ran the following commands.

First to add the user:

sudo smbpasswd -L -a familymusic

I was prompted for a new password.

And then to encrypt the users password:

sudo smbpasswd -L -e familymusic

Once those commands were complete, I restarted Samba with sudo /etc/init.d/samba restart and I was able to connect from all machines to the library.

Using the Mac was simple. I opened up the Finder and hit the apple key and "k" combination to connect to a server. I then entered smb://192.168.1.101 which then prompted for the username/password combination (it automatically detected the workgroup name). Once connected, I was able to drag and drop files onto my wife's MP3 player. With my step-daughter's ZEN it was just a matter (with the ZEN's software installed) to navigate to the library, right-click on the directories or files to copy to the device, and select Copy To Creative Zen. Done and done.

What always impresses me the most with Samba is how universal it is. I have yet to come across a problem where I need to be able to access files from multiple types of machines that Samba couldn't solve. Of course the only iHoldover I have is my iPhone. As you can guess, it would not connect to the Samba server. Maybe when the new 2.0 firmware comes out someone will come up with an samba-aware app so that there's a new way to get music onto the phone. That is probably nothing more than wishful thinking.

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

Editor's Picks