summaryrefslogtreecommitdiff
path: root/docs/htmldocs/smb.conf.5.html
blob: c154347a8658dc60c5dec20a7e0e3ce95594cc64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>smb.conf</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.60.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="smb.conf.5"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>Name</h2><p>smb.conf &#8212; The configuration file for the Samba suite</p></div><div class="refsect1" lang="en"><h2>SYNOPSIS</h2><p>The <tt class="filename">smb.conf</tt> file is a configuration  
	file for the Samba suite. <tt class="filename">smb.conf</tt> contains  
	runtime configuration information for the Samba programs. The <tt class="filename">smb.conf</tt> file 
	is designed to be configured and  administered by the <a href="swat.8.html"><span class="citerefentry"><span class="refentrytitle">swat</span>(8)</span></a> program. The complete
	description of the file format and possible parameters held within
	are here for reference purposes.</p></div><div class="refsect1" lang="en"><a name="FILEFORMATSECT"></a><h2>FILE FORMAT</h2><p>The file consists of sections and parameters. A section 
	begins with the name of the section in square brackets and continues 
	until the next section begins. Sections contain parameters of the 
	form</p><p><i class="replaceable"><tt>name</tt></i> = <i class="replaceable"><tt>value
	</tt></i></p><p>The file is line-based - that is, each newline-terminated 
	line represents either a comment, a section name or a parameter.</p><p>Section and parameter names are not case sensitive.</p><p>Only the first equals sign in a parameter is significant. 
	Whitespace before or after the first equals sign is discarded.
	Leading, trailing and internal whitespace in section and parameter 
	names is irrelevant. Leading and trailing whitespace in a parameter 
	value is discarded. Internal whitespace within a parameter value 
	is retained verbatim.</p><p>Any line beginning with a semicolon (';') or a hash ('#') 
	character is ignored, as are lines containing only whitespace.</p><p>Any line ending in a '\' is continued
	on the next line in the customary UNIX fashion.</p><p>The values following the equals sign in parameters are all 
	either a string (no quotes needed) or a boolean, which may be given 
	as yes/no, 0/1 or true/false. Case is not significant in boolean 
	values, but is preserved in string values. Some items such as 
	create modes are numeric.</p></div><div class="refsect1" lang="en"><h2>SECTION DESCRIPTIONS</h2><p>Each section in the configuration file (except for the
	[global] section) describes a shared resource (known
	as a &quot;share&quot;). The section name is the name of the 
	shared resource and the parameters within the section define 
	the shares attributes.</p><p>There are three special sections, [global],
	[homes] and [printers], which are
	described under <span class="emphasis"><em>special sections</em></span>. The
	following notes apply to ordinary section descriptions.</p><p>A share consists of a directory to which access is being 
	given plus a description of the access rights which are granted 
	to the user of the service. Some housekeeping options are 
	also specifiable.</p><p>Sections are either file share services (used by the 
	client as an extension of their native file systems) or 
	printable services (used by the client to access print services 
	on the host running the server).</p><p>Sections may be designated <span class="emphasis"><em>guest</em></span> services,
	in which case no password is required to access them. A specified 
	UNIX <span class="emphasis"><em>guest account</em></span> is used to define access
	privileges in this case.</p><p>Sections other than guest services will require a password 
	to access them. The client provides the username. As older clients 
	only provide passwords and not usernames, you may specify a list 
	of usernames to check against the password using the &quot;user =&quot; 
	option in the share definition. For modern clients such as 
	Windows 95/98/ME/NT/2000, this should not be necessary.</p><p>Note that the access rights granted by the server are 
	masked by the access rights granted to the specified or guest 
	UNIX user by the host system. The server does not grant more
	access than the host system grants.</p><p>The following sample section defines a file space share. 
	The user has write access to the path <tt class="filename">/home/bar</tt>. 
	The share is accessed via the share name &quot;foo&quot;:</p><pre class="screen">
<tt class="computeroutput">
[foo]
	path = /home/bar
	read only = no
</tt>
</pre><p>The following sample section defines a printable share. 
	The share is readonly, but printable. That is, the only write 
	access permitted is via calls to open, write to and close a 
	spool file. The <span class="emphasis"><em>guest ok</em></span> parameter means 
	access will be permitted as the default guest user (specified 
	elsewhere):</p><pre class="screen">
<tt class="computeroutput">
[aprinter]
	path = /usr/spool/public
	read only = yes
	printable = yes
	guest ok = yes
