Configuring Samba

Setting up Samba file and printer sharing is relatively straight forward once you get the hang of the all important /etc/samba/smb.conf file. The best source of documentation on exactly what the file can do is located in its man entry (http://www.samba.org/samba/docs/man/smb.conf.5.html). Its probably easiest just to show you an example smb.conf with comments and let you go from there. This example configures the server to act as a WINS (name resolution server), PDC, time and printer server. There are a few shared directories setup for data and temp files.
Note: ‘#’ are comments and not parsed by Samba

[global]
# Domain name
workgroup = STRESSFREE
# The description string you see when browsing to the server
server string = StressFree File and Print Server
# Low log level as we don’t want the logs flooded
log level = 1
# On this server we are using the CUPS print system for printing
printing = cups
# Instructs Samba to only listen on the specified interfaces
bind interfaces only = yes
interfaces = eth0
# Printer setup info
printcap name = cups
printcap cache time = 750
cups options = raw
printer admin = david, root, administrator
username map = /etc/samba/smbusers
map to guest = Bad User
include = /etc/samba/dhcp.conf
# Path to the Windows roaming profile %L = Server NetBIOS name
logon path = %Lprofiles.msprofile
# Defines the user’s home drive and what Drive it should be mapped to
logon home = %L%U.9xprofile
logon drive = H:
# Defines the logon script to be read from the Netlogon share
logon script = logon.bat
# This option defines how users are authenticated
# security = user is the most common as it allows access to shares based on
# a username/password when accessing the share
# security = domain is possible here if the only computers accessing shares are
# Windows machines joined to the domain. Being a Mac user I prefer the more
# flexible security = user
security = user
encrypt passwords = yes
# Sets up the LDAP username/password backend
passdb backend = ldapsam:ldap://127.0.0.1
add machine script = /sbin/yast /usr/share/YaST2/data/add_machine.ycp %m$
# Sets up the PDC
domain logons = yes
domain master = yes
# Defines where groups and computers are found in the LDAP tree
ldap suffix = o=sfs
ldap admin dn = cn=admin,o=sfs
idmap backend = ldap:ldap://127.0.0.1
ldap idmap suffix = ou=groups
ldap machine suffix = ou=Computers
# Sets up some NetBIOS details such as the server name and WINS support
local master = yes
netbios name = EXAMPLESERVER
os level = 65
preferred master = yes
wins support = yes
name resolve order = wins lmhosts bcast
disable netbios = yes
use client driver = no
time server = yes
# Define some useful file options for increasing general speed
socket options = TCP_NODELAY IPTOS_LOWDELAY
preserve case = yes
strict locking = no

# Defines the home directories of users as private shares
[homes]
comment = Home Directories
valid users = %S
browseable = no
read only = no
inherit acls = yes

# Enables roaming profile support (profile is stored within the home directory of the user)
[profiles]
comment = Network Profiles Service
path = %H
read only = no
store dos attributes = yes
create mask = 0600
directory mask = 0700

# Provides a share for the logon.bat script which is run during domain logins
# This script mounts network drives, synchronises time and anything else required
# Make sure you create this directory in your filesystem (in this case /home/samba)
[netlogon]
comment = Network Logon Service
path = /home/samba
guest ok = yes
writable = no
share modes = no

# Provides Samba print support
[printers]
comment = All Printers
path = /var/tmp
printable = yes
create mask = 0600
browseable = no

# The share for setting up downloadable printer drivers
[print$]
comment = Printer Drivers
path = /var/lib/samba/drivers
write list = @ntadmin root david
force group = ntadmin
create mask = 0664
directory mask = 0775

# Define some shared drives for data, multimedia and temporary files
# These can be accessed by authenticated users and mapped during logon by logon.bat
# The create and directory masks ensure all users can modify files and directories
[data]
comment = StressFree Data Drive
path = /home/data
create mask = 0775
directory mask = 0775
guest ok = no
browseable = yes
read only = no
hide dot files = yes

[media]
comment = Multimedia (mp3 and videos)
path = /home/media
create mask = 0775
directory mask = 0775
guest ok = no
browseable = yes
read only = no
hide dot files = yes

[temp]
comment = Temporary space for files
path = /home/temp
writeable = yes
create mask = 0775
directory mask = 0775
guest ok = no
browseable = yes
read only = no

Once you have your smb.conf looking how you want restart the Samba service (/etc/init.d/smb restart) and check that everything is parsed correctly by viewing the samba log:

tail /var/log/samba/log.smbd

At this point if everything is running you should be able to connect to your Samba shares without any problems and setup any printers you may have connected.