98a687f08e32b58c21cbe8978fdfe6ce43d42b25
[samba] / docs / htmldocs / using_samba / ch01.html
1 <html>
2 <body bgcolor="#ffffff">
3
4 <img src="samba2_xs.gif" border="0" alt=" " height="100" width="76"
5 hspace="10" align="left" />
6
7 <h1 class="head0">Chapter 1. Learning the Samba</h1>
8
9
10 <p><a name="INDEX-1"/>Samba
11 is an extremely useful networking tool for anyone who has both
12 Windows and Unix systems on his network. Running on a Unix system, it
13 allows Windows to share files and printers on the Unix host, and it
14 also allows Unix users to access resources shared by Windows systems.</p>
15
16 <p>Although it might seem natural to use a Windows server to serve files
17 and printers to a network containing Windows clients, there are good
18 reasons for preferring a Samba server for this duty. Samba is
19 reliable software that runs on reliable Unix operating systems,
20 resulting in fewer problems and a low cost of maintenance. Samba also
21 offers better performance under heavy loads, outperforming Windows
22 2000 Server by a factor of 2 to 1 on identical PC hardware, according
23 to published third-party benchmarks. When common, inexpensive PC
24 hardware fails to meet the demands of a huge client load, the Samba
25 server can easily be moved to a proprietary &quot;big
26 iron&quot; Unix mainframe, which can outperform Windows
27 running on a PC many times. If all that weren't
28 enough, Samba has a very nice cost advantage: it's
29 free. Not only is the software itself freely available, but also no
30 client licenses are required, and it runs on high-quality, free
31 operating systems such as Linux and FreeBSD.</p>
32
33 <p>After reading the previous paragraph, you might come to the
34 conclusion that Samba is commonly used by large organizations with
35 thousands of users on their networks&mdash;and you'd
36 be right! But Samba's user base includes
37 organizations all over the planet, of all types and sizes: from
38 international corporations, to medium and small businesses, to
39 individuals who run Samba on their Linux laptops. In the last case, a
40 tool such as VMware is used to run Windows on the same computer, with
41 Samba enabling the two operating systems to share files.</p>
42
43 <p>The types of users vary even more&mdash;Samba is used by
44 corporations, banks and other financial institutions, government and
45 military organizations, schools, public libraries, art galleries,
46 families, and even authors! This book was developed on a Linux system
47 running VMware and Windows 2000, with Adobe FrameMaker running on
48 Windows and the document files served by Samba from the Linux
49 filesystem.</p>
50
51 <p>Does all this whet your technological appetite? If so, we encourage
52 you to keep reading, learn about Samba, and follow our examples to
53 set up a Samba server of your own. In this and upcoming chapters, we
54 will tell you exactly how to get started.</p>
55
56
57
58 <div class="sect1"><a name="samba2-CHP-1-SECT-1"/>
59
60 <h2 class="head1">What Is Samba?</h2>
61
62 <p><a name="INDEX-2"/>Samba
63 is a suite of Unix applications that speak the
64 <a name="INDEX-3"/><a name="INDEX-4"/>Server
65 Message Block (SMB) protocol. Microsoft Windows operating systems and
66 the OS/2 operating system use SMB to perform client-server networking
67 for file and printer sharing and associated operations. By supporting
68 this protocol, Samba enables computers running Unix to get in on the
69 action, communicating with the same networking protocol as Microsoft
70 Windows and appearing as another Windows system on the network from
71 the perspective of a Windows client. A <a name="INDEX-5"/>Samba
72 server offers the following services:</p>
73
74 <ul><li>
75 <p>Share one or more directory trees</p>
76 </li><li>
77 <p>Share one or more Distributed filesystem (Dfs) trees</p>
78 </li><li>
79 <p>Share printers installed on the server among Windows clients on the
80 network</p>
81 </li><li>
82 <p>Assist clients with network browsing</p>
83 </li><li>
84 <p>Authenticate clients logging onto a Windows domain</p>
85 </li><li>
86 <p>Provide or assist with Windows Internet Name Service (WINS)
87 name-server resolution</p>
88 </li></ul>
89 <p>The Samba suite also includes client tools that allow users on a Unix
90 system to access folders and printers that Windows systems and Samba
91 servers offer on the network.</p>
92
93 <p>Samba is the brainchild of Andrew <a name="INDEX-6"/>Tridgell, who currently heads the Samba
94 development team. Andrew started the project in 1991, while working
95 with a Digital Equipment Corporation (DEC) software suite called
96 Pathworks, created for connecting DEC VAX computers to computers made
97 by other companies. Without knowing the significance of what he was
98 doing, Andrew created a file-server program for an odd protocol that
99 was part of Pathworks. That protocol later turned out to be SMB. A
100 few years later, he expanded upon his custom-made SMB server and
101 began distributing it as a product on the Internet under the name
102 &quot;SMB Server.&quot; However, Andrew
103 couldn't keep that name&mdash;it already belonged to
104 another company's product&mdash;so he tried the
105 following Unix renaming approach:</p>
106
107 <blockquote><pre class="code">$ <tt class="userinput"><b>grep -i '^s.*m.*b' /usr/dict/words</b></tt></pre></blockquote>
108
109 <p>And the response was:</p>
110
111 <blockquote><pre class="code">salmonberry
112 samba
113 sawtimber
114 scramble</pre></blockquote>
115
116 <p>Thus, the name &quot;Samba&quot; was born.</p>
117
118 <p>Today, the Samba suite revolves around a pair of Unix daemons that
119 provide shared resources&mdash;called <em class="firstterm">shares
120 </em>or s<em class="firstterm">ervices</em>&mdash;to SMB clients
121 on the network. These are:</p>
122
123 <dl>
124 <dt><b><a name="INDEX-7"/>smbd</b></dt>
125 <dd>
126 <p>A daemon that handles file and printer sharing and provides
127 authentication and authorization for SMB clients.</p>
128 </dd>
129
130
131
132 <dt><b><a name="INDEX-8"/>nmbd</b></dt>
133 <dd>
134 <p>A daemon that supports NetBIOS Name Service and WINS, which is
135 Microsoft's implementation of a NetBIOS Name Server
136 (NBNS). It also assists with network browsing.</p>
137 </dd>
138
139 </dl>
140
141 <p>Samba is currently maintained and extended by a group of volunteers
142 under the active supervision of Andrew Tridgell. Like the Linux
143 operating system, Samba is distributed as open source software
144 (<a href="http://opensource.org">http://opensource.org</a>) by its
145 authors and is distributed under the GNU General Public License
146 (GPL). Since its inception, development of Samba has been sponsored
147 in part by the Australian National University, where Andrew Tridgell
148 earned his Ph.D. Since then, many other organizations have sponsored
149 Samba developers, including LinuxCare, VA Linux Systems,
150 Hewlett-Packard, and IBM. It is a true testament to Samba that both
151 commercial and noncommercial entities are prepared to spend money to
152 support an open source effort.</p>
153
154 <p>Microsoft has also contributed by offering its definition of the SMB
155 protocol to the Internet Engineering Task Force (IETF) in 1996 as the
156 <a name="INDEX-9"/><a name="INDEX-10"/>Common
157 Internet File System (CIFS). Although we prefer to use the term
158 &quot;SMB&quot; in this book, you will also
159 often find the protocol being referred to as
160 &quot;CIFS.&quot; This is especially true on
161 Microsoft's web site.</p>
162
163
164 </div>
165
166
167
168 <div class="sect1"><a name="samba2-CHP-1-SECT-2"/>
169
170 <h2 class="head1">What Can Samba Do for Me?</h2>
171
172 <p><a name="INDEX-11"/>As explained earlier, Samba can help
173 Windows and Unix computers coexist in the same network. However,
174 there are some specific reasons why you might want to set up a Samba
175 server on your network:</p>
176
177 <ul><li>
178 <p>You don't want to pay for&mdash;or
179 can't afford&mdash;a full-fledged Windows server,
180 yet you still need the functionality that one provides.</p>
181 </li><li>
182 <p>The Client Access Licenses (CALs) that Microsoft requires for each
183 Windows client to access a Windows server are unaffordable.</p>
184 </li><li>
185 <p>You want to provide a common area for data or user directories to
186 transition from a Windows server to a Unix one, or vice versa.</p>
187 </li><li>
188 <p>You want to share printers among Windows and Unix workstations.</p>
189 </li><li>
190 <p>You are supporting a group of computer users who have a mixture of
191 Windows and Unix computers.</p>
192 </li><li>
193 <p>You want to integrate Unix and Windows authentication, maintaining a
194 single database of user accounts that works with both systems.</p>
195 </li><li>
196 <p>You want to network Unix, Windows, Macintosh (OS X), and other
197 systems using a single protocol.</p>
198 </li></ul>
199 <p>Let's take a quick tour of
200 <a name="INDEX-12"/>Samba in action. Assume that we have
201 the following basic network configuration: a Samba-enabled Unix
202 system, to which we will assign the name <tt class="literal">toltec</tt>,
203 and a pair of Windows clients, to which we will assign the names
204 <tt class="literal">maya</tt> and <tt class="literal">aztec</tt>, all connected
205 via a local area network (LAN). Let's also assume
206 that <tt class="literal">toltec</tt> also has a local inkjet printer
207 connected to it, <tt class="literal">lp</tt>, and a disk share named
208 <tt class="literal">spirit</tt>&mdash;both of which it can offer to the
209 other two computers. A graphic of this network is shown in <a href="ch01.html#samba2-CHP-1-FIG-1">Figure 1-1</a>.</p>
210
211 <div class="figure"><a name="samba2-CHP-1-FIG-1"/><img src="figs/sam2_0101.gif"/></div><h4 class="head4">Figure 1-1. A simple network set up with a Samba server</h4>
212
213 <p>In this network, each computer listed shares the same
214 <em class="firstterm">workgroup</em>. A workgroup is a group name tag
215 that identifies an arbitrary collection of computers and their
216 resources on an SMB network. Several workgroups can be on the network
217 at any time, but for our basic network example,
218 we'll have only one: the METRAN workgroup.</p>
219
220
221 <div class="sect2"><a name="samba2-CHP-1-SECT-2.1"/>
222
223 <h3 class="head2">Sharing a Disk Service</h3>
224
225 <p><a name="INDEX-13"/><a name="INDEX-14"/><a name="INDEX-15"/>If everything is properly
226 configured, we should be able to see the Samba server,
227 <tt class="literal">toltec</tt>, through the Network Neighborhood of the
228 <tt class="literal">maya</tt> Windows desktop. In fact, <a href="ch01.html#samba2-CHP-1-FIG-2">Figure 1-2</a> shows the Network Neighborhood of the
229 <tt class="literal">maya</tt> computer, including <tt class="literal">toltec</tt>
230 and each computer that resides in the METRAN workgroup. Note the
231 Entire Network icon at the top of the list. As we just mentioned,
232 more than one workgroup can be on an SMB network at any given time.
233 If a user clicks the Entire Network icon, she will see a list of all
234 the workgroups that currently exist on the network.</p>
235
236 <div class="figure"><a name="samba2-CHP-1-FIG-2"/><img src="figs/sam2_0102.gif"/></div><h4 class="head4">Figure 1-2. The Network Neighborhood directory</h4>
237
238 <p>We can take a closer look at the <tt class="literal">toltec</tt> server by
239 double-clicking its icon. This contacts <tt class="literal">toltec</tt>
240 itself and requests a list of its
241 <em class="firstterm">shares</em>&mdash;the file and printer
242 resources&mdash;that the computer provides. In this case, a printer
243 named <tt class="literal">lp</tt>, a home directory named
244 <tt class="literal">jay</tt>, and a disk share named
245 <tt class="literal">spirit</tt> are on the server, as shown in <a href="ch01.html#samba2-CHP-1-FIG-3">Figure 1-3</a>. Note that the Windows display shows hostnames
246 in mixed case (Toltec). Case is irrelevant in hostnames, so you might
247 see toltec, Toltec, and TOLTEC in various displays or command output,
248 but they all refer to a single system. Thanks to Samba, Windows 98
249 sees the Unix server as a valid SMB server and can access the
250 <tt class="literal">spirit</tt> folder as if it were just another system
251 folder.</p>
252
253 <div class="figure"><a name="samba2-CHP-1-FIG-3"/><img src="figs/sam2_0103.gif"/></div><h4 class="head4">Figure 1-3. Shares available on the Toltec server as viewed from maya</h4>
254
255 <p>One popular Windows feature is the ability to map a drive letter
256 (such as E:, F:, or Z:) to a shared directory on the network using
257 the Map Network Drive option in Windows Explorer.<a name="FNPTR-1"/><a href="#FOOTNOTE-1">[1]</a>
258 Once you do so, your applications can access the folder across the
259 network using the drive letter. You can store data on it, install and
260 run programs from it, and even password-protect it against unwanted
261 visitors. See <a href="ch01.html#samba2-CHP-1-FIG-4">Figure 1-4</a> for an example of mapping
262 a <a name="INDEX-16"/><a name="INDEX-17"/>drive letter to a network
263 directory.</p>
264
265 <div class="figure"><a name="samba2-CHP-1-FIG-4"/><img src="figs/sam2_0104.gif"/></div><h4 class="head4">Figure 1-4. Mapping a network drive to a Windows drive letter</h4>
266
267 <p>Take a look at the Path: entry in the dialog box of <a href="ch01.html#samba2-CHP-1-FIG-4">Figure 1-4</a>. An equivalent way to represent a directory on
268 a network computer is by using two backslashes, followed by the name
269 of the networked computer, another backslash, and the networked
270 directory of the computer, as shown here:</p>
271
272 <blockquote><pre class="code">\\<em class="replaceable">network-computer</em>\<em class="replaceable">directory</em></pre></blockquote>
273
274 <p>This is known as the <em class="firstterm"/><a name="INDEX-18"/>Universal
275 Naming Convention (UNC)</em>  in the Windows world. For example, the dialog
276 box in <a href="ch01.html#samba2-CHP-1-FIG-4">Figure 1-4</a> represents the network directory
277 on the <tt class="literal">toltec</tt> server as:</p>
278
279 <blockquote><pre class="code">\\toltec\spirit</pre></blockquote>
280
281 <p>If this looks somewhat familiar to you, you're
282 probably thinking of <em class="firstterm">uniform resource
283 locators</em><a name="INDEX-19"/><a name="INDEX-20"/> (URLs), which are addresses that web
284 browsers such as Netscape Navigator and Internet Explorer use to
285 resolve systems across the Internet. Be sure not to confuse the two:
286 URLs such as <a href="http://www.oreilly.com">http://www.oreilly.com</a> use forward slashes
287 instead of backslashes, and they precede the initial slashes with the
288 data transfer protocol (i.e., ftp, http) and a colon (:). In reality,
289 URLs and UNCs are two completely separate things, although sometimes
290 you can specify an SMB share using a URL rather than a UNC. As a URL,
291 the <em class="filename">\\toltec\spirit</em> share would be specified as
292 <em class="filename">smb://toltec/spirit</em>.</p>
293
294 <p>Once the network drive is set up, Windows and its programs behave as
295 if the networked directory were a local disk. If you have any
296 applications that support multiuser functionality on a network, you
297 can install those programs on the network drive.<a name="FNPTR-2"/><a href="#FOOTNOTE-2">[2]</a> <a href="ch01.html#samba2-CHP-1-FIG-5">Figure 1-5</a> shows the
298 resulting network drive as it would appear with other storage devices
299 in the Windows 98 client. Note the pipeline attachment in the icon
300 for the J: drive; this indicates that it is a network drive rather
301 than a fixed drive.</p>
302
303 <div class="figure"><a name="samba2-CHP-1-FIG-5"/><img src="figs/sam2_0105.gif"/></div><h4 class="head4">Figure 1-5. The Network directory mapped to the client drive letter J</h4>
304
305 <p>My Network Places, found in Windows Me, 2000, and XP, works
306 differently from Network Neighborhood. It is necessary to click a few
307 more icons, but eventually we can get to the view of the
308 <tt class="literal">toltec</tt> server as shown in <a href="ch01.html#samba2-CHP-1-FIG-6">Figure 1-6</a>. This is from a Windows 2000 system. Setting
309 up the network drive using the Map Network Drive option in Windows
310 2000 works similarly to other Windows versions. <a name="INDEX-21"/><a name="INDEX-22"/><a name="INDEX-23"/></p>
311
312 <div class="figure"><a name="samba2-CHP-1-FIG-6"/><img src="figs/sam2_0106.gif"/></div><h4 class="head4">Figure 1-6. Shares available on Toltec (viewed from dine)</h4>
313
314
315 </div>
316
317
318 <div class="sect2"><a name="samba2-CHP-1-SECT-2.2"/>
319
320 <h3 class="head2">Sharing a Printer</h3>
321
322 <p><a name="INDEX-24"/><a name="INDEX-25"/><a name="INDEX-26"/>You probably noticed that the printer
323 <tt class="literal">lp</tt> appeared under the available shares for
324 <tt class="literal">toltec</tt> in <a href="ch01.html#samba2-CHP-1-FIG-3">Figure 1-3</a>. This
325 indicates that the Unix server has a printer that can be shared by
326 the various SMB clients in the workgroup. Data sent to the printer
327 from any of the clients will be spooled on the Unix server and
328 printed in the order in which it is received.</p>
329
330 <p><a name="INDEX-27"/><a name="INDEX-28"/>Setting up a Samba-enabled
331 printer on the Windows side is even easier than setting up a disk
332 share. By double-clicking the printer and identifying the
333 manufacturer and model, you can install a driver for this printer on
334 the Windows client. Windows can then properly format any information
335 sent to the network printer and access it as if it were a local
336 printer. On Windows 98, double-clicking the Printers icon in the
337 Control Panel opens the Printers window shown in <a href="ch01.html#samba2-CHP-1-FIG-7">Figure 1-7</a>. Again, note the pipeline attachment below the
338 printer, which identifies it as being on a network.</p>
339
340 <div class="figure"><a name="samba2-CHP-1-FIG-7"/><img src="figs/sam2_0107.gif"/></div><h4 class="head4">Figure 1-7. A network printer available on Toltec</h4>
341
342
343 <div class="sect3"><a name="samba2-CHP-1-SECT-2.2.1"/>
344
345 <h3 class="head3">Seeing things from the Unix side</h3>
346
347 <p><a name="INDEX-29"/><a name="INDEX-30"/>As mentioned earlier, Samba
348 appears in Unix as a set of daemon programs. You can view them with
349 the Unix <a name="INDEX-31"/><em class="emphasis">ps</em> command; you can
350 read any messages they generate through custom debug files or the
351 Unix <em class="emphasis">syslog</em> (depending on how Samba is set up);
352 and you can configure them from a single Samba configuration file:
353 <em class="emphasis">smb.conf</em>. In addition, if you want to get an idea of
354 what the daemons are doing, Samba has a program called
355 <em class="emphasis">smbstatus</em><a name="INDEX-32"/> that will lay it all on the line. Here
356 is how it works:</p>
357
358 <blockquote><pre class="code"># <tt class="userinput"><b>smbstatus</b></tt>
359 Processing section &quot;[homes]&quot;
360 Processing section &quot;[printers]&quot;
361 Processing section &quot;[spirit]&quot;
362
363 Samba version 2.2.6
364 Service     uid    gid    pid     machine
365 -----------------------------------------
366 spirit      jay    jay    7735    maya     (172.16.1.6) Sun Aug 12 12:17:14 2002
367 spirit      jay    jay    7779    aztec    (172.16.1.2) Sun Aug 12 12:49:11 2002
368 jay         jay    jay    7735    maya     (172.16.1.6) Sun Aug 12 12:56:19 2002
369
370 Locked files:
371 Pid    DenyMode   R/W        Oplock     Name
372 --------------------------------------------------
373 7735   DENY_WRITE RDONLY     NONE       /u/RegClean.exe   Sun Aug 12 13:01:22 2002
374
375 Share mode memory usage (bytes):
376    1048368(99%) free + 136(0%) used + 72(0%) overhead = 1048576(100%) total</pre></blockquote>
377
378 <p>The Samba status from this output provides three sets of data, each
379 divided into separate sections. The first section tells which systems
380 have connected to the Samba server, identifying each client by its
381 machine name (<tt class="literal">maya</tt> and <tt class="literal">aztec</tt>)
382 and IP (Internet Protocol) address. The second section reports the
383 name and status of the files that are currently in use on a share on
384 the server, including the read/write status and any locks on the
385 files. Finally, Samba reports the amount of memory it has currently
386 allocated to the shares that it administers, including the amount
387 actively used by the shares plus additional overhead. (Note that this
388 is not the same as the total amount of memory that the
389 <em class="emphasis">smbd</em> or <em class="emphasis">nmbd</em> processes are
390 using.)</p>
391
392 <p>Don't worry if you don't understand
393 these statistics; they will become easier to understand as you move
394 through the book.</p>
395
396
397 </div>
398
399
400 </div>
401
402
403 </div>
404
405
406
407 <div class="sect1"><a name="samba2-CHP-1-SECT-3"/>
408
409 <h2 class="head1">Getting Familiar with an SMB Network</h2>
410
411 <p><a name="INDEX-33"/>Now that you have had a brief tour of
412 Samba, let's take some time to get familiar with
413 Samba's adopted environment: an SMB network.
414 Networking with SMB is significantly different from working with
415 common TCP/IP protocols such as FTP and Telnet because there are
416 several new concepts to learn and a lot of information to cover.
417 First, we will discuss the basic concepts behind an SMB network,
418 followed by some Microsoft implementations of it, and finally we will
419 show you where a Samba server can and cannot fit into the picture.</p>
420
421
422 <div class="sect2"><a name="samba2-CHP-1-SECT-3.1"/>
423
424 <h3 class="head2">Understanding NetBIOS</h3>
425
426 <p>To begin, let's step back in time. In 1984, IBM
427 authored a simple application programming interface (API) for
428 networking its computers, called the <em class="firstterm">Network Basic
429 Input/Output System
430 </em>(<a name="INDEX-34"/>NetBIOS).
431 The NetBIOS API provided a rudimentary design for an application to
432 connect and share data with other computers.</p>
433
434 <p>It's helpful to think of the NetBIOS API as
435 networking extensions to the standard BIOS API calls. The BIOS
436 contains low-level code for performing filesystem operations on the
437 local computer. NetBIOS originally had to exchange instructions with
438 computers across IBM PC or Token Ring networks. It therefore required
439 a low-level transport protocol to carry its requests from one
440 computer to the next.</p>
441
442 <p>In late 1985, IBM released one such protocol, which it merged with
443 the NetBIOS API to become the <em class="firstterm">NetBIOS Extended User
444 Interface</em> (<em class="emphasis">NetBEUI</em> ).
445 <a name="INDEX-35"/>NetBEUI was
446 designed for small LANs, and it let each computer claim a name (up to
447 15 characters) that wasn't already in use on the
448 network. By a &quot;small LAN,&quot; we mean
449 fewer than 255 nodes on the network&mdash;which was considered a
450 generous number in 1985!</p>
451
452 <p>The NetBEUI protocol was very popular with networking applications,
453 including those running under Windows for Workgroups. Later,
454 implementations of NetBIOS over Novell's IPX
455 networking protocols also emerged, which competed with NetBEUI.
456 However, the networking protocols of choice for the burgeoning
457 Internet community were TCP/IP and UDP/IP, and implementing the
458 NetBIOS APIs over those protocols soon became a necessity.</p>
459
460 <p>Recall that TCP/IP uses numbers to represent computer addresses
461 (192.168.220.100, for instance) while NetBIOS uses only names. This
462 was a major issue when trying to mesh the two protocols together. In
463 1987, the IETF published standardization documents, titled RFC 1001
464 and 1002, that outlined how NetBIOS would work over a TCP/UDP
465 network. This set of documents still governs each implementation that
466 exists today, including those provided by Microsoft with its Windows
467 operating systems, as well as the Samba suite.</p>
468
469 <p>Since then, the standard that this document governs has become known
470 as <em class="firstterm">NetBIOS over
471 TCP/IP</em><a name="INDEX-36"/><a name="INDEX-37"/><a name="INDEX-38"/>, or NBT for short.<a name="FNPTR-3"/><a href="#FOOTNOTE-3">[3]</a> </p>
472
473 <p>The NBT standard (RFC 1001/1002)
474 currently outlines a trio of services on a network:</p>
475
476 <ul><li>
477 <p>A name service</p>
478 </li><li>
479 <p>Two communication services:</p>
480 <ul><li>
481 <p>Datagrams</p>
482 </li>
483
484 <li>
485 <p>Sessions</p>
486 </li></ul>
487 </li>
488 </ul>
489
490 <p>The <a name="INDEX-39"/>name
491 service solves the name-to-address problem mentioned earlier; it
492 allows each computer to declare a specific name on the network that
493 can be translated to a machine-readable IP address, much like
494 today's Domain Name System (DNS) on the Internet.
495 The <a name="INDEX-40"/>datagram and <a name="INDEX-41"/>session services are both
496 secondary communication protocols used to transmit data back and
497 forth from NetBIOS computers across the network.</p>
498
499
500 </div>
501
502
503 <div class="sect2"><a name="samba2-CHP-1-SECT-3.2"/>
504
505 <h3 class="head2">Getting a Name</h3>
506
507 <p><a name="INDEX-42"/><a name="INDEX-43"/>In the NetBIOS world, when each
508 computer comes online, it wants to claim a name for itself; this is
509 called <em class="firstterm">name registration</em>. However, no two
510 computers in the same workgroup should be able to claim the same
511 name; this would cause endless confusion for any computer that wanted
512 to communicate with either of them. There are two different
513 approaches to ensuring that this doesn't happen:</p>
514
515 <ul><li>
516 <p>Use an <em class="firstterm"/>NBNS</em> to keep track of which hosts have
517 registered a NetBIOS name.</p>
518 </li><li>
519 <p>Allow each computer on the network to defend its name in the event
520 that another computer attempts to use it.</p>
521 </li></ul>
522 <p><a href="ch01.html#samba2-CHP-1-FIG-8">Figure 1-8</a> illustrates a (failed) name
523 registration, with and without an NBNS.</p>
524
525 <div class="figure"><a name="samba2-CHP-1-FIG-8"/><img src="figs/sam2_0108.gif"/></div><h4 class="head4">Figure 1-8. Broadcast versus NBNS name registration</h4>
526
527 <p><a name="INDEX-44"/><a name="INDEX-45"/>As mentioned earlier,
528 there must be a way to resolve a NetBIOS name to a specific IP
529 address; this is known as <em class="firstterm">name resolution</em>.
530 There are two different approaches with NBT here as well:</p>
531
532 <ul><li>
533 <p>Have each computer report back its IP address when it
534 &quot;hears&quot; a broadcast request for its
535 NetBIOS name.</p>
536 </li><li>
537 <p>Use an NBNS to help resolve NetBIOS names to IP addresses.</p>
538 </li></ul>
539 <p><a href="ch01.html#samba2-CHP-1-FIG-9">Figure 1-9</a> illustrates the two types of name
540 resolution.</p>
541
542 <div class="figure"><a name="samba2-CHP-1-FIG-9"/><img src="figs/sam2_0109.gif"/></div><h4 class="head4">Figure 1-9. Broadcast versus NBNS name resolution</h4>
543
544 <p>As you might expect, having an NBNS on your network can help out
545 tremendously. To see exactly why, let's look at the
546 broadcast method.</p>
547
548 <p>Here, when a client computer boots, it will
549 <a name="INDEX-46"/>broadcast a
550 message declaring that it wishes to register a specified NetBIOS name
551 as its own. If nobody objects to the use of the name, it keeps the
552 name. On the other hand, if another computer on the local subnet is
553 currently using the requested name, it will send a message back to
554 the requesting client that the name is already taken. This is known
555 as <em class="firstterm">defending</em><a name="INDEX-47"/><a name="INDEX-48"/> the hostname. This type of system
556 comes in handy when one client has unexpectedly dropped off the
557 network&mdash;another can take its name unchallenged&mdash;but it
558 does incur an inordinate amount of traffic on the network for
559 something as simple as name registration.</p>
560
561 <p>With an NBNS, the same thing occurs, except the communication is
562 confined to the requesting computer and the NBNS. No broadcasting
563 occurs when the computer wishes to register the name; the
564 registration message is simply sent directly from the client to the
565 NBNS, and the NBNS replies regardless of whether the name is already
566 taken. This is known as <em class="firstterm">point-to-point
567 communication</em><a name="INDEX-49"/>, and it is often beneficial on
568 networks with more than one subnet. This is because routers are
569 generally configured to block incoming packets that are broadcast to
570 all computers in the subnet.</p>
571
572 <p>The same principles apply to name resolution. Without an NBNS,
573 NetBIOS name resolution would also be done with a broadcast
574 mechanism. All request packets would be sent to each computer in the
575 network, with the hope that one computer that might be affected will
576 respond directly back to the computer that asked. Using an NBNS and
577 point-to-point communication for this purpose is far less taxing on
578 the network than flooding the network with broadcasts for every
579 name-resolution request.</p>
580
581 <p>It can be argued that broadcast packets do not cause significant
582 problems in modern, high-bandwidth networks of hosts with fast CPUs,
583 if only a small number of hosts are on the network, or the demand for
584 bandwidth is low. There are certainly cases where this is true;
585 however, our advice throughout this book is to avoid relying on
586 broadcasts as much as possible. This is a good rule to follow for
587 large, busy networks, and if you follow our advice when configuring a
588 small network, your network will be able to grow without encountering
589 problems later on that might be difficult to diagnose. <a name="INDEX-50"/><a name="INDEX-51"/></p>
590
591
592 </div>
593
594
595 <div class="sect2"><a name="samba2-CHP-1-SECT-3.3"/>
596
597 <h3 class="head2">Node Types</h3>
598
599 <p><a name="INDEX-52"/><a name="INDEX-53"/>How can you tell what strategy each
600 client on your network will use when performing name registration and
601 resolution? Each computer on an NBT network earns one of the
602 following designations, depending on how it handles name registration
603 and resolution: <a name="INDEX-54"/><a name="INDEX-55"/><a name="INDEX-56"/><a name="INDEX-57"/>b-node, p-node, m-node, and h-node. The
604 behaviors of each type of node are summarized in <a href="ch01.html#samba2-CHP-1-TABLE-1">Table 1-1</a>.</p>
605
606 <a name="samba2-CHP-1-TABLE-1"/><h4 class="head4">Table 1-1. NetBIOS node types</h4><table border="1">
607
608
609
610 <tr>
611 <th>
612 <p>Role</p>
613 </th>
614 <th>
615 <p>Value</p>
616 </th>
617 </tr>
618
619
620 <tr>
621 <td>
622 <p>b-node</p>
623 </td>
624 <td>
625 <p>Uses broadcast registration and resolution only.</p>
626 </td>
627 </tr>
628 <tr>
629 <td>
630 <p>p-node</p>
631 </td>
632 <td>
633 <p>Uses point-to-point registration and resolution only.</p>
634 </td>
635 </tr>
636 <tr>
637 <td>
638 <p>m-node (mixed)</p>
639 </td>
640 <td>
641 <p>Uses broadcast for registration. If successful, it notifies the NBNS
642 of the result. Uses broadcast for resolution; uses the NBNS if
643 broadcast is unsuccessful.</p>
644 </td>
645 </tr>
646 <tr>
647 <td>
648 <p>h-node (hybrid)</p>
649 </td>
650 <td>
651 <p>Uses the NBNS for registration and resolution; uses broadcast if the
652 NBNS is unresponsive or inoperative.</p>
653 </td>
654 </tr>
655
656 </table>
657
658 <p>In the case of Windows clients, you will usually find them listed as
659 h-nodes or hybrid nodes. The first three node types appear in RFC
660 1001/1002, and h-nodes were invented later by Microsoft, as a more
661 fault-tolerant method.</p>
662
663 <p>You can find the node type of a Windows 95/98/Me computer by running
664 the <em class="emphasis">winipcfg</em><a name="INDEX-58"/><a name="INDEX-59"/> command from the Start
665 &rarr; Run dialog (or from an MS-DOS prompt) and clicking
666 the More Info&gt;&gt; button. On Windows NT/2000/XP, you can use the
667 <tt class="literal">ipconfig</tt><a name="INDEX-60"/><a name="INDEX-61"/><a name="INDEX-62"/><a name="INDEX-63"/>
668 <tt class="literal">/all</tt> command in a command-prompt window. In either
669 case, search for the line that says <tt class="literal">Node Type</tt>.</p>
670
671
672 </div>
673
674
675 <div class="sect2"><a name="samba2-CHP-1-SECT-3.4"/>
676
677 <h3 class="head2">What's in a Name?</h3>
678
679 <p>The names <a name="INDEX-64"/><a name="INDEX-65"/>NetBIOS uses are quite different
680 from the DNS hostnames you might be familiar with. First, NetBIOS
681 names exist in a flat namespace. In other words, there are no
682 hierarchical levels, such as in <tt class="literal">oreilly.com</tt> (two
683 levels) or <em class="emphasis">ftp</em><em class="emphasis">.samba.org</em> (three
684 levels). NetBIOS names consist of a single unique string such as
685 <tt class="literal">navaho</tt> or <tt class="literal">hopi</tt> within each
686 workgroup or domain. Second, NetBIOS names are allowed to be only 15
687 characters and can consist only of standard alphanumeric characters
688 (a-z, A-Z, 0-9) and the following:</p>
689
690 <blockquote><pre class="code">! @ # $ % ^ &amp; ( ) - ' { } . ~</pre></blockquote>
691
692 <p>Although you are allowed to use a <a name="INDEX-66"/><a name="INDEX-67"/><a name="INDEX-68"/>period (.) in a NetBIOS name, we recommend
693 against it because those names are not guaranteed to work in future
694 versions of NBT.</p>
695
696 <p>It's not a coincidence that all valid DNS names are
697 also valid NetBIOS names. In fact, the unqualified DNS name for a
698 Samba server is often reused as its NetBIOS name. For example, if you
699 had a system with a hostname of <tt class="literal">mixtec.ora.com</tt> ,
700 its NetBIOS name would likely be MIXTEC (followed by 9 spaces).</p>
701
702
703 <div class="sect3"><a name="samba2-CHP-1-SECT-3.4.1"/>
704
705 <h3 class="head3">Resource names and types</h3>
706
707 <p><a name="INDEX-69"/><a name="INDEX-70"/>With NetBIOS, a computer not
708 only advertises its presence, but also tells others what types of
709 services it offers. For example, <tt class="literal">mixtec</tt> can
710 indicate that it's not just a workstation, but that
711 it's also a file server and can receive Windows
712 Messenger messages. This is done by adding a 16th byte to the end of
713 the machine (resource) name, called the <em class="firstterm">resource
714 type</em>, and registering the name multiple times, once for
715 each service that it offers. See <a href="ch01.html#samba2-CHP-1-FIG-10">Figure 1-10</a>.</p>
716
717 <div class="figure"><a name="samba2-CHP-1-FIG-10"/><img src="figs/sam2_0110.gif"/></div><h4 class="head4">Figure 1-10. The structure of NetBIOS names</h4>
718
719 <p>The 1-byte resource type indicates a unique service that the named
720 computer provides. In this book, you will often see the resource type
721 shown in angled brackets (&lt;&gt;) after the NetBIOS name, such as:</p>
722
723 <blockquote><pre class="code">MIXTEC&lt;00&gt;</pre></blockquote>
724
725 <p>You can see which names are registered for a particular NBT computer
726 using the Windows command-line
727 <em class="emphasis">nbtstat</em><a name="INDEX-71"/> utility.
728 Because these services are unique (i.e., there cannot be more than
729 one registered), you will see them listed as type UNIQUE in the
730 output. For example, the following partial output describes the
731 <tt class="literal">toltec</tt> server:</p>
732
733 <blockquote><pre class="code">C:\&gt;<tt class="userinput"><b>nbtstat -a toltec</b></tt>
734
735        NetBIOS Remote Machine Name Table
736    Name               Type         Status
737 ---------------------------------------------
738 TOLTEC          &lt;00&gt;  UNIQUE      Registered
739 TOLTEC          &lt;03&gt;  UNIQUE      Registered
740 TOLTEC          &lt;20&gt;  UNIQUE      Registered
741 ...</pre></blockquote>
742
743 <p>This says the server has registered the NetBIOS name
744 <tt class="literal">toltec</tt> as a machine (computer) name, as a
745 recipient of messages from the Windows Messenger service, and as a
746 file server. Some possible attributes a name can have are listed in
747 <a href="ch01.html#samba2-CHP-1-TABLE-2">Table 1-2</a>.</p>
748
749 <a name="samba2-CHP-1-TABLE-2"/><h4 class="head4">Table 1-2. NetBIOS unique resource types</h4><table border="1">
750
751
752
753 <tr>
754 <th>
755 <p>Named resource</p>
756 </th>
757 <th>
758 <p>Hexadecimal byte value</p>
759 </th>
760 </tr>
761
762
763 <tr>
764 <td>
765 <p>Standard Workstation Service</p>
766 </td>
767 <td>
768 <p>00</p>
769 </td>
770 </tr>
771 <tr>
772 <td>
773 <p>Messenger Service</p>
774 </td>
775 <td>
776 <p>03</p>
777 </td>
778 </tr>
779 <tr>
780 <td>
781 <p>RAS Server Service</p>
782 </td>
783 <td>
784 <p>06</p>
785 </td>
786 </tr>
787 <tr>
788 <td>
789 <p>Domain Master Browser Service (associated with primary domain controller)</p>
790 </td>
791 <td>
792 <p>1B</p>
793 </td>
794 </tr>
795 <tr>
796 <td>
797 <p>Master Browser name</p>
798 </td>
799 <td>
800 <p>1D</p>
801 </td>
802 </tr>
803 <tr>
804 <td>
805 <p>NetDDE Service</p>
806 </td>
807 <td>
808 <p>1F</p>
809 </td>
810 </tr>
811 <tr>
812 <td>
813 <p>Fileserver (including printer server)</p>
814 </td>
815 <td>
816 <p>20</p>
817 </td>
818 </tr>
819 <tr>
820 <td>
821 <p>RAS Client Service</p>
822 </td>
823 <td>
824 <p>21</p>
825 </td>
826 </tr>
827 <tr>
828 <td>
829 <p>Network Monitor Agent</p>
830 </td>
831 <td>
832 <p>BE</p>
833 </td>
834 </tr>
835 <tr>
836 <td>
837 <p>Network Monitor Utility</p>
838 </td>
839 <td>
840 <p>BF</p>
841 </td>
842 </tr>
843
844 </table>
845
846
847 </div>
848
849
850
851 <div class="sect3"><a name="samba2-CHP-1-SECT-3.4.2"/>
852
853 <h3 class="head3">Group names and types</h3>
854
855 <p>SMB also uses the concept of groups, with which computers can
856 register themselves. Earlier we mentioned that the computers in our
857 example belonged to a
858 <em class="firstterm">workgroup</em><a name="INDEX-73"/>,
859 which is a partition of computers on the same network. For example, a
860 business might very easily have an ACCOUNTING and a SALES workgroup,
861 each with different servers and printers. In the Windows world, a
862 workgroup and an
863 <a name="INDEX-74"/>SMB
864 group are the same thing.</p>
865
866 <p>Continuing our
867 <em class="emphasis">nbtstat</em><a name="INDEX-75"/> example,
868 the <tt class="literal">toltec</tt> Samba server is also a member of the
869 METRAN workgroup (the GROUP attribute hex 00) and will participate in
870 elections for the browse master (GROUP attribute 1E). Here is the
871 remainder of the <em class="emphasis">nbtstat</em> output:</p>
872
873 <blockquote><pre class="code">       NetBIOS Remote Machine Name Table
874    Name               Type         Status
875 ---------------------------------------------
876 METRAN         &lt;00&gt;   GROUP       Registered
877 METRAN         &lt;1E&gt;   GROUP       Registered
878 ..__MSBROWSE__.&lt;01&gt;   GROUP       Registered</pre></blockquote>
879
880 <p>The possible group attributes a computer can have are illustrated in
881 <a href="ch01.html#samba2-CHP-1-TABLE-3">Table 1-3</a>. More
882 <a name="INDEX-76"/><a name="INDEX-77"/>information
883 is available in <em class="emphasis">Windows NT in a Nutshell</em> by Eric
884 <a name="INDEX-78"/>Pearce, also
885 published by O'Reilly.</p>
886
887 <a name="samba2-CHP-1-TABLE-3"/><h4 class="head4">Table 1-3. NetBIOS group resource types</h4><table border="1">
888
889
890
891 <tr>
892 <th>
893 <p>Named resource</p>
894 </th>
895 <th>
896 <p>Hexadecimal byte value</p>
897 </th>
898 </tr>
899
900
901 <tr>
902 <td>
903 <p>Standard Workstation group</p>
904 </td>
905 <td>
906 <p>00</p>
907 </td>
908 </tr>
909 <tr>
910 <td>
911 <p>Logon server</p>
912 </td>
913 <td>
914 <p>1C</p>
915 </td>
916 </tr>
917 <tr>
918 <td>
919 <p>Master Browser name</p>
920 </td>
921 <td>
922 <p>1D</p>
923 </td>
924 </tr>
925 <tr>
926 <td>
927 <p>Normal Group name (used in browser elections)</p>
928 </td>
929 <td>
930 <p>1E</p>
931 </td>
932 </tr>
933 <tr>
934 <td>
935 <p>Internet Group name (administrative)</p>
936 </td>
937 <td>
938 <p>20</p>
939 </td>
940 </tr>
941 <tr>
942 <td>
943 <p><tt class="literal">&lt;01&gt;&lt;02&gt;_ _MSBROWSE_ _&lt;02&gt;</tt></p>
944 </td>
945 <td>
946 <p>01</p>
947 </td>
948 </tr>
949
950 </table>
951
952 <p>The final entry, <tt class="literal">_ _ MSBROWSE _ _</tt>
953 <a name="INDEX-80"/>, is used to announce a group to other
954 master browsers. The nonprinting characters in the name show up as
955 dots in an <em class="emphasis">nbtstat</em> printout.
956 Don't worry if you don't understand
957 all of the resource or group types. Some of them you will not need
958 with Samba, and others you will pick up as you move through the rest
959 of the chapter. The important thing to remember here is the logistics
960 of the naming mechanism.</p>
961
962
963 </div>
964
965
966
967 <div class="sect3"><a name="samba2-CHP-1-SECT-3.4.3"/>
968
969 <h3 class="head3">Scope ID</h3>
970
971 <p>In the dark ages of SMB networking before NetBIOS groups were
972 introduced, you could use a very primitive method to isolate groups
973 of computers from the rest of the network. Each SMB packet contains a
974 field called the <em class="firstterm">scope
975 ID</em><a name="INDEX-81"/><a name="INDEX-82"/>, with the idea being that
976 systems on the network could be configured to accept only packets
977 with a scope ID matching that of their configuration. This feature
978 was hardly ever used and unfortunately lingers in modern
979 implementations. Some of the utilities included in the Samba
980 distribution allow the scope ID to be set. Setting the scope ID in a
981 network is likely to cause problems, and we are mentioning scope ID
982 only so that you will not be confused by it when you later encounter
983 it in various places.</p>
984
985
986 </div>
987
988
989 </div>
990
991
992 <div class="sect2"><a name="samba2-CHP-1-SECT-3.5"/>
993
994 <h3 class="head2">Datagrams and Sessions</h3>
995
996 <p>At this point, let's digress to discuss the
997 responsibility of NBT: to provide connection services between two
998 NetBIOS computers.
999 <a name="INDEX-83"/>NBT
1000 offers two services: the <em class="firstterm">session
1001 service</em><a name="INDEX-84"/> and the
1002 <em class="firstterm">datagram service</em><a name="INDEX-85"/>.
1003 Understanding how these two services work is not essential to using
1004 Samba, but it does give you an idea of how NBT works and how to
1005 troubleshoot Samba when it doesn't work.</p>
1006
1007 <p>The datagram service has no stable connection between computers.
1008 Packets of data are simply sent or broadcast from one computer to
1009 another, without regard to the order in which they arrive at the
1010 destination, or even if they arrive at all. The use of datagrams
1011 requires less processing overhead than sessions, although the
1012 reliability of the connection can suffer. Datagrams, therefore, are
1013 used for quickly sending nonvital blocks of data to one or more
1014 computers. The datagram service communicates using the simple
1015 primitives shown in <a href="ch01.html#samba2-CHP-1-TABLE-4">Table 1-4</a>.</p>
1016
1017 <a name="samba2-CHP-1-TABLE-4"/><h4 class="head4">Table 1-4. Datagram primitives</h4><table border="1">
1018
1019
1020
1021 <tr>
1022 <th>
1023 <p>Primitive</p>
1024 </th>
1025 <th>
1026 <p>Description</p>
1027 </th>
1028 </tr>
1029
1030
1031 <tr>
1032 <td>
1033 <p>Send Datagram</p>
1034 </td>
1035 <td>
1036 <p>Send datagram packet to computer or groups of computers.</p>
1037 </td>
1038 </tr>
1039 <tr>
1040 <td>
1041 <p>Send Broadcast Datagram</p>
1042 </td>
1043 <td>
1044 <p>Broadcast datagram to any computer waiting with a Receive Broadcast
1045 datagram.</p>
1046 </td>
1047 </tr>
1048 <tr>
1049 <td>
1050 <p>Receive Datagram</p>
1051 </td>
1052 <td>
1053 <p>Receive a datagram from a computer.</p>
1054 </td>
1055 </tr>
1056 <tr>
1057 <td>
1058 <p>Receive Broadcast Datagram</p>
1059 </td>
1060 <td>
1061 <p>Wait for a Broadcast datagram.</p>
1062 </td>
1063 </tr>
1064
1065 </table>
1066
1067 <p>The session service is more complex. Sessions are a communication
1068 method that, in theory, offers the ability to detect problematic or
1069 inoperable connections between two NetBIOS applications. It helps to
1070 think of an NBT session as being similar to a telephone call, an
1071 analogy that obviously influenced the design of the CIFS standard.</p>
1072
1073 <p>Once the connection is made, it remains open throughout the duration
1074 of the conversation, each side knows who the caller and the called
1075 computer are, and each can communicate with the simple primitives
1076 shown in <a href="ch01.html#samba2-CHP-1-TABLE-5">Table 1-5</a>.</p>
1077
1078 <a name="samba2-CHP-1-TABLE-5"/><h4 class="head4">Table 1-5. Session primitives</h4><table border="1">
1079
1080
1081
1082 <tr>
1083 <th>
1084 <p>Primitive</p>
1085 </th>
1086 <th>
1087 <p>Description</p>
1088 </th>
1089 </tr>
1090
1091
1092 <tr>
1093 <td>
1094 <p>Call</p>
1095 </td>
1096 <td>
1097 <p>Initiate a session with a computer listening under a specified name.</p>
1098 </td>
1099 </tr>
1100 <tr>
1101 <td>
1102 <p>Listen</p>
1103 </td>
1104 <td>
1105 <p>Wait for a call from a known caller or any caller.</p>
1106 </td>
1107 </tr>
1108 <tr>
1109 <td>
1110 <p>Hang-up</p>
1111 </td>
1112 <td>
1113 <p>Exit a call.</p>
1114 </td>
1115 </tr>
1116 <tr>
1117 <td>
1118 <p>Send</p>
1119 </td>
1120 <td>
1121 <p>Send data to the other computer.</p>
1122 </td>
1123 </tr>
1124 <tr>
1125 <td>
1126 <p>Receive</p>
1127 </td>
1128 <td>
1129 <p>Receive data from the other computer.</p>
1130 </td>
1131 </tr>
1132 <tr>
1133 <td>
1134 <p>Session Status</p>
1135 </td>
1136 <td>
1137 <p>Get information on requested sessions.</p>
1138 </td>
1139 </tr>
1140
1141 </table>
1142
1143 <p>Sessions are the backbone of resource sharing on an NBT network. They
1144 are typically used for establishing stable connections from client
1145 computers to disk or printer shares on a server. The client
1146 &quot;calls&quot; the server and starts
1147 trading information such as which files it wishes to open, which data
1148 it wishes to exchange, etc. These calls can last a long
1149 time&mdash;hours, even days&mdash;and all of this occurs within the
1150 context of a single connection. If there is an error, the session
1151 software (TCP) will retransmit until the data is received properly,
1152 unlike the &quot;punt-and-pray&quot; approach
1153 of the datagram service (UDP).</p>
1154
1155 <p>In truth, while sessions are supposed to handle problematic
1156 communications, they sometimes don't. If the
1157 connection is interrupted, session information that is open between
1158 the two computers might become invalid. If that happens, the only way
1159 to regain the session information is for the same two computers to
1160 call each other again and start over.</p>
1161
1162 <p>If you want more information on each service, we recommend you look
1163 at RFC 1001. However, there are two important things to remember
1164 here:</p>
1165
1166 <ul><li>
1167 <p><a name="INDEX-88"/>Sessions always
1168 occur between two NetBIOS computers. If a session service is
1169 interrupted, the client is supposed to store sufficient state
1170 information for it to reestablish the connection. However, in
1171 practice, this often does not happen.</p>
1172 </li><li>
1173 <p><a name="INDEX-89"/>Datagrams can
1174 be broadcast to multiple computers, but they are unreliable. In other
1175 words, there is no way for the source to know that the datagrams it
1176 sent have indeed arrived at their destinations. <a name="INDEX-90"/></p>
1177 </li></ul>
1178
1179 </div>
1180
1181
1182 </div>
1183
1184
1185
1186 <div class="sect1"><a name="samba2-CHP-1-SECT-4"/>
1187
1188 <h2 class="head1">An Introduction to the SMB Protocol</h2>
1189
1190 <p><a name="INDEX-91"/>Now
1191 we're going to cover some low-level technical
1192 details and explore the elementals of the SMB protocol. You probably
1193 don't need to know much about this to implement a
1194 simple Samba network, and therefore you might want to skip or skim
1195 over this section and go on to the next one
1196 (&quot;Windows Workgroups and Domains&quot;)
1197 on your first reading. However, assuming you are going to be
1198 responsible for long-term maintenance of a Samba network, it will
1199 help if you understand how it actually works. You will more easily be
1200 able to diagnose and correct any odd problems that pop up.</p>
1201
1202 <p>At a high level, the SMB protocol suite is relatively simple. It
1203 includes commands for all the file and print operations that you
1204 might perform on a local disk or printer, such as:</p>
1205
1206 <ul><li>
1207 <p>Opening and closing files</p>
1208 </li><li>
1209 <p>Creating and deleting files and directories</p>
1210 </li><li>
1211 <p>Reading and writing files</p>
1212 </li><li>
1213 <p>Searching for files</p>
1214 </li><li>
1215 <p>Queueing and dequeueing files in a print spool</p>
1216 </li></ul>
1217 <p>Each operation can be encoded into an SMB message and transmitted to
1218 and from a server. The original name
1219 &quot;SMB&quot; comes from the way in which
1220 the commands are formatted: they are versions of the standard DOS
1221 system-call data structures, or <em class="firstterm">Server Message
1222 Blocks</em>, redesigned for transmitting to another computer
1223 across a network.</p>
1224
1225
1226 <div class="sect2"><a name="samba2-CHP-1-SECT-4.1"/>
1227
1228 <h3 class="head2">SMB Format</h3>
1229
1230 <p>Richard <a name="INDEX-92"/>Sharpe of the Samba team defines SMB as
1231 a <em class="firstterm">request-response</em> protocol.<a name="FNPTR-4"/><a href="#FOOTNOTE-4">[4]</a> In effect,
1232 this means that a client sends an SMB request to a server and the
1233 server sends an SMB response back to the client. In only one rare
1234 circumstance does a server send a message that is not in response to
1235 a client.</p>
1236
1237 <p>An <a name="INDEX-94"/>SMB message is not as complex as you
1238 might think. Let's take a closer look at the
1239 internal structure of such a message. It can be broken down into two
1240 parts: the <em class="firstterm">header</em>, which is a fixed size, and
1241 the <em class="firstterm">command string</em>, whose size can vary
1242 dramatically based on the contents of the message.</p>
1243
1244
1245 <div class="sect3"><a name="samba2-CHP-1-SECT-4.1.1"/>
1246
1247 <h3 class="head3">SMB header format</h3>
1248
1249 <p><a href="ch01.html#samba2-CHP-1-TABLE-6">Table 1-6</a> shows the format of an
1250 <a name="INDEX-95"/>SMB header. The COM field identifies
1251 the command being performed. SMB commands are not required to use all
1252 the fields in the SMB header. For example, when a client first
1253 attempts to connect to a server, it does not yet have a tree
1254 identifier (TID) value&mdash;one is assigned after it successfully
1255 connects&mdash;so a null TID is placed in its header field. Other
1256 fields can be padded with zeros when not used.</p>
1257
1258 <p>The <a name="INDEX-96"/>SMB header fields are listed in <a href="ch01.html#samba2-CHP-1-TABLE-6">Table 1-6</a>.</p>
1259
1260 <a name="samba2-CHP-1-TABLE-6"/><h4 class="head4">Table 1-6. SMB header fields</h4><table border="1">
1261
1262
1263
1264
1265 <tr>
1266 <th>
1267 <p>Field</p>
1268 </th>
1269 <th>
1270 <p>Size (bytes)</p>
1271 </th>
1272 <th>
1273 <p>Description</p>
1274 </th>
1275 </tr>
1276
1277
1278 <tr>
1279 <td>
1280 <p><tt class="literal">0xFF 'SMB</tt>'</p>
1281 </td>
1282 <td>
1283 <p><tt class="literal">1</tt></p>
1284 </td>
1285 <td>
1286 <p>Protocol identifier</p>
1287 </td>
1288 </tr>
1289 <tr>
1290 <td>
1291 <p><tt class="literal">COM</tt></p>
1292 </td>
1293 <td>
1294 <p><tt class="literal">1</tt></p>
1295 </td>
1296 <td>
1297 <p>Command code, from 0x00 to 0xFF</p>
1298 </td>
1299 </tr>
1300 <tr>
1301 <td>
1302 <p><tt class="literal">RCLS</tt></p>
1303 </td>
1304 <td>
1305 <p><tt class="literal">1</tt></p>
1306 </td>
1307 <td>
1308 <p>Error class</p>
1309 </td>
1310 </tr>
1311 <tr>
1312 <td>
1313 <p><tt class="literal">REH</tt></p>
1314 </td>
1315 <td>
1316 <p><tt class="literal">1</tt></p>
1317 </td>
1318 <td>
1319 <p>Reserved</p>
1320 </td>
1321 </tr>
1322 <tr>
1323 <td>
1324 <p><tt class="literal">ERR</tt></p>
1325 </td>
1326 <td>
1327 <p><tt class="literal">2</tt></p>
1328 </td>
1329 <td>
1330 <p>Error code</p>
1331 </td>
1332 </tr>
1333 <tr>
1334 <td>
1335 <p><tt class="literal">REB</tt></p>
1336 </td>
1337 <td>
1338 <p><tt class="literal">1</tt></p>
1339 </td>
1340 <td>
1341 <p>Reserved</p>
1342 </td>
1343 </tr>
1344 <tr>
1345 <td>
1346 <p><tt class="literal">RES</tt></p>
1347 </td>
1348 <td>
1349 <p><tt class="literal">14</tt></p>
1350 </td>
1351 <td>
1352 <p>Reserved</p>
1353 </td>
1354 </tr>
1355 <tr>
1356 <td>
1357 <p><tt class="literal">TID</tt></p>
1358 </td>
1359 <td>
1360 <p><tt class="literal">2</tt></p>
1361 </td>
1362 <td>
1363 <p>TID; a unique ID for a resource in use by the client</p>
1364 </td>
1365 </tr>
1366 <tr>
1367 <td>
1368 <p><tt class="literal">PID</tt></p>
1369 </td>
1370 <td>
1371 <p><tt class="literal">2</tt></p>
1372 </td>
1373 <td>
1374 <p>Caller process ID</p>
1375 </td>
1376 </tr>
1377 <tr>
1378 <td>
1379 <p><tt class="literal">UID</tt></p>
1380 </td>
1381 <td>
1382 <p><tt class="literal">2</tt></p>
1383 </td>
1384 <td>
1385 <p>User identifier</p>
1386 </td>
1387 </tr>
1388 <tr>
1389 <td>
1390 <p><tt class="literal">MID</tt></p>
1391 </td>
1392 <td>
1393 <p><tt class="literal">2</tt></p>
1394 </td>
1395 <td>
1396 <p>Multiplex identifier; used to route requests inside a process</p>
1397 </td>
1398 </tr>
1399
1400 </table>
1401
1402
1403 </div>
1404
1405
1406
1407 <div class="sect3"><a name="samba2-CHP-1-SECT-4.1.2"/>
1408
1409 <h3 class="head3">SMB command format</h3>
1410
1411 <p>Immediately after the header is a variable number of bytes that
1412 constitute an <a name="INDEX-97"/>SMB command or reply. Each command,
1413 such as Open File (COM field identifier: <tt class="literal">SMBopen</tt>)
1414 or Get Print Queue (<tt class="literal">SMBsplretq</tt> ), has its own set
1415 of parameters and data. Like the SMB header fields, not all of the
1416 command fields need to be filled, depending on the specific command.
1417 For example, the Get Server Attributes
1418 (<tt class="literal">SMBdskattr</tt>) command sets the WCT and BCC fields
1419 to zero. The fields of the command segment are shown in <a href="ch01.html#samba2-CHP-1-TABLE-7">Table 1-7</a>.</p>
1420
1421 <a name="samba2-CHP-1-TABLE-7"/><h4 class="head4">Table 1-7. SMB command contents</h4><table border="1">
1422
1423
1424
1425
1426 <tr>
1427 <th>
1428 <p>Field</p>
1429 </th>
1430 <th>
1431 <p>Size (bytes)</p>
1432 </th>
1433 <th>
1434 <p>Description</p>
1435 </th>
1436 </tr>
1437
1438
1439 <tr>
1440 <td>
1441 <p><tt class="literal">WCT</tt></p>
1442 </td>
1443 <td>
1444 <p><tt class="literal">1</tt></p>
1445 </td>
1446 <td>
1447 <p>Word count</p>
1448 </td>
1449 </tr>
1450 <tr>
1451 <td>
1452 <p><tt class="literal">VWV</tt></p>
1453 </td>
1454 <td>
1455 <p>Variable</p>
1456 </td>
1457 <td>
1458 <p>Parameter words (size given by WCT)</p>
1459 </td>
1460 </tr>
1461 <tr>
1462 <td>
1463 <p><tt class="literal">BCC</tt></p>
1464 </td>
1465 <td>
1466 <p><tt class="literal">2</tt></p>
1467 </td>
1468 <td>
1469 <p>Parameter byte count</p>
1470 </td>
1471 </tr>
1472 <tr>
1473 <td>
1474 <p><tt class="literal">DATA</tt></p>
1475 </td>
1476 <td>
1477 <p>Variable</p>
1478 </td>
1479 <td>
1480 <p>Data (size given by BCC)</p>
1481 </td>
1482 </tr>
1483
1484 </table>
1485
1486 <p>Don't worry if you don't understand
1487 each field; they are not necessary for using Samba at an
1488 administrator level. However, they do come in handy when debugging
1489 system messages. We will show you some of the more common SMB
1490 messages that clients and servers send using a modified version of
1491 <em class="filename">tcpdump</em> later in this section. (If you prefer an
1492 <a name="INDEX-98"/><a name="INDEX-99"/>SMB sniffer with a graphical
1493 interface, try Ethereal, which uses the GTK libraries; see
1494 <a href="http://www.ethereal.com">http://www.ethereal.com</a> for more
1495 information on this tool.)</p>
1496
1497 <a name="samba2-CHP-1-NOTE-84"/><blockquote class="note"><h4 class="objtitle">TIP</h4>
1498 <p>For more information on each command in the
1499 <a name="INDEX-100"/>SMB protocol, see the
1500 <em class="citetitle">CIFS Technical
1501 Reference</em><a name="INDEX-101"/> at <a href="http://www.snia.org/tech_activities/CIFS">http://www.snia.org/tech_activities/CIFS</a>.</p>
1502 </blockquote>
1503
1504
1505 </div>
1506
1507
1508
1509 <div class="sect3"><a name="samba2-CHP-1-SECT-4.1.3"/>
1510
1511 <h3 class="head3">SMB variations</h3>
1512
1513 <p>The SMB protocol has been extended with new commands several times
1514 since its inception. Each new version is backward-compatible with the
1515 previous versions, so it is possible for a LAN to have clients and
1516 servers concurrently running different versions of the SMB protocol.</p>
1517
1518 <p><a href="ch01.html#samba2-CHP-1-TABLE-8">Table 1-8</a> outlines the major versions of the
1519 <a name="INDEX-102"/>SMB
1520 protocol. Within each &quot;dialect&quot; of
1521 SMB are many sub-versions that include commands supporting particular
1522 releases of major operating systems. The ID string in column 2 is
1523 used by clients and servers to determine in which level of the
1524 protocol they will speak to each other.</p>
1525
1526 <a name="samba2-CHP-1-TABLE-8"/><h4 class="head4">Table 1-8. SMB protocol dialects</h4><table border="1">
1527
1528
1529
1530
1531 <tr>
1532 <th>
1533 <p>Protocol name</p>
1534 </th>
1535 <th>
1536 <p>ID string</p>
1537 </th>
1538 <th>
1539 <p>Used by</p>
1540 </th>
1541 </tr>
1542
1543
1544 <tr>
1545 <td>
1546 <p>Core</p>
1547 </td>
1548 <td>
1549 <p><tt class="literal">PC NETWORK PROGRAM 1.0</tt></p>
1550 </td>
1551 <td>
1552 </td>
1553 </tr>
1554 <tr>
1555 <td>
1556 <p><a name="INDEX-103"/>Core Plus</p>
1557 </td>
1558 <td>
1559 <p><tt class="literal">MICROSOFT NETWORKS 1.03</tt></p>
1560 </td>
1561 <td>
1562 </td>
1563 </tr>
1564 <tr>
1565 <td>
1566 <p><a name="INDEX-104"/>LAN Manager 1.0</p>
1567 </td>
1568 <td>
1569 <p><tt class="literal">LANMAN1.0</tt></p>
1570 </td>
1571 <td>
1572 </td>
1573 </tr>
1574 <tr>
1575 <td>
1576 <p>LAN Manager 2.0</p>
1577 </td>
1578 <td>
1579 <p><tt class="literal">LM1.2X002</tt></p>
1580 </td>
1581 <td>
1582 </td>
1583 </tr>
1584 <tr>
1585 <td>
1586 <p>LAN Manager 2.1</p>
1587 </td>
1588 <td>
1589 <p><tt class="literal">LANMAN2.1</tt></p>
1590 </td>
1591 <td>
1592 </td>
1593 </tr>
1594 <tr>
1595 <td>
1596 <p><a name="INDEX-105"/>NT LAN
1597 Manager 1.0</p>
1598 </td>
1599 <td>
1600 <p><tt class="literal">NT LM 0.12</tt></p>
1601 </td>
1602 <td>
1603 <p>Windows NT 4.0</p>
1604 </td>
1605 </tr>
1606 <tr>
1607 <td>
1608 <p><a name="INDEX-106"/>Samba's NT LM 0.12</p>
1609 </td>
1610 <td>
1611 <p><tt class="literal">Samba</tt></p>
1612 </td>
1613 <td>
1614 <p>Samba</p>
1615 </td>
1616 </tr>
1617 <tr>
1618 <td>
1619 <p><a name="INDEX-107"/><a name="INDEX-108"/>Common
1620 Internet File System</p>
1621 </td>
1622 <td>
1623 <p><tt class="literal">CIFS 1.0</tt></p>
1624 </td>
1625 <td>
1626 <p>Windows 2000/XP</p>
1627 </td>
1628 </tr>
1629
1630 </table>
1631
1632 <p>Samba implements the NT LM 0.12 specification for NT LAN Manager 1.0.
1633 It is backward-compatible with all the other SMB variants. The CIFS
1634 specification is, in reality, LAN Manager 0.12 with a few specific
1635 additions.</p>
1636
1637
1638 </div>
1639
1640
1641 </div>
1642
1643
1644 <div class="sect2"><a name="samba2-CHP-1-SECT-4.2"/>
1645
1646 <h3 class="head2">SMB Clients and Servers</h3>
1647
1648 <p><a name="INDEX-109"/><a name="INDEX-110"/>As
1649 mentioned earlier, SMB is a client/server protocol. In the purest
1650 sense, this means that a client sends a request to a server, which
1651 acts on the request and returns a reply. However, the client/server
1652 roles can often be reversed, sometimes within the context of a single
1653 SMB session. For example, consider the two Windows 95/98/Me computers
1654 in <a href="ch01.html#samba2-CHP-1-FIG-11">Figure 1-11</a>. The computer named
1655 <tt class="literal">maya</tt> shares a printer to the network, and the
1656 computer named <tt class="literal">toltec</tt> shares a disk directory.
1657 <tt class="literal">maya</tt> is in the client role when accessing
1658 <tt class="literal">toltec</tt>'s network drive and in the
1659 server role when printing a job for <tt class="literal">toltec</tt>.</p>
1660
1661 <div class="figure"><a name="samba2-CHP-1-FIG-11"/><img src="figs/sam2_0111.gif"/></div><h4 class="head4">Figure 1-11. Two computers that both have resources to share</h4>
1662
1663 <p>This brings out an important point in Samba terminology:</p>
1664
1665 <ul><li>
1666 <p>A <em class="firstterm">server</em> is a computer with a resource to
1667 share.</p>
1668 </li><li>
1669 <p>A <em class="firstterm">client</em> is a computer that wishes to use that
1670 resource.</p>
1671 </li><li>
1672 <p>A computer can be a client, a server, or both, or it can be neither
1673 at any given time.</p>
1674 </li></ul>
1675 <p>Microsoft Windows products have both the SMB client and server built
1676 into the operating system, and it is common to find Windows acting as
1677 a server, client, both, or neither at any given time in a production
1678 network. Although Samba has been developed primarily to function as a
1679 server, there are also ways that it and associated software can act
1680 as an SMB client. As with Windows, it is even possible to set up a
1681 Unix system to act as an SMB client and not as a server. See <a href="ch05.html">Chapter 5</a> for more details on this topic.</p>
1682
1683
1684 </div>
1685
1686
1687 <div class="sect2"><a name="samba2-CHP-1-SECT-4.3"/>
1688
1689 <h3 class="head2">A Simple SMB Connection</h3>
1690
1691 <p><a name="INDEX-111"/>The client and server must complete
1692 three steps to establish a connection to a resource:</p>
1693
1694 <ol><li>
1695 <p>Establish a NetBIOS session.</p>
1696 </li><li>
1697 <p>Negotiate the protocol variant.</p>
1698 </li><li>
1699 <p>Set session parameters, and make a tree connection to a resource.</p>
1700 </li></ol>
1701 <p>We will examine each step through the eyes of a useful tool that we
1702 mentioned earlier: the modified
1703 <em class="filename">tcpdump</em><a name="INDEX-112"/> that is
1704 available from the Samba web site.</p>
1705
1706 <a name="samba2-CHP-1-NOTE-85"/><blockquote class="note"><h4 class="objtitle">TIP</h4>
1707 <p>You can download the tcpdump program at <a href="http://www.samba.org">http://www.samba.org</a> in the
1708 <em class="filename">samba/ftp/tcpdump-smb</em> directory; the latest
1709 version as of this writing is 3.4-10. Use this program as you would
1710 use the standard <em class="filename">tcpdump</em> application, but add
1711 the <tt class="literal">-s 1500</tt> switch to ensure that you get the
1712 whole packet and not just the first few bytes.</p>
1713 </blockquote>
1714
1715
1716 </div>
1717
1718
1719 <div class="sect2"><a name="samba2-CHP-1-SECT-4.4"/>
1720
1721 <h3 class="head2">Establishing a NetBIOS Session</h3>
1722
1723 <p><a name="INDEX-113"/>When a user first makes a request
1724 to access a network disk or send a print job to a remote printer,
1725 NetBIOS takes care of making a connection at the session layer. The
1726 result is a bidirectional channel between the client and server. The
1727 client and server need only two messages to establish this
1728 connection. This is shown in the following example session request
1729 and response, as captured by <em class="filename">tcpdump</em> .</p>
1730
1731 <p>First, the client sends a request to open a session, and
1732 <em class="filename">tcpdump </em><a name="INDEX-114"/>reports:</p>
1733
1734 <blockquote><pre class="code">&gt;&gt;&gt; NBT Packet
1735 NBT Session Request
1736 Flags=0x81000044
1737 Destination=TOLTEC      NameType=0x20 (Server)
1738 Source=MAYA             NameType=0x00 (Workstation)</pre></blockquote>
1739
1740 <p>Then the server responds, granting a session to the client:</p>
1741
1742 <blockquote><pre class="code">&gt;&gt;&gt; NBT Packet
1743 NBT Session Granted
1744 Flags=0x82000000</pre></blockquote>
1745
1746 <p>At this point, there is an open channel between the client and server.</p>
1747
1748
1749 </div>
1750
1751
1752 <div class="sect2"><a name="samba2-CHP-1-SECT-4.5"/>
1753
1754 <h3 class="head2">Negotiating the Protocol Variant</h3>
1755
1756 <p>Next, the client sends a message to the server to negotiate an
1757 <a name="INDEX-115"/>SMB protocol. As mentioned
1758 earlier, the client sets its <a name="INDEX-116"/>tree identifier (TID) field to
1759 zero, because it does not yet know what TID to use. A <em class="emphasis">tree
1760 identifier</em> is a number that represents a connection to a
1761 share on a server.</p>
1762
1763 <p>The command in the message is <tt class="literal">SMBnegprot</tt>, a
1764 request to negotiate a protocol variant that will be used for the
1765 entire session. Note that the client sends to the server a list of
1766 all the variants that it can speak, not vice versa:</p>
1767
1768 <blockquote><pre class="code">&gt;&gt;&gt; NBT Packet
1769 NBT Session Packet
1770 Flags=0x0
1771 Length=154
1772
1773 SMB PACKET: SMBnegprot (REQUEST)
1774 SMB Command   =  0x72
1775 Error class   =  0x0
1776 Error code    =  0
1777 Flags1        =  0x0
1778 Flags2        =  0x0
1779 Tree ID       =  0
1780 Proc ID       =  5315
1781 UID           =  0
1782 MID           =  257
1783 Word Count    =  0
1784 Dialect=PC NETWORK PROGRAM 1.0
1785 Dialect=MICROSOFT NETWORKS 3.0
1786 Dialect=DOS LM1.2X002
1787 Dialect=DOS LANMAN2.1
1788 Dialect=Windows for Workgroups 3.1a
1789 Dialect=NT LM 0.12</pre></blockquote>
1790
1791 <p>The server responds to the
1792 <tt class="literal">SMBnegprot</tt><a name="INDEX-117"/> request with an index (with counting
1793 starting at 0) into the list of variants that the client offered, or
1794 with the value 0xFF if none of the protocol variants is acceptable:</p>
1795
1796 <blockquote><pre class="code">&gt;&gt;&gt; NBT Packet
1797 NBT Session Packet
1798 Flags=0x0
1799 Length=84
1800
1801 SMB PACKET: SMBnegprot (REPLY)
1802 SMB Command   =  0x72
1803 Error class   =  0x0
1804 Error code    =  0
1805 Flags1        =  0x80
1806 Flags2        =  0x1
1807 Tree ID       =  0
1808 Proc ID       =  5315
1809 UID           =  0
1810 MID           =  257
1811 Word Count    =  17
1812 NT1 Protocol
1813 DialectIndex=5
1814 [...]</pre></blockquote>
1815
1816 <p>In this example, the server responds with the value 5, which
1817 indicates that the <tt class="literal">NT</tt> <tt class="literal">LM</tt>
1818 <tt class="literal">0.12</tt> dialect will be used for the remainder of the
1819 session.</p>
1820
1821
1822 </div>
1823
1824
1825 <div class="sect2"><a name="samba2-CHP-1-SECT-4.6"/>
1826
1827 <h3 class="head2">Set Session and Login Parameters</h3>
1828
1829 <p><a name="INDEX-118"/><a name="INDEX-119"/>The next step is to transmit session and
1830 login parameters for the session, which you do using the
1831 <a name="INDEX-120"/><tt class="literal">SMBSesssetupX</tt>
1832 command. The parameters include the following:</p>
1833
1834 <ul><li>
1835 <p>The account name and password (if there is one)</p>
1836 </li><li>
1837 <p>The workgroup name</p>
1838 </li><li>
1839 <p>The maximum size of data that can be transferred</p>
1840 </li><li>
1841 <p>The number of pending requests that can be in the queue at a time</p>
1842 </li></ul>
1843 <p>The resulting output from <em class="filename">tcpdump </em>is:</p>
1844
1845 <blockquote><pre class="code">&gt;&gt;&gt; NBT Packet
1846 NBT Session Packet
1847 Flags=0x0
1848 Length=150
1849
1850 SMB PACKET: SMBsesssetupX (REQUEST)
1851 SMB Command   =  0x73
1852 Error class   =  0x0
1853 Error code    =  0
1854 Flags1        =  0x10
1855 Flags2        =  0x0
1856 Tree ID       =  0
1857 Proc ID       =  5315
1858 UID           =  1
1859 MID           =  257
1860 Word Count    =  13
1861 Com2=0x75
1862 Res1=0x0
1863 Off2=120
1864 MaxBuffer=2920
1865 MaxMpx=50
1866 VcNumber=0
1867 SessionKey=0x1380
1868 CaseInsensitivePasswordLength=24
1869 CaseSensitivePasswordLength=0
1870 Res=0x0
1871 Capabilities=0x1
1872 Pass1&amp;Pass2&amp;Account&amp;Domain&amp;OS&amp;LanMan=  
1873   JAY METRAN Windows 4.0 Windows 4.0
1874
1875 SMB PACKET: SMBtconX (REQUEST) (CHAINED)
1876 smbvwv[]=
1877 Com2=0xFF
1878 Off2=0
1879 Flags=0x2
1880 PassLen=1
1881 Passwd&amp;Path&amp;Device=
1882 smb_bcc=23
1883 smb_buf[]=\\TOLTEC\SPIRIT</pre></blockquote>
1884
1885 <p>In this example, the <tt class="literal">SMBsesssetupX</tt> Session Setup
1886 command allows for an additional SMB command to be piggybacked onto
1887 it (indicated by the letter X at the end of the command name). The
1888 hexadecimal code of the second command is given in the
1889 <tt class="literal">Com2</tt> field. In this case the command is
1890 <tt class="literal">0x75</tt>, which is the <tt class="literal">SMBtconX</tt>
1891 <tt class="literal">(</tt>Tree Connect and X) command. The
1892 <tt class="literal">SMBtconX</tt><a name="INDEX-121"/> message looks for the name of the
1893 resource in the <em class="emphasis">smb_buf</em> buffer. In this example,
1894 <em class="emphasis">smb_buf</em> contains the string
1895 <tt class="literal">\\TOLTEC\SPIRIT</tt>, which is the full pathname to a
1896 shared directory on <tt class="literal">toltec</tt>. Using the
1897 &quot;and X&quot; commands like this speeds
1898 up each transaction because the server doesn't have
1899 to wait on the client to make a second request.</p>
1900
1901 <p>Note that the TID is still zero. Finally, the server returns a TID to
1902 the client, indicating that the user has been authorized access and
1903 that the resource is ready to be used:</p>
1904
1905 <blockquote><pre class="code">&gt;&gt;&gt; NBT Packet
1906 NBT Session Packet
1907 Flags=0x0
1908 Length=85
1909
1910 SMB PACKET: SMBsesssetupX (REPLY)
1911 SMB Command   =  0x73
1912 Error class   =  0x0
1913 Error code    =  0
1914 Flags1        =  0x80
1915 Flags2        =  0x1
1916 Tree ID       =  1
1917 Proc ID       =  5315
1918 UID           =  100
1919 MID           =  257
1920 Word Count    =  3
1921 Com2=0x75
1922 Off2=68
1923 Action=0x1
1924 [000] Unix Samba 2.2.6
1925 [010] METRAN
1926
1927 SMB PACKET: SMBtconX (REPLY) (CHAINED)
1928 smbvwv[]=
1929 Com2=0xFF
1930 Off2=0
1931 smbbuf[]=
1932 ServiceType=A:</pre></blockquote>
1933
1934 <p>The <em class="emphasis">ServiceType</em> field is set to
1935 &quot;A&quot; to indicate that this is a file
1936 service. Available service types are:</p>
1937
1938 <ul><li>
1939 <p>&quot;A&quot; for a disk or file</p>
1940 </li><li>
1941 <p>&quot;LPT1&quot; for a spooled output</p>
1942 </li><li>
1943 <p>&quot;COMM&quot; for a direct-connect printer
1944 or modem</p>
1945 </li><li>
1946 <p>&quot;IPC&quot; for a named pipe</p>
1947 </li></ul>
1948 <p>Now that a TID has been assigned, the client can use it as a handle
1949 to perform any operation that it would use on a local disk drive. It
1950 can open files, read and write to them, delete them, create new
1951 files, search for filenames, and so on. <a name="INDEX-122"/></p>
1952
1953
1954 </div>
1955
1956
1957 </div>
1958
1959
1960
1961 <div class="sect1"><a name="samba2-CHP-1-SECT-5"/>
1962
1963 <h2 class="head1">Windows Workgroups and Domains</h2>
1964
1965 <p>Up to now, we've covered basic SMB technology, which
1966 is all you would need if you had nothing more advanced than MS-DOS
1967 clients on your network. We do assume you want to support Windows
1968 clients, especially the more recent versions, so next
1969 we'll describe the enhancements Microsoft has added
1970 to SMB networking&mdash;namely, Windows for Workgroups and Windows
1971 domains.</p>
1972
1973
1974 <div class="sect2"><a name="samba2-CHP-1-SECT-5.1"/>
1975
1976 <h3 class="head2">Windows Workgroups</h3>
1977
1978 <p><a name="INDEX-123"/><a name="INDEX-124"/>Windows
1979 Workgroups are very similar to the SMB groups already described. You
1980 need to know just a few additional things.</p>
1981
1982
1983 <div class="sect3"><a name="samba2-CHP-1-SECT-5.1.1"/>
1984
1985 <h3 class="head3">Browsing</h3>
1986
1987 <p><a name="INDEX-125"/>Browsing
1988 is the process of finding the other computers and shared resources in
1989 the Windows network. Note that there is no connection with a World
1990 Wide Web browser, apart from the general idea of
1991 &quot;discovering what's
1992 there.&quot; On the other hand, browsing the Windows
1993 network is like the Web in that what's out there can
1994 change without warning.</p>
1995
1996 <p>Before browsing existed, users had to know the name of the computer
1997 they wanted to connect to on the network and then manually enter a
1998 UNC such as the following into an application or file manager to
1999 access resources:</p>
2000
2001 <blockquote><pre class="code">\\toltec\spirit\</pre></blockquote>
2002
2003 <p>Browsing is much more convenient, making it possible to examine the
2004 contents of a network by using the point-and-click GUI interface of
2005 the Network Neighborhood (or My Network Places<a name="FNPTR-5"/><a href="#FOOTNOTE-5">[5]</a>) on a Windows client.</p>
2006
2007 <p>You will encounter two types of browsing in an SMB network:</p>
2008
2009 <ul><li>
2010 <p><a name="INDEX-129"/>Browsing a list
2011 of computers and shared resources</p>
2012 </li><li>
2013 <p><a name="INDEX-130"/>Browsing the shared resource
2014 of a specific computer</p>
2015 </li></ul>
2016 <p>Let's look at the first one. On each LAN (or subnet)
2017 with a Windows workgroup or domain, one computer has the
2018 responsibility of maintaining a list of the computers that are
2019 currently accessible through the network. This computer is called the
2020 <em class="firstterm">local master
2021 browser</em><a name="INDEX-131"/><a name="INDEX-132"/>, and the list that it maintains is
2022 called the <em class="firstterm">browse
2023 list</em><a name="INDEX-133"/>. Computers on a subnet use the browse
2024 list to cut down on the amount of network traffic generated while
2025 browsing. Instead of each computer dynamically polling to determine a
2026 list of the currently available computers, the computer can simply
2027 query the local master browser to obtain a complete, up-to-date list.</p>
2028
2029 <p>To browse the resources on a computer, a user must connect to the
2030 specific computer; this information cannot be obtained from the
2031 browse list. Browsing the list of resources on a computer can be done
2032 by double-clicking the computer's icon when it is
2033 presented in the Network Neighborhood. As you saw at the opening of
2034 the chapter, the computer will respond with a list of shared
2035 resources that can be accessed after the user is successfully
2036 authenticated.</p>
2037
2038 <p>Each server on a Windows workgroup is required to announce its
2039 presence to the local master browser after it has registered a
2040 NetBIOS name, and (theoretically) announce that it is leaving the
2041 workgroup when it is shut down. It is the local master
2042 browser's responsibility to record what the servers
2043 have announced.</p>
2044 <a name="samba2-CHP-1-NOTE-86"/><blockquote class="note"><h4 class="objtitle">WARNING</h4>
2045 <p>The Windows <a name="INDEX-134"/>Network Neighborhood can behave
2046 oddly: until you select a particular computer to browse, the Network
2047 Neighborhood window might contain data that is not up-to-date. That
2048 means the Network Neighborhood window can be showing computers that
2049 have crashed or can be missing computers that
2050 haven't been noticed yet. Put succinctly, once
2051 you've selected a server and connected to it, you
2052 can be a lot more confident that the shares and printers really exist
2053 on the network.</p>
2054 </blockquote>
2055
2056 <p>Unlike the roles you've seen earlier, almost any
2057 Windows system (including Windows for Workgroups and Windows 95/98/Me
2058 or NT/2000/XP) can act as a local master browser. The local master
2059 browser can have one or more
2060 <em class="firstterm"/><a name="INDEX-135"/><a name="INDEX-136"/>backup 
2061 browsers</em> on the local subnet
2062 that will take over in the event that the local master browser fails
2063 or becomes inaccessible. To ensure fluid operation, the local backup
2064 browsers will frequently synchronize their browse list with the local
2065 master browser.</p>
2066
2067 <p>Here is how to calculate the minimum number of backup browsers that
2068 will be allocated on a workgroup:</p>
2069
2070 <ul><li>
2071 <p>If up to 32 Windows NT/2000/XP workstations are on the network, or up
2072 to 16 Windows 95/98/Me computers are on the network, the local master
2073 browser allocates one backup browser in addition to the local master
2074 browser.</p>
2075 </li><li>
2076 <p>If the number of Windows NT/2000/XP workstations falls between 33 and
2077 64, or the number of Windows 95/98/Me workstations falls between 17
2078 and 32, the local master browser allocates two backup browsers.</p>
2079 </li><li>
2080 <p>For each group of 32 NT/2000/XP workstations or 16 Windows 95/98/Me
2081 computers beyond this, the local master browser allocates another
2082 backup browser.</p>
2083 </li></ul>
2084 <p>There is currently no upper limit on the number of backup browsers
2085 that can be allocated by the local master browser.</p>
2086
2087
2088 </div>
2089
2090
2091
2092 <div class="sect3"><a name="samba2-CHP-1-SECT-5.1.2"/>
2093
2094 <h3 class="head3">Browsing elections</h3>
2095
2096 <p><a name="INDEX-137"/>Browsing
2097 is a critical aspect of any Windows workgroup. However, not
2098 everything runs perfectly on any network. For example,
2099 let's say that a computer running Windows on the
2100 desk of a small company's CEO is the local master
2101 browser&mdash;that is, until he switches it off while plugging in his
2102 massage chair. At this point the Windows NT Workstation in the spare
2103 parts department might agree to take over the job. However, that
2104 computer is currently running a large, poorly written program that
2105 has brought its processor to its knees. The moral: browsing has to be
2106 very tolerant of servers coming and going. Because nearly every
2107 Windows system can serve as a browser, there has to be a way of
2108 deciding at any time who will take on the job. This decision-making
2109 process is called an <em class="firstterm">election</em>.</p>
2110
2111 <p>An election algorithm is built into nearly all Windows operating
2112 systems such that they can each agree who is going to be a local
2113 master browser and who will be local backup browsers. An election can
2114 be forced at any time. For example, let's assume
2115 that the CEO has finished his massage and reboots his server. As the
2116 server comes online, it will announce its presence, and an election
2117 will take place to see if the PC in the spare parts department should
2118 still be the master browser.</p>
2119
2120 <p>When an election is performed, each computer broadcasts information
2121 about itself via datagrams. This information includes the following:</p>
2122
2123 <ul><li>
2124 <p>The version of the election protocol used</p>
2125 </li><li>
2126 <p>The operating system on the computer</p>
2127 </li><li>
2128 <p>The amount of time the client has been on the network</p>
2129 </li><li>
2130 <p>The hostname of the client</p>
2131 </li></ul>
2132 <p>These values determine which operating system has seniority and will
2133 fulfill the role of the local master browser. (<a href="ch07.html">Chapter 7</a> describes the election process in more
2134 detail.) The architecture developed to achieve this is not elegant
2135 and has built-in security problems. While a browsing domain can be
2136 integrated with domain security, the election algorithm does not take
2137 into consideration which computers become browsers. Thus it is
2138 possible for any computer running a browser service to register
2139 itself as participating in the browsing election and (after winning)
2140 being able to change the browse list. Nevertheless, browsing is a key
2141 feature of Windows networking, and backward-compatibility
2142 requirements will ensure that it is in use for years to come.
2143 <a name="INDEX-138"/></p>
2144
2145
2146 </div>
2147
2148
2149
2150 <div class="sect3"><a name="samba2-CHP-1-SECT-5.1.3"/>
2151
2152 <h3 class="head3">Windows 95/98/Me authentication</h3>
2153
2154 <p>Three types of passwords arise when
2155 <a name="INDEX-139"/><a name="INDEX-140"/>Windows
2156 95/98/Me is operating in a Windows workgroup:</p>
2157
2158 <ul><li>
2159 <p>A Windows password</p>
2160 </li><li>
2161 <p>A Windows Networking password</p>
2162 </li><li>
2163 <p>A password for each shared resource that has been assigned password
2164 protection</p>
2165 </li></ul>
2166 <p>The Windows <a name="INDEX-141"/>password functions in a manner
2167 that might be a source of confusion for Unix system administrators.
2168 It is not there to prevent unauthorized users from using the
2169 computer. (If you don't believe that, try clicking
2170 the Cancel button on the password dialog box and see what happens!)
2171 Instead, the Windows password is used to gain access to a file that
2172 contains the Windows Networking and network resource passwords. There
2173 is one such file per registered user of the system, and they can be
2174 found in the <em class="filename">C:\Windows</em> directory with a name
2175 composed of the user's account name, followed by a
2176 <em class="filename">.pwl</em><a name="INDEX-142"/><a name="INDEX-143"/><a name="INDEX-144"/> extension. For example, if the
2177 user's account name is
2178 &quot;sarah,&quot; the file will be
2179 <em class="filename">C:\Windows\sarah.pwl</em>. This file is encrypted
2180 using the Windows password as the encryption key.</p>
2181
2182 <a name="samba2-CHP-1-NOTE-87"/><blockquote class="note"><h4 class="objtitle">TIP</h4>
2183 <p>As a security measure, you might want to check for junk
2184 <em class="filename">.pwl</em> files on Windows 95/98/Me clients, which
2185 might have been created by mistakes users made while attempting to
2186 log on. A <em class="filename">.pwl</em> file is easily cracked and can
2187 contain valid passwords for Samba accounts and network shares.</p>
2188 </blockquote>
2189
2190 <p>The first time the network is accessed, Windows attempts to use the
2191 Windows password as the Windows Networking password. If this is
2192 successful, the user will not be prompted for two separate passwords,
2193 and subsequent logins to the Windows system will automatically result
2194 in logging on to the Windows network as well, making things much
2195 simpler for the user.</p>
2196
2197 <p>Shared network resources in the workgroup can also have passwords
2198 assigned to them to limit their accessibility. The first time a user
2199 attempts to access the resource, she is asked for its password, and a
2200 checkbox in the password dialog box gives the user the option to add
2201 the password to her password list. This is the default; if it is
2202 accepted, Windows will store the password in the
2203 user's <em class="filename">.pwl</em> file, and all
2204 further authentication to the resource will be handled automatically
2205 by Windows.</p>
2206
2207 <p>Samba's approach to workgroup authentication is a
2208 little different, which is a result of blending the Windows workgroup
2209 model with that of the Unix host upon which Samba runs. This will be
2210 discussed further in <a href="ch09.html">Chapter 9</a>. <a name="INDEX-145"/></p>
2211
2212
2213 </div>
2214
2215
2216 </div>
2217
2218
2219 <div class="sect2"><a name="samba2-CHP-1-SECT-5.2"/>
2220
2221 <h3 class="head2">Windows NT Domains</h3>
2222
2223 <p><a name="INDEX-146"/>The
2224 peer-to-peer networking model of
2225 <a name="INDEX-147"/>workgroups functions fairly well as long as
2226 the number of computers on the network is small and there is a
2227 close-knit community of users. However, in larger networks the
2228 simplicity of workgroups becomes a limiting factor. Workgroups offer
2229 only the most basic level of security, and because each resource can
2230 have its own password, it is inconvenient (to say the least) for
2231 users to remember the password for each resource in a large network.
2232 Even if that were not a problem, many people find it frustrating to
2233 have to interrupt their creative workflow to enter a shared password
2234 into a dialog box every time another network resource is accessed.</p>
2235
2236 <p>To support the needs of larger networks, such as those found in
2237 departmental computing environments, Microsoft introduced domains
2238 with Windows NT 3.51. A <em class="firstterm">Windows NT domain</em> is
2239 essentially a workgroup of SMB computers that has one addition: a
2240 server acting as a <em class="firstterm">domain
2241 controller</em><a name="INDEX-148"/> (see <a href="ch01.html#samba2-CHP-1-FIG-12">Figure 1-12</a>).</p>
2242
2243 <div class="figure"><a name="samba2-CHP-1-FIG-12"/><img src="figs/sam2_0112.gif"/></div><h4 class="head4">Figure 1-12. A simple Windows domain</h4>
2244
2245
2246 <div class="sect3"><a name="samba2-CHP-1-SECT-5.2.1"/>
2247
2248 <h3 class="head3">Domain controllers</h3>
2249
2250 <p>A domain controller in a Windows NT domain functions much like a
2251 <a name="INDEX-149"/><a name="INDEX-150"/>Network
2252 Information Service (NIS) server in a Unix network, maintaining a
2253 domain-wide database of user and group information, as well as
2254 performing related services. The responsibilities of a domain
2255 controller are mainly centered around security, including
2256 <em class="firstterm">authentication</em><a name="INDEX-151"/>,
2257 the process of granting or denying a user access to the resources of
2258 the domain. This is typically done through the use of a username and
2259 password. The service that maintains the database on the domain
2260 controllers is called the <a name="INDEX-152"/><a name="INDEX-153"/>Security Account Manager (SAM).</p>
2261
2262 <p>The <a name="INDEX-154"/>Windows NT security model revolves
2263 around <em class="firstterm">security
2264 identifiers</em><a name="INDEX-155"/><a name="INDEX-156"/> (SIDs) and <em class="firstterm">access
2265 control lists</em><a name="INDEX-157"/><a name="INDEX-158"/>
2266 (ACLs). Security identifiers are used to represent objects in the
2267 domain, which include (but are not limited to) users, groups,
2268 computers, and processes. SIDs are commonly written in ASCII form as
2269 hyphen-separated fields, like this:</p>
2270
2271 <blockquote><pre class="code">S-1-5-21-1638239387-7675610646-9254035128-545</pre></blockquote>
2272
2273 <p>The part of the SID starting with the
2274 &quot;S&quot; and leading up to the rightmost
2275 hyphen identifies a domain. The number after the rightmost hyphen is
2276 called a <a name="INDEX-159"/>relative identifier (RID) and is a unique
2277 number within the domain that identifies the user, group, computer,
2278 or other object. The RID is the analog of a <a name="INDEX-160"/>user ID (UID) or
2279 <a name="INDEX-161"/>group ID
2280 (GID) on a Unix system or within an NIS domain.</p>
2281
2282 <p>ACLs supply the same function as
2283 &quot;rwx&quot;
2284 <a name="INDEX-162"/><a name="INDEX-163"/><a name="INDEX-164"/><a name="INDEX-165"/><a name="INDEX-166"/>file permissions that are common in Unix
2285 systems. However, ACLs are more versatile. Unix file permissions only
2286 set permissions for the owner and group to which the file belongs,
2287 and &quot;other,&quot; meaning everyone else.
2288 Windows NT/2000/XP ACLs allow permissions to be set individually for
2289 any number of arbitrary users and/or groups. ACLs are made up of one
2290 or more <em class="firstterm">access control
2291 entries</em><a name="INDEX-167"/> (ACEs), each of which contains an SID
2292 and the access rights associated with it.</p>
2293
2294 <p>ACL support has been added as a standard feature for some Unix
2295 variants and is available as an add-on for others. Samba supports
2296 mappings between Windows and Unix ACLs, and this will be covered in
2297 <a href="ch08.html">Chapter 8</a>.</p>
2298
2299
2300 </div>
2301
2302
2303
2304 <div class="sect3"><a name="samba2-CHP-1-SECT-5.2.2"/>
2305
2306 <h3 class="head3">Primary and backup domain controllers</h3>
2307
2308 <p>You've already read about master and backup
2309 browsers. Domain controllers are similar in that a domain has a
2310 <em class="firstterm">primary domain
2311 controller</em><a name="INDEX-168"/><a name="INDEX-169"/><a name="INDEX-170"/> (PDC) and can have
2312 one or more <em class="firstterm">backup domain
2313 controllers</em><a name="INDEX-171"/> (BDCs) as well. If the PDC fails or
2314 becomes inaccessible, its duties are automatically taken over by one
2315 of the BDCs. BDCs frequently synchronize their SAM data with the PDC
2316 so if the need arises, any one of them can immediately begin
2317 performing domain-controller services without impacting the clients.
2318 However, note that BDCs have read-only copies of the SAM database;
2319 they can update their data only by synchronizing with a PDC. A server
2320 in a Windows domain can use the SAM of any PDC or BDC to authenticate
2321 a user who attempts to access its resources and log on to the domain.</p>
2322
2323 <p>All recent versions of Windows can log on to a domain as clients to
2324 access the resources of the domain servers. The systems that are
2325 considered members of the domain are a more exclusive class, composed
2326 of the PDC and BDCs, as well as domain member servers, which are
2327 systems that have joined a domain as members, and are known to the
2328 domain controllers by having a computer account in the SAM database.</p>
2329
2330
2331 </div>
2332
2333
2334
2335 <div class="sect3"><a name="samba2-CHP-1-SECT-5.2.3"/>
2336
2337 <h3 class="head3">Authentication</h3>
2338
2339 <p><a name="INDEX-172"/>When
2340 a user logs on to a Windows domain by typing in a username and
2341 password, a secure challenge and response protocol is invoked between
2342 the client computer and a domain controller to verify that the
2343 username and password are valid. Then the domain controller sends a
2344 SID back to the client, which uses it to create a
2345 <a name="INDEX-173"/>Security Access Token (SAT) that is valid
2346 only for that system, to be used for further authentication. This
2347 access token has information about the user coded into it, including
2348 the username, the group, and the rights the user has within the
2349 domain. At this point, the user is logged on to the domain.</p>
2350
2351 <p>Subsequently, when the client attempts to access a shared resource
2352 within the domain, the client system enters into a secure challenge
2353 and response exchange with the server of the resource. The server
2354 then enters into another secure challenge and response conversation
2355 with a domain controller to check that the client is valid. (What
2356 actually happens is that the server uses information it gets from the
2357 client to pretend to be the client and authenticate itself with the
2358 domain controller. If the domain controller validates the
2359 credentials, it sends an SID back to the server, which uses the SID
2360 to create its own SAT for the client to enable access to its local
2361 resources on the client's behalf.) At this point,
2362 the client is authenticated for resources on the server and is
2363 allowed to access them. The server then uses the SID in the access
2364 token to determine what permissions the client has to use and modify
2365 the requested resource by comparing them to entries in the ACL of the
2366 resource.</p>
2367
2368 <p>Although this method of authentication might seem overly complicated,
2369 it allows clients to authenticate without having plain-text passwords
2370 travel through the network, and it is much more difficult to crack
2371 than the relatively weak workgroup security we described earlier.</p>
2372
2373
2374 </div>
2375
2376
2377
2378 <div class="sect3"><a name="samba2-CHP-1-SECT-5.2.4"/>
2379
2380 <h3 class="head3">Name service with WINS and DNS</h3>
2381
2382 <p>The <a name="INDEX-174"/><a name="INDEX-175"/>Windows
2383 Internet Name Service (WINS) is Microsoft's
2384 implementation of a NetBIOS name server (NBNS). As such, WINS
2385 inherits much of NetBIOS's characteristics. First,
2386 WINS is flat; you can have only simple machine names such as
2387 <tt class="literal">inca</tt>, <tt class="literal">mixtec</tt>, or
2388 <tt class="literal">navaho</tt>, and workgroups such as PERU, MEXICO, or
2389 USA. In addition, WINS is dynamic: when a client first comes online,
2390 it is required to report its hostname, its address, and its workgroup
2391 to the local WINS server. This WINS server will retain the
2392 information so long as the client periodically refreshes its WINS
2393 registration, which indicates that it's still
2394 connected to the network. Note that WINS servers are not workgroup-
2395 or domain-specific; they can contain information for multiple domains
2396 and/or workgroups, which might exist on more than one subnet.</p>
2397
2398 <p>Multiple <a name="INDEX-176"/>WINS
2399 servers can be set to synchronize with each other. This allows
2400 entries for computers that come online and go offline in the network
2401 to propagate from one WINS server to another. While in theory this
2402 seems efficient, it can quickly become cumbersome if several WINS
2403 servers are covering a network. Because WINS services can cross
2404 multiple subnets (you'll either hardcode the address
2405 of a WINS server in each of your clients or obtain it via DHCP), it
2406 is often more efficient to have each Windows client, regardless of
2407 the number of Windows domains, point themselves to the same WINS
2408 server. That way, only one authoritative WINS server will have the
2409 correct information, instead of several WINS servers continually
2410 struggling to synchronize themselves with the most recent changes.</p>
2411
2412 <p>The currently active WINS server is known as the <em class="firstterm">primary
2413 WINS server</em><a name="INDEX-177"/><a name="INDEX-178"/>. You can also install a secondary WINS
2414 server, which will take over if the primary WINS server fails or
2415 becomes inaccessible. Both the primary and any other WINS servers
2416 will synchronize their address databases on a periodic basis.</p>
2417
2418 <p>In the Windows family of operating systems, only a server edition of
2419 Windows NT/2000 can act as a WINS server. Samba 2.2 can function as a
2420 primary WINS server, but cannot <a name="INDEX-179"/><a name="INDEX-180"/>synchronize
2421 its database with other WINS servers. It therefore cannot act as a
2422 secondary WINS server or as a primary WINS server for a Windows
2423 secondary WINS server.</p>
2424
2425 <p>WINS handles name service by default, although Microsoft added DNS
2426 starting with Windows NT 4 Server. It is compatible with DNS that is
2427 standard on virtually every Unix system, and a Unix server (such as
2428 the Samba host) can also be used for DNS.</p>
2429
2430
2431 </div>
2432
2433
2434
2435 <div class="sect3"><a name="samba2-CHP-1-SECT-5.2.5"/>
2436
2437 <h3 class="head3">Trust relationships</h3>
2438
2439 <p>One additional aspect of Windows NT domains not yet supported in
2440 Samba 2.2 is that it is possible to set up a <em class="emphasis">trust
2441 relationship</em><a name="INDEX-181"/><a name="INDEX-182"/><a name="INDEX-183"/> between domains, allowing clients
2442 within one domain to access the resources within another without the
2443 user having to go through additional authentication. The protocol
2444 that is followed is called <em class="emphasis">pass-through authentication</em>,
2445 <a name="INDEX-184"/><a name="INDEX-185"/>in which the
2446 user's credentials are passed from the client system
2447 in the first domain to the server in the second domain, which
2448 consults a domain controller in the first (trusted) domain to check
2449 that the user is valid before granting access to the resource.</p>
2450
2451 <p>Note that in many aspects, the behaviors of a Windows workgroup and a
2452 Windows NT domain overlap. For example, the master and backup
2453 browsers in a domain are always the PDC and BDC, respectively.
2454 Let's update our Windows domain diagram to include
2455 both a local master and local backup browser. The result is shown in
2456 <a href="ch01.html#samba2-CHP-1-FIG-13">Figure 1-13</a>.</p>
2457
2458 <div class="figure"><a name="samba2-CHP-1-FIG-13"/><a name="INDEX-186"/><img src="figs/sam2_0113.gif"/></div><h4 class="head4">Figure 1-13. A Windows domain with a local master and local backup browser</h4>
2459
2460 <p>The similarity between workgroups and NT domains is not accidental
2461 because the concept of Windows domains did not evolve until Windows
2462 NT 3.5 was introduced, and Windows domains were forced to remain
2463 backward-compatible with the workgroups present in Windows for
2464 Workgroups.</p>
2465
2466 <p>Samba can function as a primary domain controller for Windows
2467 95/98/Me and Windows NT/2000/XP clients with the limitation that it
2468 can act as a PDC only, and not as a BDC.</p>
2469
2470 <p>Samba can also function as a <em class="firstterm">domain member
2471 server</em><a name="INDEX-187"/><a name="INDEX-188"/>, meaning that it has a computer account
2472 in the PDC's account database and is therefore
2473 recognized as being part of the domain. A domain member server does
2474 not authenticate users logging on to the domain, but still handles
2475 security functions (such as file permissions) for domain users
2476 accessing its resources.</p>
2477
2478
2479 </div>
2480
2481
2482 </div>
2483
2484
2485 <div class="sect2"><a name="samba2-CHP-1-SECT-5.3"/>
2486
2487 <h3 class="head2">Active Directory Domains</h3>
2488
2489 <p>Starting with Windows 2000, Microsoft has introduced
2490 <a name="INDEX-189"/><a name="INDEX-190"/>Active
2491 Directory, the next step beyond Windows NT domains. We
2492 won't go into much detail concerning Active
2493 Directory because it is a huge topic. <a name="INDEX-191"/>Samba 2.2 doesn't
2494 support Active Directory at all, and support in Samba 3.0 is limited
2495 to acting as a client. For now, be aware that with Active Directory,
2496 the authentication model is centered around
2497 <a name="INDEX-192"/>Lightweight Directory
2498 Access Protocol (LDAP), and name service is provided by DNS instead
2499 of WINS. Domains in Active Directory can be organized in a
2500 hierarchical tree structure, in which each domain controller operates
2501 as a peer, with no distinction between primary and backup controllers
2502 as in Windows NT domains.</p>
2503
2504 <p>Windows 2000/XP systems can be set up as simple workgroup or Windows
2505 NT domain clients (which will function with Samba). The server
2506 editions of Windows 2000 can be set up to run Active Directory and
2507 support Windows NT domains for backward compatibility
2508 (<em class="firstterm">mixed mode</em>). In this case, Samba 2.2 works
2509 with Windows 2000 servers in the same way it works with Windows NT
2510 4.0 servers. When set up to operate in <em class="firstterm">native mode,
2511 </em><a name="INDEX-193"/>Windows 2000 servers support only
2512 Active Directory. Even so, <a name="INDEX-194"/>Samba 2.2 can operate as a server
2513 in a domain hosted by a native-mode Windows 2000 server, using the
2514 <a name="INDEX-195"/>Windows 2000 server's
2515 <em class="firstterm">PDC emulation mode</em>. However, it is not
2516 possible for Samba 2.2 or 3.0 to operate as a domain controller in a
2517 Windows 2000 Active Directory domain.</p>
2518
2519 <p>If you want to know more about Active Directory, we encourage you to
2520 obtain a copy of the O'Reilly book,
2521 <em class="emphasis">Windows 2000 Active Directory</em>. <a name="INDEX-196"/></p>
2522
2523
2524 </div>
2525
2526
2527 <div class="sect2"><a name="samba2-CHP-1-SECT-5.4"/>
2528
2529 <h3 class="head2">Can a Windows Workgroup Span Multiple Subnets?</h3>
2530
2531 <p><a name="INDEX-197"/><a name="INDEX-198"/>Yes, but most people who have
2532 done it have had their share of headaches. Spanning multiple subnets
2533 was not part of the initial design of Windows NT 3.5 or Windows for
2534 Workgroups. As a result, a Windows domain that spans two or more
2535 subnets is, in reality, the
2536 &quot;gluing&quot; together of two or more
2537 workgroups that share an identical name. The good news is that you
2538 can still use a PDC to control authentication across each subnet. The
2539 bad news is that things are not as simple with browsing.</p>
2540
2541 <p>As mentioned previously, each subnet must have its own local master
2542 browser. When a Windows domain spans multiple subnets, a system
2543 administrator will have to assign one of the computers as the
2544 <em class="firstterm">domain master
2545 browser</em><a name="INDEX-199"/><a name="INDEX-200"/>. The domain master browser will keep a
2546 browse list for the entire Windows domain. This browse list is
2547 created by periodically synchronizing the browse lists of each local
2548 master browser with the browse list of the domain master browser.
2549 After the synchronization, the local master browser and the domain
2550 master browser should contain identical entries. See <a href="ch01.html#samba2-CHP-1-FIG-14">Figure 1-14</a> for an illustration.</p>
2551
2552 <div class="figure"><a name="samba2-CHP-1-FIG-14"/><img src="figs/sam2_0114.gif"/></div><h4 class="head4">Figure 1-14. A workgroup that spans more than one subnet</h4>
2553
2554 <p>Sound good? <a name="INDEX-201"/>Well, it's not quite
2555 nirvana for the following reasons:</p>
2556
2557 <ul><li>
2558 <p>If it exists, a PDC always plays the role of the domain master
2559 browser. By Microsoft design, the two always share the NetBIOS
2560 resource type <tt class="literal">&lt;1B&gt;</tt> and (unfortunately)
2561 cannot be separated.</p>
2562 </li><li>
2563 <p>Windows 95/98/Me computers cannot become <em class="emphasis">or</em>
2564 <em class="emphasis">even contact</em> a domain master browser. This means
2565 that it is necessary to have at least one Windows NT/2000/XP system
2566 (or Samba server) on each subnet of a multisubnet workgroup.</p>
2567 </li></ul>
2568 <p>Each subnet's local master browser continues to
2569 maintain the browse list for its subnet, for which it becomes
2570 authoritative. So if a computer wants to see a list of servers within
2571 its own subnet, the local master browser of that subnet will be
2572 queried. If a computer wants to see a list of servers outside the
2573 subnet, it can still go only as far as the local master browser. This
2574 works because at appointed intervals, the authoritative browse list
2575 of a subnet's local master browser is synchronized
2576 with the domain master browser, which is synchronized with the local
2577 master browser of the other subnets in the domain. This is called
2578 <em class="firstterm">browse list propagation</em>.</p>
2579
2580 <p>Samba can act as a domain master browser in a Windows NT domain, or
2581 it can act as a local master browser for a subnet, synchronizing its
2582 browse list with the domain master browser.</p>
2583
2584
2585 </div>
2586
2587
2588 </div>
2589
2590
2591
2592 <div class="sect1"><a name="samba2-CHP-1-SECT-6"/>
2593
2594 <h2 class="head1">What's New in Samba 2.2?</h2>
2595
2596 <p><a name="INDEX-202"/><a name="INDEX-203"/>In
2597 Version 2.2, Samba has more advanced support for Windows networking,
2598 including the ability to perform the more important tasks necessary
2599 for acting in a Windows NT domain. In addition, Samba 2.2 has some
2600 support for technologies that Microsoft introduced in Windows 2000,
2601 although the Samba team has saved Active Directory support for
2602 Version 3.0.</p>
2603
2604
2605 <div class="sect2"><a name="samba2-CHP-1-SECT-6.1"/>
2606
2607 <h3 class="head2">PDC Support for Windows 2000/XP Clients</h3>
2608
2609 <p>Samba previously could act as a PDC to authenticate Windows 95/98/Me
2610 and Windows NT 4 systems. This functionality has been extended in
2611 Release 2.2 to include Windows 2000 and Windows XP. Thus, it is
2612 possible to have a Samba server supporting domain logons for a
2613 network of Windows clients, including the most recent releases from
2614 Microsoft. This can result in a very stable, high-performance, and
2615 more secure network, and gives you the added benefit of not having to
2616 purchase per-seat Windows CALs from Microsoft.</p>
2617
2618
2619 </div>
2620
2621
2622 <div class="sect2"><a name="samba2-CHP-1-SECT-6.2"/>
2623
2624 <h3 class="head2">Microsoft Dfs Support</h3>
2625
2626 <p><a name="INDEX-204"/>Microsoft Dfs allows shared resources that
2627 are dispersed among a number of servers in the network to be gathered
2628 together and appear to users as if they all exist in a single
2629 directory tree on one server. This method of organization makes life
2630 much simpler for users. Instead of having to browse around the
2631 network on a treasure hunt to locate the resource they want to use,
2632 they can go directly to the Dfs server and grab what they want. Samba
2633 2.2 offers support for serving Dfs, so a Windows server is no longer
2634 needed for this purpose.</p>
2635
2636
2637 </div>
2638
2639
2640 <div class="sect2"><a name="samba2-CHP-1-SECT-6.3"/>
2641
2642 <h3 class="head2">Windows NT/2000/XP Printing Support</h3>
2643
2644 <p>Windows NT/2000/XP has a different Remote Procedure Call (RPC)-based
2645 printer interface than Windows 95/98/Me does. In Samba 2.2, the
2646 Windows NT/2000/XP interface is supported. Along with this, the Samba
2647 team has been adding support for automatically downloading the
2648 printer driver from the Samba server while adding a new printer to a
2649 Windows client.</p>
2650
2651
2652 </div>
2653
2654
2655 <div class="sect2"><a name="samba2-CHP-1-SECT-6.4"/>
2656
2657 <h3 class="head2">ACLs</h3>
2658
2659 <p>Samba now supports
2660 <a name="INDEX-205"/>ACLs on its Unix host for Unix variants
2661 that support them. The list includes Solaris 2.6, 7, and 8, Irix,
2662 AIX, Linux (with either the ACL patch for the
2663 <a name="INDEX-206"/>ext2/ext3 filesystem from <a href="http://acl.bestbits.at">http://acl.bestbits.at</a> or when using the
2664 <a name="INDEX-207"/>XFS
2665 filesystem), and FreeBSD (Version 5.0 and later). When using ACL
2666 support, Samba translates between Unix ACLs and Windows NT/2000/XP
2667 ACLs, making the Samba host look and act more like a Windows
2668 NT/2000/XP server from the point of view of Windows clients.</p>
2669
2670
2671 </div>
2672
2673
2674 <div class="sect2"><a name="samba2-CHP-1-SECT-6.5"/>
2675
2676 <h3 class="head2">Support for Windows Client Administration Tools</h3>
2677
2678 <p>Windows comes with tools that can be used from a client to manage
2679 shared resources remotely on a Windows server. Samba 2.2 allows these
2680 tools to operate on shares on the Samba server as well.</p>
2681
2682
2683 </div>
2684
2685
2686 <div class="sect2"><a name="samba2-CHP-1-SECT-6.6"/>
2687
2688 <h3 class="head2">Integration with Winbind</h3>
2689
2690 <p><a name="INDEX-208"/>Winbind is a
2691 facility that allows users whose account information is stored in a
2692 Windows domain database to authenticate on a Unix system. The result
2693 is a unified logon environment, in which a user account can be kept
2694 on either the Unix system or a Windows NT/2000 domain controller.
2695 This greatly facilitates account management because administrators no
2696 longer need to keep the two systems synchronized, and it is possible
2697 for users whose accounts are held in a Windows domain to authenticate
2698 when accessing Samba shares.</p>
2699
2700
2701 </div>
2702
2703
2704 <div class="sect2"><a name="samba2-CHP-1-SECT-6.7"/>
2705
2706 <h3 class="head2">Unix CIFS Extensions</h3>
2707
2708 <p>The <a name="INDEX-209"/><a name="INDEX-210"/>Unix CIFS extensions were developed
2709 at Hewlett-Packard and introduced in Samba 2.2.4. They allow Samba
2710 servers to support Unix filesystem attributes, such as links and
2711 permissions, when sharing files with other Unix systems. This allows
2712 Samba to be used as an alternative to network file sharing (NFS) for
2713 Unix-to-Unix file sharing. An advantage of using Samba is that it
2714 authenticates individual users, whereas NFS authenticates only
2715 clients (based on their IP addresses, which is a poor security
2716 model). This gives Samba an edge in the area of security, along with
2717 its much greater configurability. See <a href="ch05.html">Chapter 5</a>
2718 for information on how to operate Unix systems as Samba clients.</p>
2719
2720
2721 </div>
2722
2723
2724 <div class="sect2"><a name="samba2-CHP-1-SECT-6.8"/>
2725
2726 <h3 class="head2">And More...</h3>
2727
2728 <p>As usual, the code has numerous improvements that do not show up at
2729 the administrative level in an immediate or obvious way. Samba now
2730 functions better on systems that employ <a name="INDEX-211"/>PAM
2731 (Pluggable Authentication Modules), and there is new support for
2732 profiling. Samba's support for oplocks has been
2733 strengthened, offering better integration with NFS server-terminated
2734 leases (currently on Irix and Linux only) and in the local filesystem
2735 with SMB locks mapped to POSIX locks (which is dependent on each Unix
2736 variant's implementation of POSIX locks). And of
2737 course there have been the usual bug fixes.</p>
2738
2739
2740 </div>
2741
2742
2743 </div>
2744
2745
2746
2747 <div class="sect1"><a name="samba2-CHP-1-SECT-7"/>
2748
2749 <h2 class="head1">What's New in Samba 3.0?</h2>
2750
2751 <p>The main distinguishing feature of <a name="INDEX-212"/><a name="INDEX-213"/>Samba 3.0
2752 is that it includes support for <a name="INDEX-214"/>Kerberos 5 authentication and
2753 <a name="INDEX-215"/>LDAP, which are
2754 required to act as clients in an Active Directory domain. Another
2755 feature that appeared in Samba 3.0 is support for Unicode, which
2756 greatly simplifies supporting international languages.</p>
2757
2758 <p>In later Version 3 releases, the Samba team plans to develop support
2759 for
2760 <a name="INDEX-216"/>WINS
2761 replication, allowing Samba to act as a secondary WINS server or as a
2762 primary WINS server with Windows or Samba secondary WINS servers.
2763 Also planned are support for acting as a Windows NT BDC and support
2764 for Windows NT domain trust relationships.</p>
2765
2766
2767 </div>
2768
2769
2770
2771 <div class="sect1"><a name="samba2-CHP-1-SECT-8"/>
2772
2773 <h2 class="head1">What Can Samba Do?</h2>
2774
2775 <p>Now let's wrap up by showing where Samba can help
2776 out and where it is limited. <a href="ch01.html#samba2-CHP-1-TABLE-9">Table 1-9</a> summarizes
2777 which roles Samba can and cannot play in a Windows NT or Active
2778 Directory domain or a Windows workgroup. Many of the Windows domain
2779 protocols are proprietary and have not been documented by Microsoft
2780 and therefore must be reverse-engineered by the Samba team before
2781 Samba can support them. As of Version 3.0, Samba cannot act as a
2782 backup in most roles and does not yet fully support Active Directory.</p>
2783
2784 <a name="samba2-CHP-1-TABLE-9"/><h4 class="head4">Table 1-9. Samba roles (as of Version 3.0)</h4><table border="1">
2785
2786
2787
2788 <tr>
2789 <th>
2790 <p>Role</p>
2791 </th>
2792 <th>
2793 <p>Can perform?</p>
2794 </th>
2795 </tr>
2796
2797
2798 <tr>
2799 <td>
2800 <p><a name="INDEX-217"/>File server</p>
2801 </td>
2802 <td>
2803 <p>Yes</p>
2804 </td>
2805 </tr>
2806 <tr>
2807 <td>
2808 <p>Printer server</p>
2809 </td>
2810 <td>
2811 <p>Yes</p>
2812 </td>
2813 </tr>
2814 <tr>
2815 <td>
2816 <p>Microsoft Dfs server</p>
2817 </td>
2818 <td>
2819 <p>Yes</p>
2820 </td>
2821 </tr>
2822 <tr>
2823 <td>
2824 <p>Primary domain controller</p>
2825 </td>
2826 <td>
2827 <p>Yes</p>
2828 </td>
2829 </tr>
2830 <tr>
2831 <td>
2832 <p>Backup domain controller</p>
2833 </td>
2834 <td>
2835 <p>No</p>
2836 </td>
2837 </tr>
2838 <tr>
2839 <td>
2840 <p>Active Directory domain controller</p>
2841 </td>
2842 <td>
2843 <p>No</p>
2844 </td>
2845 </tr>
2846 <tr>
2847 <td>
2848 <p>Windows 95/98/Me authentication</p>
2849 </td>
2850 <td>
2851 <p>Yes</p>
2852 </td>
2853 </tr>
2854 <tr>
2855 <td>
2856 <p>Windows NT/2000/XP authentication</p>
2857 </td>
2858 <td>
2859 <p>Yes</p>
2860 </td>
2861 </tr>
2862 <tr>
2863 <td>
2864 <p>Local master browser</p>
2865 </td>
2866 <td>
2867 <p>Yes</p>
2868 </td>
2869 </tr>
2870 <tr>
2871 <td>
2872 <p>Local backup browser</p>
2873 </td>
2874 <td>
2875 <p>Yes</p>
2876 </td>
2877 </tr>
2878 <tr>
2879 <td>
2880 <p>Domain master browser</p>
2881 </td>
2882 <td>
2883 <p>Yes</p>
2884 </td>
2885 </tr>
2886 <tr>
2887 <td>
2888 <p>Primary WINS server</p>
2889 </td>
2890 <td>
2891 <p>Yes</p>
2892 </td>
2893 </tr>
2894 <tr>
2895 <td>
2896 <p>Secondary WINS server</p>
2897 </td>
2898 <td>
2899 <p>No</p>
2900 </td>
2901 </tr>
2902
2903 </table>
2904
2905
2906 </div>
2907
2908
2909
2910 <div class="sect1"><a name="samba2-CHP-1-SECT-9"/>
2911
2912 <h2 class="head1">An Overview of the Samba Distribution</h2>
2913
2914 <p><a name="INDEX-218"/>As mentioned earlier, Samba actually
2915 contains several programs that serve different but related purposes.
2916 These programs are documented more fully in <a href="appc.html">Appendix C</a>. For now, we will introduce each of them
2917 briefly and describe how they work together.</p>
2918
2919 <p>The majority of the programs that come with Samba center on its two
2920 daemons. Let's take a refined look at the
2921 responsibilities of each daemon:</p>
2922
2923 <dl>
2924 <dt><b><em class="emphasis">nmbd</em></b></dt>
2925 <dd>
2926 <p>The <em class="emphasis">nmbd</em><a name="INDEX-219"/> daemon is a simple name server that
2927 supplies WINS functionality. This daemon listens for name-server
2928 requests and provides the appropriate IP addresses when called upon.
2929 It also provides browse lists for the Network Neighborhood and
2930 participates in browsing elections.</p>
2931 </dd>
2932
2933
2934
2935 <dt><b><em class="emphasis">smbd</em></b></dt>
2936 <dd>
2937 <p>The <em class="emphasis">smbd</em><a name="INDEX-220"/> daemon manages the shared resources
2938 between the Samba server and its clients. It provides file, print,
2939 and browse services to <span class="acronym">SMB</span> clients across one or
2940 more networks and handles all notifications between the Samba server
2941 and the network clients. In addition, it is responsible for user
2942 authentication, resource locking, and data sharing through the
2943 <span class="acronym">SMB</span> protocol.</p>
2944 </dd>
2945
2946 </dl>
2947
2948 <p>New with Version 2.2, there is an additional daemon:</p>
2949
2950 <dl>
2951 <dt><b><a name="INDEX-221"/><em class="emphasis">winbindd</em></b></dt>
2952 <dd>
2953 <p>This daemon is used along with the name service switch to get
2954 information on users and groups from a Windows NT server and allows
2955 Samba to authorize users through a Windows NT/2000 server.</p>
2956 </dd>
2957
2958 </dl>
2959
2960 <p>The Samba distribution also comes with a small set of Unix
2961 command-line tools:</p>
2962
2963 <dl>
2964 <dt><b><em class="emphasis">findsmb</em><a name="INDEX-222"/></b></dt>
2965 <dd>
2966 <p>A program that searches the local network for computers that respond
2967 to SMB protocol and prints information on them.</p>
2968 </dd>
2969
2970
2971
2972 <dt><b><em class="emphasis">make_smbcodepage</em><a name="INDEX-223"/></b></dt>
2973 <dd>
2974 <p>A program used when working with Samba's
2975 internationalization features for telling Samba how to convert
2976 between upper- and lowercase in different character sets.</p>
2977 </dd>
2978
2979
2980
2981 <dt><b><em class="emphasis">make_unicodemap</em><a name="INDEX-224"/></b></dt>
2982 <dd>
2983 <p>Another internationalization program used with Samba for compiling
2984 Unicode map files that Samba uses to translate DOS codepages or Unix
2985 character sets into 16-bit unicode.</p>
2986 </dd>
2987
2988
2989
2990 <dt><b><a name="INDEX-225"/><em class="emphasis">net</em></b></dt>
2991 <dd>
2992 <p>A new program distributed with Samba 3.0 that can be used to perform
2993 remote administration of servers.</p>
2994 </dd>
2995
2996
2997
2998 <dt><b><em class="emphasis">nmblookup</em><a name="INDEX-226"/></b></dt>
2999 <dd>
3000 <p>A program that provides NBT name lookups to find a
3001 computer's IP address when given its machine name.</p>
3002 </dd>
3003
3004
3005
3006 <dt><b><a name="INDEX-227"/><em class="emphasis">pdbedit</em></b></dt>
3007 <dd>
3008 <p>A new program distributed with Samba 3.0 that is helpful for managing
3009 user accounts held in SAM databases.</p>
3010 </dd>
3011
3012
3013
3014 <dt><b><em class="emphasis">rpcclient</em><a name="INDEX-228"/></b></dt>
3015 <dd>
3016 <p>A program that can be used to run MS-RPC functions on Windows clients.</p>
3017 </dd>
3018
3019
3020
3021 <dt><b><em class="emphasis">smbcacls</em><a name="INDEX-229"/></b></dt>
3022 <dd>
3023 <p>A program that is used to set or show ACLs on Windows NT filesystems.</p>
3024 </dd>
3025
3026
3027
3028 <dt><b><em class="emphasis">smbclient</em><a name="INDEX-230"/></b></dt>
3029 <dd>
3030 <p>An <em class="emphasis">ftp</em>-like Unix client that can be used to connect to
3031 SMB shares and operate on them. The <em class="emphasis">smbclient</em>
3032 command is discussed in detail in <a href="ch05.html">Chapter 5</a>.</p>
3033 </dd>
3034
3035
3036
3037 <dt><b><em class="emphasis">smbcontrol</em><a name="INDEX-231"/></b></dt>
3038 <dd>
3039 <p>A simple administrative utility that sends messages to <em class="emphasis">nmbd</em>
3040 or <em class="emphasis">smbd</em>.</p>
3041 </dd>
3042
3043
3044
3045 <dt><b><a name="INDEX-232"/><em class="emphasis">smbgroupedit</em></b></dt>
3046 <dd>
3047 <p>A command that can be used to define mappings between Windows NT
3048 groups and Unix groups. It is new in Samba 3.0.</p>
3049 </dd>
3050
3051
3052
3053 <dt><b><em class="emphasis">smbmnt</em><a name="INDEX-233"/></b></dt>
3054 <dd>
3055 <p>A helper utility used along with <em class="emphasis">smbmount.</em></p>
3056 </dd>
3057
3058
3059
3060 <dt><b><em class="emphasis">smbmount</em><a name="INDEX-234"/></b></dt>
3061 <dd>
3062 <p>A program that mounts an smbfs filesystem, allowing remote SMB shares
3063 to be mounted in the filesystem of the Samba host.</p>
3064 </dd>
3065
3066
3067
3068 <dt><b><em class="emphasis">smbpasswd</em><a name="INDEX-235"/></b></dt>
3069 <dd>
3070 <p>A program that allows an administrator to change the passwords used
3071 by Samba.</p>
3072 </dd>
3073
3074
3075
3076 <dt><b><em class="emphasis">smbsh</em><a name="INDEX-236"/></b></dt>
3077 <dd>
3078 <p>A tool that functions like a command shell to allow access to a
3079 remote SMB filesystem and allow Unix utilities to operate on it. This
3080 command is covered in <a href="ch05.html">Chapter 5</a>.</p>
3081 </dd>
3082
3083
3084
3085 <dt><b><em class="emphasis">smbspool</em><a name="INDEX-237"/></b></dt>
3086 <dd>
3087 <p>A print-spooling program used to send files to remote printers that
3088 are shared on the SMB network.</p>
3089 </dd>
3090
3091
3092
3093 <dt><b><em class="emphasis">smbstatus</em><a name="INDEX-238"/></b></dt>
3094 <dd>
3095 <p>A program that reports the current network connections to the shares
3096 on a Samba server.</p>
3097 </dd>
3098
3099
3100
3101 <dt><b><em class="emphasis">smbtar</em><a name="INDEX-239"/></b></dt>
3102 <dd>
3103 <p>A program similar to the Unix <em class="filename">tar</em> command, for
3104 backing up data in SMB shares.</p>
3105 </dd>
3106
3107
3108
3109 <dt><b><em class="emphasis">smbumount</em><a name="INDEX-240"/></b></dt>
3110 <dd>
3111 <p>A program that works along with <em class="emphasis">smbmount</em> to unmount
3112 smbfs filesystems.</p>
3113 </dd>
3114
3115
3116
3117 <dt><b><em class="emphasis">testparm</em><a name="INDEX-241"/></b></dt>
3118 <dd>
3119 <p>A simple program for checking the Samba configuration file.</p>
3120 </dd>
3121
3122
3123
3124 <dt><b><em class="emphasis">testprns</em><a name="INDEX-242"/></b></dt>
3125 <dd>
3126 <p>A program that tests whether printers on the Samba host are
3127 recognized by the <em class="filename">smbd</em> daemon.</p>
3128 </dd>
3129
3130
3131
3132 <dt><b><em class="emphasis">wbinfo</em><a name="INDEX-243"/></b></dt>
3133 <dd>
3134 <p>A utility used to query the <em class="filename">winbindd
3135 </em><a name="INDEX-244"/>daemon.</p>
3136 </dd>
3137
3138 </dl>
3139
3140 <p>Each major release of Samba goes through an exposure test before
3141 it's announced. In addition, it is quickly updated
3142 afterward if problems or unwanted side effects are found. The latest
3143 stable distribution as of this writing is Samba 2.2.6, and this book
3144 focuses mainly on the functionality supported in Samba 2.2.6, as
3145 opposed to older versions of Samba.</p>
3146
3147
3148 </div>
3149
3150
3151
3152 <div class="sect1"><a name="samba2-CHP-1-SECT-10"/>
3153
3154 <h2 class="head1">How Can I Get Samba?</h2>
3155
3156 <p><a name="INDEX-245"/><a name="INDEX-246"/>Source
3157 and binary distributions of Samba are available from mirror sites
3158 across the Internet. The primary web site for Samba is located at
3159 <a href="http://www.samba.org/">http://www.samba.org/</a>. From there, you
3160 can select a mirror site that is geographically near you.</p>
3161
3162 <p>Most Linux and many Unix vendors provide binary packages. These can
3163 be more convenient to install and maintain than the Samba
3164 team's source or binary packages, due to the
3165 vendor's efforts to supply a package that matches
3166 its specific products. <a name="INDEX-247"/></p>
3167
3168
3169 </div>
3170
3171 <hr/><h4 class="head4">Footnotes</h4><blockquote><a name="FOOTNOTE-1"/> <p><a href="#FNPTR-1">[1]</a> You
3172 can also right-click the shared resource in the Network Neighborhood
3173 and then select the Map Network Drive menu item.</p> <a name="FOOTNOTE-2"/> <p><a href="#FNPTR-2">[2]</a> Be
3174 warned that many end-user license agreements forbid installing a
3175 program on a network so that multiple clients can access it. Check
3176 the legal agreements that accompany the product to be absolutely
3177 sure.</p> <a name="FOOTNOTE-3"/> <p><a href="#FNPTR-3">[3]</a> You
3178 might also see the abbreviation NetBT, which is common in Microsoft
3179 literature.</p> <a name="FOOTNOTE-4"/>
3180 <p><a href="#FNPTR-4">[4]</a> See
3181 <a href="http://www.samba.org/cifs/docs/what-is-smb.html">http://www.samba.org/cifs/docs/what-is-smb.html</a>
3182 for Richard's excellent summary of
3183 <a name="INDEX-93"/>SMB.</p> <a name="FOOTNOTE-5"/> <p><a href="#FNPTR-5">[5]</a> This
3184 was originally called <a name="INDEX-126"/><a name="INDEX-127"/><a name="INDEX-128"/>Network Neighborhood in Windows 95/98/NT,
3185 but Microsoft has changed the name to My Network Places in the more
3186 recent Windows Me/2000/XP. We will continue to call it Network
3187 Neighborhood, and if you're using a new version of
3188 Windows, be aware that My Network Places can act a little differently
3189 in some ways.</p> </blockquote>
3190
3191
3192 <hr/><h4 class="head4"><a href="toc.html">TOC</a></h4>
3193 </body></html>