</tt>
</pre></div><div class="refsect1" lang="en"><h2>SPECIAL SECTIONS</h2><div class="refsect2" lang="en"><h3>The [global] section</h3><p>parameters in this section apply to the server 
		as a whole, or are defaults for sections which do not 
		specifically define certain items. See the notes
		under PARAMETERS for more information.</p></div><div class="refsect2" lang="en"><a name="HOMESECT"></a><h3>The [homes] section</h3><p>If a section called homes is included in the 
		configuration file, services connecting clients to their 
		home directories can be created on the fly by the server.</p><p>When the connection request is made, the existing 
		sections are scanned. If a match is found, it is used. If no 
		match is found, the requested section name is treated as a 
		user name and looked up in the local password file. If the 
		name exists and the correct password has been given, a share is 
		created by cloning the [homes] section.</p><p>Some modifications are then made to the newly 
		created share:</p><div class="itemizedlist"><ul type="disc"><li><p>The share name is changed from homes to 
		the located username.</p></li><li><p>If no path was given, the path is set to
		the user's home directory.</p></li></ul></div><p>If you decide to use a <span class="emphasis"><em>path =</em></span> line 
		in your [homes] section then you may find it useful 
		to use the %S macro. For example :</p><p><b class="userinput"><tt>path = /data/pchome/%S</tt></b></p><p>would be useful if you have different home directories 
		for your PCs than for UNIX access.</p><p>This is a fast and simple way to give a large number 
		of clients access to their home directories with a minimum 
		of fuss.</p><p>A similar process occurs if the requested section 
		name is &quot;homes&quot;, except that the share name is not 
		changed to that of the requesting user. This method of using
		the [homes] section works well if different users share 
		a client PC.</p><p>The [homes] section can specify all the parameters 
		a normal service section can specify, though some make more sense 
		than others. The following is a typical and suitable [homes]
		section:</p><pre class="screen">
<tt class="computeroutput">
[homes]
	read only = no
</tt>
</pre><p>An important point is that if guest access is specified 
		in the [homes] section, all home directories will be 
		visible to all clients <span class="emphasis"><em>without a password</em></span>. 
		In the very unlikely event that this is actually desirable, it 
		would be wise to also specify <span class="emphasis"><em>read only
		access</em></span>.</p><p>Note that the <span class="emphasis"><em>browseable</em></span> flag for 
		auto home directories will be inherited from the global browseable 
		flag, not the [homes] browseable flag. This is useful as 
		it means setting <span class="emphasis"><em>browseable = no</em></span> in
		the [homes] section will hide the [homes] share but make
		any auto home directories visible.</p></div><div class="refsect2" lang="en"><a name="PRINTERSSECT"></a><h3>The [printers] section</h3><p>This section works like [homes], 
		but for printers.</p><p>If a [printers] section occurs in the 
		configuration file, users are able to connect to any printer 
		specified in the local host's printcap file.</p><p>When a connection request is made, the existing sections 
		are scanned. If a match is found, it is used. If no match is found, 
		but a [homes] section exists, it is used as described
		above. Otherwise, the requested section name is treated as a
		printer name and the appropriate printcap file is scanned to see 
		if the requested section name is a valid printer share name. If 
		a match is found, a new printer share is created by cloning 
		the [printers] section.</p><p>A few modifications are then made to the newly created 
		share:</p><div class="itemizedlist"><ul type="disc"><li><p>The share name is set to the located printer 
		name</p></li><li><p>If no printer name was given, the printer name 
		is set to the located printer name</p></li><li><p>If the share does not permit guest access and 
		no username was given, the username is set to the located 
		printer name.</p></li></ul></div><p>Note that the [printers] service MUST be 
		printable - if you specify otherwise, the server will refuse 
		to load the configuration file.</p><p>Typically the path specified would be that of a 
		world-writeable spool directory with the sticky bit set on 
		it. A typical [printers] entry would look like 
		this:</p><pre class="screen"><tt class="computeroutput">
[printers]
	path = /usr/spool/public
	guest ok = yes
	printable = yes 
</tt></pre><p>All aliases given for a printer in the printcap file 
		are legitimate printer names as far as the server is concerned. 
		If your printing subsystem doesn't work like that, you will have 
		to set up a pseudo-printcap. This is a file consisting of one or 
		more lines like this:</p><pre class="screen">
