1 <refentry id="smb.conf.5">
4 <refentrytitle>smb.conf</refentrytitle>
5 <manvolnum>5</manvolnum>
10 <refname>smb.conf</refname>
11 <refpurpose>The configuration file for the Samba suite</refpurpose>
15 <title>SYNOPSIS</title>
17 <para>The <filename moreinfo="none">smb.conf</filename> file is a configuration
18 file for the Samba suite. <filename moreinfo="none">smb.conf</filename> contains
19 runtime configuration information for the Samba programs. The <filename moreinfo="none">smb.conf</filename> file
20 is designed to be configured and administered by the <citerefentry><refentrytitle>swat</refentrytitle>
21 <manvolnum>8</manvolnum></citerefentry> program. The complete
22 description of the file format and possible parameters held within
23 are here for reference purposes.</para> </refsect1>
25 <refsect1 id="FILEFORMATSECT">
26 <title>FILE FORMAT</title>
28 <para>The file consists of sections and parameters. A section
29 begins with the name of the section in square brackets and continues
30 until the next section begins. Sections contain parameters of the
33 <para><replaceable>name</replaceable> = <replaceable>value
36 <para>The file is line-based - that is, each newline-terminated
37 line represents either a comment, a section name or a parameter.</para>
39 <para>Section and parameter names are not case sensitive.</para>
41 <para>Only the first equals sign in a parameter is significant.
42 Whitespace before or after the first equals sign is discarded.
43 Leading, trailing and internal whitespace in section and parameter
44 names is irrelevant. Leading and trailing whitespace in a parameter
45 value is discarded. Internal whitespace within a parameter value
46 is retained verbatim.</para>
48 <para>Any line beginning with a semicolon (<quote>;</quote>) or a hash (<quote>#</quote>)
49 character is ignored, as are lines containing only whitespace.</para>
51 <para>Any line ending in a <quote>\</quote> is continued
52 on the next line in the customary UNIX fashion.</para>
54 <para>The values following the equals sign in parameters are all
55 either a string (no quotes needed) or a boolean, which may be given
56 as yes/no, 0/1 or true/false. Case is not significant in boolean
57 values, but is preserved in string values. Some items such as
58 create modes are numeric.</para>
62 <title>SECTION DESCRIPTIONS</title>
64 <para>Each section in the configuration file (except for the
65 [global] section) describes a shared resource (known
66 as a <quote>share</quote>). The section name is the name of the
67 shared resource and the parameters within the section define
68 the shares attributes.</para>
70 <para>There are three special sections, [global],
71 [homes] and [printers], which are
72 described under <emphasis>special sections</emphasis>. The
73 following notes apply to ordinary section descriptions.</para>
75 <para>A share consists of a directory to which access is being
76 given plus a description of the access rights which are granted
77 to the user of the service. Some housekeeping options are
78 also specifiable.</para>
80 <para>Sections are either file share services (used by the
81 client as an extension of their native file systems) or
82 printable services (used by the client to access print services
83 on the host running the server).</para>
85 <para>Sections may be designated <emphasis>guest</emphasis> services,
86 in which case no password is required to access them. A specified
87 UNIX <emphasis>guest account</emphasis> is used to define access
88 privileges in this case.</para>
90 <para>Sections other than guest services will require a password
91 to access them. The client provides the username. As older clients
92 only provide passwords and not usernames, you may specify a list
93 of usernames to check against the password using the <quote>user =</quote>
94 option in the share definition. For modern clients such as
95 Windows 95/98/ME/NT/2000, this should not be necessary.</para>
97 <para>The access rights granted by the server are
98 masked by the access rights granted to the specified or guest
99 UNIX user by the host system. The server does not grant more
100 access than the host system grants.</para>
102 <para>The following sample section defines a file space share.
103 The user has write access to the path <filename moreinfo="none">/home/bar</filename>.
104 The share is accessed via the share name <quote>foo</quote>:</para>
107 <smbconfsection>[foo]</smbconfsection>
108 <smbconfoption><name>path</name><value>/home/bar</value></smbconfoption>
109 <smbconfoption><name>read only</name><value>read only = no</value></smbconfoption>
112 <para>The following sample section defines a printable share.
113 The share is read-only, but printable. That is, the only write
114 access permitted is via calls to open, write to and close a
115 spool file. The <emphasis>guest ok</emphasis> parameter means
116 access will be permitted as the default guest user (specified
120 <smbconfsection>[aprinter]</smbconfsection>
121 <smbconfoption><name>path</name><value>/usr/spool/public</value></smbconfoption>
122 <smbconfoption><name>read only</name><value>yes</value></smbconfoption>
123 <smbconfoption><name>printable</name><value>yes</value></smbconfoption>
124 <smbconfoption><name>guest ok</name><value>yes</value></smbconfoption>
129 <title>SPECIAL SECTIONS</title>
132 <title>The [global] section</title>
134 <para>Parameters in this section apply to the server
135 as a whole, or are defaults for sections that do not
136 specifically define certain items. See the notes
137 under PARAMETERS for more information.</para>
140 <refsect2 id="HOMESECT">
141 <title>The [homes] section</title>
143 <para>If a section called [homes] is included in the
144 configuration file, services connecting clients to their
145 home directories can be created on the fly by the server.</para>
147 <para>When the connection request is made, the existing
148 sections are scanned. If a match is found, it is used. If no
149 match is found, the requested section name is treated as a
150 username and looked up in the local password file. If the
151 name exists and the correct password has been given, a share is
152 created by cloning the [homes] section.</para>
154 <para>Some modifications are then made to the newly
155 created share:</para>
158 <listitem><para>The share name is changed from homes to
159 the located username.</para></listitem>
161 <listitem><para>If no path was given, the path is set to
162 the user's home directory.</para></listitem>
165 <para>If you decide to use a <emphasis>path =</emphasis> line
166 in your [homes] section, you may find it useful
167 to use the %S macro. For example :</para>
169 <para><userinput moreinfo="none">path = /data/pchome/%S</userinput></para>
171 <para>is useful if you have different home directories
172 for your PCs than for UNIX access.</para>
174 <para>This is a fast and simple way to give a large number
175 of clients access to their home directories with a minimum
178 <para>A similar process occurs if the requested section
179 name is <quote>homes</quote>, except that the share name is not
180 changed to that of the requesting user. This method of using
181 the [homes] section works well if different users share
184 <para>The [homes] section can specify all the parameters
185 a normal service section can specify, though some make more sense
186 than others. The following is a typical and suitable [homes]
190 <smbconfsection>[homes]</smbconfsection>
191 <smbconfoption><name>read only</name><value>no</value></smbconfoption>
194 <para>An important point is that if guest access is specified
195 in the [homes] section, all home directories will be
196 visible to all clients <emphasis>without a password</emphasis>.
197 In the very unlikely event that this is actually desirable, it
198 is wise to also specify <emphasis>read only access</emphasis>.</para>
200 <para>The <emphasis>browseable</emphasis> flag for
201 auto home directories will be inherited from the global browseable
202 flag, not the [homes] browseable flag. This is useful as
203 it means setting <emphasis>browseable = no</emphasis> in
204 the [homes] section will hide the [homes] share but make
205 any auto home directories visible.</para>
208 <refsect2 id="PRINTERSSECT">
209 <title>The [printers] section</title>
211 <para>This section works like [homes],
212 but for printers.</para>
214 <para>If a [printers] section occurs in the
215 configuration file, users are able to connect to any printer
216 specified in the local host's printcap file.</para>
218 <para>When a connection request is made, the existing sections
219 are scanned. If a match is found, it is used. If no match is found,
220 but a [homes] section exists, it is used as described
221 above. Otherwise, the requested section name is treated as a
222 printer name and the appropriate printcap file is scanned to see
223 if the requested section name is a valid printer share name. If
224 a match is found, a new printer share is created by cloning
225 the [printers] section.</para>
227 <para>A few modifications are then made to the newly created
231 <listitem><para>The share name is set to the located printer
232 name</para></listitem>
234 <listitem><para>If no printer name was given, the printer name
235 is set to the located printer name</para></listitem>
237 <listitem><para>If the share does not permit guest access and
238 no username was given, the username is set to the located
239 printer name.</para></listitem>
242 <para>The [printers] service MUST be
243 printable - if you specify otherwise, the server will refuse
244 to load the configuration file.</para>
246 <para>Typically the path specified is that of a
247 world-writeable spool directory with the sticky bit set on
248 it. A typical [printers] entry looks like
252 <smbconfsection>[printers]</smbconfsection>
253 <smbconfoption><name>path</name><value>/usr/spool/public</value></smbconfoption>
254 <smbconfoption><name>guest ok</name><value>yes</value></smbconfoption>
255 <smbconfoption><name>printable</name><value>yes</value></smbconfoption>
258 <para>All aliases given for a printer in the printcap file
259 are legitimate printer names as far as the server is concerned.
260 If your printing subsystem doesn't work like that, you will have
261 to set up a pseudo-printcap. This is a file consisting of one or
262 more lines like this:</para>
265 alias|alias|alias|alias...
268 <para>Each alias should be an acceptable printer name for
269 your printing subsystem. In the [global] section, specify
270 the new file as your printcap. The server will only recognize
271 names found in your pseudo-printcap, which of course can contain
272 whatever aliases you like. The same technique could be used
273 simply to limit access to a subset of your local printers.</para>
275 <para>An alias, by the way, is defined as any component of the
276 first entry of a printcap record. Records are separated by newlines,
277 components (if there are more than one) are separated by vertical
278 bar symbols (<quote>|</quote>).</para>
280 <note><para>On SYSV systems which use lpstat to determine what
281 printers are defined on the system you may be able to use
282 <quote>printcap name = lpstat</quote> to automatically obtain a list
283 of printers. See the <quote>printcap name</quote> option
284 for more details.</para></note>
289 <title>PARAMETERS</title>
291 <para>Parameters define the specific attributes of sections.</para>
293 <para>Some parameters are specific to the [global] section
294 (e.g., <emphasis>security</emphasis>). Some parameters are usable
295 in all sections (e.g., <emphasis>create mode</emphasis>). All others
296 are permissible only in normal sections. For the purposes of the
297 following descriptions the [homes] and [printers]
298 sections will be considered normal. The letter <emphasis>G</emphasis>
299 in parentheses indicates that a parameter is specific to the
300 [global] section. The letter <emphasis>S</emphasis>
301 indicates that a parameter can be specified in a service specific
302 section. All <emphasis>S</emphasis> parameters can also be specified in
303 the [global] section - in which case they will define
304 the default behavior for all services.</para>
306 <para>Parameters are arranged here in alphabetical order - this may
307 not create best bedfellows, but at least you can find them! Where
308 there are synonyms, the preferred synonym is described, others refer
309 to the preferred synonym.</para>
313 <title>VARIABLE SUBSTITUTIONS</title>
315 <para>Many of the strings that are settable in the config file
316 can take substitutions. For example the option <quote>path =
317 /tmp/%u</quote> is interpreted as <quote>path =
318 /tmp/john</quote> if the user connected with the username john.</para>
320 <para>These substitutions are mostly noted in the descriptions below,
321 but there are some general substitutions which apply whenever they
322 might be relevant. These are:</para>
327 <listitem><para>session username (the username that the client
328 wanted, not necessarily the same as the one they got).</para></listitem>
333 <listitem><para>primary group name of %U.</para></listitem>
338 <listitem><para>the Internet hostname that Samba is running
339 on.</para></listitem>
344 <listitem><para>the NetBIOS name of the client machine
345 (very useful).</para></listitem>
350 <listitem><para>the NetBIOS name of the server. This allows you
351 to change your config based on what the client calls you. Your
352 server can have a <quote>dual personality</quote>.</para>
354 <para>This parameter is not available when Samba listens
355 on port 445, as clients no longer send this information.</para>
362 <listitem><para>the Internet name of the client machine.
368 <listitem><para>the selected protocol level after
369 protocol negotiation. It can be one of CORE, COREPLUS,
370 LANMAN1, LANMAN2 or NT1.</para></listitem>
375 <listitem><para>The process id of the current server
376 process.</para></listitem>
381 <listitem><para>the architecture of the remote
382 machine. Only some are recognized, and those may not be
383 100% reliable. It currently recognizes Samba, Windows for Workgroups, Windows 95,
384 Windows NT and Windows 2000. Anything else will be known as
385 <quote>UNKNOWN</quote>. If it gets it wrong sending a level
386 3 log to <ulink url="mailto:samba@samba.org">samba@samba.org
387 </ulink> should allow it to be fixed.</para></listitem>
392 <listitem><para>The IP address of the client machine.</para>
398 <listitem><para>the current date and time.</para></listitem>
403 <listitem><para>Name of the domain or workgroup of the current user.</para></listitem>
407 <term>%$(<replaceable>envvar</replaceable>)</term>
408 <listitem><para>The value of the environment variable
409 <replaceable>envar</replaceable>.</para></listitem>
413 <para>The following substitutes apply only to some configuration options (only those
414 that are used when a connection has been established):</para>
419 <listitem><para>the name of the current service, if any.</para>
425 <listitem><para>the root directory of the current service,
426 if any.</para></listitem>
431 <listitem><para>username of the current service, if any.</para>
437 <listitem><para>primary group name of %u.</para></listitem>
442 <listitem><para>the home directory of the user given
443 by %u.</para></listitem>
448 <listitem><para>the name of your NIS home directory server.
449 This is obtained from your NIS auto.map entry. If you have
450 not compiled Samba with the <emphasis>--with-automount</emphasis>
451 option, this value will be the same as %L.</para>
457 <listitem><para>the path of the service's home directory,
458 obtained from your NIS auto.map entry. The NIS auto.map entry
459 is split up as <quote>%N:%p</quote>.</para></listitem>
463 <para>There are some quite creative things that can be done
464 with these substitutions and other <filename moreinfo="none">smb.conf</filename> options.</para>
467 <refsect1 id="NAMEMANGLINGSECT">
468 <title>NAME MANGLING</title>
470 <para>Samba supports <quote>name mangling</quote> so that DOS and
471 Windows clients can use files that don't conform to the 8.3 format.
472 It can also be set to adjust the case of 8.3 format filenames.</para>
474 <para>There are several options that control the way mangling is
475 performed, and they are grouped here rather than listed separately.
476 For the defaults look at the output of the testparm program. </para>
478 <para>All of these options can be set separately for each service
479 (or globally, of course). </para>
481 <para>The options are: </para>
486 <term>mangle case = yes/no</term>
487 <listitem><para> controls whether names that have characters that
488 aren't of the <quote>default</quote> case are mangled. For example,
489 if this is yes, a name like <quote>Mail</quote> will be mangled.
490 Default <emphasis>no</emphasis>.</para></listitem>
494 <term>case sensitive = yes/no/auto</term>
495 <listitem><para>controls whether filenames are case sensitive. If
496 they aren't, Samba must do a filename search and match on passed
497 names. The default setting of auto allows clients that support case
498 sensitive filenames (Linux CIFSVFS and smbclient 3.0.5 and above currently)
499 to tell the Samba server on a per-packet basis that they wish to access
500 the file system in a case-sensitive manner (to support UNIX case sensitive
501 semantics). No Windows or DOS system supports case-sensitive filename so
502 setting this option to auto is that same as setting it to no for them.
503 Default <emphasis>auto</emphasis>.</para></listitem>
507 <term>default case = upper/lower</term>
508 <listitem><para>controls what the default case is for new
509 filenames. Default <emphasis>lower</emphasis>.</para></listitem>
513 <term>preserve case = yes/no</term>
514 <listitem><para>controls whether new files are created with the
515 case that the client passes, or if they are forced to be the
516 <quote>default</quote> case. Default <emphasis>yes</emphasis>.
521 <term>short preserve case = yes/no</term>
522 <listitem><para>controls if new files which conform to 8.3 syntax,
523 that is all in upper case and of suitable length, are created
524 upper case, or if they are forced to be the <quote>default</quote>
525 case. This option can be used with <quote>preserve case = yes</quote>
526 to permit long filenames to retain their case, while short names
527 are lowercased. Default <emphasis>yes</emphasis>.</para></listitem>
531 <para>By default, Samba 3.0 has the same semantics as a Windows
532 NT server, in that it is case insensitive but case preserving.</para>
536 <refsect1 id="VALIDATIONSECT">
537 <title>NOTE ABOUT USERNAME/PASSWORD VALIDATION</title>
539 <para>There are a number of ways in which a user can connect
540 to a service. The server uses the following steps in determining
541 if it will allow a connection to a specified service. If all the
542 steps fail, the connection request is rejected. However, if one of the
543 steps succeeds, the following steps are not checked.</para>
545 <para>If the service is marked <quote>guest only = yes</quote> and the
546 server is running with share-level security (<quote>security = share</quote>,
547 steps 1 to 5 are skipped.</para>
550 <orderedlist continuation="restarts" inheritnum="ignore" numeration="arabic">
551 <listitem><para>If the client has passed a username/password
552 pair and that username/password pair is validated by the UNIX
553 system's password programs, the connection is made as that
554 username. This includes the
555 \\server\service%<replaceable>username</replaceable> method of passing
556 a username.</para></listitem>
558 <listitem><para>If the client has previously registered a username
559 with the system and now supplies a correct password for that
560 username, the connection is allowed.</para></listitem>
562 <listitem><para>The client's NetBIOS name and any previously
563 used usernames are checked against the supplied password. If
564 they match, the connection is allowed as the corresponding
565 user.</para></listitem>
567 <listitem><para>If the client has previously validated a
568 username/password pair with the server and the client has passed
569 the validation token, that username is used. </para></listitem>
571 <listitem><para>If a <quote>user = </quote> field is given in the
572 <filename moreinfo="none">smb.conf</filename> file for the service and the client
573 has supplied a password, and that password matches (according to
574 the UNIX system's password checking) with one of the usernames
575 from the <quote>user =</quote> field, the connection is made as
576 the username in the <quote>user =</quote> line. If one
577 of the usernames in the <quote>user =</quote> list begins with a
578 <quote>@</quote>, that name expands to a list of names in
579 the group of the same name.</para></listitem>
581 <listitem><para>If the service is a guest service, a
582 connection is made as the username given in the <quote>guest
583 account =</quote> for the service, irrespective of the
584 supplied password.</para></listitem>
590 <title>EXPLANATION OF EACH PARAMETER</title>
592 <xi:include href="../smbdotconf/parameters.all.xml" parse="xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
597 <title>WARNINGS</title>
599 <para>Although the configuration file permits service names
600 to contain spaces, your client software may not. Spaces will
601 be ignored in comparisons anyway, so it shouldn't be a
602 problem - but be aware of the possibility.</para>
604 <para>On a similar note, many clients - especially DOS clients -
605 limit service names to eight characters. <citerefentry><refentrytitle>smbd</refentrytitle>
606 <manvolnum>8</manvolnum></citerefentry> has no such limitation, but attempts to connect from such
607 clients will fail if they truncate the service names. For this reason
608 you should probably keep your service names down to eight characters
611 <para>Use of the [homes] and [printers] special sections make life
612 for an administrator easy, but the various combinations of default
613 attributes can be tricky. Take extreme care when designing these
614 sections. In particular, ensure that the permissions on spool
615 directories are correct.</para>
619 <title>VERSION</title>
621 <para>This man page is correct for version 3.0 of the Samba suite.</para>
625 <title>SEE ALSO</title>
627 <citerefentry><refentrytitle>samba</refentrytitle>
628 <manvolnum>7</manvolnum></citerefentry>, <citerefentry><refentrytitle>smbpasswd</refentrytitle>
629 <manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>swat</refentrytitle>
630 <manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>smbd</refentrytitle>
631 <manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>nmbd</refentrytitle>
632 <manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>smbclient</refentrytitle>
633 <manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>nmblookup</refentrytitle>
634 <manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>testparm</refentrytitle>
635 <manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>testprns</refentrytitle>
636 <manvolnum>1</manvolnum></citerefentry>.</para>
640 <title>AUTHOR</title>
642 <para>The original Samba software and related utilities
643 were created by Andrew Tridgell. Samba is now developed
644 by the Samba Team as an Open Source project similar
645 to the way the Linux kernel is developed.</para>
647 <para>The original Samba man pages were written by Karl Auer.
648 The man page sources were converted to YODL format (another
649 excellent piece of Open Source software, available at <ulink noescape="1" url="ftp://ftp.icce.rug.nl/pub/unix/">
650 ftp://ftp.icce.rug.nl/pub/unix/</ulink>) and updated for the Samba 2.0
651 release by Jeremy Allison. The conversion to DocBook for
652 Samba 2.2 was done by Gerald Carter. The conversion to DocBook XML 4.2
653 for Samba 3.0 was done by Alexander Bokovoy.</para>