Ubuntu 8.10 Server Setup: Samba

We need Samba for the Token Windows Laptop and the CNC box on the milling machine which also runs TurboTax during that season of the year. Despite having done this many times before, it never works right until, suddenly, without warning, everything works. It’s a permission thing, I think.

To get SWAT running, check there, which boils down to:

  • sudo chmod g+w /etc/samba/smb.conf
  • sudo chgrp adm /etc/samba/smb.conf

Put this in /etc/xinetd.d/swat:

... comments snipped ...
service swat
        port    = 901
        socket_type     = stream
        wait    = no
###     only_from = localhost
        user    = <<your adm-enabled userid>>
        server  = /usr/sbin/swat
        log_on_failure  += USERID
        disable = no

Then use sudo smbpasswd -a -e <> to set up the allowed users and get their passwords aligned. I use the same userids and paswords on all the boxes, which is terrible security.

Whenever you change anything, use sudo /etc/init.d/samba restart to make sure Samba gets the message.

Use SWAT to set up all the shares. This is what the config file looked like after the damn thing finally started working:

# Samba config file created using SWAT
... snippage ...

	workgroup = whatever-you-use
	server string = %h server (Samba, Ubuntu)
	map to guest = Bad User
	obey pam restrictions = Yes
	passdb backend = tdbsam
	pam password change = Yes
	passwd program = /usr/bin/passwd %u
	passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
	unix password sync = Yes
	syslog = 0
	log file = /var/log/samba/log.%m
	max log size = 1000
	dns proxy = No
	usershare allow guests = No
	panic action = /usr/share/samba/panic-action %d

	comment = All Printers
	path = /var/spool/samba
	create mask = 0700
	browseable = Yes
	printable = Yes
	writeable = Yes

	comment = Printer Drivers
	path = /var/lib/samba/printers

	comment = Assorted useful files
	path = /mnt/bulkdata
	read only = No

... likewise for other file shares ...

Actually, you don’t have to share the printers with Samba. Better to use CUPs directly. Just tell Windows to “Connect to a printer on the Internet or on a home or office network”, then fill in something like:


And that’ll work even better.