<tt class="computeroutput">
alias|alias|alias|alias...    
</tt>
</pre><p>Each alias should be an acceptable printer name for 
		your printing subsystem. In the [global] section, specify 
		the new file as your printcap.  The server will then only recognize 
		names found in your pseudo-printcap, which of course can contain 
		whatever aliases you like. The same technique could be used 
		simply to limit access to a subset of your local printers.</p><p>An alias, by the way, is defined as any component of the 
		first entry of a printcap record. Records are separated by newlines,
		components (if there are more than one) are separated by vertical 
		bar symbols ('|').</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>On SYSV systems which use lpstat to determine what 
		printers are defined on the system you may be able to use
		&quot;printcap name = lpstat&quot; to automatically obtain a list 
		of printers. See the &quot;printcap name&quot; option 
		for more details.</p></div></div></div><div class="refsect1" lang="en"><h2>PARAMETERS</h2><p>parameters define the specific attributes of sections.</p><p>Some parameters are specific to the [global] section
	(e.g., <span class="emphasis"><em>security</em></span>).  Some parameters are usable 
	in all sections (e.g., <span class="emphasis"><em>create mode</em></span>). All others 
	are permissible only in normal sections. For the purposes of the 
	following descriptions the [homes] and [printers]
	sections will be considered normal.  The letter <span class="emphasis"><em>G</em></span> 
	in parentheses indicates that a parameter is specific to the
	[global] section. The letter <span class="emphasis"><em>S</em></span>
	indicates that a parameter can be specified in a service specific
	section. Note that all <span class="emphasis"><em>S</em></span> parameters can also be specified in 
	the [global] section - in which case they will define
	the default behavior for all services.</p><p>parameters are arranged here in alphabetical order - this may 
	not create best bedfellows, but at least you can find them! Where
	there are synonyms, the preferred synonym is described, others refer 
	to the preferred synonym.</p></div><div class="refsect1" lang="en"><h2>VARIABLE SUBSTITUTIONS</h2><p>Many of the strings that are settable in the config file 
	can take substitutions. For example the option &quot;path =
	/tmp/%u&quot; would be interpreted as &quot;path = 
	/tmp/john&quot; if the user connected with the username john.</p><p>These substitutions are mostly noted in the descriptions below, 
	but there are some general substitutions which apply whenever they 
	might be relevant. These are:</p><div class="variablelist"><dl><dt><span class="term">%U</span></dt><dd><p>session user name (the user name that the client 
		wanted, not necessarily the same as the one they got).</p></dd><dt><span class="term">%G</span></dt><dd><p>primary group name of %U.</p></dd><dt><span class="term">%h</span></dt><dd><p>the Internet hostname that Samba is running 
		on.</p></dd><dt><span class="term">%m</span></dt><dd><p>the NetBIOS name of the client machine 
		(very useful).</p></dd><dt><span class="term">%L</span></dt><dd><p>the NetBIOS name of the server. This allows you 
		to change your config based on what the client calls you. Your 
		server can have a &quot;dual personality&quot;.</p><p>Note that this parameter is not available when Samba listens
                on port 445, as clients no longer send this information </p></dd><dt><span class="term">%M</span></dt><dd><p>the Internet name of the client machine.
		</p></dd><dt><span class="term">%R</span></dt><dd><p>the selected protocol level after 
		protocol negotiation. It can be one of CORE, COREPLUS, 
		LANMAN1, LANMAN2 or NT1.</p></dd><dt><span class="term">%d</span></dt><dd><p>The process id of the current server
		process.</p></dd><dt><span class="term">%a</span></dt><dd><p>the architecture of the remote
		machine. Only some are recognized, and those may not be 
		100% reliable. It currently recognizes Samba, WfWg, Win95,
		WinNT and Win2k. Anything else will be known as 
		&quot;UNKNOWN&quot;. If it gets it wrong then sending a level 
		3 log to <a href="mailto:samba@samba.org" target="_top">samba@samba.org
		</a> should allow it to be fixed.</p></dd><dt><span class="term">%I</span></dt><dd><p>The IP address of the client machine.</p></dd><dt><span class="term">%T</span></dt><dd><p>the current date and time.</p></dd><dt><span class="term">%D</span></dt><dd><p>Name of the domain or workgroup of the current user.</p></dd><dt><span class="term">%$(<i class="replaceable"><tt>envvar</tt></i>)</span></dt><dd><p>The value of the environment variable
		<i class="replaceable"><tt>envar</tt></i>.</p></dd></dl></div><p>The following substitutes apply only to some configuration options(only those 
	that are used when a connection has been established):</p><div class="variablelist"><dl><dt><span class="term">%S</span></dt><dd><p>the name of the current service, if any.</p></dd><dt><span class="term">%P</span></dt><dd><p>the root directory of the current service, 
		if any.</p></dd><dt><span class="term">%u</span></dt><dd><p>user name of the current service, if any.</p></dd><dt><span class="term">%g</span></dt><dd><p>primary group name of %u.</p></dd><dt><span class="term">%H</span></dt><dd><p>the home directory of the user given 
		by %u.</p></dd><dt><span class="term">%N</span></dt><dd><p>the name of your NIS home directory server.  
		This is obtained from your NIS auto.map entry.  If you have 
		not compiled Samba with the <span class="emphasis"><em>--with-automount</em></span> 
		option then this value will be the same as %L.</p></dd><dt><span class="term">%p</span></dt><dd><p>the path of the service's home directory, 
		obtained from your NIS auto.map entry. The NIS auto.map entry 
		is split up as &quot;%N:%p&quot;.</p></dd></dl></div><p>There are some quite creative things that can be done 
	with these substitutions and other smb.conf options.</p></div><div class="refsect1" lang="en"><a name="NAMEMANGLINGSECT"></a><h2>NAME MANGLING</h2><p>Samba supports &quot;name mangling&quot; so that DOS and 
	Windows clients can use files that don't conform to the 8.3 format. 
	It can also be set to adjust the case of 8.3 format filenames.</p><p>There are several options that control the way mangling is 
	performed, and they are grouped here rather than listed separately. 
	For the defaults look at the output of the testparm program. </p><p>All of these options can be set separately for each service 
	(or globally, of course). </p><p>The options are: </p><div class="variablelist"><dl><dt><span class="term">mangle case = yes/no</span></dt><dd><p> controls if names that have characters that 
		aren't of the &quot;default&quot; case are mangled. For example, 
		if this is yes then a name like &quot;Mail&quot; would be mangled. 
		Default <span class="emphasis"><em>no</em></span>.</p></dd><dt><span class="term">case sensitive = yes/no</span></dt><dd><p>controls whether filenames are case sensitive. If 
		they aren't then Samba must do a filename search and match on passed 
		names. Default <span class="emphasis"><em>no</em></span>.</p></dd><dt><span class="term">default case = upper/lower</span></dt><dd><p>controls what the default case is for new 
		filenames. Default <span class="emphasis"><em>lower</em></span>.</p></dd><dt><span class="term">preserve case = yes/no</span></dt><dd><p>controls if new files are created with the 
		case that the client passes, or if they are forced to be the 
		&quot;default&quot; case. Default <span class="emphasis"><em>yes</em></span>.
		</p></dd><dt><span class="term">short preserve case = yes/no</span></dt><dd><p>controls if new files which conform to 8.3 syntax,
		that is all in upper case and of suitable length, are created 
		upper case, or if they are forced to be the &quot;default&quot; 
		case. This option can be use with &quot;preserve case = yes&quot; 
		to permit long filenames to retain their case, while short names 
		are lowercased. Default <span class="emphasis"><em>yes</em></span>.</p></dd></dl></div><p>By default, Samba 3.0 has the same semantics as a Windows 
	NT server, in that it is case insensitive but case preserving.</p></div><div class="refsect1" lang="en"><a name="VALIDATIONSECT"></a><h2>NOTE ABOUT USERNAME/PASSWORD VALIDATION</h2><p>There are a number of ways in which a user can connect 
	to a service. The server uses the following steps in determining 
	if it will allow a connection to a specified service. If all the 
	steps fail, then the connection request is rejected.  However, if one of the 
	steps succeeds, then the following steps are not checked.</p><p>If the service is marked &quot;guest only = yes&quot; and the
	server is running with share-level security (&quot;security = share&quot;)
	then steps 1 to 5 are skipped.</p><div class="orderedlist"><ol type="1"><li><p>If the client has passed a username/password 
		pair and that username/password pair is validated by the UNIX 
		system's password programs then the connection is made as that 
		username. Note that this includes the 
		\\server\service%<i class="replaceable"><tt>username</tt></i> method of passing 
		a username.</p></li><li><p>If the client has previously registered a username 
		with the system and now supplies a correct password for that 
		username then the connection is allowed.</p></li><li><p>The client's NetBIOS name and any previously 
		used user names are checked against the supplied password, if 
		they match then the connection is allowed as the corresponding 
		user.</p></li><li><p>If the client has previously validated a
		username/password pair with the server and the client has passed 
		the validation token then that username is used. </p></li><li><p>If a &quot;user = &quot; field is given in the
		<tt class="filename">smb.conf</tt> file for the service and the client 
		has supplied a password, and that password matches (according to 
		the UNIX system's password checking) with one of the usernames 
		from the &quot;user =&quot; field then the connection is made as 
		the username in the &quot;user =&quot; line. If one 
		of the username in the &quot;user =&quot; list begins with a
		'@' then that name expands to a list of names in 
		the group of the same name.</p></li><li><p>If the service is a guest service then a 
		connection is made as the username given in the &quot;guest 
		account =&quot; for the service, irrespective of the 
		supplied password.</p></li></ol></div></div><div class="refsect1" lang="en"><h2>COMPLETE LIST OF GLOBAL PARAMETERS</h2><p>Here is a list of all global parameters. See the section of 
	each parameter for details.  Note that some are synonyms.</p><div class="itemizedlist"><ul type="disc"></ul></div></div><div class="refsect1" lang="en"><h2>COMPLETE LIST OF SERVICE PARAMETERS</h2><p>Here is a list of all service parameters. See the section on 
	each parameter for details. Note that some are synonyms.</p><div class="itemizedlist"><ul type="disc"></ul></div></div><div class="refsect1" lang="en"><h2>EXPLANATION OF EACH PARAMETER</h2><div class="variablelist"><dl></dl></div></div><div class="refsect1" lang="en"><h2>WARNINGS</h2><p>Although the configuration file permits service names 
	to contain spaces, your client software may not. Spaces will 
	be ignored in comparisons anyway, so it shouldn't be a 
	problem - but be aware of the possibility.</p><p>On a similar note, many clients - especially DOS clients - 
	limit service names to eight characters. <a href="smbd.8.html"><span class="citerefentry"><span class="refentrytitle">smbd</span>(8)</span></a> has no such limitation, but attempts to connect from such 
	clients will fail if they truncate the service names.  For this reason 
	you should probably keep your service names down to eight characters 
	in length.</p><p>Use of the [homes] and [printers] special sections make life 
	for an administrator easy, but the various combinations of default 
	attributes can be tricky. Take extreme care when designing these 
	sections. In particular, ensure that the permissions on spool 
	directories are correct.</p></div><div class="refsect1" lang="en"><h2>VERSION</h2><p>This man page is correct for version 3.0 of the Samba suite.</p></div><div class="refsect1" lang="en"><h2>SEE ALSO</h2><p>
	<a href="samba.7.html"><span class="citerefentry"><span class="refentrytitle">samba</span>(7)</span></a>, <a href="smbpasswd.8.html"><span class="citerefentry"><span class="refentrytitle">smbpasswd</span>(8)</span></a>, <a href="swat.8.html"><span class="citerefentry"><span class="refentrytitle">swat</span>(8)</span></a>, <a href="smbd.8.html"><span class="citerefentry"><span class="refentrytitle">smbd</span>(8)</span></a>, <a href="nmbd.8.html"><span class="citerefentry"><span class="refentrytitle">nmbd</span>(8)</span></a>, <a href="smbclient.1.html"><span class="citerefentry"><span class="refentrytitle">smbclient</span>(1)</span></a>, <a href="nmblookup.1.html"><span class="citerefentry"><span class="refentrytitle">nmblookup</span>(1)</span></a>, <a href="testparm.1.html"><span class="citerefentry"><span class="refentrytitle">testparm</span>(1)</span></a>, <a href="testprns.1.html"><span class="citerefentry"><span class="refentrytitle">testprns</span>(1)</span></a>.</p></div><div class="refsect1" lang="en"><h2>AUTHOR</h2><p>The original Samba software and related utilities 
	were created by Andrew Tridgell. Samba is now developed
	by the Samba Team as an Open Source project similar 
	to the way the Linux kernel is developed.</p><p>The original Samba man pages were written by Karl Auer. 
	The man page sources were converted to YODL format (another 
	excellent piece of Open Source software, available at <a href="ftp://ftp.icce.rug.nl/pub/unix/" target="_top">
	ftp://ftp.icce.rug.nl/pub/unix/</a>) and updated for the Samba 2.0 
	release by Jeremy Allison.  The conversion 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 Alexander Bokovoy.</p></div></div></body></html>