7952f7c75f6ba9a3ad0d3f23ed9defe39a8d57c4
[sfrench/samba-autobuild/.git] / docs / docbook / projdoc / Samba-PDC-HOWTO.xml
1 <chapter id="samba-pdc">
2
3
4 <chapterinfo>
5         &author.jerry;
6         &author.jht;
7         <author>
8                 <firstname>David</firstname><surname>Bannon</surname>
9                 <affiliation>
10                         <orgname>Samba Team</orgname>
11                         <address><email>dbannon@samba.org</email></address>
12                 </affiliation>
13         </author>
14         <pubdate> (26 Apr 2001) </pubdate>
15 </chapterinfo>
16
17 <title>Domain Control</title>
18
19 <formalpara><title><emphasis>The Essence of Learning:</emphasis></title>
20 <para>
21 There are many who approach MS Windows networking with incredible misconceptions.
22 That's OK, because it give the rest of us plenty of opportunity to help someone.
23 Those who really want help would be well advised to not make too big a fool
24 of themselves by not being informed when are where the information needed is in
25 fact available.
26 </para>
27 </formalpara>
28
29 <para>
30 The reader is well advised NOT to tackle this section until having first understood
31 and mastered some basics. MS Windows networking is not particularly forgiving of
32 misconfiguration. Users of MS Windows networking are likely to complain bitterly
33 of persistent niggles that may be caused by broken network or system configuration.
34 To a great many people however, MS Windows networking starts with a domain controller
35 that in some magical way is expected to solve all ills.
36 </para>
37
38 <para>
39 From the Samba mailing list one can readilly identify many common networking issues.
40 If you are not clear on the following subjects, then it will do much good to read the 
41 sections of this HOWTO that deal with it. These are the most common causes of MS Windows
42 networking problems:
43 </para>
44
45 <itemizedlist>
46         <listitem><para>Basic TCP/IP configuration</para></listitem>
47         <listitem><para>NetBIOS name resolution</para></listitem>
48         <listitem><para>Authentication configuration</para></listitem>
49         <listitem><para>User and Group configuration</para></listitem>
50         <listitem><para>Basic File and Directory Permission Control in Unix/Linux</para></listitem>
51         <listitem><para>Understanding of how MS Windows clients interoperate in a network
52         environment</para></listitem>
53 </itemizedlist>
54
55 <para>
56 Now, do not be put off too much, on the surface of it MS Windows networking seems so simple
57 that any fool can do it. In fact, only a fool would set up an MS Windows network with
58 inadequate training and preparation. So let's get our first indelible principle out of the
59 way: <emphasis>It is perfectly OK to make mistakes!</emphasis> In the right place and at
60 the right time, mistakes are the essence of learning. It is <emphasis>very much</emphasis>
61 not Ok to make mistakes that cause loss of productivity and impose an avoidable financial
62 burden on an organisation.
63 </para>
64
65 <para>
66 So where is the right place to make mistakes? Only out of harms' way! If you are going to
67 make mistakes, then please do this on a test network, away from users and in such a way as
68 to not inflict pain on others. Do your learning on a test network.
69 </para>
70
71 <sect1>
72 <title>Background</title>
73
74 <sect2>
75 <title>Domain Controller</title>
76
77 <para>
78 Over the years public perceptions of what Domain Control really is has taken on an
79 almost mystical nature. Before we branch into a brief overview of Domain Control
80 there are three basic types of domain controllers:
81 </para>
82
83 <sect3>
84 <title>Domain Controller Types</title>
85
86 <itemizedlist>
87         <listitem><para>Primary Domain Controller</para></listitem>
88         <listitem><para>Backup Domain Controller</para></listitem>
89         <listitem><para>ADS Domain Controller</para></listitem>
90 </itemizedlist>
91
92 <para>
93 The <emphasis>Primary Domain Controller</emphasis> or PDC plays an important role in the MS 
94 Windows NT4 and Windows 200x Domain Control architecture, but not in the manner that so many
95 expect.
96 </para>
97
98 <para>
99 In the case of MS Windows NT4 style domaines it is the PDC seeds the Domain Control database,
100 a part of the Windows registry called the SAM (Security Accounts Management). It plays a key
101 part in NT4 type domain user authentication and in synchronisation of the domain authentication
102 database with Backup Domain Controllers. 
103 </para>
104
105 <para>
106 New to Samba-3 is the ability to use a back-end file that holds the same type of data as
107 the NT4 style SAM (Security Account Manager) database (one of the registry files).
108 The samba-3 SAM can be specified via the smb.conf file parameter "passwd backend" and
109 valid options include <emphasis> smbpasswd tdbsam ldapsam nisplussam plugin unixsam</emphasis>.
110 The smbpasswd, tdbsam and ldapsam options can have a "_nua" suffix to indicate that No Unix
111 Accounts need to be created. In other words, the Samba SAM will be independant of Unix/Linux
112 system accounts, provided a uid range is defined from which SAM accounts can be created.
113 </para>
114
115 <para>
116 The <emphasis>Backup Domain Controller</emphasis> or BDC plays a key role in servicing network
117 authentication requests. The BDC is biased to answer logon requests so that on a network segment
118 that has a BDC and a PDC the BDC will be most likely to service network logon requests. The PDC will
119 answer network logon requests when the BDC is too busy (high load). A BDC can be promoted to
120 a PDC. If the PDC is on line at the time that the BDC is promoted to PDC the previous PDC is
121 automatically demoted to a BDC.
122 </para>
123
124 <para>
125 With MS Windows NT4 it is an install time decision what type of machine the server will be.
126 It is possible to change the promote a BDC to a PDC and vica versa only, but the only way
127 to convert a domain controller to a domain member server or a stand-alone server is to
128 reinstall it. The install time choices offered are:
129 </para>
130
131 <itemizedlist>
132         <listitem><para>Primary Domain Controller - The one that seeds the domain SAM</para></listitem>
133         <listitem><para>Backup Domain Controller - One that obtains a copy of the domain SAM</para></listitem>
134         <listitem><para>Stand-Alone Server - One that plays NO part is SAM synchronisation</para></listitem>
135 </itemizedlist>
136
137 <para>
138 With MS Windows 2000 the configuration of domain control is done after the server has been
139 installed. Samba-3 is capable of acting fully as a native member of a Windows 200x server
140 Active Directory domain.
141 </para>
142
143 <para>
144 At this time Samba-3 is capable of acting as an <emphasis>ADS Domain Controller</emphasis> but
145 in only a limited and experimental manner. This functionality should not be depended upon
146 until the samba-team offers formal support for it. At such a time, the documentation will
147 be revised to duely reflect all configuration and management requirements.
148 </para>
149 </sect3>
150 </sect2>
151
152 <para>
153 This article outlines the steps necessary for configuring Samba-3 as an MS Windows NT4 style PDC.
154 It is necessary to have a working Samba server prior to implementing the PDC functionality.
155 </para>
156
157 <itemizedlist>
158         <listitem><para>
159         Domain logons for Windows NT 4.0 / 200x / XP Professional clients.
160         </para></listitem>
161         
162         <listitem><para>
163         Placing Windows 9x / Me clients in user level security
164         </para></listitem>
165         
166         <listitem><para>
167         Retrieving a list of users and groups from a Samba PDC to
168         Windows 9x / Me / NT / 200x / XP Professional clients
169         </para></listitem>
170         
171         <listitem><para>
172         Roaming Profiles
173         </para></listitem>
174         
175         <listitem><para>
176         Network/System Policies
177         </para></listitem>
178 </itemizedlist>
179
180 <note>
181 <para>
182 Roaming Profiles and System/Network policies are advanced network administration topics
183 that are covered separately in this document.
184 </para>
185 </note>
186
187 <para>
188 The following functionalities are new to the Samba-3 release:
189 </para>
190
191 <itemizedlist>
192         <listitem><para>
193         Windows NT4 domain trusts
194         </para></listitem>
195         
196         <listitem><para>
197         Adding users via the User Manager for Domains
198         </para></listitem>
199 </itemizedlist>
200
201 <para>
202 The following functionalities are NOT provided by Samba 3.0:
203 </para>
204
205 <itemizedlist>
206         <listitem><para>
207         SAM replication with Windows NT4 Domain Controllers
208         (i.e. a Samba PDC and a Windows NT BDC or vice versa) 
209         </para></listitem>
210         
211         <listitem><para>
212         Acting as a Windows 2000 Domain Controller (i.e. Kerberos and 
213         Active Directory)
214         </para></listitem>
215 </itemizedlist>
216
217 <para>
218 Please note that Windows 9x / Me / XP Home clients are not true members of a domain
219 for reasons outlined in this article.  Therefore the protocol for
220 support of Windows 9x-style domain logons is completely different
221 from NT4 / Win2k type domain logons and has been officially supported for some 
222 time.
223 </para>
224
225 <para><emphasis>
226 MS Windows XP Home edition is NOT able to join a domain and does not permit
227 the use of domain logons.</emphasis>
228 </para>
229
230
231 <para>
232 Implementing a Samba PDC can basically be divided into 3 broad
233 steps.
234 </para>
235
236 <orderedlist numeration="arabic">
237         <listitem><para>
238         Configuring the Samba PDC
239         </para></listitem>
240         
241         <listitem><para>
242         Creating machine trust accounts and joining clients to the domain
243         </para></listitem>
244
245         <listitem><para>
246         Adding and managing domain user accounts
247         </para></listitem>
248 </orderedlist>
249
250 <para>
251 There are other minor details such as user profiles, system policies, etc... 
252 However, these are not necessarily specific to a Samba PDC as much as they are
253 related to Windows NT networking concepts.
254 </para>
255
256 </sect1>
257
258 <sect1>
259 <title>Configuring Samba NT4 Style Domain Control</title>
260
261 <para>
262 The first step in creating a working Samba PDC is to understand the parameters necessary
263 in &smb.conf;. Here we attempt to explain the parameters that are covered in
264 the &smb.conf; man page.
265 </para>
266
267 <para>
268 Here is an example &smb.conf; for acting as a PDC:
269 </para>
270
271 <para><programlisting>
272         [global]
273             ; Basic server settings
274             <ulink url="smb.conf.5.html#NETBIOSNAME">netbios name</ulink> = <replaceable>POGO</replaceable>
275             <ulink url="smb.conf.5.html#WORKGROUP">workgroup</ulink> = <replaceable>NARNIA</replaceable>
276
277             ; User and Machine Account Backends
278             ; Choices are: tdbsam, smbpasswd, ldapsam, mysqlsam, xmlsam, guest
279             <ulink url="smb.conf.5.html#PASSDBBACKEND">passdb backend</ulink> = ldapsam, guest
280
281             ; we should act as the domain and local master browser
282             <ulink url="smb.conf.5.html#OSLEVEL">os level</ulink> = 64
283             <ulink url="smb.conf.5.html#PERFERREDMASTER">preferred master</ulink> = yes
284             <ulink url="smb.conf.5.html#DOMAINMASTER">domain master</ulink> = yes
285             <ulink url="smb.conf.5.html#LOCALMASTER">local master</ulink> = yes
286             
287             ; security settings (must user security = user)
288             <ulink url="smb.conf.5.html#SECURITYEQUALSUSER">security</ulink> = user
289             
290             ; encrypted passwords are a requirement for a PDC
291             <ulink url="smb.conf.5.html#ENCRYPTPASSWORDS">encrypt passwords</ulink> = yes
292             
293             ; support domain logons
294             <ulink url="smb.conf.5.html#DOMAINLOGONS">domain logons</ulink> = yes
295             
296             ; where to store user profiles?
297             <ulink url="smb.conf.5.html#LOGONPATH">logon path</ulink> = \\%N\profiles\%u
298             
299             ; where is a user's home directory and where should it be mounted at?
300             <ulink url="smb.conf.5.html#LOGONDRIVE">logon drive</ulink> = H:
301             <ulink url="smb.conf.5.html#LOGONHOME">logon home</ulink> = \\homeserver\%u
302             
303             ; specify a generic logon script for all users
304             ; this is a relative **DOS** path to the [netlogon] share
305             <ulink url="smb.conf.5.html#LOGONSCRIPT">logon script</ulink> = logon.cmd
306
307         ; necessary share for domain controller
308         [netlogon]
309             <ulink url="smb.conf.5.html#PATH">path</ulink> = /usr/local/samba/lib/netlogon
310             <ulink url="smb.conf.5.html#READONLY">read only</ulink> = yes
311             <ulink url="smb.conf.5.html#WRITELIST">write list</ulink> = <replaceable>ntadmin</replaceable>
312             
313         ; share for storing user profiles
314         [profiles]
315             <ulink url="smb.conf.5.html#PATH">path</ulink> = /export/smb/ntprofile
316             <ulink url="smb.conf.5.html#READONLY">read only</ulink> = no
317             <ulink url="smb.conf.5.html#CREATEMASK">create mask</ulink> = 0600
318             <ulink url="smb.conf.5.html#DIRECTORYMASK">directory mask</ulink> = 0700
319 </programlisting></para>
320
321 <note><para>
322 The above parameters make for a full set of parameters that may define the server's mode
323 of operation. The following parameters are the essentials alone:
324
325 <programlisting>
326         workgroup = NARNIA
327         domain logons = Yes
328         security = User
329 </programlisting>
330
331 The additional parameters shown in the longer listing above just makes for a
332 more complete environment.
333 </para></note>
334
335 <para>
336 There are a couple of points to emphasize in the above configuration.
337 </para>
338
339 <itemizedlist>
340         <listitem><para>
341         Encrypted passwords must be enabled.  For more details on how 
342         to do this, refer to <link linkend="passdb">the User Database chapter</link>.
343         </para></listitem>
344         
345         <listitem><para>
346         The server must support domain logons and have a
347         <filename>[netlogon]</filename> share
348         </para></listitem>
349         
350         <listitem><para>
351         The server must be the domain master browser in order for Windows 
352         client to locate the server as a DC.  Please refer to the various 
353         Network Browsing documentation included with this distribution for 
354         details.
355         </para></listitem>
356 </itemizedlist>    
357
358 <para>
359 Samba 3.0 offers a complete implementation of group mapping
360 between Windows NT groups and Unix groups (this is really quite
361 complicated to explain in a short space).
362 </para>
363
364 <sect2>
365 <title>Creating Machine Trust Accounts and Joining Clients to the Domain</title>
366
367 <para>
368 A machine trust account is a Samba account that is used to
369 authenticate a client machine (rather than a user) to the Samba
370 server.  In Windows terminology, this is known as a "Computer
371 Account."</para>
372
373 <para>
374 The password of a machine trust account acts as the shared secret for
375 secure communication with the Domain Controller.  This is a security
376 feature to prevent an unauthorized machine with the same NetBIOS name
377 from joining the domain and gaining access to domain user/group
378 accounts.  Windows NT, 200x, XP Professional clients use machine trust
379 accounts, but Windows 9x / Me / XP Home clients do not.  Hence, a
380 Windows 9x / Me / XP Home  client is never a true member of a domain
381 because it does not possess a machine trust account, and thus has no
382 shared secret with the domain controller.
383 </para>
384
385 <para>A Windows NT4 PDC stores each machine trust account in the Windows
386 Registry. The introduction of MS Windows 2000 saw the introduction of Active Directory,
387 the new repository for machine trust accounts.
388 </para>
389
390 <para>
391 A Samba-3 PDC also has to store machine trust account information
392 in a suitable backend data store. With Samba-3 there can be multiple back-ends
393 for this including:
394 </para>
395
396 <itemizedlist>
397         <listitem><para>
398         <emphasis>smbpasswd</emphasis> - the plain ascii file stored used by
399         earlier versions of Samba. This file configuration option requires
400         a Unix/Linux system account for EVERY entry (ie: both for user and for
401         machine accounts). This file will be located in the <emphasis>private</emphasis>
402         directory (default is /usr/local/samba/lib/private or on linux /etc/samba).
403         </para></listitem>
404
405         <listitem><para>
406         <emphasis>tdbsam</emphasis> - a binary database backend that will be
407         stored in the <emphasis>private</emphasis> directory in a file called
408         <emphasis>passwd.tdb</emphasis>. The key benefit of this binary format
409         file is that it can store binary objects that can not be accomodated
410         in the traditional plain text smbpasswd file.
411         </para></listitem>
412
413         <listitem><para>
414         <emphasis>ldapsam</emphasis> - An LDAP based back-end. Permits the
415         LDAP server to be specified. eg: ldap://localhost or ldap://frodo.murphy.com
416         </para></listitem>
417 </itemizedlist>
418
419 <para>Read the chapter about the <link linkend="passdb">User Database</link> 
420 for details.</para>
421
422 <note><para>
423 The new tdbsam and ldapsam account backends store vastly more information than
424 smbpasswd is capable of. The new backend database includes capacity to specify
425 per user settings for many parameters, over-riding global settings given in the
426 <filename>smb.conf</filename> file. eg: logon drive, logon home, logon path, etc.
427 </para></note>
428
429 <para>
430 A Samba PDC, however, stores each machine trust account in two parts,
431 as follows:
432
433 <itemizedlist>
434     <listitem><para>A Samba account, stored in the same location as user
435     LanMan and NT password hashes (currently <filename>smbpasswd</filename>).
436     The Samba account possesses and uses only the NT password hash.</para></listitem>
437
438     <listitem><para>A corresponding Unix account, typically stored in
439     <filename>/etc/passwd</filename>. (Future releases will alleviate the need to
440     create <filename>/etc/passwd</filename> entries.) </para></listitem>
441 </itemizedlist>
442 </para>
443
444 <para>
445 There are two ways to create machine trust accounts:
446 </para>
447
448 <itemizedlist>
449         <listitem><para> Manual creation. Both the Samba and corresponding
450         Unix account are created by hand.</para></listitem>
451         
452         <listitem><para> "On-the-fly" creation. The Samba machine trust
453         account is automatically created by Samba at the time the client
454         is joined to the domain. (For security, this is the
455         recommended method.) The corresponding Unix account may be
456         created automatically or manually. </para>
457         </listitem>
458
459 </itemizedlist>
460
461 <sect3>
462 <title>Manual Creation of Machine Trust Accounts</title>
463
464 <para>
465 The first step in manually creating a machine trust account is to
466 manually create the corresponding Unix account in
467 <filename>/etc/passwd</filename>.  This can be done using
468 <command>vipw</command> or other 'add user' command that is normally
469 used to create new Unix accounts.  The following is an example for a
470 Linux based Samba server:
471 </para>
472
473 <para>
474   <prompt>root# </prompt><command>/usr/sbin/useradd -g 100 -d /dev/null -c <replaceable>"machine 
475 nickname"</replaceable> -s /bin/false <replaceable>machine_name</replaceable>$ </command>
476 </para>
477 <para>
478 <prompt>root# </prompt><command>passwd -l <replaceable>machine_name</replaceable>$</command>
479 </para>
480
481 <para>On *BSD systems, this can be done using the 'chpass' utility:</para>
482
483 <para>
484 <prompt>root# </prompt><command>chpass -a "<replaceable>machine_name</replaceable>$:*:101:100::0:0:Workstation <replaceable>machine_name</replaceable>:/dev/null:/sbin/nologin"</command>
485 </para>
486
487 <para>
488 The <filename>/etc/passwd</filename> entry will list the machine name 
489 with a "$" appended, won't have a password, will have a null shell and no 
490 home directory. For example a machine named 'doppy' would have an 
491 <filename>/etc/passwd</filename> entry like this:
492 </para>
493
494 <para><programlisting>
495 doppy$:x:505:501:<replaceable>machine_nickname</replaceable>:/dev/null:/bin/false
496 </programlisting></para>
497
498 <para>
499 Above, <replaceable>machine_nickname</replaceable> can be any
500 descriptive name for the client, i.e., BasementComputer.
501 <replaceable>machine_name</replaceable> absolutely must be the NetBIOS
502 name of the client to be joined to the domain.  The "$" must be
503 appended to the NetBIOS name of the client or Samba will not recognize
504 this as a machine trust account.
505 </para>
506
507
508 <para>
509 Now that the corresponding Unix account has been created, the next step is to create 
510 the Samba account for the client containing the well-known initial 
511 machine trust account password.  This can be done using the <ulink 
512 url="smbpasswd.8.html"><command>smbpasswd(8)</command></ulink> command 
513 as shown here:
514 </para>
515
516 <para>
517 <prompt>root# </prompt><userinput>smbpasswd -a -m <replaceable>machine_name</replaceable></userinput>
518 </para>
519
520 <para>
521 where <replaceable>machine_name</replaceable> is the machine's NetBIOS
522 name.  The RID of the new machine account is generated from the UID of 
523 the corresponding Unix account.
524 </para>
525
526 <warning>
527         <title>Join the client to the domain immediately</title>
528
529         <para>
530         Manually creating a machine trust account using this method is the 
531         equivalent of creating a machine trust account on a Windows NT PDC using 
532         the "Server Manager".  From the time at which the account is created
533         to the time which the client joins the domain and changes the password,
534         your domain is vulnerable to an intruder joining your domain using
535         a machine with the same NetBIOS name.  A PDC inherently trusts
536         members of the domain and will serve out a large degree of user 
537         information to such clients.  You have been warned!
538         </para>
539 </warning>
540 </sect3>
541
542
543 <sect3>
544 <title>"On-the-Fly" Creation of Machine Trust Accounts</title>
545
546 <para>
547 The second (and recommended) way of creating machine trust accounts is
548 simply to allow the Samba server to create them as needed when the client
549 is joined to the domain. </para>
550
551 <para>Since each Samba machine trust account requires a corresponding
552 Unix account, a method for automatically creating the
553 Unix account is usually supplied; this requires configuration of the
554 <ulink url="smb.conf.5.html#ADDMACHINESCRIPT">add machine script</ulink> 
555 option in <filename>smb.conf</filename>.  This
556 method is not required, however; corresponding Unix accounts may also
557 be created manually.
558 </para>
559
560
561 <para>Below is an example for a RedHat 6.2 Linux system.
562 </para>
563
564 <para><programlisting>
565 [global]
566    # &lt;...remainder of parameters...&gt;
567    add machine script = /usr/sbin/useradd -d /dev/null -g 100 -s /bin/false -M %u 
568 </programlisting></para>
569
570 </sect3>
571
572
573 <sect3><title>Joining the Client to the Domain</title>
574
575 <para>
576 The procedure for joining a client to the domain varies with the
577 version of Windows.
578 </para>
579
580 <itemizedlist>
581 <listitem><para><emphasis>Windows 2000</emphasis></para>
582
583         <para>
584         When the user elects to join the client to a domain, Windows prompts for
585         an account and password that is privileged to join the domain. A Samba administrative
586         account (i.e., a Samba account that has root privileges on the Samba server) must be
587         entered here; the operation will fail if an ordinary user account is given. 
588         The password for this account should be set to a different password than the associated
589         <filename>/etc/passwd</filename> entry, for security reasons.
590         </para>
591
592         <para>
593         The session key of the Samba administrative account acts as an
594         encryption key for setting the password of the machine trust
595         account. The machine trust account will be created on-the-fly, or
596         updated if it already exists.
597         </para>
598
599 </listitem>
600
601 <listitem><para><emphasis>Windows NT</emphasis></para>
602
603     <para> If the machine trust account was created manually, on the
604         Identification Changes menu enter the domain name, but do not
605         check the box "Create a Computer Account in the Domain."  In this case,
606         the existing machine trust account is used to join the machine to
607         the domain.</para>
608
609     <para> If the machine trust account is to be created
610         on-the-fly, on the Identification Changes menu enter the domain
611         name, and check the box "Create a Computer Account in the Domain."  In
612         this case, joining the domain proceeds as above for Windows 2000
613         (i.e., you must supply a Samba administrative account when
614         prompted).</para>
615 </listitem>
616
617 <listitem><para><emphasis>Samba</emphasis></para>
618         <para>Joining a samba client to a domain is documented in 
619         the <link linkend="domain-member">Domain Member</link> chapter.
620 </para></listitem>
621 </itemizedlist>
622
623 </sect3>
624 </sect2>
625 </sect1>
626
627 <sect1>
628 <title>Samba ADS Domain Control</title>
629
630 <para>
631 Not yet Freddie!
632 </para>
633
634 </sect1>
635
636 <sect1>
637 <title>Domain Control for Windows 9x/ME</title>
638
639 <para>
640 A domain and a workgroup are exactly the same thing in terms of network
641 browsing.  The difference is that a distributable authentication
642 database is associated with a domain, for secure login access to a
643 network.  Also, different access rights can be granted to users if they
644 successfully authenticate against a domain logon server. Samba-3 does this
645 now in the same way that MS Windows NT/2K.
646 </para>
647
648 <para>
649 The SMB client logging on to a domain has an expectation that every other
650 server in the domain should accept the same authentication information.
651 Network browsing functionality of domains and workgroups is identical and
652 is explained in this documentation under the browsing discussions.
653 It should be noted, that browsing is totally orthogonal to logon support.
654 </para>
655
656 <para>
657 Issues related to the single-logon network model are discussed in this
658 section.  Samba supports domain logons, network logon scripts, and user
659 profiles for MS Windows for workgroups and MS Windows 9X/ME clients
660 which are the focus of this section.
661 </para>
662
663
664 <para>
665 When an SMB client in a domain wishes to logon it broadcast requests for a
666 logon server.  The first one to reply gets the job, and validates its
667 password using whatever mechanism the Samba administrator has installed.
668 It is possible (but very stupid) to create a domain where the user
669 database is not shared between servers, i.e. they are effectively workgroup
670 servers advertising themselves as participating in a domain.  This
671 demonstrates how authentication is quite different from but closely
672 involved with domains.
673 </para>
674
675
676 <para>
677 Using these features you can make your clients verify their logon via
678 the Samba server; make clients run a batch file when they logon to
679 the network and download their preferences, desktop and start menu.
680 </para>
681
682 <para>
683 Before launching into the configuration instructions, it is 
684 worthwhile to look at how a Windows 9x/ME client performs a logon:
685 </para>
686
687 <orderedlist>
688 <listitem>
689         <para>
690         The client broadcasts (to the IP broadcast address of the subnet it is in)
691         a NetLogon request. This is sent to the NetBIOS name DOMAIN&lt;1c&gt; at the
692         NetBIOS layer.  The client chooses the first response it receives, which
693         contains the NetBIOS name of the logon server to use in the format of 
694         \\SERVER.
695         </para>
696 </listitem>
697
698 <listitem>
699         <para>
700         The client then connects to that server, logs on (does an SMBsessetupX) and
701         then connects to the IPC$ share (using an SMBtconX).
702         </para>
703 </listitem>
704
705 <listitem>
706         <para>
707         The client then does a NetWkstaUserLogon request, which retrieves the name
708         of the user's logon script. 
709         </para>
710 </listitem>
711
712 <listitem>
713         <para>
714         The client then connects to the NetLogon share and searches for this    
715         and if it is found and can be read, is retrieved and executed by the client.
716         After this, the client disconnects from the NetLogon share.
717         </para>
718 </listitem>
719
720 <listitem>
721         <para>
722         The client then sends a NetUserGetInfo request to the server, to retrieve
723         the user's home share, which is used to search for profiles. Since the
724         response to the NetUserGetInfo request does not contain much more then  
725         the user's home share, profiles for Win9X clients MUST reside in the user
726         home directory.
727         </para>
728 </listitem>
729
730 <listitem>
731         <para>
732         The client then connects to the user's home share and searches for the 
733         user's profile. As it turns out, you can specify the user's home share as
734         a sharename and path. For example, \\server\fred\.profile.
735         If the profiles are found, they are implemented.
736         </para>
737 </listitem>
738
739 <listitem>
740         <para>
741         The client then disconnects from the user's home share, and reconnects to
742         the NetLogon share and looks for CONFIG.POL, the policies file. If this is
743         found, it is read and implemented.
744         </para>
745 </listitem>
746 </orderedlist>
747
748
749 <sect2>
750 <title>Configuring Network Logon Capability</title>
751
752 <para>
753 The main difference between a PDC and a Windows 9x logon server configuration is that
754 </para>
755
756 <itemizedlist>
757
758 <listitem><para>
759 Password encryption is not required for a Windows 9x logon server.
760 </para></listitem>
761
762 <listitem><para>
763 Windows 9x/ME clients do not possess machine trust accounts.
764 </para></listitem>
765
766 </itemizedlist>
767
768 <para>
769 Therefore, a Samba PDC will also act as a Windows 9x logon server.
770 </para>
771
772
773 <warning>
774 <title>security mode and master browsers</title>
775
776 <para>
777 There are a few comments to make in order to tie up some 
778 loose ends.  There has been much debate over the issue of whether
779 or not it is ok to configure Samba as a Domain Controller in security
780 modes other than <constant>USER</constant>.  The only security mode 
781 which  will not work due to technical reasons is <constant>SHARE</constant>
782 mode security.  <constant>DOMAIN</constant> and <constant>SERVER</constant>
783 mode security is really just a variation on SMB user level security.
784 </para>
785
786 <para>
787 Actually, this issue is also closely tied to the debate on whether 
788 or not Samba must be the domain master browser for its workgroup
789 when operating as a DC.  While it may technically be possible
790 to configure a server as such (after all, browsing and domain logons
791 are two distinctly different functions), it is not a good idea to do
792 so.  You should remember that the DC must register the DOMAIN#1b NetBIOS 
793 name.  This is the name used by Windows clients to locate the DC.
794 Windows clients do not distinguish between the DC and the DMB.
795 For this reason, it is very wise to configure the Samba DC as the DMB.
796 </para>
797
798 <para>
799 Now back to the issue of configuring a Samba DC to use a mode other
800 than "security = user".  If a Samba host is configured to use 
801 another SMB server or DC in order to validate user connection 
802 requests, then it is a fact that some other machine on the network 
803 (the "password server") knows more about the user than the Samba host.
804 99% of the time, this other host is a domain controller.  Now 
805 in order to operate in domain mode security, the "workgroup" parameter
806 must be set to the name of the Windows NT domain (which already 
807 has a domain controller, right?)
808 </para>
809
810 <para>
811 Therefore configuring a Samba box as a DC for a domain that 
812 already by definition has a PDC is asking for trouble.
813 Therefore, you should always configure the Samba DC to be the DMB
814 for its domain.
815 </para>
816 </warning>
817
818 </sect2>
819 </sect1>
820
821 <sect1>
822 <title>Common Problems and Errors</title>
823
824 <sect2>
825 <title>I cannot include a '$' in a machine name</title>
826 <para>
827 A 'machine name' in (typically) <filename>/etc/passwd</filename>        
828 of the machine name with a '$' appended. FreeBSD (and other BSD 
829 systems?) won't create a user with a '$' in their name.
830 </para>
831
832 <para>
833 The problem is only in the program used to make the entry. Once made, it works perfectly.
834 Create a user without the '$' using <command>vipw</command> to edit the entry, adding
835 the '$'. Or create the whole entry with vipw if you like, make sure you use a unique User ID!
836 </para>
837 </sect2>
838
839 <sect2>
840 <title>I get told "You already have a connection to the Domain...." 
841 or "Cannot join domain, the credentials supplied conflict with an 
842 existing set.." when creating a machine trust account.</title>
843
844 <para>
845 This happens if you try to create a machine trust account from the 
846 machine itself and already have a connection (e.g. mapped drive) 
847 to a share (or IPC$) on the Samba PDC.  The following command
848 will remove all network drive connections:
849 </para>
850
851 <para>
852 <prompt>C:\WINNT\></prompt> <command>net use * /d</command>
853 </para>
854
855 <para>
856 Further, if the machine is already a 'member of a workgroup' that 
857 is the same name as the domain you are joining (bad idea) you will 
858 get this message.  Change the workgroup name to something else, it 
859 does not matter what, reboot, and try again.
860 </para>
861 </sect2>
862
863 <sect2>
864 <title>The system can not log you on (C000019B)....</title>
865
866 <para>I joined the domain successfully but after upgrading 
867 to a newer version of the Samba code I get the message, "The system 
868 can not log you on (C000019B), Please try again or consult your 
869 system administrator" when attempting to logon.
870 </para>
871
872 <para>
873 This occurs when the domain SID stored in the secrets.tdb database
874 is changed. The most common cause of a change in domain SID is when
875 the domain name and/or the server name (netbios name) is changed.
876 The only way to correct the problem is to restore the original domain 
877 SID or remove the domain client from the domain and rejoin. The domain
878 SID may be reset using either the net or rpcclient utilities.
879 </para>
880
881 <para>
882 The reset or change the domain SID you can use the net command as follows:
883
884 <programlisting>
885         net getlocalsid 'OLDNAME'
886         net setlocalsid 'SID'
887 </programlisting>
888 </para>
889
890 </sect2>
891
892 <sect2>
893 <title>The machine trust account for this computer either does not 
894 exist or is not accessible.</title>
895
896 <para>
897 When I try to join the domain I get the message "The machine account 
898 for this computer either does not exist or is not accessible". What's 
899 wrong?
900 </para>
901
902 <para>
903 This problem is caused by the PDC not having a suitable machine trust account. 
904 If you are using the <parameter>add machine script</parameter> method to create 
905 accounts then this would indicate that it has not worked. Ensure the domain 
906 admin user system is working.
907 </para>
908
909 <para>
910 Alternatively if you are creating account entries manually then they 
911 have not been created correctly. Make sure that you have the entry 
912 correct for the machine trust account in smbpasswd file on the Samba PDC. 
913 If you added the account using an editor rather than using the smbpasswd 
914 utility, make sure that the account name is the machine NetBIOS name 
915 with a '$' appended to it ( i.e. computer_name$ ). There must be an entry 
916 in both /etc/passwd and the smbpasswd file. Some people have reported 
917 that inconsistent subnet masks between the Samba server and the NT 
918 client have caused this problem.   Make sure that these are consistent 
919 for both client and server.
920 </para>
921 </sect2>
922
923 <sect2>
924 <title>When I attempt to login to a Samba Domain from a NT4/W2K workstation,
925 I get a message about my account being disabled.</title>
926
927 <para>
928 At first be ensure to enable the useraccounts with <command>smbpasswd -e 
929 %user%</command>, this is normally done, when you create an account.
930 </para>
931
932 </sect2>
933 </sect1>
934 </chapter>