1 <?xml version="1.0" encoding="iso8859-1"?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
5 <!ENTITY % globalentities SYSTEM './../global.ent'> %globalentities;
7 <refentry id="smb.conf.5">
10 <refentrytitle>smb.conf</refentrytitle>
11 <manvolnum>5</manvolnum>
16 <refname>smb.conf</refname>
17 <refpurpose>The configuration file for the Samba suite</refpurpose>
21 <title>SYNOPSIS</title>
23 <para>The <filename moreinfo="none">smb.conf</filename> file is a configuration
24 file for the Samba suite. <filename moreinfo="none">smb.conf</filename> contains
25 runtime configuration information for the Samba programs. The <filename moreinfo="none">smb.conf</filename> file
26 is designed to be configured and administered by the <citerefentry><refentrytitle>swat</refentrytitle>
27 <manvolnum>8</manvolnum></citerefentry> program. The complete
28 description of the file format and possible parameters held within
29 are here for reference purposes.</para> </refsect1>
31 <refsect1 id="FILEFORMATSECT">
32 <title>FILE FORMAT</title>
34 <para>The file consists of sections and parameters. A section
35 begins with the name of the section in square brackets and continues
36 until the next section begins. Sections contain parameters of the
39 <para><replaceable>name</replaceable> = <replaceable>value
42 <para>The file is line-based - that is, each newline-terminated
43 line represents either a comment, a section name or a parameter.</para>
45 <para>Section and parameter names are not case sensitive.</para>
47 <para>Only the first equals sign in a parameter is significant.
48 Whitespace before or after the first equals sign is discarded.
49 Leading, trailing and internal whitespace in section and parameter
50 names is irrelevant. Leading and trailing whitespace in a parameter
51 value is discarded. Internal whitespace within a parameter value
52 is retained verbatim.</para>
54 <para>Any line beginning with a semicolon (';') or a hash ('#')
55 character is ignored, as are lines containing only whitespace.</para>
57 <para>Any line ending in a '\' is continued
58 on the next line in the customary UNIX fashion.</para>
60 <para>The values following the equals sign in parameters are all
61 either a string (no quotes needed) or a boolean, which may be given
62 as yes/no, 0/1 or true/false. Case is not significant in boolean
63 values, but is preserved in string values. Some items such as
64 create modes are numeric.</para>
68 <title>SECTION DESCRIPTIONS</title>
70 <para>Each section in the configuration file (except for the
71 [global] section) describes a shared resource (known
72 as a "share"). The section name is the name of the
73 shared resource and the parameters within the section define
74 the shares attributes.</para>
76 <para>There are three special sections, [global],
77 [homes] and [printers], which are
78 described under <emphasis>special sections</emphasis>. The
79 following notes apply to ordinary section descriptions.</para>
81 <para>A share consists of a directory to which access is being
82 given plus a description of the access rights which are granted
83 to the user of the service. Some housekeeping options are
84 also specifiable.</para>
86 <para>Sections are either file share services (used by the
87 client as an extension of their native file systems) or
88 printable services (used by the client to access print services
89 on the host running the server).</para>
91 <para>Sections may be designated <emphasis>guest</emphasis> services,
92 in which case no password is required to access them. A specified
93 UNIX <emphasis>guest account</emphasis> is used to define access
94 privileges in this case.</para>
96 <para>Sections other than guest services will require a password
97 to access them. The client provides the username. As older clients
98 only provide passwords and not usernames, you may specify a list
99 of usernames to check against the password using the "user ="
100 option in the share definition. For modern clients such as
101 Windows 95/98/ME/NT/2000, this should not be necessary.</para>
103 <para>Note that the access rights granted by the server are
104 masked by the access rights granted to the specified or guest
105 UNIX user by the host system. The server does not grant more
106 access than the host system grants.</para>
108 <para>The following sample section defines a file space share.
109 The user has write access to the path <filename moreinfo="none">/home/bar</filename>.
110 The share is accessed via the share name "foo":</para>
112 <screen format="linespecific">
113 <computeroutput moreinfo="none">
120 <para>The following sample section defines a printable share.
121 The share is readonly, but printable. That is, the only write
122 access permitted is via calls to open, write to and close a
123 spool file. The <emphasis>guest ok</emphasis> parameter means
124 access will be permitted as the default guest user (specified
127 <screen format="linespecific">
128 <computeroutput moreinfo="none">
130 path = /usr/spool/public
139 <title>SPECIAL SECTIONS</title>
142 <title>The [global] section</title>
144 <para>parameters in this section apply to the server
145 as a whole, or are defaults for sections which do not
146 specifically define certain items. See the notes
147 under PARAMETERS for more information.</para>
150 <refsect2 id="HOMESECT">
151 <title>The [homes] section</title>
153 <para>If a section called homes is included in the
154 configuration file, services connecting clients to their
155 home directories can be created on the fly by the server.</para>
157 <para>When the connection request is made, the existing
158 sections are scanned. If a match is found, it is used. If no
159 match is found, the requested section name is treated as a
160 user name and looked up in the local password file. If the
161 name exists and the correct password has been given, a share is
162 created by cloning the [homes] section.</para>
164 <para>Some modifications are then made to the newly
165 created share:</para>
168 <listitem><para>The share name is changed from homes to
169 the located username.</para></listitem>
171 <listitem><para>If no path was given, the path is set to
172 the user's home directory.</para></listitem>
175 <para>If you decide to use a <emphasis>path =</emphasis> line
176 in your [homes] section then you may find it useful
177 to use the %S macro. For example :</para>
179 <para><userinput moreinfo="none">path = /data/pchome/%S</userinput></para>
181 <para>would be useful if you have different home directories
182 for your PCs than for UNIX access.</para>
184 <para>This is a fast and simple way to give a large number
185 of clients access to their home directories with a minimum
188 <para>A similar process occurs if the requested section
189 name is "homes", except that the share name is not
190 changed to that of the requesting user. This method of using
191 the [homes] section works well if different users share
194 <para>The [homes] section can specify all the parameters
195 a normal service section can specify, though some make more sense
196 than others. The following is a typical and suitable [homes]
199 <screen format="linespecific">
200 <computeroutput moreinfo="none">
206 <para>An important point is that if guest access is specified
207 in the [homes] section, all home directories will be
208 visible to all clients <emphasis>without a password</emphasis>.
209 In the very unlikely event that this is actually desirable, it
210 would be wise to also specify <emphasis>read only
211 access</emphasis>.</para>
213 <para>Note that the <emphasis>browseable</emphasis> flag for
214 auto home directories will be inherited from the global browseable
215 flag, not the [homes] browseable flag. This is useful as
216 it means setting <emphasis>browseable = no</emphasis> in
217 the [homes] section will hide the [homes] share but make
218 any auto home directories visible.</para>
221 <refsect2 id="PRINTERSSECT">
222 <title>The [printers] section</title>
224 <para>This section works like [homes],
225 but for printers.</para>
227 <para>If a [printers] section occurs in the
228 configuration file, users are able to connect to any printer
229 specified in the local host's printcap file.</para>
231 <para>When a connection request is made, the existing sections
232 are scanned. If a match is found, it is used. If no match is found,
233 but a [homes] section exists, it is used as described
234 above. Otherwise, the requested section name is treated as a
235 printer name and the appropriate printcap file is scanned to see
236 if the requested section name is a valid printer share name. If
237 a match is found, a new printer share is created by cloning
238 the [printers] section.</para>
240 <para>A few modifications are then made to the newly created
244 <listitem><para>The share name is set to the located printer
245 name</para></listitem>
247 <listitem><para>If no printer name was given, the printer name
248 is set to the located printer name</para></listitem>
250 <listitem><para>If the share does not permit guest access and
251 no username was given, the username is set to the located
252 printer name.</para></listitem>
255 <para>Note that the [printers] service MUST be
256 printable - if you specify otherwise, the server will refuse
257 to load the configuration file.</para>
259 <para>Typically the path specified would be that of a
260 world-writeable spool directory with the sticky bit set on
261 it. A typical [printers] entry would look like
264 <screen format="linespecific"><computeroutput moreinfo="none">
266 path = /usr/spool/public
269 </computeroutput></screen>
271 <para>All aliases given for a printer in the printcap file
272 are legitimate printer names as far as the server is concerned.
273 If your printing subsystem doesn't work like that, you will have
274 to set up a pseudo-printcap. This is a file consisting of one or
275 more lines like this:</para>
277 <screen format="linespecific">
278 <computeroutput moreinfo="none">
279 alias|alias|alias|alias...
283 <para>Each alias should be an acceptable printer name for
284 your printing subsystem. In the [global] section, specify
285 the new file as your printcap. The server will then only recognize
286 names found in your pseudo-printcap, which of course can contain
287 whatever aliases you like. The same technique could be used
288 simply to limit access to a subset of your local printers.</para>
290 <para>An alias, by the way, is defined as any component of the
291 first entry of a printcap record. Records are separated by newlines,
292 components (if there are more than one) are separated by vertical
293 bar symbols ('|').</para>
295 <note><para>On SYSV systems which use lpstat to determine what
296 printers are defined on the system you may be able to use
297 "printcap name = lpstat" to automatically obtain a list
298 of printers. See the "printcap name" option
299 for more details.</para></note>
304 <title>PARAMETERS</title>
306 <para>parameters define the specific attributes of sections.</para>
308 <para>Some parameters are specific to the [global] section
309 (e.g., <emphasis>security</emphasis>). Some parameters are usable
310 in all sections (e.g., <emphasis>create mode</emphasis>). All others
311 are permissible only in normal sections. For the purposes of the
312 following descriptions the [homes] and [printers]
313 sections will be considered normal. The letter <emphasis>G</emphasis>
314 in parentheses indicates that a parameter is specific to the
315 [global] section. The letter <emphasis>S</emphasis>
316 indicates that a parameter can be specified in a service specific
317 section. Note that all <emphasis>S</emphasis> parameters can also be specified in
318 the [global] section - in which case they will define
319 the default behavior for all services.</para>
321 <para>parameters are arranged here in alphabetical order - this may
322 not create best bedfellows, but at least you can find them! Where
323 there are synonyms, the preferred synonym is described, others refer
324 to the preferred synonym.</para>
328 <title>VARIABLE SUBSTITUTIONS</title>
330 <para>Many of the strings that are settable in the config file
331 can take substitutions. For example the option "path =
332 /tmp/%u" would be interpreted as "path =
333 /tmp/john" if the user connected with the username john.</para>
335 <para>These substitutions are mostly noted in the descriptions below,
336 but there are some general substitutions which apply whenever they
337 might be relevant. These are:</para>
342 <listitem><para>session user name (the user name that the client
343 wanted, not necessarily the same as the one they got).</para></listitem>
348 <listitem><para>primary group name of %U.</para></listitem>
353 <listitem><para>the Internet hostname that Samba is running
354 on.</para></listitem>
359 <listitem><para>the NetBIOS name of the client machine
360 (very useful).</para></listitem>
365 <listitem><para>the NetBIOS name of the server. This allows you
366 to change your config based on what the client calls you. Your
367 server can have a "dual personality".</para>
369 <para>Note that this parameter is not available when Samba listens
370 on port 445, as clients no longer send this information </para>
377 <listitem><para>the Internet name of the client machine.
383 <listitem><para>the selected protocol level after
384 protocol negotiation. It can be one of CORE, COREPLUS,
385 LANMAN1, LANMAN2 or NT1.</para></listitem>
390 <listitem><para>The process id of the current server
391 process.</para></listitem>
396 <listitem><para>the architecture of the remote
397 machine. Only some are recognized, and those may not be
398 100% reliable. It currently recognizes Samba, WfWg, Win95,
399 WinNT and Win2k. Anything else will be known as
400 "UNKNOWN". If it gets it wrong then sending a level
401 3 log to <ulink url="mailto:samba@samba.org">samba@samba.org
402 </ulink> should allow it to be fixed.</para></listitem>
407 <listitem><para>The IP address of the client machine.</para>
413 <listitem><para>the current date and time.</para></listitem>
418 <listitem><para>Name of the domain or workgroup of the current user.</para></listitem>
422 <term>%$(<replaceable>envvar</replaceable>)</term>
423 <listitem><para>The value of the environment variable
424 <replaceable>envar</replaceable>.</para></listitem>
428 <para>The following substitutes apply only to some configuration options(only those
429 that are used when a connection has been established):</para>
434 <listitem><para>the name of the current service, if any.</para>
440 <listitem><para>the root directory of the current service,
441 if any.</para></listitem>
446 <listitem><para>user name of the current service, if any.</para>
452 <listitem><para>primary group name of %u.</para></listitem>
457 <listitem><para>the home directory of the user given
458 by %u.</para></listitem>
463 <listitem><para>the name of your NIS home directory server.
464 This is obtained from your NIS auto.map entry. If you have
465 not compiled Samba with the <emphasis>--with-automount</emphasis>
466 option then this value will be the same as %L.</para>
472 <listitem><para>the path of the service's home directory,
473 obtained from your NIS auto.map entry. The NIS auto.map entry
474 is split up as "%N:%p".</para></listitem>
478 <para>There are some quite creative things that can be done
479 with these substitutions and other smb.conf options.</para>
482 <refsect1 id="NAMEMANGLINGSECT">
483 <title>NAME MANGLING</title>
485 <para>Samba supports "name mangling" so that DOS and
486 Windows clients can use files that don't conform to the 8.3 format.
487 It can also be set to adjust the case of 8.3 format filenames.</para>
489 <para>There are several options that control the way mangling is
490 performed, and they are grouped here rather than listed separately.
491 For the defaults look at the output of the testparm program. </para>
493 <para>All of these options can be set separately for each service
494 (or globally, of course). </para>
496 <para>The options are: </para>
501 <term>mangle case = yes/no</term>
502 <listitem><para> controls if names that have characters that
503 aren't of the "default" case are mangled. For example,
504 if this is yes then a name like "Mail" would be mangled.
505 Default <emphasis>no</emphasis>.</para></listitem>
509 <term>case sensitive = yes/no</term>
510 <listitem><para>controls whether filenames are case sensitive. If
511 they aren't then Samba must do a filename search and match on passed
512 names. Default <emphasis>no</emphasis>.</para></listitem>
516 <term>default case = upper/lower</term>
517 <listitem><para>controls what the default case is for new
518 filenames. Default <emphasis>lower</emphasis>.</para></listitem>
522 <term>preserve case = yes/no</term>
523 <listitem><para>controls if new files are created with the
524 case that the client passes, or if they are forced to be the
525 "default" case. Default <emphasis>yes</emphasis>.
530 <term>short preserve case = yes/no</term>
531 <listitem><para>controls if new files which conform to 8.3 syntax,
532 that is all in upper case and of suitable length, are created
533 upper case, or if they are forced to be the "default"
534 case. This option can be use with "preserve case = yes"
535 to permit long filenames to retain their case, while short names
536 are lowercased. Default <emphasis>yes</emphasis>.</para></listitem>
540 <para>By default, Samba 3.0 has the same semantics as a Windows
541 NT server, in that it is case insensitive but case preserving.</para>
545 <refsect1 id="VALIDATIONSECT">
546 <title>NOTE ABOUT USERNAME/PASSWORD VALIDATION</title>
548 <para>There are a number of ways in which a user can connect
549 to a service. The server uses the following steps in determining
550 if it will allow a connection to a specified service. If all the
551 steps fail, then the connection request is rejected. However, if one of the
552 steps succeeds, then the following steps are not checked.</para>
554 <para>If the service is marked "guest only = yes" and the
555 server is running with share-level security ("security = share")
556 then steps 1 to 5 are skipped.</para>
559 <orderedlist continuation="restarts" inheritnum="ignore" numeration="arabic">
560 <listitem><para>If the client has passed a username/password
561 pair and that username/password pair is validated by the UNIX
562 system's password programs then the connection is made as that
563 username. Note that this includes the
564 \\server\service%<replaceable>username</replaceable> method of passing
565 a username.</para></listitem>
567 <listitem><para>If the client has previously registered a username
568 with the system and now supplies a correct password for that
569 username then the connection is allowed.</para></listitem>
571 <listitem><para>The client's NetBIOS name and any previously
572 used user names are checked against the supplied password, if
573 they match then the connection is allowed as the corresponding
574 user.</para></listitem>
576 <listitem><para>If the client has previously validated a
577 username/password pair with the server and the client has passed
578 the validation token then that username is used. </para></listitem>
580 <listitem><para>If a "user = " field is given in the
581 <filename moreinfo="none">smb.conf</filename> file for the service and the client
582 has supplied a password, and that password matches (according to
583 the UNIX system's password checking) with one of the usernames
584 from the "user =" field then the connection is made as
585 the username in the "user =" line. If one
586 of the username in the "user =" list begins with a
587 '@' then that name expands to a list of names in
588 the group of the same name.</para></listitem>
590 <listitem><para>If the service is a guest service then a
591 connection is made as the username given in the "guest
592 account =" for the service, irrespective of the
593 supplied password.</para></listitem>
599 <title>COMPLETE LIST OF GLOBAL PARAMETERS</title>
601 <para>Here is a list of all global parameters. See the section of
602 each parameter for details. Note that some are synonyms.</para>
604 <xi:include href="parameters.global.xml" parse="xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
609 <title>COMPLETE LIST OF SERVICE PARAMETERS</title>
611 <para>Here is a list of all service parameters. See the section on
612 each parameter for details. Note that some are synonyms.</para>
614 <xi:include href="parameters.service.xml" parse="xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
619 <title>EXPLANATION OF EACH PARAMETER</title>
621 <xi:include href="parameters.all.xml" parse="xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
626 <title>WARNINGS</title>
628 <para>Although the configuration file permits service names
629 to contain spaces, your client software may not. Spaces will
630 be ignored in comparisons anyway, so it shouldn't be a
631 problem - but be aware of the possibility.</para>
633 <para>On a similar note, many clients - especially DOS clients -
634 limit service names to eight characters. <citerefentry><refentrytitle>smbd</refentrytitle>
635 <manvolnum>8</manvolnum></citerefentry> has no such limitation, but attempts to connect from such
636 clients will fail if they truncate the service names. For this reason
637 you should probably keep your service names down to eight characters
640 <para>Use of the [homes] and [printers] special sections make life
641 for an administrator easy, but the various combinations of default
642 attributes can be tricky. Take extreme care when designing these
643 sections. In particular, ensure that the permissions on spool
644 directories are correct.</para>
648 <title>VERSION</title>
650 <para>This man page is correct for version 3.0 of the Samba suite.</para>
654 <title>SEE ALSO</title>
656 <citerefentry><refentrytitle>samba</refentrytitle>
657 <manvolnum>7</manvolnum></citerefentry>, <citerefentry><refentrytitle>smbpasswd</refentrytitle>
658 <manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>swat</refentrytitle>
659 <manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>smbd</refentrytitle>
660 <manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>nmbd</refentrytitle>
661 <manvolnum>8</manvolnum></citerefentry>, <citerefentry><refentrytitle>smbclient</refentrytitle>
662 <manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>nmblookup</refentrytitle>
663 <manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>testparm</refentrytitle>
664 <manvolnum>1</manvolnum></citerefentry>, <citerefentry><refentrytitle>testprns</refentrytitle>
665 <manvolnum>1</manvolnum></citerefentry>.</para>
669 <title>AUTHOR</title>
671 <para>The original Samba software and related utilities
672 were created by Andrew Tridgell. Samba is now developed
673 by the Samba Team as an Open Source project similar
674 to the way the Linux kernel is developed.</para>
676 <para>The original Samba man pages were written by Karl Auer.
677 The man page sources were converted to YODL format (another
678 excellent piece of Open Source software, available at <ulink url="ftp://ftp.icce.rug.nl/pub/unix/">
679 ftp://ftp.icce.rug.nl/pub/unix/</ulink>) and updated for the Samba 2.0
680 release by Jeremy Allison. The conversion to DocBook for
681 Samba 2.2 was done by Gerald Carter. The conversion to DocBook XML 4.2
682 for Samba 3.0 was done by Alexander Bokovoy.</para>