You are here

  1. Blogs
  2. » charles's blog

Samba: Voodoo to some, childsplay to others.

There are those that would have you believe making samba work is a black art. On the flipside of this are a number of GUI options for configuring samba that make it very very quick to shoot yourself in the foot. I'm going to try and run through a few key points that I end up explaining repeatedly, and try and record the snippets I keep having to look up because I'm not infallible.

A historical aside: In the 90's samba was a bit more of a black art, there was a hefty chapter of the book that shipped with suse 6.3 explaing all the ins and outs of it. I so wanted to get samba working back then, but my dad was still getting around the idea that PCs were more than glorified electric typewriters, blissfully unaware of the extent his workplace was networked. I suspect the blissful unawareness of the network is a rare example of an IT project done well. So I had to wait. Family issues and geography separated me from access to a PC I could hack* on from early 2001 to mid 2003. A round of upgrades for parents (and an influx of old tech including my beloved suse box), and a networking dogsbody semi-permanently installed in the living room of the house I shared as I began the second year of uni, saw a sudden rediscovery of my enthusiasm for computers and the first thing I did was make samba work on the SuSE box. The arrival of broadband was a godsend, 512kbit/s seem so slow now, it it was enough to discover first Fedora and then gentoo in 2004. The killer app for me was having a file server I could keep MP3s on. I had hundreds of albums on CD, and I loved the flexibility MP3s gave me, but keeping them on the same machine I was hacking on, or on something I was dual-booting was just a pain in the arse.

Where to start? There are a bunch of ways to set samba up, depending on the kind of windows set-up you are trying to emulate. Single-sign-on trickery of LDAP/Active Directory is overkill for most household applications and involves quite a good understanding of Active Directory, and I speak from experience that there are more dragons and voodoo in Active Directory than a role-player's game room** NT4 Domains are less complicated but best left in the same place as NT4 - History.

That leaves us with the workgroup level of sharing, which is dead easy if you have just one server, or users that don't get confused by password sync issues. This is referred to as User Level Security by samba. This assigns a username and password to each user, parallel with the login behaviour of linux boxen. A number of distributions, Ubuntu included, have a feature called password chat which allows smbpasswd to change both samba and linux passwords at once. This behaves much like the ad-hoc file sharing that is typical of a home windows network.

You will benefit from having one Samba host running as your WINS server. WINS is part of the mechanism that allows all the shares available on a network to show up in 'View workgroup computers'

I use dnsmasq as a combination DNS relay and dhcp server, whilst an exploration of the configuration is outside of this post, finding the correct options was a chore, so here is the fragment of config file, assuming the server we want to run wins is 10.42.10.5

<br />
#WINS (/etc/dnsmasq.conf fragment)<br />
dhcp-option=19,0              # option ip-forwarding off<br />
dhcp-option=44,10.42.10.5     # set netbios-over-TCP/IP nameserver(s) aka WINS server(s)<br />
dhcp-option=45,10.42.10.5     # netbios datagram distribution server<br />
dhcp-option=46,8               # netbios node type<br />
dhcp-option=47                # empty netbios scope<br />

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
; wins support = yes

# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
wins server = 10.42.10.5



* No not that kind of hacking. [url=http://en.wikipedia.org/wiki/Hacker_(free_and_open_source_software)]This kind[/url].
** Our basement is cold and drafty, and it appears to be the local tradition is to squeeze bedrooms into basements and attics and do the gaming at ground level.

Overview of the SMB protocol
A PDF explaining CIFS, with a useful section on the NetBIOS name server, aka WINS
dnsmasq is explored in a debian firewall tutorial by cyberdogtech.com, whilst it's written for debian, ubuntu works just as well.

Subject: 

Add new comment

BBCode, html and code systax highlighting

  • Allowed HTML tags: <a><img> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><strike><hr>
  • Lines and paragraphs break automatically.
  • You can use BBCode tags in the text. URLs will automatically be converted to links.

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

My Band

LinuxCounter.net

Creative Commons License
Except where otherwise noted, work is licensed under a Creative Commons Licence and is the work and opinion of the credited author(s).

Powered by Drupal

My Facebook


Charles Elwood's Facebook profile