System information

Chapter 4. Installing and configuring Samba 63
Example 4-6 Home directory parameters
[homes]
comment = Home Directories
path = %H
valid users = %S
browseable = no
writable = yes
create mode = 0700
directory mode = 0700
The special variables used in this definition are explained in Table 4-7.
Table 4-7 Variable description
In Example 4-6 the create mode and directory mode masks are used to limit access to
created files and directories to the owner of the home directory.
Defining printer shares
A Samba server uses the same procedure for printer shares as for home shares. If the share
does not match a defined share or a user name on the system, Samba then looks in the file
specified by the global printcap name parameter, Example 4-2 on page 59, for the name. If
there is a matching printer name, Samba creates a share named after the printer. All the
printer shares will use the parameters of the [printers] definition. Example 4-7 shows an
example of the printers definition.
Example 4-7 Printers share parameters
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
# Set public = yes to allow user 'guest account' to print
guest ok = no
writable = no
printable = yes
create mask = 0700
As you can see, the [printers] section is just another share definition. When a user prints, the
output of the local printing system is copied into the spool directory. The only big difference
between a printer share and other share definitions is that the printable parameter is set to
yes. This means that a client can write a spool file to the directory specified under the share
definition. If the share is printable, then it is also writable by default.
The major benefit of the special [homes] and [printers] sections is not having to maintain a
share for each home directory and printer on the system.
Variable Description
%H The home directory of the current user.
%S The name of the current service. Since the requested share is the user
name, this variable is replace by the user name.
%u The user name of the current service.
%g The primary group name of %u.