File Server: Setting Up Samba On Ubuntu 14.04

Alrighty then, it appears the file server component of my storage machine is finally up and running, has survived a reboot and had a test write&read from both Windows (via SMB/CIFS, you know, Samba) and Linux (via the host machine). So now I’m going to run through a quick tutorial in setting up Samba on Ubuntu 14.04 (I’ve used a headless Server edition but whatever floats your boat) so you too can work towards creating a networked file server.

For this particular use case we’re building a general purpose file server that anyone on the network can read and write to, a good setup if you don’t have security needs or expect multiple computers to come and go (such as home fileserver for storing photos, backing up/sharing resources).

First things first, make sure you’ve got a directory set aside to be shared and make it readable/writeable by everyone:

$ sudo mkdir /mnt/sdbmisc
$ sudo chmod -R 0755 /mnt/sdbmisc
$ sudo chown -R nobody:nogroup /mnt/sdbmisc

Now install Samba (in case you didn’t choose to install it as a server role during OS installation):

$ sudo apt-get update
$ sudo apt-get install samba

Once installed, you’ll notice when using sudo commands that there’ll be a warning stating no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory or something similar. To stop this happening, run sudo apt-get remove libpam-smbpass (libpam-smbpass syncs system users/passwords with SMB user database and isn’t really needed for our example).

Backup the original smb.conf configuration document:

$ sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak

Now edit the smb.conf file with your favourite text editor (i<3nano):

$ sudo nano /etc/samba/smb.conf

[global] workgroup = WORKGROUP server string = Samba Server %v netbios name = srvr1 security = user map to guest = bad user name resolve order = bcast host dns proxy = no

[sdbmisc] path = /mnt/sdbmisc browsable =yes writable = yes guest ok = yes read only = no

Once it’s all ready to go, run sudo restart smbd and Samba should start displaying your shares over the network to Windows computers!

If you have any questions or queries, feel free to Tweet me at @adamjogrady or you can find my other contact details on my website.