This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.(This used to...
[nivanova/samba-autobuild/.git] / docs / htmldocs / integrate-ms-networks.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >Integrating MS Windows networks with Samba</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
9 "><LINK
10 REL="HOME"
11 TITLE="SAMBA Project Documentation"
12 HREF="samba-howto-collection.html"><LINK
13 REL="UP"
14 TITLE="Optional configuration"
15 HREF="optional.html"><LINK
16 REL="PREVIOUS"
17 TITLE="Optional configuration"
18 HREF="optional.html"><LINK
19 REL="NEXT"
20 TITLE="UNIX Permission Bits and Windows NT Access Control Lists"
21 HREF="unix-permissions.html"></HEAD
22 ><BODY
23 CLASS="CHAPTER"
24 BGCOLOR="#FFFFFF"
25 TEXT="#000000"
26 LINK="#0000FF"
27 VLINK="#840084"
28 ALINK="#0000FF"
29 ><DIV
30 CLASS="NAVHEADER"
31 ><TABLE
32 SUMMARY="Header navigation table"
33 WIDTH="100%"
34 BORDER="0"
35 CELLPADDING="0"
36 CELLSPACING="0"
37 ><TR
38 ><TH
39 COLSPAN="3"
40 ALIGN="center"
41 >SAMBA Project Documentation</TH
42 ></TR
43 ><TR
44 ><TD
45 WIDTH="10%"
46 ALIGN="left"
47 VALIGN="bottom"
48 ><A
49 HREF="optional.html"
50 ACCESSKEY="P"
51 >Prev</A
52 ></TD
53 ><TD
54 WIDTH="80%"
55 ALIGN="center"
56 VALIGN="bottom"
57 ></TD
58 ><TD
59 WIDTH="10%"
60 ALIGN="right"
61 VALIGN="bottom"
62 ><A
63 HREF="unix-permissions.html"
64 ACCESSKEY="N"
65 >Next</A
66 ></TD
67 ></TR
68 ></TABLE
69 ><HR
70 ALIGN="LEFT"
71 WIDTH="100%"></DIV
72 ><DIV
73 CLASS="CHAPTER"
74 ><H1
75 ><A
76 NAME="INTEGRATE-MS-NETWORKS">Chapter 10. Integrating MS Windows networks with Samba</H1
77 ><DIV
78 CLASS="SECT1"
79 ><H1
80 CLASS="SECT1"
81 ><A
82 NAME="AEN1374">10.1. Agenda</H1
83 ><P
84 >To identify the key functional mechanisms of MS Windows networking 
85 to enable the deployment of Samba as a means of extending and/or 
86 replacing MS Windows NT/2000 technology.</P
87 ><P
88 >We will examine:</P
89 ><P
90 ></P
91 ><OL
92 TYPE="1"
93 ><LI
94 ><P
95 >Name resolution in a pure Unix/Linux TCP/IP 
96         environment
97         </P
98 ></LI
99 ><LI
100 ><P
101 >Name resolution as used within MS Windows 
102         networking
103         </P
104 ></LI
105 ><LI
106 ><P
107 >How browsing functions and how to deploy stable 
108         and dependable browsing using Samba
109         </P
110 ></LI
111 ><LI
112 ><P
113 >MS Windows security options and how to 
114         configure Samba for seemless integration
115         </P
116 ></LI
117 ><LI
118 ><P
119 >Configuration of Samba as:</P
120 ><P
121 ></P
122 ><OL
123 TYPE="a"
124 ><LI
125 ><P
126 >A stand-alone server</P
127 ></LI
128 ><LI
129 ><P
130 >An MS Windows NT 3.x/4.0 security domain member
131                 </P
132 ></LI
133 ><LI
134 ><P
135 >An alternative to an MS Windows NT 3.x/4.0 Domain Controller
136                 </P
137 ></LI
138 ></OL
139 ></LI
140 ></OL
141 ></DIV
142 ><DIV
143 CLASS="SECT1"
144 ><H1
145 CLASS="SECT1"
146 ><A
147 NAME="AEN1396">10.2. Name Resolution in a pure Unix/Linux world</H1
148 ><P
149 >The key configuration files covered in this section are:</P
150 ><P
151 ></P
152 ><UL
153 ><LI
154 ><P
155 ><TT
156 CLASS="FILENAME"
157 >/etc/hosts</TT
158 ></P
159 ></LI
160 ><LI
161 ><P
162 ><TT
163 CLASS="FILENAME"
164 >/etc/resolv.conf</TT
165 ></P
166 ></LI
167 ><LI
168 ><P
169 ><TT
170 CLASS="FILENAME"
171 >/etc/host.conf</TT
172 ></P
173 ></LI
174 ><LI
175 ><P
176 ><TT
177 CLASS="FILENAME"
178 >/etc/nsswitch.conf</TT
179 ></P
180 ></LI
181 ></UL
182 ><DIV
183 CLASS="SECT2"
184 ><H2
185 CLASS="SECT2"
186 ><A
187 NAME="AEN1412">10.2.1. <TT
188 CLASS="FILENAME"
189 >/etc/hosts</TT
190 ></H2
191 ><P
192 >Contains a static list of IP Addresses and names.
193 eg:</P
194 ><P
195 ><PRE
196 CLASS="PROGRAMLISTING"
197 >       127.0.0.1       localhost localhost.localdomain
198         192.168.1.1     bigbox.caldera.com      bigbox  alias4box</PRE
199 ></P
200 ><P
201 >The purpose of <TT
202 CLASS="FILENAME"
203 >/etc/hosts</TT
204 > is to provide a 
205 name resolution mechanism so that uses do not need to remember 
206 IP addresses.</P
207 ><P
208 >Network packets that are sent over the physical network transport 
209 layer communicate not via IP addresses but rather using the Media 
210 Access Control address, or MAC address. IP Addresses are currently 
211 32 bits in length and are typically presented as four (4) decimal 
212 numbers that are separated by a dot (or period). eg: 168.192.1.1</P
213 ><P
214 >MAC Addresses use 48 bits (or 6 bytes) and are typically represented 
215 as two digit hexadecimal numbers separated by colons. eg: 
216 40:8e:0a:12:34:56</P
217 ><P
218 >Every network interfrace must have an MAC address. Associated with 
219 a MAC address there may be one or more IP addresses. There is NO 
220 relationship between an IP address and a MAC address, all such assignments 
221 are arbitary or discretionary in nature. At the most basic level all 
222 network communications takes place using MAC addressing. Since MAC 
223 addresses must be globally unique, and generally remains fixed for 
224 any particular interface, the assignment of an IP address makes sense 
225 from a network management perspective. More than one IP address can 
226 be assigned per MAC address. One address must be the primary IP address, 
227 this is the address that will be returned in the ARP reply.</P
228 ><P
229 >When a user or a process wants to communicate with another machine 
230 the protocol implementation ensures that the "machine name" or "host 
231 name" is resolved to an IP address in a manner that is controlled 
232 by the TCP/IP configuration control files. The file 
233 <TT
234 CLASS="FILENAME"
235 >/etc/hosts</TT
236 > is one such file.</P
237 ><P
238 >When the IP address of the destination interface has been 
239 determined a protocol called ARP/RARP is used to identify 
240 the MAC address of the target interface. ARP stands for Address 
241 Resolution Protocol, and is a broadcast oriented method that 
242 uses UDP (User Datagram Protocol) to send a request to all 
243 interfaces on the local network segment using the all 1's MAC 
244 address. Network interfaces are programmed to respond to two 
245 MAC addresses only; their own unique address and the address 
246 ff:ff:ff:ff:ff:ff. The reply packet from an ARP request will 
247 contain the MAC address and the primary IP address for each 
248 interface.</P
249 ><P
250 >The <TT
251 CLASS="FILENAME"
252 >/etc/hosts</TT
253 > file is foundational to all 
254 Unix/Linux TCP/IP installations and as a minumum will contain 
255 the localhost and local network interface IP addresses and the 
256 primary names by which they are known within the local machine. 
257 This file helps to prime the pump so that a basic level of name 
258 resolution can exist before any other method of name resolution 
259 becomes available.</P
260 ></DIV
261 ><DIV
262 CLASS="SECT2"
263 ><H2
264 CLASS="SECT2"
265 ><A
266 NAME="AEN1428">10.2.2. <TT
267 CLASS="FILENAME"
268 >/etc/resolv.conf</TT
269 ></H2
270 ><P
271 >This file tells the name resolution libraries:</P
272 ><P
273 ></P
274 ><UL
275 ><LI
276 ><P
277 >The name of the domain to which the machine 
278         belongs
279         </P
280 ></LI
281 ><LI
282 ><P
283 >The name(s) of any domains that should be 
284         automatically searched when trying to resolve unqualified 
285         host names to their IP address
286         </P
287 ></LI
288 ><LI
289 ><P
290 >The name or IP address of available Domain 
291         Name Servers that may be asked to perform name to address 
292         translation lookups
293         </P
294 ></LI
295 ></UL
296 ></DIV
297 ><DIV
298 CLASS="SECT2"
299 ><H2
300 CLASS="SECT2"
301 ><A
302 NAME="AEN1439">10.2.3. <TT
303 CLASS="FILENAME"
304 >/etc/host.conf</TT
305 ></H2
306 ><P
307 ><TT
308 CLASS="FILENAME"
309 >/etc/host.conf</TT
310 > is the primary means by 
311 which the setting in /etc/resolv.conf may be affected. It is a 
312 critical configuration file.  This file controls the order by 
313 which name resolution may procede. The typical structure is:</P
314 ><P
315 ><PRE
316 CLASS="PROGRAMLISTING"
317 >       order hosts,bind
318         multi on</PRE
319 ></P
320 ><P
321 >then both addresses should be returned. Please refer to the 
322 man page for host.conf for further details.</P
323 ></DIV
324 ><DIV
325 CLASS="SECT2"
326 ><H2
327 CLASS="SECT2"
328 ><A
329 NAME="AEN1447">10.2.4. <TT
330 CLASS="FILENAME"
331 >/etc/nsswitch.conf</TT
332 ></H2
333 ><P
334 >This file controls the actual name resolution targets. The 
335 file typically has resolver object specifications as follows:</P
336 ><P
337 ><PRE
338 CLASS="PROGRAMLISTING"
339 >       # /etc/nsswitch.conf
340         #
341         # Name Service Switch configuration file.
342         #
343
344         passwd:         compat
345         # Alternative entries for password authentication are:
346         # passwd:       compat files nis ldap winbind
347         shadow:         compat
348         group:          compat
349
350         hosts:          files nis dns
351         # Alternative entries for host name resolution are:
352         # hosts:        files dns nis nis+ hesoid db compat ldap wins
353         networks:       nis files dns
354
355         ethers:         nis files
356         protocols:      nis files
357         rpc:            nis files
358         services:       nis files</PRE
359 ></P
360 ><P
361 >Of course, each of these mechanisms requires that the appropriate 
362 facilities and/or services are correctly configured.</P
363 ><P
364 >It should be noted that unless a network request/message must be 
365 sent, TCP/IP networks are silent. All TCP/IP communications assumes a 
366 principal of speaking only when necessary.</P
367 ><P
368 >Starting with version 2.2.0 samba has Linux support for extensions to 
369 the name service switch infrastructure so that linux clients will 
370 be able to obtain resolution of MS Windows NetBIOS names to IP 
371 Addresses. To gain this functionality Samba needs to be compiled 
372 with appropriate arguments to the make command (ie: <B
373 CLASS="COMMAND"
374 >make 
375 nsswitch/libnss_wins.so</B
376 >). The resulting library should 
377 then be installed in the <TT
378 CLASS="FILENAME"
379 >/lib</TT
380 > directory and 
381 the "wins" parameter needs to be added to the "hosts:" line in 
382 the <TT
383 CLASS="FILENAME"
384 >/etc/nsswitch.conf</TT
385 > file. At this point it 
386 will be possible to ping any MS Windows machine by it's NetBIOS 
387 machine name, so long as that machine is within the workgroup to 
388 which both the samba machine and the MS Windows machine belong.</P
389 ></DIV
390 ></DIV
391 ><DIV
392 CLASS="SECT1"
393 ><H1
394 CLASS="SECT1"
395 ><A
396 NAME="AEN1459">10.3. Name resolution as used within MS Windows networking</H1
397 ><P
398 >MS Windows networking is predicated about the name each machine 
399 is given. This name is known variously (and inconsistently) as 
400 the "computer name", "machine name", "networking name", "netbios name", 
401 "SMB name". All terms mean the same thing with the exception of 
402 "netbios name" which can apply also to the name of the workgroup or the 
403 domain name. The terms "workgroup" and "domain" are really just a 
404 simply name with which the machine is associated. All NetBIOS names 
405 are exactly 16 characters in length. The 16th character is reserved. 
406 It is used to store a one byte value that indicates service level 
407 information for the NetBIOS name that is registered. A NetBIOS machine 
408 name is therefore registered for each service type that is provided by 
409 the client/server.</P
410 ><P
411 >The following are typical NetBIOS name/service type registrations:</P
412 ><P
413 ><PRE
414 CLASS="PROGRAMLISTING"
415 >       Unique NetBIOS Names:
416                 MACHINENAME&#60;00&#62; = Server Service is running on MACHINENAME
417                 MACHINENAME&#60;03&#62; = Generic Machine Name (NetBIOS name)
418                 MACHINENAME&#60;20&#62; = LanMan Server service is running on MACHINENAME
419                 WORKGROUP&#60;1b&#62; = Domain Master Browser
420
421         Group Names:
422                 WORKGROUP&#60;03&#62; = Generic Name registered by all members of WORKGROUP
423                 WORKGROUP&#60;1c&#62; = Domain Controllers / Netlogon Servers
424                 WORKGROUP&#60;1d&#62; = Local Master Browsers
425                 WORKGROUP&#60;1e&#62; = Internet Name Resolvers</PRE
426 ></P
427 ><P
428 >It should be noted that all NetBIOS machines register their own 
429 names as per the above. This is in vast contrast to TCP/IP 
430 installations where traditionally the system administrator will 
431 determine in the /etc/hosts or in the DNS database what names 
432 are associated with each IP address.</P
433 ><P
434 >One further point of clarification should be noted, the <TT
435 CLASS="FILENAME"
436 >/etc/hosts</TT
437
438 file and the DNS records do not provide the NetBIOS name type information 
439 that MS Windows clients depend on to locate the type of service that may 
440 be needed. An example of this is what happens when an MS Windows client 
441 wants to locate a domain logon server. It find this service and the IP 
442 address of a server that provides it by performing a lookup (via a 
443 NetBIOS broadcast) for enumeration of all machines that have 
444 registered the name type *&#60;1c&#62;. A logon request is then sent to each 
445 IP address that is returned in the enumerated list of IP addresses. Which 
446 ever machine first replies then ends up providing the logon services.</P
447 ><P
448 >The name "workgroup" or "domain" really can be confusing since these 
449 have the added significance of indicating what is the security 
450 architecture of the MS Windows network. The term "workgroup" indicates 
451 that the primary nature of the network environment is that of a 
452 peer-to-peer design. In a WORKGROUP all machines are responsible for 
453 their own security, and generally such security is limited to use of 
454 just a password (known as SHARE MODE security). In most situations 
455 with peer-to-peer networking the users who control their own machines 
456 will simply opt to have no security at all. It is possible to have 
457 USER MODE security in a WORKGROUP environment, thus requiring use 
458 of a user name and a matching password.</P
459 ><P
460 >MS Windows networking is thus predetermined to use machine names 
461 for all local and remote machine message passing. The protocol used is 
462 called Server Message Block (SMB) and this is implemented using 
463 the NetBIOS protocol (Network Basic Input Output System). NetBIOS can 
464 be encapsulated using LLC (Logical Link Control) protocol - in which case 
465 the resulting protocol is called NetBEUI (Network Basic Extended User 
466 Interface). NetBIOS can also be run over IPX (Internetworking Packet 
467 Exchange) protocol as used by Novell NetWare, and it can be run 
468 over TCP/IP protocols - in which case the resulting protocol is called 
469 NBT or NetBT, the NetBIOS over TCP/IP.</P
470 ><P
471 >MS Windows machines use a complex array of name resolution mechanisms. 
472 Since we are primarily concerned with TCP/IP this demonstration is 
473 limited to this area.</P
474 ><DIV
475 CLASS="SECT2"
476 ><H2
477 CLASS="SECT2"
478 ><A
479 NAME="AEN1471">10.3.1. The NetBIOS Name Cache</H2
480 ><P
481 >All MS Windows machines employ an in memory buffer in which is 
482 stored the NetBIOS names and IP addresses for all external 
483 machines that that machine has communicated with over the 
484 past 10-15 minutes. It is more efficient to obtain an IP address 
485 for a machine from the local cache than it is to go through all the 
486 configured name resolution mechanisms.</P
487 ><P
488 >If a machine whose name is in the local name cache has been shut 
489 down before the name had been expired and flushed from the cache, then 
490 an attempt to exchange a message with that machine will be subject 
491 to time-out delays. i.e.: Its name is in the cache, so a name resolution 
492 lookup will succeed, but the machine can not respond. This can be 
493 frustrating for users - but it is a characteristic of the protocol.</P
494 ><P
495 >The MS Windows utility that allows examination of the NetBIOS 
496 name cache is called "nbtstat". The Samba equivalent of this 
497 is called "nmblookup".</P
498 ></DIV
499 ><DIV
500 CLASS="SECT2"
501 ><H2
502 CLASS="SECT2"
503 ><A
504 NAME="AEN1476">10.3.2. The LMHOSTS file</H2
505 ><P
506 >This file is usually located in MS Windows NT 4.0 or 
507 2000 in <TT
508 CLASS="FILENAME"
509 >C:\WINNT\SYSTEM32\DRIVERS\ETC</TT
510 > and contains 
511 the IP Address and the machine name in matched pairs. The 
512 <TT
513 CLASS="FILENAME"
514 >LMHOSTS</TT
515 > file performs NetBIOS name 
516 to IP address mapping oriented.</P
517 ><P
518 >It typically looks like:</P
519 ><P
520 ><PRE
521 CLASS="PROGRAMLISTING"
522 >       # Copyright (c) 1998 Microsoft Corp.
523         #
524         # This is a sample LMHOSTS file used by the Microsoft Wins Client (NetBIOS
525         # over TCP/IP) stack for Windows98
526         #
527         # This file contains the mappings of IP addresses to NT computernames
528         # (NetBIOS) names.  Each entry should be kept on an individual line.
529         # The IP address should be placed in the first column followed by the
530         # corresponding computername. The address and the comptername
531         # should be separated by at least one space or tab. The "#" character
532         # is generally used to denote the start of a comment (see the exceptions
533         # below).
534         #
535         # This file is compatible with Microsoft LAN Manager 2.x TCP/IP lmhosts
536         # files and offers the following extensions:
537         #
538         #      #PRE
539         #      #DOM:&lt;domain&gt;
540         #      #INCLUDE &lt;filename&gt;
541         #      #BEGIN_ALTERNATE
542         #      #END_ALTERNATE
543         #      \0xnn (non-printing character support)
544         #
545         # Following any entry in the file with the characters "#PRE" will cause
546         # the entry to be preloaded into the name cache. By default, entries are
547         # not preloaded, but are parsed only after dynamic name resolution fails.
548         #
549         # Following an entry with the "#DOM:&lt;domain&gt;" tag will associate the
550         # entry with the domain specified by &lt;domain&gt;. This affects how the
551         # browser and logon services behave in TCP/IP environments. To preload
552         # the host name associated with #DOM entry, it is necessary to also add a
553         # #PRE to the line. The &lt;domain&gt; is always preloaded although it will not
554         # be shown when the name cache is viewed.
555         #
556         # Specifying "#INCLUDE &lt;filename&gt;" will force the RFC NetBIOS (NBT)
557         # software to seek the specified &lt;filename&gt; and parse it as if it were
558         # local. &lt;filename&gt; is generally a UNC-based name, allowing a
559         # centralized lmhosts file to be maintained on a server.
560         # It is ALWAYS necessary to provide a mapping for the IP address of the
561         # server prior to the #INCLUDE. This mapping must use the #PRE directive.
562         # In addtion the share "public" in the example below must be in the
563         # LanManServer list of "NullSessionShares" in order for client machines to
564         # be able to read the lmhosts file successfully. This key is under
565         # \machine\system\currentcontrolset\services\lanmanserver\parameters\nullsessionshares
566         # in the registry. Simply add "public" to the list found there.
567         #
568         # The #BEGIN_ and #END_ALTERNATE keywords allow multiple #INCLUDE
569         # statements to be grouped together. Any single successful include
570         # will cause the group to succeed.
571         #
572         # Finally, non-printing characters can be embedded in mappings by
573         # first surrounding the NetBIOS name in quotations, then using the
574         # \0xnn notation to specify a hex value for a non-printing character.
575         #
576         # The following example illustrates all of these extensions:
577         #
578         # 102.54.94.97     rhino         #PRE #DOM:networking  #net group's DC
579         # 102.54.94.102    "appname  \0x14"                    #special app server
580         # 102.54.94.123    popular            #PRE             #source server
581         # 102.54.94.117    localsrv           #PRE             #needed for the include
582         #
583         # #BEGIN_ALTERNATE
584         # #INCLUDE \\localsrv\public\lmhosts
585         # #INCLUDE \\rhino\public\lmhosts
586         # #END_ALTERNATE
587         #
588         # In the above example, the "appname" server contains a special
589         # character in its name, the "popular" and "localsrv" server names are
590         # preloaded, and the "rhino" server name is specified so it can be used
591         # to later #INCLUDE a centrally maintained lmhosts file if the "localsrv"
592         # system is unavailable.
593         #
594         # Note that the whole file is parsed including comments on each lookup,
595         # so keeping the number of comments to a minimum will improve performance.
596         # Therefore it is not advisable to simply add lmhosts file entries onto the
597         # end of this file.</PRE
598 ></P
599 ></DIV
600 ><DIV
601 CLASS="SECT2"
602 ><H2
603 CLASS="SECT2"
604 ><A
605 NAME="AEN1484">10.3.3. HOSTS file</H2
606 ><P
607 >This file is usually located in MS Windows NT 4.0 or 2000 in 
608 <TT
609 CLASS="FILENAME"
610 >C:\WINNT\SYSTEM32\DRIVERS\ETC</TT
611 > and contains 
612 the IP Address and the IP hostname in matched pairs. It can be 
613 used by the name resolution infrastructure in MS Windows, depending 
614 on how the TCP/IP environment is configured. This file is in 
615 every way the equivalent of the Unix/Linux <TT
616 CLASS="FILENAME"
617 >/etc/hosts</TT
618 > file.</P
619 ></DIV
620 ><DIV
621 CLASS="SECT2"
622 ><H2
623 CLASS="SECT2"
624 ><A
625 NAME="AEN1489">10.3.4. DNS Lookup</H2
626 ><P
627 >This capability is configured in the TCP/IP setup area in the network 
628 configuration facility. If enabled an elaborate name resolution sequence 
629 is followed the precise nature of which isdependant on what the NetBIOS 
630 Node Type parameter is configured to. A Node Type of 0 means use 
631 NetBIOS broadcast (over UDP broadcast) is first used if the name 
632 that is the subject of a name lookup is not found in the NetBIOS name 
633 cache. If that fails then DNS, HOSTS and LMHOSTS are checked. If set to 
634 Node Type 8, then a NetBIOS Unicast (over UDP Unicast) is sent to the 
635 WINS Server to obtain a lookup before DNS, HOSTS, LMHOSTS, or broadcast 
636 lookup is used.</P
637 ></DIV
638 ><DIV
639 CLASS="SECT2"
640 ><H2
641 CLASS="SECT2"
642 ><A
643 NAME="AEN1492">10.3.5. WINS Lookup</H2
644 ><P
645 >A WINS (Windows Internet Name Server) service is the equivaent of the 
646 rfc1001/1002 specified NBNS (NetBIOS Name Server). A WINS server stores 
647 the names and IP addresses that are registered by a Windows client 
648 if the TCP/IP setup has been given at least one WINS Server IP Address.</P
649 ><P
650 >To configure Samba to be a WINS server the following parameter needs 
651 to be added to the <TT
652 CLASS="FILENAME"
653 >smb.conf</TT
654 > file:</P
655 ><P
656 ><PRE
657 CLASS="PROGRAMLISTING"
658 >       wins support = Yes</PRE
659 ></P
660 ><P
661 >To configure Samba to use a WINS server the following parameters are 
662 needed in the smb.conf file:</P
663 ><P
664 ><PRE
665 CLASS="PROGRAMLISTING"
666 >       wins support = No
667         wins server = xxx.xxx.xxx.xxx</PRE
668 ></P
669 ><P
670 >where <TT
671 CLASS="REPLACEABLE"
672 ><I
673 >xxx.xxx.xxx.xxx</I
674 ></TT
675 > is the IP address 
676 of the WINS server.</P
677 ></DIV
678 ></DIV
679 ><DIV
680 CLASS="SECT1"
681 ><H1
682 CLASS="SECT1"
683 ><A
684 NAME="AEN1504">10.4. How browsing functions and how to deploy stable and 
685 dependable browsing using Samba</H1
686 ><P
687 >As stated above, MS Windows machines register their NetBIOS names 
688 (i.e.: the machine name for each service type in operation) on start 
689 up. Also, as stated above, the exact method by which this name registration 
690 takes place is determined by whether or not the MS Windows client/server 
691 has been given a WINS server address, whether or not LMHOSTS lookup 
692 is enabled, or if DNS for NetBIOS name resolution is enabled, etc.</P
693 ><P
694 >In the case where there is no WINS server all name registrations as 
695 well as name lookups are done by UDP broadcast. This isolates name 
696 resolution to the local subnet, unless LMHOSTS is used to list all 
697 names and IP addresses. In such situations Samba provides a means by 
698 which the samba server name may be forcibly injected into the browse 
699 list of a remote MS Windows network (using the "remote announce" parameter).</P
700 ><P
701 >Where a WINS server is used, the MS Windows client will use UDP 
702 unicast to register with the WINS server. Such packets can be routed 
703 and thus WINS allows name resolution to function across routed networks.</P
704 ><P
705 >During the startup process an election will take place to create a 
706 local master browser if one does not already exist. On each NetBIOS network 
707 one machine will be elected to function as the domain master browser. This 
708 domain browsing has nothing to do with MS security domain control. 
709 Instead, the domain master browser serves the role of contacting each local 
710 master browser (found by asking WINS or from LMHOSTS) and exchanging browse 
711 list contents. This way every master browser will eventually obtain a complete 
712 list of all machines that are on the network. Every 11-15 minutes an election 
713 is held to determine which machine will be the master browser. By the nature of 
714 the election criteria used, the machine with the highest uptime, or the 
715 most senior protocol version, or other criteria, will win the election 
716 as domain master browser.</P
717 ><P
718 >Clients wishing to browse the network make use of this list, but also depend 
719 on the availability of correct name resolution to the respective IP 
720 address/addresses. </P
721 ><P
722 >Any configuration that breaks name resolution and/or browsing intrinsics 
723 will annoy users because they will have to put up with protracted 
724 inability to use the network services.</P
725 ><P
726 >Samba supports a feature that allows forced synchonisation 
727 of browse lists across routed networks using the "remote 
728 browse sync" parameter in the smb.conf file. This causes Samba 
729 to contact the local master browser on a remote network and 
730 to request browse list synchronisation. This effectively bridges 
731 two networks that are separated by routers. The two remote 
732 networks may use either broadcast based name resolution or WINS 
733 based name resolution, but it should be noted that the "remote 
734 browse sync" parameter provides browse list synchronisation - and 
735 that is distinct from name to address resolution, in other 
736 words, for cross subnet browsing to function correctly it is 
737 essential that a name to address resolution mechanism be provided. 
738 This mechanism could be via DNS, <TT
739 CLASS="FILENAME"
740 >/etc/hosts</TT
741 >, 
742 and so on.</P
743 ></DIV
744 ><DIV
745 CLASS="SECT1"
746 ><H1
747 CLASS="SECT1"
748 ><A
749 NAME="AEN1514">10.5. MS Windows security options and how to configure 
750 Samba for seemless integration</H1
751 ><P
752 >MS Windows clients may use encrypted passwords as part of a 
753 challenege/response authentication model (a.k.a. NTLMv1) or 
754 alone, or clear text strings for simple password based 
755 authentication. It should be realized that with the SMB 
756 protocol the password is passed over the network either 
757 in plain text or encrypted, but not both in the same 
758 authentication requets.</P
759 ><P
760 >When encrypted passwords are used a password that has been 
761 entered by the user is encrypted in two ways:</P
762 ><P
763 ></P
764 ><UL
765 ><LI
766 ><P
767 >An MD4 hash of the UNICODE of the password
768         string.  This is known as the NT hash.
769         </P
770 ></LI
771 ><LI
772 ><P
773 >The password is converted to upper case,
774         and then padded or trucated to 14 bytes.  This string is 
775         then appended with 5 bytes of NULL characters and split to
776         form two 56 bit DES keys to encrypt a "magic" 8 byte value.
777         The resulting 16 bytes for the LanMan hash.
778         </P
779 ></LI
780 ></UL
781 ><P
782 >You should refer to the <A
783 HREF="ENCRYPTION.html"
784 TARGET="_top"
785 >Password Encryption</A
786 > chapter in this HOWTO collection
787 for more details on the inner workings</P
788 ><P
789 >MS Windows 95 pre-service pack 1, MS Windows NT versions 3.x 
790 and version 4.0 pre-service pack 3 will use either mode of 
791 password authentication. All versions of MS Windows that follow 
792 these versions no longer support plain text passwords by default.</P
793 ><P
794 >MS Windows clients have a habit of dropping network mappings that 
795 have been idle for 10 minutes or longer. When the user attempts to 
796 use the mapped drive connection that has been dropped, the client
797 re-establishes the connection using 
798 a cached copy of the password.</P
799 ><P
800 >When Microsoft changed the default password mode, they dropped support for 
801 caching of the plain text password. This means that when the registry 
802 parameter is changed to re-enable use of plain text passwords it appears to 
803 work, but when a dropped mapping attempts to revalidate it will fail if 
804 the remote authentication server does not support encrypted passwords. 
805 This means that it is definitely not a good idea to re-enable plain text 
806 password support in such clients.</P
807 ><P
808 >The following parameters can be used to work around the 
809 issue of Windows 9x client upper casing usernames and
810 password before transmitting them to the SMB server
811 when using clear text authentication.</P
812 ><P
813 ><PRE
814 CLASS="PROGRAMLISTING"
815 >       <A
816 HREF="smb.conf.5.html#PASSWORDLEVEL"
817 TARGET="_top"
818 >passsword level</A
819 > = <TT
820 CLASS="REPLACEABLE"
821 ><I
822 >integer</I
823 ></TT
824 >
825         <A
826 HREF="smb.conf.5.html#USERNAMELEVEL"
827 TARGET="_top"
828 >username level</A
829 > = <TT
830 CLASS="REPLACEABLE"
831 ><I
832 >integer</I
833 ></TT
834 ></PRE
835 ></P
836 ><P
837 >By default Samba will lower case the username before attempting
838 to lookup the user in the database of local system accounts.
839 Because UNIX usernames conventionally only contain lower case
840 character, the <TT
841 CLASS="PARAMETER"
842 ><I
843 >username level</I
844 ></TT
845 > parameter
846 is rarely even needed.</P
847 ><P
848 >However, password on UNIX systems often make use of mixed case
849 characters.  This means that in order for a user on a Windows 9x
850 client to connect to a Samba server using clear text authentication,
851 the <TT
852 CLASS="PARAMETER"
853 ><I
854 >password level</I
855 ></TT
856 > must be set to the maximum
857 number of upper case letter which <SPAN
858 CLASS="emphasis"
859 ><I
860 CLASS="EMPHASIS"
861 >could</I
862 ></SPAN
863 > appear
864 is a password.  Note that is the server OS uses the traditional
865 DES version of crypt(), then a <TT
866 CLASS="PARAMETER"
867 ><I
868 >password level</I
869 ></TT
870 >
871 of 8 will result in case insensitive passwords as seen from Windows
872 users.  This will also result in longer login times as Samba
873 hash to compute the permutations of the password string and 
874 try them one by one until a match is located (or all combinations fail).</P
875 ><P
876 >The best option to adopt is to enable support for encrypted passwords 
877 where ever Samba is used. There are three configuration possibilities 
878 for support of encrypted passwords:</P
879 ><DIV
880 CLASS="SECT2"
881 ><H2
882 CLASS="SECT2"
883 ><A
884 NAME="AEN1542">10.5.1. Use MS Windows NT as an authentication server</H2
885 ><P
886 >This method involves the additions of the following parameters 
887 in the smb.conf file:</P
888 ><P
889 ><PRE
890 CLASS="PROGRAMLISTING"
891 >       encrypt passwords = Yes
892         security = server
893         password server = "NetBIOS_name_of_PDC"</PRE
894 ></P
895 ><P
896 >There are two ways of identifying whether or not a username and 
897 password pair was valid or not. One uses the reply information provided 
898 as part of the authentication messaging process, the other uses 
899 just and error code.</P
900 ><P
901 >The down-side of this mode of configuration is the fact that 
902 for security reasons Samba will send the password server a bogus 
903 username and a bogus password and if the remote server fails to 
904 reject the username and password pair then an alternative mode 
905 of identification of validation is used. Where a site uses password 
906 lock out after a certain number of failed authentication attempts 
907 this will result in user lockouts.</P
908 ><P
909 >Use of this mode of authentication does require there to be 
910 a standard Unix account for the user, this account can be blocked 
911 to prevent logons by other than MS Windows clients.</P
912 ></DIV
913 ><DIV
914 CLASS="SECT2"
915 ><H2
916 CLASS="SECT2"
917 ><A
918 NAME="AEN1550">10.5.2. Make Samba a member of an MS Windows NT security domain</H2
919 ><P
920 >This method involves additon of the following paramters in the smb.conf file:</P
921 ><P
922 ><PRE
923 CLASS="PROGRAMLISTING"
924 >       encrypt passwords = Yes
925         security = domain
926         workgroup = "name of NT domain"
927         password server = *</PRE
928 ></P
929 ><P
930 >The use of the "*" argument to "password server" will cause samba 
931 to locate the domain controller in a way analogous to the way 
932 this is done within MS Windows NT.</P
933 ><P
934 >In order for this method to work the Samba server needs to join the 
935 MS Windows NT security domain. This is done as follows:</P
936 ><P
937 ></P
938 ><UL
939 ><LI
940 ><P
941 >On the MS Windows NT domain controller using 
942         the Server Manager add a machine account for the Samba server.
943         </P
944 ></LI
945 ><LI
946 ><P
947 >Next, on the Linux system execute: 
948         <B
949 CLASS="COMMAND"
950 >smbpasswd -r PDC_NAME -j DOMAIN_NAME</B
951 >
952         </P
953 ></LI
954 ></UL
955 ><P
956 >Use of this mode of authentication does require there to be 
957 a standard Unix account for the user in order to assign
958 a uid once the account has been authenticated by the remote
959 Windows DC.  This account can be blocked to prevent logons by 
960 other than MS Windows clients by things such as setting an invalid
961 shell in the <TT
962 CLASS="FILENAME"
963 >/etc/passwd</TT
964 > entry.</P
965 ><P
966 >An alternative to assigning UIDs to Windows users on a 
967 Samba member server is presented in the <A
968 HREF="winbind.html"
969 TARGET="_top"
970 >Winbind Overview</A
971 > chapter in
972 this HOWTO collection.</P
973 ></DIV
974 ><DIV
975 CLASS="SECT2"
976 ><H2
977 CLASS="SECT2"
978 ><A
979 NAME="AEN1567">10.5.3. Configure Samba as an authentication server</H2
980 ><P
981 >This mode of authentication demands that there be on the 
982 Unix/Linux system both a Unix style account as well as an 
983 smbpasswd entry for the user. The Unix system account can be 
984 locked if required as only the encrypted password will be 
985 used for SMB client authentication.</P
986 ><P
987 >This method involves addition of the following parameters to 
988 the smb.conf file:</P
989 ><P
990 ><PRE
991 CLASS="PROGRAMLISTING"
992 >## please refer to the Samba PDC HOWTO chapter later in 
993 ## this collection for more details
994 [global]
995         encrypt passwords = Yes
996         security = user
997         domain logons = Yes
998         ; an OS level of 33 or more is recommended
999         os level = 33
1000
1001 [NETLOGON]
1002         path = /somewhare/in/file/system
1003         read only = yes</PRE
1004 ></P
1005 ><P
1006 >in order for this method to work a Unix system account needs 
1007 to be created for each user, as well as for each MS Windows NT/2000 
1008 machine. The following structure is required.</P
1009 ><DIV
1010 CLASS="SECT3"
1011 ><H3
1012 CLASS="SECT3"
1013 ><A
1014 NAME="AEN1574">10.5.3.1. Users</H3
1015 ><P
1016 >A user account that may provide a home directory should be 
1017 created. The following Linux system commands are typical of 
1018 the procedure for creating an account.</P
1019 ><P
1020 ><PRE
1021 CLASS="PROGRAMLISTING"
1022 >       # useradd -s /bin/bash -d /home/"userid" -m "userid"
1023         # passwd "userid"
1024           Enter Password: &lt;pw&gt;
1025           
1026         # smbpasswd -a "userid"
1027           Enter Password: &lt;pw&gt;</PRE
1028 ></P
1029 ></DIV
1030 ><DIV
1031 CLASS="SECT3"
1032 ><H3
1033 CLASS="SECT3"
1034 ><A
1035 NAME="AEN1579">10.5.3.2. MS Windows NT Machine Accounts</H3
1036 ><P
1037 >These are required only when Samba is used as a domain 
1038 controller.  Refer to the Samba-PDC-HOWTO for more details.</P
1039 ><P
1040 ><PRE
1041 CLASS="PROGRAMLISTING"
1042 >       # useradd -s /bin/false -d /dev/null "machine_name"\$
1043         # passwd -l "machine_name"\$
1044         # smbpasswd -a -m "machine_name"</PRE
1045 ></P
1046 ></DIV
1047 ></DIV
1048 ></DIV
1049 ><DIV
1050 CLASS="SECT1"
1051 ><H1
1052 CLASS="SECT1"
1053 ><A
1054 NAME="AEN1584">10.6. Conclusions</H1
1055 ><P
1056 >Samba provides a flexible means to operate as...</P
1057 ><P
1058 ></P
1059 ><UL
1060 ><LI
1061 ><P
1062 >A Stand-alone server - No special action is needed 
1063         other than to create user accounts. Stand-alone servers do NOT 
1064         provide network logon services, meaning that machines that use this 
1065         server do NOT perform a domain logon but instead make use only of 
1066         the MS Windows logon which is local to the MS Windows 
1067         workstation/server.
1068         </P
1069 ></LI
1070 ><LI
1071 ><P
1072 >An MS Windows NT 3.x/4.0 security domain member.
1073         </P
1074 ></LI
1075 ><LI
1076 ><P
1077 >An alternative to an MS Windows NT 3.x/4.0 
1078         Domain Controller.
1079         </P
1080 ></LI
1081 ></UL
1082 ></DIV
1083 ></DIV
1084 ><DIV
1085 CLASS="NAVFOOTER"
1086 ><HR
1087 ALIGN="LEFT"
1088 WIDTH="100%"><TABLE
1089 SUMMARY="Footer navigation table"
1090 WIDTH="100%"
1091 BORDER="0"
1092 CELLPADDING="0"
1093 CELLSPACING="0"
1094 ><TR
1095 ><TD
1096 WIDTH="33%"
1097 ALIGN="left"
1098 VALIGN="top"
1099 ><A
1100 HREF="optional.html"
1101 ACCESSKEY="P"
1102 >Prev</A
1103 ></TD
1104 ><TD
1105 WIDTH="34%"
1106 ALIGN="center"
1107 VALIGN="top"
1108 ><A
1109 HREF="samba-howto-collection.html"
1110 ACCESSKEY="H"
1111 >Home</A
1112 ></TD
1113 ><TD
1114 WIDTH="33%"
1115 ALIGN="right"
1116 VALIGN="top"
1117 ><A
1118 HREF="unix-permissions.html"
1119 ACCESSKEY="N"
1120 >Next</A
1121 ></TD
1122 ></TR
1123 ><TR
1124 ><TD
1125 WIDTH="33%"
1126 ALIGN="left"
1127 VALIGN="top"
1128 >Optional configuration</TD
1129 ><TD
1130 WIDTH="34%"
1131 ALIGN="center"
1132 VALIGN="top"
1133 ><A
1134 HREF="optional.html"
1135 ACCESSKEY="U"
1136 >Up</A
1137 ></TD
1138 ><TD
1139 WIDTH="33%"
1140 ALIGN="right"
1141 VALIGN="top"
1142 >UNIX Permission Bits and Windows NT Access Control Lists</TD
1143 ></TR
1144 ></TABLE
1145 ></DIV
1146 ></BODY
1147 ></HTML
1148 >