5.3. Examples

5.3.1. Shared Directories

We will define one share called readshare which is readable and another called rw-share which has read-write permissions but is only accessible for user tux:


# The smb.conf options
[readshare]
comment = Read-only Directory
path = /usr/local/news/
guest ok = yes
guest only = yes
browseable = yes  # this is optional

[rw-share]
comment = Read-write Share for tux
path = /usr/local/documents
browseable = yes
guest ok = yes
writeable = yes
valid users = tux 

5.3.2. Sharing Printers

We choose to export all printers defined with CUPS on the Linux server. The following configuration will enable this:

#The smb.conf options
[global]
printcap name = cups
load printers = yes
printing = cups

# printing without filters
[printers]
comment = All Printers defined using CUPS
path = /var/spool/samba
browseable = no
guest ok = yes             # allow 'guest account to print'
writable = no
printable = yes
create mode = 0700
# printer drivers must be on the client side
print command  = lpr-cups -P %p -o raw %s -r 

5.3.3. Implementing WINS with Samba?

On a NetBIOS network machine names are resolved using Windows information network services or WINS.

Clients can either use broadcasts to query host names or be configured to use a WINS server. This server reduces the amount of traffic on the network due to broadcasts.

5.3.3.1. SAMBA as a WINS server

To enable WINS in SAMBA the following option is set in smb.conf

wins support = yes

Windows clients can then be configured to use the SAMBA server as a WINS server.

5.3.3.2. Second WINS server

A NetBIOS network generally only has one WINS server. If a second server is configured then the servers should be able to synchronise their host information. One can configure SAMBA to register on an existing network as a second WINS server by giving it the address of this server with the option:

wins server = existing-wins-server
[Note]Note

The options wins support and wins server are mutually exclusive.

The wins server option registers the SAMBA server with an existing WINS server and enables WINS capabilities, there is no need to set wins support as well.

5.3.4. Samba server as a Domain Controller

# Options selected in /etc/samba/smb.conf:
security = users
domain master = yes
local master
preferred master = yes
domain logon = yes

[netlogon]
path=/var/lib/samba/netlogon
writable = no
public = no
[Note]Note

You don't need to have a logon script. This netlogon share is something the Windows client needs to connect to even if it is empty