1 <refentry id="smb.conf.5" xmlns:xi="http://www.w3.org/2003/XInclude"
2 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
5 <refentrytitle>smb.conf</refentrytitle>
6 <manvolnum>5</manvolnum>
11 <refname>smb.conf</refname>
12 <refpurpose>The configuration file for the Samba suite</refpurpose>
16 <title>SYNOPSIS</title>
19 The <filename moreinfo="none">smb.conf</filename> file is a configuration file for the Samba suite. <filename
20 moreinfo="none">smb.conf</filename> contains runtime configuration information for the Samba programs. The
21 <filename moreinfo="none">smb.conf</filename> file is designed to be configured and administered by the
22 <citerefentry><refentrytitle>swat</refentrytitle> <manvolnum>8</manvolnum></citerefentry> program. The
23 complete description of the file format and possible parameters held within are here for reference purposes.
27 <refsect1 id="FILEFORMATSECT">
28 <title>FILE FORMAT</title>
31 The file consists of sections and parameters. A section begins with the name of the section in square brackets
32 and continues until the next section begins. Sections contain parameters of the form:
34 <replaceable>name</replaceable> = <replaceable>value </replaceable>
39 The file is line-based - that is, each newline-terminated line represents either a comment, a section name or
43 <para>Section and parameter names are not case sensitive.</para>
46 Only the first equals sign in a parameter is significant. Whitespace before or after the first equals sign is
47 discarded. Leading, trailing and internal whitespace in section and parameter names is irrelevant. Leading
48 and trailing whitespace in a parameter value is discarded. Internal whitespace within a parameter value is
53 Any line beginning with a semicolon (<quote>;</quote>) or a hash (<quote>#</quote>)
54 character is ignored, as are lines containing only whitespace.
58 Any line ending in a <quote>\</quote> is continued on the next line in the customary UNIX fashion.
62 The values following the equals sign in parameters are all either a string (no quotes needed) or a boolean,
63 which may be given as yes/no, 0/1 or true/false. Case is not significant in boolean values, but is preserved
64 in string values. Some items such as create masks are numeric.
70 <title>SECTION DESCRIPTIONS</title>
73 Each section in the configuration file (except for the [global] section) describes a shared resource (known as
74 a <quote>share</quote>). The section name is the name of the shared resource and the parameters within the
75 section define the shares attributes.
79 There are three special sections, [global], [homes] and [printers], which are described under
80 <emphasis>special sections</emphasis>. The following notes apply to ordinary section descriptions.
84 A share consists of a directory to which access is being given plus a description of the access rights
85 which are granted to the user of the service. Some housekeeping options are also specifiable.
89 Sections are either file share services (used by the client as an extension of their native file systems)
90 or printable services (used by the client to access print services on the host running the server).
94 Sections may be designated <emphasis>guest</emphasis> services, in which case no password is required to
95 access them. A specified UNIX <emphasis>guest account</emphasis> is used to define access privileges in this
100 Sections other than guest services will require a password to access them. The client provides the
101 username. As older clients only provide passwords and not usernames, you may specify a list of usernames to
102 check against the password using the <literal>user =</literal> option in the share definition. For modern clients
103 such as Windows 95/98/ME/NT/2000, this should not be necessary.
107 The access rights granted by the server are masked by the access rights granted to the specified or guest
108 UNIX user by the host system. The server does not grant more access than the host system grants.
112 The following sample section defines a file space share. The user has write access to the path <filename
113 moreinfo="none">/home/bar</filename>. The share is accessed via the share name <literal>foo</literal>:
117 <smbconfsection name="[foo]"/>
118 <smbconfoption name="path">/home/bar</smbconfoption>
119 <smbconfoption name="read only">read only = no</smbconfoption>
123 The following sample section defines a printable share. The share is read-only, but printable. That is,
124 the only write access permitted is via calls to open, write to and close a spool file. The <emphasis>guest
125 ok</emphasis> parameter means access will be permitted as the default guest user (specified elsewhere):
129 <smbconfsection name="[aprinter]"/>
130 <smbconfoption name="path">/usr/spool/public</smbconfoption>
131 <smbconfoption name="read only">yes</smbconfoption>
132 <smbconfoption name="printable">yes</smbconfoption>
133 <smbconfoption name="guest ok">yes</smbconfoption>
139 <title>SPECIAL SECTIONS</title>
142 <title>The [global] section</title>
145 Parameters in this section apply to the server as a whole, or are defaults for sections that do not
146 specifically define certain items. See the notes under PARAMETERS for more information.
150 <refsect2 id="HOMESECT">
151 <title>The [homes] section</title>
154 If a section called [homes] is included in the configuration file, services connecting clients
155 to their home directories can be created on the fly by the server.
159 When the connection request is made, the existing sections are scanned. If a match is found, it is
160 used. If no match is found, the requested section name is treated as a username and looked up in the local
161 password file. If the name exists and the correct password has been given, a share is created by cloning the
166 Some modifications are then made to the newly created share:
171 The share name is changed from homes to the located username.
175 If no path was given, the path is set to the user's home directory.
180 If you decide to use a <emphasis>path =</emphasis> line in your [homes] section, it may be useful
181 to use the %S macro. For example:
183 <userinput moreinfo="none">path = /data/pchome/%S</userinput>
185 is useful if you have different home directories for your PCs than for UNIX access.
189 This is a fast and simple way to give a large number of clients access to their home directories with a minimum
194 A similar process occurs if the requested section name is <quote>homes</quote>, except that the share
195 name is not changed to that of the requesting user. This method of using the [homes] section works well if
196 different users share a client PC.
200 The [homes] section can specify all the parameters a normal service section can specify, though some make more sense
201 than others. The following is a typical and suitable [homes] section:
205 <smbconfsection name="[homes]"/>
206 <smbconfoption name="read only">no</smbconfoption>
210 An important point is that if guest access is specified in the [homes] section, all home directories will be
211 visible to all clients <emphasis>without a password</emphasis>. In the very unlikely event that this is actually
212 desirable, it is wise to also specify <emphasis>read only access</emphasis>.
216 The <emphasis>browseable</emphasis> flag for auto home directories will be inherited from the global browseable
217 flag, not the [homes] browseable flag. This is useful as it means setting <emphasis>browseable = no</emphasis> in
218 the [homes] section will hide the [homes] share but make any auto home directories visible.
222 <refsect2 id="PRINTERSSECT">
223 <title>The [printers] section</title>
226 This section works like [homes], but for printers.
230 If a [printers] section occurs in the configuration file, users are able to connect to any printer
231 specified in the local host's printcap file.
235 When a connection request is made, the existing sections are scanned. If a match is found, it is used.
236 If no match is found, but a [homes] section exists, it is used as described above. Otherwise, the requested
237 section name is treated as a printer name and the appropriate printcap file is scanned to see if the requested
238 section name is a valid printer share name. If a match is found, a new printer share is created by cloning the
243 A few modifications are then made to the newly created share:
247 <listitem><para>The share name is set to the located printer name</para></listitem>
249 <listitem><para>If no printer name was given, the printer name is set to the located printer name</para></listitem>
251 <listitem><para>If the share does not permit guest access and no username was given, the username is set
252 to the located printer name.</para></listitem>
256 The [printers] service MUST be printable - if you specify otherwise, the server will refuse
257 to load the configuration file.
261 Typically the path specified is that of a world-writeable spool directory with the sticky bit set on
262 it. A typical [printers] entry looks like this:
266 <smbconfsection name="[printers]"/>
267 <smbconfoption name="path">/usr/spool/public</smbconfoption>
268 <smbconfoption name="guest ok">yes</smbconfoption>
269 <smbconfoption name="printable">yes</smbconfoption>
273 All aliases given for a printer in the printcap file are legitimate printer names as far as the server is concerned.
274 If your printing subsystem doesn't work like that, you will have to set up a pseudo-printcap. This is a file
275 consisting of one or more lines like this:
277 alias|alias|alias|alias...
282 Each alias should be an acceptable printer name for your printing subsystem. In the [global] section,
283 specify the new file as your printcap. The server will only recognize names found in your pseudo-printcap,
284 which of course can contain whatever aliases you like. The same technique could be used simply to limit access
285 to a subset of your local printers.
289 An alias, by the way, is defined as any component of the first entry of a printcap record. Records are separated by newlines,
290 components (if there are more than one) are separated by vertical bar symbols (<literal>|</literal>).
294 On SYSV systems which use lpstat to determine what printers are defined on the system you may be able to use
295 <literal>printcap name = lpstat</literal> to automatically obtain a list of printers. See the
296 <literal>printcap name</literal> option for more details.
302 <title>PARAMETERS</title>
304 <para>Parameters define the specific attributes of sections.</para>
307 Some parameters are specific to the [global] section (e.g., <emphasis>security</emphasis>). Some parameters
308 are usable in all sections (e.g., <emphasis>create mask</emphasis>). All others are permissible only in normal
309 sections. For the purposes of the following descriptions the [homes] and [printers] sections will be
310 considered normal. The letter <emphasis>G</emphasis> in parentheses indicates that a parameter is specific to
311 the [global] section. The letter <emphasis>S</emphasis> indicates that a parameter can be specified in a
312 service specific section. All <emphasis>S</emphasis> parameters can also be specified in the [global] section
313 - in which case they will define the default behavior for all services.
317 Parameters are arranged here in alphabetical order - this may not create best bedfellows, but at least you can
318 find them! Where there are synonyms, the preferred synonym is described, others refer to the preferred
324 <title>VARIABLE SUBSTITUTIONS</title>
327 Many of the strings that are settable in the config file can take substitutions. For example the option
328 <quote>path = /tmp/%u</quote> is interpreted as <quote>path = /tmp/john</quote> if the user connected with the
333 These substitutions are mostly noted in the descriptions below, but there are some general substitutions
334 which apply whenever they might be relevant. These are:
340 <listitem><para>session username (the username that the client wanted, not
341 necessarily the same as the one they got).</para></listitem>
346 <listitem><para>primary group name of %U.</para></listitem>
351 <listitem><para>the Internet hostname that Samba is running on.</para></listitem>
356 <listitem><para>the NetBIOS name of the client machine (very useful).</para></listitem>
361 <listitem><para>the NetBIOS name of the server. This allows you to change your config based on what
362 the client calls you. Your server can have a <quote>dual personality</quote>.</para>
364 <para>This parameter is not available when Samba listens on port 445, as clients no longer
365 send this information. If you use this macro in an include statement on a domain that has
366 a Samba domain controller be sure to set in the [global] section <parameter>smb ports =
367 139</parameter>. This will cause Samba to not listen on port 445 and will permit include
368 functionality to function as it did with Samba 2.x.
375 <listitem><para>the Internet name of the client machine.
381 <listitem><para>the selected protocol level after protocol negotiation. It can be one of CORE, COREPLUS,
382 LANMAN1, LANMAN2 or NT1.</para></listitem>
387 <listitem><para>the process id of the current server
388 process.</para></listitem>
393 <listitem><para>the architecture of the remote
394 machine. It currently recognizes Samba (<constant>Samba</constant>),
395 the Linux CIFS file system (<constant>CIFSFS</constant>), OS/2, (<constant>OS2</constant>),
396 Windows for Workgroups (<constant>WfWg</constant>), Windows 9x/ME
397 (<constant>Win95</constant>), Windows NT (<constant>WinNT</constant>),
398 Windows 2000 (<constant>Win2K</constant>), Windows XP (<constant>WinXP</constant>),
399 and Windows 2003 (<constant>Win2K3</constant>). Anything else will be known as
400 <constant>UNKNOWN</constant>.</para>
406 <listitem><para>the IP address of the client machine.</para>
412 <listitem><para>the local IP address to which a client connected.</para>
418 <listitem><para>the current date and time.</para></listitem>
423 <listitem><para>name of the domain or workgroup of the current user.</para></listitem>
427 <term>%$(<replaceable>envvar</replaceable>)</term>
428 <listitem><para>the value of the environment variable
429 <replaceable>envar</replaceable>.</para></listitem>
434 The following substitutes apply only to some configuration options (only those that are
435 used when a connection has been established):
441 <listitem><para>the name of the current service, if any.</para>
447 <listitem><para>the root directory of the current service, if any.</para></listitem>
452 <listitem><para>username of the current service, if any.</para>
458 <listitem><para>primary group name of %u.</para></listitem>
463 <listitem><para>the home directory of the user given by %u.</para></listitem>
469 the name of your NIS home directory server. This is obtained from your NIS auto.map entry.
470 If you have not compiled Samba with the <emphasis>--with-automount</emphasis> option, this
471 value will be the same as %L.</para></listitem>
477 the path of the service's home directory, obtained from your NIS auto.map entry. The NIS
478 auto.map entry is split up as <literal>%N:%p</literal>.</para></listitem>
483 There are some quite creative things that can be done with these substitutions and other
484 <filename moreinfo="none">smb.conf</filename> options.
488 <refsect1 id="NAMEMANGLINGSECT">
489 <title>NAME MANGLING</title>
492 Samba supports <literal>name mangling</literal> so that DOS and Windows clients can use files that don't
493 conform to the 8.3 format. It can also be set to adjust the case of 8.3 format filenames.
497 There are several options that control the way mangling is performed, and they are grouped here rather
498 than listed separately. For the defaults look at the output of the testparm program.
502 All of these options can be set separately for each service (or globally, of course).
512 <term>case sensitive = yes/no/auto</term>
514 controls whether filenames are case sensitive. If they aren't, Samba must do a filename search and match on
515 passed names. The default setting of auto allows clients that support case sensitive filenames (Linux CIFSVFS
516 and smbclient 3.0.5 and above currently) to tell the Samba server on a per-packet basis that they wish to
517 access the file system in a case-sensitive manner (to support UNIX case sensitive semantics). No Windows or
518 DOS system supports case-sensitive filename so setting this option to auto is that same as setting it to no
519 for them. Default <emphasis>auto</emphasis>.
524 <term>default case = upper/lower</term>
526 controls what the default case is for new filenames. Default <emphasis>lower</emphasis>.
531 <term>preserve case = yes/no</term>
533 controls whether new files are created with the case that the client passes, or if they are forced to be the
534 <literal>default</literal> case. Default <emphasis>yes</emphasis>.
539 <term>short preserve case = yes/no</term>
541 controls if new files which conform to 8.3 syntax, that is all in upper case and of suitable length,
542 are created upper case, or if they are forced to be the <literal>default</literal> case. This option can be
543 used with <literal>preserve case = yes</literal> to permit long filenames to retain their case, while short
544 names are lowercased. Default <emphasis>yes</emphasis>.
550 By default, Samba 3.0 has the same semantics as a Windows NT server, in that it is case insensitive but case preserving.
555 <refsect1 id="VALIDATIONSECT">
556 <title>NOTE ABOUT USERNAME/PASSWORD VALIDATION</title>
559 There are a number of ways in which a user can connect to a service. The server uses the following steps
560 in determining if it will allow a connection to a specified service. If all the steps fail, the connection
561 request is rejected. However, if one of the steps succeeds, the following steps are not checked.
565 If the service is marked <quote>guest only = yes</quote> and the server is running with share-level
566 security (<quote>security = share</quote>, steps 1 to 5 are skipped.
570 <orderedlist continuation="restarts" inheritnum="ignore" numeration="arabic">
572 If the client has passed a username/password pair and that username/password pair is validated by the UNIX
573 system's password programs, the connection is made as that username. This includes the
574 <literal>\\server\service%<replaceable>username</replaceable></literal> method of passing a username.
578 If the client has previously registered a username with the system and now supplies a correct password for that
579 username, the connection is allowed.
583 The client's NetBIOS name and any previously used usernames are checked against the supplied password. If
584 they match, the connection is allowed as the corresponding user.
588 If the client has previously validated a username/password pair with the server and the client has passed
589 the validation token, that username is used.
593 If a <literal>user = </literal> field is given in the <filename moreinfo="none">smb.conf</filename> file for the
594 service and the client has supplied a password, and that password matches (according to the UNIX system's
595 password checking) with one of the usernames from the <literal>user =</literal> field, the connection is made as
596 the username in the <literal>user =</literal> line. If one of the usernames in the <literal>user =</literal> list
597 begins with a <literal>@</literal>, that name expands to a list of names in the group of the same name.
601 If the service is a guest service, a connection is made as the username given in the <literal>guest account
602 =</literal> for the service, irrespective of the supplied password.
609 <title>EXPLANATION OF EACH PARAMETER</title>
611 <samba:parameterlist>
612 <xi:include href="../smbdotconf/parameters.all.xml" parse="xml"/>
613 </samba:parameterlist>
618 <title>WARNINGS</title>
621 Although the configuration file permits service names to contain spaces, your client software may not.
622 Spaces will be ignored in comparisons anyway, so it shouldn't be a problem - but be aware of the possibility.
626 On a similar note, many clients - especially DOS clients - limit service names to eight characters.
627 <citerefentry><refentrytitle>smbd</refentrytitle> <manvolnum>8</manvolnum></citerefentry> has no such
628 limitation, but attempts to connect from such clients will fail if they truncate the service names. For this
629 reason you should probably keep your service names down to eight characters in length.
633 Use of the <literal>[homes]</literal> and <literal>[printers]</literal> special sections make life
634 for an administrator easy, but the various combinations of default attributes can be tricky. Take extreme
635 care when designing these sections. In particular, ensure that the permissions on spool directories are
642 <title>VERSION</title>
644 <para>This man page is correct for version 3.0 of the Samba suite.</para>
648 <title>SEE ALSO</title>
650 <citerefentry><refentrytitle>samba</refentrytitle>
651 <manvolnum>7</manvolnum></citerefentry>, <citerefentry><refentrytitle>smbpasswd</refentrytitle>
652 <manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>swat</refentrytitle>
653 <manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>smbd</refentrytitle>
654 <manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>nmbd</refentrytitle>
655 <manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>smbclient</refentrytitle>
656 <manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>nmblookup</refentrytitle>
657 <manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>testparm</refentrytitle>
658 <manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>testprns</refentrytitle>
659 <manvolnum>1</manvolnum></citerefentry>.</para>
663 <title>AUTHOR</title>
666 The original Samba software and related utilities were created by Andrew Tridgell. Samba is now developed
667 by the Samba Team as an Open Source project similar to the way the Linux kernel is developed.
671 The original Samba man pages were written by Karl Auer. The man page sources were converted to YODL format (another
672 excellent piece of Open Source software, available at <ulink noescape="1" url="ftp://ftp.icce.rug.nl/pub/unix/">
673 ftp://ftp.icce.rug.nl/pub/unix/</ulink>) and updated for the Samba 2.0 release by Jeremy Allison. The conversion
674 to DocBook for Samba 2.2 was done by Gerald Carter. The conversion to DocBook XML 4.2 for Samba 3.0 was done by