Begin of another reorg.
[tprouty/samba.git] / docs / Samba-Guide / SBE-AddingUNIXClients.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <chapter id="unixclients">
4   <title>Adding Domain Member Servers and Clients</title>
5
6     <para><indexterm>
7         <primary>Open Magazine</primary>
8       </indexterm><indexterm>
9         <primary>survey</primary>
10       </indexterm>
11         The most frequently discussed Samba subjects over the past two years have focused around Domain Control and printing. 
12         It is well known that Samba is a file and print server. A recent survey conducted by Open Magazine found 
13         that of all respondents: 97% use Samba for file and print services, and 68% use Samba for Domain Control. See the 
14         <ulink url="http://www.open-mag.com/cgi-bin/opencgi/surveys/survey.cgi?survey_name=samba">Open-Mag</ulink>
15         Web site for current information. The survey results as found on January 14, 2004, as shown in
16         <link linkend="ch09openmag"/>.
17         </para>
18
19         <image id="ch09openmag">
20                 <imagedescription>Open Magazine Samba Survey</imagedescription>
21                 <imagefile scale="60">openmag</imagefile>
22         </image>
23
24         <para>
25         While Domain Control is an exciting subject, basic file and print sharing remains the staple bread-and-butter
26         function that Samba provides. Yet this book may give the appearance of having focused too much on more
27         exciting aspects of Samba deployment. This chapter directs your attention to provide important information on
28         the addition of Samba servers into your present Windows network &smbmdash; whatever the controlling technology
29         may be. So let's get back to Abmas and our good friends Bob Jordan and company.
30         </para>
31
32 <sect1>
33         <title>Introduction</title>
34
35       <para><indexterm>
36           <primary>Linux desktop</primary>
37         </indexterm><indexterm>
38           <primary>Domain Member</primary>
39           <secondary>server</secondary>
40         </indexterm>
41         Bob Jordan looks back over the achievements of the past year or two. Daily events are rather straightforward
42         with not too many distractions or problems. Bob, your team is doing well, but a number of employees
43         are asking for Linux desktop systems. Your network has grown and demands additional Domain Member servers. Let's
44         get on with this; Christine and Stan are ready to go.
45         </para>
46
47       <para><indexterm>
48           <primary>Domain Member</primary>
49           <secondary>desktop</secondary>
50         </indexterm>
51         Stan Soroka is firmly in control of the Department of the Future, while Christine is enjoying a stable and
52         predictable network environment. It is time to add more servers and to add Linux desktops. It is
53         time to meet the demands of future growth and endure trial by fire. Go on, walk the steps
54         with Stan and Company.
55         </para>
56
57         <sect2>
58         <title>Assignment Tasks</title>
59
60         <para><indexterm>
61             <primary>Active Directory</primary>
62           </indexterm>
63         You must now add UNIX/Linux Domain Member servers to your network. You have a friend who has a Windows 2003
64         Active Directory Domain network who wants to add a Samba/Linux server and has asked Christine to help him
65         out. Your real objective is to help Christine to see more of the way the Microsoft world lives and use
66         her help to get validation that Samba really does live up to expectations.
67         </para>
68
69         <para>
70         Over the past six months, you have hired several new staff who want Linux on their desktops. You must integrate
71         these systems to make sure that Abmas is not building islands of technology. You ask Christine to
72         do likewise at Swodniw Biz NL (your friend's company) to help them to evaluate a Linux desktop. You want to make
73         the right decision, don't you?
74         </para>
75
76         </sect2>
77 </sect1>
78
79 <sect1>
80         <title>Dissection and Discussion</title>
81
82       <para><indexterm>
83           <primary>winbind</primary>
84         </indexterm>
85         Recent Samba mailing list activity is witness to how many sites are using winbind. Some have no trouble
86         at all with it, yet to others the problems seem insurmountable. Periodically there are complaints concerning
87         an inability to achieve identical user and group IDs between Windows and UNIX environments.
88         </para>
89
90         <para>
91         You provide step-by-step implementations of the various tools that can be used for identity
92         resolution. You also provide working examples of solutions for integrated authentication for
93         both UNIX/Linux and Windows environments.
94         </para>
95
96         <sect2>
97                 <title>Technical Issues</title>
98
99                 <para>
100                 One of the great challenges we face when people ask us, <quote>What is the best way to solve
101                 this problem?</quote> is to get beyond the facts so we can not only clearly comprehend
102                 the immediate technical problem, but also understand how needs may change.
103                 </para>
104
105         <para><indexterm>
106             <primary>integrate</primary>
107           </indexterm>
108                 There are a few facts we should note when dealing with the question of how best to
109                 integrate UNIX/Linux clients and servers into a Windows networking environment:
110                 </para>
111
112                 <itemizedlist>
113           <listitem><para><indexterm>
114                 <primary>Domain Controller</primary>
115               </indexterm><indexterm>
116                 <primary>authoritative</primary>
117               </indexterm><indexterm>
118                 <primary>accounts</primary>
119                 <secondary>authoritative</secondary>
120               </indexterm><indexterm>
121                 <primary>PDC</primary>
122               </indexterm><indexterm>
123                 <primary>BDC</primary>
124               </indexterm>
125                         A Domain Controller (PDC or BDC) is always authoritative for all accounts in its Domain.
126                         This means that a BDC must (of necessity) be able to resolve all account UIDs and GIDs
127                         to the same values that the PDC resolved them to.
128                         </para></listitem>
129
130           <listitem><para><indexterm>
131                 <primary>local accounts</primary>
132               </indexterm><indexterm>
133                 <primary>Domain Member</primary>
134                 <secondary>authoritative</secondary>
135                 <tertiary>local accounts</tertiary>
136               </indexterm><indexterm>
137                 <primary>Domain accounts</primary>
138               </indexterm><indexterm>
139                 <primary>winbindd</primary>
140               </indexterm>
141                         A Domain Member can be authoritative for local accounts, but is never authoritative for
142                         Domain accounts. If a user is accessing a Domain Member server and that user's account
143                         is not known locally, the Domain Member server must resolve the identity of that user
144                         from the Domain in which that user's account resides. It must then map that ID to a
145                         UID/GID pair that it can use locally. This is handled by <command>winbindd</command>.
146                         </para></listitem>
147
148                         <listitem><para>
149                         Samba, when running on a Domain Member server, can resolve user identities from a
150                         number of sources:
151
152                         <itemizedlist>
153                 <listitem><para><indexterm>
154                       <primary>getpwnam</primary>
155                     </indexterm><indexterm>
156                       <primary>getgrnam</primary>
157                     </indexterm><indexterm>
158                       <primary>NSS</primary>
159                     </indexterm><indexterm>
160                       <primary>LDAP</primary>
161                     </indexterm><indexterm>
162                       <primary>NIS</primary>
163                     </indexterm>
164                                 By executing a system <command>getpwnam()</command> or <command>getgrnam()</command> call. 
165                                 On systems that support it, this utilizes the name service switch (NSS) facility to 
166                                 resolve names according to the configuration of the <filename>/etc/nsswitch.conf</filename> 
167                                 file. NSS can be configured to use LDAP, winbind, NIS, or local files.
168                                 </para></listitem>
169
170                 <listitem><para><indexterm>
171                       <primary>passdb backend</primary>
172                     </indexterm><indexterm>
173                       <primary>PADL</primary>
174                     </indexterm><indexterm>
175                       <primary>nss_ldap</primary>
176                     </indexterm>
177                                 Performing, via NSS, a direct LDAP search (where an LDAP passdb backend has been configured).
178                                 This requires the use of the PADL nss_ldap tool (or equivalent).
179                                 </para></listitem>
180
181                 <listitem><para><indexterm>
182                       <primary>winbindd</primary>
183                     </indexterm><indexterm>
184                       <primary>SID</primary>
185                     </indexterm><indexterm>
186                       <primary>winbindd_idmap.tdb</primary>
187                     </indexterm><indexterm>
188                       <primary>winbindd_cache.tdb</primary>
189                     </indexterm>
190                                 Directly by querying <command>winbindd</command>. The <command>winbindd</command>
191                                 contact a Domain Controller to attempt to resolve the identity of the user or group. It
192                                 receives the Windows networking security identifier (SID) for that appropriate
193                                 account and then allocates a local UID or GID from the range of available IDs and
194                                 creates an entry in its <filename>winbindd_idmap.tdb</filename> and 
195                                 <filename>winbindd_cache.tdb</filename> files.
196                                 </para>
197
198                   <para><indexterm>
199                       <primary>idmap backend</primary>
200                     </indexterm><indexterm>
201                       <primary>mapping</primary>
202                     </indexterm>
203                                 If the parameter 
204                         <smbconfoption name="idmap backend">ldap:ldap://myserver.domain</smbconfoption>
205                                 was specified and the LDAP server has been configured with a container in which it may
206                                 store the IDMAP entries, all Domain Members may share a common mapping.
207                                 </para></listitem>
208                         </itemizedlist>
209                         </para>
210
211                         <para>
212                         Irrespective of how &smb.conf; is configured, winbind creates and caches a local copy of
213                         the ID mapping database. It uses the <filename>winbindd_idmap.tdb</filename>, and
214                                 <filename>winbindd_cache.tdb</filename> files to do this.
215                         </para>
216
217                         <para>
218                         Which of the above resolver methods is chosen is determined by the way that Samba is configured 
219                         in the &smb.conf; file. Some of the configuration options are rather less than obvious to the 
220                         casual user.
221                         </para></listitem>
222
223           <listitem><para><indexterm>
224                 <primary>winbind enable local accounts</primary>
225               </indexterm><indexterm>
226                 <primary>Domain Member</primary>
227                 <secondary>servers</secondary>
228               </indexterm><indexterm>
229                 <primary>Domain Controllers</primary>
230               </indexterm>
231                         If you wish to make use of accounts (users and/or groups) that are local to (i.e., capable
232                         of being resolved using) the name service switch (NSS) facility, it is imperative to use the 
233                         <smbconfoption name="winbind enable local accounts">Yes</smbconfoption>
234                         in the &smb.conf; file. This parameter specifically applies only to Domain Controllers, 
235                         not to Domain Member servers.
236                         </para></listitem>
237                 </itemizedlist>
238
239         <para><indexterm>
240             <primary>Posix accounts</primary>
241           </indexterm><indexterm>
242             <primary>Samba accounts</primary>
243           </indexterm><indexterm>
244             <primary>LDAP</primary>
245           </indexterm>
246                 For many administrators, it should be plain that the use of an LDAP-based repository for all network
247                 accounts (both for Posix accounts as well as for Samba accounts) provides the most elegant and
248                 controllable facility. You eventually appreciate the decision to use LDAP.
249                 </para>
250
251         <para><indexterm>
252             <primary>nss_ldap</primary>
253           </indexterm><indexterm>
254             <primary>identifiers</primary>
255           </indexterm><indexterm>
256             <primary>resolve</primary>
257           </indexterm>
258                 If your network account information resides in an LDAP repository, you should use it ahead of any
259                 alternative method. This means that if it is humanly possible to use the <command>nss_ldap</command>
260                 tools to resolve UNIX account UIDs/GIDs via LDAP, this is the preferred solution, as it provides
261                 a more readily controllable method for asserting the exact same user and group identifiers 
262                 throughout the network.
263                 </para>
264
265                 <para><indexterm>
266             <primary>Domain Member</primary>
267             <secondary>server</secondary>
268           </indexterm><indexterm>
269             <primary>winbind trusted domains only</primary>
270           </indexterm><indexterm>
271             <primary>getpwnam</primary>
272           </indexterm><indexterm>
273             <primary>smbd</primary>
274           </indexterm><indexterm>
275             <primary>Trusted Domains</primary>
276           </indexterm><indexterm>
277             <primary>External Domains</primary>
278           </indexterm>
279                 In the situation where UNIX accounts are held on the Domain Member server itself, the only effective
280                 way to use them involves the &smb.conf; entry 
281                 <smbconfoption name="winbind trusted domains only">Yes</smbconfoption>. This forces 
282                 Samba (<command>smbd</command>) to perform a <command>getpwnam()</command> system call that can
283                 then be controlled via <filename>/etc/nsswitch.conf</filename> file settings. The use of this parameter
284                 disables the use of Samba with Trusted Domains (i.e., External Domains).
285                 </para>
286
287         <para><indexterm>
288             <primary>appliance mode</primary>
289           </indexterm><indexterm>
290             <primary>Domain Member</primary>
291             <secondary>server</secondary>
292           </indexterm><indexterm>
293             <primary>winbindd</primary>
294           </indexterm><indexterm>
295             <primary>automatically allocate</primary>
296           </indexterm>
297                 Winbind can be used to create an appliance mode Domain Member server. In this capacity, <command>winbindd</command>
298                 is configured to automatically allocate UIDs/GIDs from numeric ranges set in the &smb.conf; file. The allocation
299                 is made for all accounts that connect to that Domain Member server, whether within its own Domain or from
300                 Trusted Domains. If not stored in an LDAP backend, each Domain Member maintains its own unique mapping database.
301                 This means that it is almost certain that a given user who accesses two Domain Member servers does not have the
302                 same UID/GID on both servers &smbmdash; however, this is transparent to the Windows network user. This data
303                 is stored in the <filename>winbindd_idmap.tdb</filename> and <filename>winbindd_cache.tdb</filename> files.
304                 </para>
305         
306         <para><indexterm>
307             <primary>mapping</primary>
308           </indexterm>
309                 The use of an LDAP backend for the Winbind IDMAP facility permits Windows Domain security identifiers (SIDs)
310                 mappings to UIDs/GIDs to be stored centrally. The result is a consistent mapping across all Domain Member
311                 servers so configured. This solves one of the major headaches for network administrators who need to copy
312                 files between/across network file servers.
313                 </para>
314
315         </sect2>
316
317         <sect2>
318                 <title>Political Issues</title>
319
320         <para><indexterm>
321             <primary>OpenLDAP</primary>
322           </indexterm><indexterm>
323             <primary>NIS</primary>
324           </indexterm><indexterm>
325             <primary>yellow pages</primary>
326             <see>NIS</see>
327           </indexterm><indexterm>
328             <primary>identity management</primary>
329           </indexterm>
330                 One of the most fierce conflicts recently being waged is one of resistance to the adoption of LDAP, in
331                 particular OpenLDAP, as a replacement for UNIX NIS (previously called Yellow Pages). Let's face it, LDAP
332                 is different and requires a new approach to the need for a better identity management solution. The more
333                 you work with LDAP, the more its power and flexibility emerges from its dark, cavernous chasm.
334                 </para>
335
336                 <para>
337                 LDAP is a most suitable solution for heterogenous environments. If you need crypto, add Kerberos. 
338                 The reason these are preferable is because they are heterogenous. Windows solutions of this sort are NOT 
339                 heterogenous by design. This is fundamental &smbmdash; it isn't religious or political. This also doesn't say that 
340                 you can't use Windows Active Directory in a heterogenous environment &smbmdash; it can be done, it just requires 
341                 commercial integration products &smbmdash; it's just not what Active Directory was designed for.
342                 </para>
343
344         <para><indexterm>
345             <primary>directory</primary>
346           </indexterm><indexterm>
347             <primary>management</primary>
348           </indexterm>
349                 A number of long-term UNIX devotees have recently commented in various communications that the Samba Team
350                 is the first application group to almost force network administrators to use LDAP. It should be pointed
351                 out that we resisted this as long as we could. It is not out of laziness or out of malice that LDAP has
352                 finally emerged as the preferred identity management backend for Samba. We recommend LDAP for your total
353                 organizational directory needs.
354                 </para>
355
356         </sect2>
357
358 </sect1>
359
360 <sect1>
361         <title>Implementation</title>
362
363       <para><indexterm>
364           <primary>Domain Member</primary>
365           <secondary>server</secondary>
366         </indexterm><indexterm>
367           <primary>Domain Member</primary>
368           <secondary>client</secondary>
369         </indexterm><indexterm>
370           <primary>Domain Controller</primary>
371         </indexterm>
372         The Domain Member server and the Domain Member client are at the center of focus in this chapter.
373         Configuration of Samba-3 Domain Controller has been covered in earlier chapters, so if your 
374         interest is in Domain Controller configuration, you will not find that here. You will find good
375         oil that helps you to add Domain Member servers and clients.
376         </para>
377
378       <para><indexterm>
379           <primary>Domain Member</primary>
380           <secondary>workstations</secondary>
381         </indexterm>
382         In practice, Domain Member servers and Domain Member workstations are very different entities, but in
383         terms of technology they share similar core infrastructure. A technologist would argue that servers
384         and workstations are identical. Many users would argue otherwise, given that in a well-disciplined
385         environment a workstation (client) is a device from which a user creates documents and files that
386         are located on servers. A workstation is frequently viewed as a disposable (easy to replace) item,
387         but a server is viewed as a core component of the business.
388         </para>
389
390       <para><indexterm>
391           <primary>workstation</primary>
392         </indexterm>
393         One can look at this another way. If a workstation breaks down, one user is affected, but if a
394         server breaks down, hundreds of users may not be able to work. The services that a workstation
395         must provide are document and file production oriented; a server provides information storage
396         and is distribution oriented.
397         </para>
398
399       <para><indexterm>
400           <primary>authentication process</primary>
401         </indexterm><indexterm>
402           <primary>logon process</primary>
403         </indexterm><indexterm>
404           <primary>user identities</primary>
405         </indexterm>
406         <emphasis>Why is this important?</emphasis> &smbmdash; For starters, we must identify what
407         components of the operating system and its environment must be configured. Also, it is necessary
408         to recognize where the interdependencies between the various services to be used are.
409         In particular, it is important to understand the operation of each critical part of the
410         authentication process, the logon process, and how user identities get resolved and applied
411         within the operating system and applications (like Samba) that depend on this and may
412         actually contribute to it.
413         </para>
414
415         <para>
416         So, while here we demonstrate how to implement the technology. It is done within a context of
417         what type of service need must be fulfilled.
418         </para>
419
420         <sect2 id="sdcsdmldap">
421                 <title>Samba Domain with Samba Domain Member Server &smbmdash; Using LDAP</title>
422
423         <para><indexterm>
424             <primary>ldapsam</primary>
425           </indexterm><indexterm>
426             <primary>ldapsam backend</primary>
427           </indexterm><indexterm>
428             <primary>IDMAP</primary>
429           </indexterm><indexterm>
430             <primary>mapping</primary>
431             <secondary>consistent</secondary>
432           </indexterm><indexterm>
433             <primary>winbindd</primary>
434           </indexterm><indexterm>
435             <primary>foreign SID</primary>
436           </indexterm>
437         In this example, it is assumed that you have Samba PDC/BDC servers. This means you are using
438         an LDAP ldapsam backend. In this example, we are adding to the LDAP backend database (directory)
439         containers for use by the IDMAP facility. This makes it possible to have globally consistent
440         mapping of SIDs to/from UIDs/GIDs. This means that you are running <command>winbindd</command>
441         as part of your configuration. The primary purpose of running <command>winbindd</command> (within
442         this operational context) is to permit mapping of foreign SIDs (those not originating from our 
443         own Domain). Foreign SIDs can come from any external Domain or from Windows clients that do not 
444         belong to a Domain.
445         </para>
446
447         <para><indexterm>
448             <primary>winbindd</primary>
449           </indexterm><indexterm>
450             <primary>getpwnam</primary>
451           </indexterm><indexterm>
452             <primary>NSS</primary>
453           </indexterm>
454         If your installation is accessed only from clients that are members of your own domain, then
455         it is not necessary to run <command>winbindd</command> as long as all users can be resolved
456         locally via the <command>getpwnam()</command> system call. On NSS-enabled systems, this condition
457         is met by having:
458         </para>
459
460         <itemizedlist>
461           <listitem><para><indexterm>
462                 <primary>/etc/passwd</primary>
463               </indexterm><indexterm>
464                 <primary>/etc/group</primary>
465               </indexterm>
466                 All accounts in <filename>/etc/passwd</filename> or in <filename>/etc/group</filename>.
467                 </para></listitem>
468
469           <listitem><para><indexterm>
470                 <primary>NSS</primary>
471               </indexterm><indexterm>
472                 <primary>compat</primary>
473               </indexterm><indexterm>
474                 <primary>compat</primary>
475               </indexterm><indexterm>
476                 <primary>ldap</primary>
477               </indexterm><indexterm>
478                 <primary>nis</primary>
479               </indexterm><indexterm>
480                 <primary>nisplus</primary>
481               </indexterm><indexterm>
482                 <primary>hesoid</primary>
483               </indexterm><indexterm>
484                 <primary>ldap</primary>
485               </indexterm><indexterm>
486                 <primary>nss_ldap</primary>
487               </indexterm><indexterm>
488                 <primary>PADL Software</primary>
489               </indexterm>
490                 Resolution via NSS. On NSS-enabled systems, there is usually a facility to resolve IDs
491                 via multiple methods. The methods typically include: <command>files, compat, db, ldap, 
492                 nis, nisplus, hesoid.</command>  When correctly installed, Samba adds to this list
493                 the <command>winbindd</command> facility. The ldap facility is frequently the nss_ldap
494                 tool provided by PADL Software.
495                 </para></listitem>
496         </itemizedlist>
497
498         <para><indexterm>
499             <primary>Identity resolution</primary>
500           </indexterm>
501         The diagram in <link linkend="ch9-sambadc"/> demonstrates the relationship of samba and system 
502         components that are involved in the Identity resolution process where Samba is used as a Domain
503         Member server within a Samba Domain Control network.
504         </para>
505
506 <image id="ch9-sambadc">
507         <imagedescription>Samba Domain: Samba Member Server</imagedescription>
508         <imagefile scale="60">chap9-SambaDC</imagefile>
509 </image>
510
511         <para><indexterm>
512             <primary>IDMAP</primary>
513           </indexterm><indexterm>
514             <primary>foreign</primary>
515           </indexterm>
516         In this example configuration, Samba will directly search the LDAP-based passwd backend ldapsam
517         to obtain authentication and user identity information. The IDMAP information is stored in the LDAP
518         backend so that it can be shared by all Domain Member servers so that every user will have a
519         consistent UID and GID across all of them. The IDMAP facility will be used for all foreign
520         (i.e., not having the same SID as the Domain it is a member of) Domains. The configuration of 
521         NSS will ensure that all unix processes will obtain a consistent UID/GID.
522         </para>
523
524         <para>
525         The instructions given here apply to the Samba environment as shown in Chapters 6 and 7.
526         If your network does not have an LDAP slave server (i.e., Chapter 6 configuration), you
527         must change the target LDAP server from <constant>lapdc</constant> to <constant>massive.</constant>
528         </para>
529
530         <procedure>
531         <title>Configuration of LDAP-Based Identity Resolution</title>
532
533                 <step><para>
534                 Create the &smb.conf; file as shown in <link linkend="ch9-sdmsdc"/>. Locate
535                 this file in the directory <filename>/etc/samba</filename>.
536                 </para></step>
537
538           <step><para><indexterm>
539                 <primary>ldap.conf</primary>
540               </indexterm>
541                 Configure the file that will be used by <constant>nss_ldap</constant> to
542                 locate and communicate with the LDAP server. This file is called <filename>ldap.conf</filename>.
543                 If your implementation of <constant>nss_ldap</constant> is consistent with
544                 the defaults suggested by PADL (the authors), it will be located in the
545                 <filename>/etc</filename> directory. On some systems, the default location is
546                 the <filename>/etc/openldap</filename> directory. Change the parameters inside
547                 the file that is located on your OS so it matches <link linkend="ch9-sdmlcnf"/>.
548                 To find the correct location of this file, you can obtain this from the
549                 library that will be used by executing the following:
550 <screen>
551 &rootprompt; strings /lib/libnss_ldap* | grep ldap.conf
552 /etc/ldap.conf
553 </screen>
554                 </para></step>
555
556                 <step><para>
557                 Configure the name service switch (NSS) control file so it matches the one shown
558                 in <link linkend="ch9-sdmnss"/>.
559                 </para></step>
560
561           <step><para><indexterm>
562                 <primary>Identity resolution</primary>
563               </indexterm><indexterm>
564                 <primary>getent</primary>
565               </indexterm>
566                 Before proceeding to configure Samba, validate the operation of the NSS Identity 
567                 resolution via LDAP by executing:
568 <screen>
569 &rootprompt; getent passwd
570 ...
571 root:x:0:512:Netbios Domain Administrator:/root:/bin/false
572 nobody:x:999:514:nobody:/dev/null:/bin/false
573 bobj:x:1000:513:Robert Jordan:/home/bobj:/bin/bash
574 stans:x:1001:513:Stanley Soroka:/home/stans:/bin/bash
575 chrisr:x:1002:513:Christine Roberson:/home/chrisr:/bin/bash
576 maryv:x:1003:513:Mary Vortexis:/home/maryv:/bin/bash
577 jht:x:1004:513:John H Terpstra:/home/jht:/bin/bash
578 bldg1$:x:1006:553:bldg1$:/dev/null:/bin/false
579 temptation$:x:1009:553:temptation$:/dev/null:/bin/false
580 vaioboss$:x:1005:553:vaioboss$:/dev/null:/bin/false
581 fran$:x:1008:553:fran$:/dev/null:/bin/false
582 josephj:x:1007:513:Joseph James:/home/josephj:/bin/bash
583 </screen>
584                 You should notice the location of the users' home directories. First, make certain that
585                 the home directories exist on the Domain Member server; otherwise, the home directory
586                 share is not available. The home directories could be mounted off a domain controller
587                 using NFS, or by any other suitable means. Second, the absence of the Domain name in the
588                 home directory path is indicative that Identity resolution is not being done via Winbind.
589 <screen>
590 &rootprompt; getent group
591 ...
592 Domain Admins:x:512:root,jht
593 Domain Users:x:513:bobj,stans,chrisr,maryv,jht,josephj
594 Domain Guests:x:514:
595 Accounts:x:1000:
596 Finances:x:1001:
597 PIOps:x:1002:
598 sammy:x:4321:
599 </screen>
600               <indexterm>
601                 <primary>secondary group</primary>
602               </indexterm><indexterm>
603                 <primary>primary group</primary>
604               </indexterm><indexterm>
605                 <primary>group membership</primary>
606               </indexterm>
607                 This shows that all is working as it should. Notice that in the LDAP database
608                 the users primary and secondary group memberships are identical. It is not
609                 necessary to add secondary group memberships (in the group database) if the
610                 user is already a member via primary group membership in the password database.
611                 When using winbind, it is in fact undesirable to do this as it results in
612                 doubling up of group memberships and may break winbind under certain conditions.
613                 </para></step>
614
615           <step><para><indexterm>
616                 <primary>slapcat</primary>
617               </indexterm>
618                 The LDAP directory must have a container object for IDMAP data. There are several ways you can
619                 check that your LDAP database is able to receive IDMAP information. One of the simplest is to
620                 execute:
621 <screen>
622 &rootprompt; slapcat | grep -i idmap
623 dn: ou=Idmap,dc=abmas,dc=biz
624 ou: idmap
625 </screen>
626               <indexterm>
627                 <primary>ldapadd</primary>
628               </indexterm>
629                 If the execution of this command does not return IDMAP entries, you need to create an LDIF
630                 template file (see <link linkend="ch9-ldifadd"/>). You can add the required entries using the following command:
631 <screen>
632 &rootprompt; ldapadd -x -D "cn=Manager,dc=abmas,dc=biz" \
633                 -w not24get &lt; /etc/openldap/idmap.LDIF
634 </screen>
635                 Samba automatically populates this LDAP directory container when it needs to.
636                 </para></step>
637
638           <step><para><indexterm>
639                 <primary>net</primary>
640                 <secondary>rpc</secondary>
641                 <tertiary>join</tertiary>
642               </indexterm><indexterm>
643                 <primary>Domain join</primary>
644               </indexterm>
645                 The system is ready to join the Domain. Execute the following:
646 <screen>
647 &rootprompt; net rpc join -U root%not24et
648 Joined domain MEGANET2.
649 </screen>
650                 This indicates that the Domain join succeeded.
651                 </para></step>
652
653                 <step><para>
654                 <indexterm><primary>wbinfo</primary></indexterm>
655                 Just joining the Domain is not quite enough, you must now provide a privilidged set
656                 of credentials through which <command>winbindd</command> can interact with the ADS
657                 Domain servers. Execute the following to implant the necessary credentials:
658 <screen>
659 &rootprompt; wbinfo --set-auth-user=Administrator%not24get
660 </screen>
661 -               The configuration is now ready to obtain ADS Domain user and group information.
662                 </para></step>
663
664                 <step><para>
665                 You may now start Samba in the usual manner and your Samba Domain Member server
666                 is ready for use. Just add shares as required.
667                 </para></step>
668
669         </procedure>
670
671 <smbconfexample id="ch9-sdmsdc">
672 <title>Samba Domain Member in Samba Domain Control Context &smbmdash; &smb.conf; File</title>
673 <smbconfcomment>Global parameters</smbconfcomment>
674 <smbconfsection name="[global]"/>
675 <smbconfoption name="unix charset">LOCALE</smbconfoption>
676 <smbconfoption name="workgroup">MEGANET2</smbconfoption>
677 <smbconfoption name="security">DOMAIN</smbconfoption>
678 <smbconfoption name="username map">/etc/samba/smbusers</smbconfoption>
679 <smbconfoption name="log level">10</smbconfoption>
680 <smbconfoption name="syslog">0</smbconfoption>
681 <smbconfoption name="log file">/var/log/samba/%m</smbconfoption>
682 <smbconfoption name="max log size">50</smbconfoption>
683 <smbconfoption name="smb ports">139 445</smbconfoption>
684 <smbconfoption name="name resolve order">wins bcast hosts</smbconfoption>
685 <smbconfoption name="printcap name">CUPS</smbconfoption>
686 <smbconfoption name="wins server">192.168.2.1</smbconfoption>
687 <smbconfoption name="ldap suffix">dc=abmas,dc=biz</smbconfoption>
688 <smbconfoption name="ldap machine suffix">ou=People</smbconfoption>
689 <smbconfoption name="ldap user suffix">ou=People</smbconfoption>
690 <smbconfoption name="ldap group suffix">ou=Groups</smbconfoption>
691 <smbconfoption name="ldap idmap suffix">ou=Idmap</smbconfoption>
692 <smbconfoption name="ldap admin dn">cn=Manager,dc=abmas,dc=biz</smbconfoption>
693 <smbconfoption name="idmap backend">ldap:ldap://lapdc.abmas.biz</smbconfoption>
694 <smbconfoption name="idmap uid">10000-20000</smbconfoption>
695 <smbconfoption name="idmap gid">10000-20000</smbconfoption>
696 <smbconfoption name="winbind trusted domains only">Yes</smbconfoption>
697 <smbconfoption name="printer admin">root</smbconfoption>
698 <smbconfoption name="printing">cups</smbconfoption>
699
700 <smbconfsection name="[homes]"/>
701 <smbconfoption name="comment">Home Directories</smbconfoption>
702 <smbconfoption name="valid users">%S</smbconfoption>
703 <smbconfoption name="read only">No</smbconfoption>
704 <smbconfoption name="browseable">No</smbconfoption>
705
706 <smbconfsection name="[printers]"/>
707 <smbconfoption name="comment">SMB Print Spool</smbconfoption>
708 <smbconfoption name="path">/var/spool/samba</smbconfoption>
709 <smbconfoption name="guest ok">Yes</smbconfoption>
710 <smbconfoption name="printable">Yes</smbconfoption>
711 <smbconfoption name="browseable">No</smbconfoption>
712
713 <smbconfsection name="[print$]"/>
714 <smbconfoption name="comment">Printer Drivers</smbconfoption>
715 <smbconfoption name="path">/var/lib/samba/drivers</smbconfoption>
716 <smbconfoption name="admin users">root, Administrator</smbconfoption>
717 <smbconfoption name="write list">root</smbconfoption>
718 </smbconfexample>
719
720 <example id="ch9-ldifadd">
721 <title>LDIF IDMAP Add-On Load File &smbmdash; File: /etc/openldap/idmap.LDIF</title>
722 <screen>
723 dn: ou=Idmap,dc=abmas,dc=biz
724 objectClass: organizationalUnit
725 ou: idmap
726 structuralObjectClass: organizationalUnit
727 </screen>
728 </example>
729
730 <example id="ch9-sdmlcnf">
731 <title>Configuration File for NSS LDAP Support &smbmdash; <filename>/etc/ldap.conf</filename></title>
732 <screen>
733 URI     ldap://massive.abmas.biz ldap://massive.abmas.biz:636
734 host    192.168.2.1
735 base    dc=abmas,dc=biz
736 binddn  cn=Manager,dc=abmas,dc=biz
737 bindpw  not24get
738
739 pam_password exop
740
741 nss_base_passwd ou=People,dc=abmas,dc=biz?one
742 nss_base_shadow ou=People,dc=abmas,dc=biz?one
743 nss_base_group  ou=Groups,dc=abmas,dc=biz?one
744 ssl     no
745 </screen>
746 </example>
747
748 <example id="ch9-sdmnss">
749 <title>NSS using LDAP for Identity Resolution &smbmdash; File: <filename>/etc/nsswitch.conf</filename></title>
750 <screen>
751 passwd:         compat ldap
752 group:          compat ldap
753
754 hosts:          files dns wins
755 networks:       files dns
756
757 services:       files
758 protocols:      files
759 rpc:            files
760 ethers:         files
761 netmasks:       files
762 netgroup:       files
763 publickey:      files
764
765 bootparams:     files
766 automount:      files
767 aliases:        files
768 </screen>
769 </example>
770
771         </sect2>
772
773         <sect2 id="wdcsdm">
774                 <title>NT4/Samba Domain with Samba Domain Member Server &smbmdash; Using Winbind</title>
775
776         <para>
777         You need to use this method for creating a Samba Domain Member server if any of the following conditions
778         prevail:
779         </para>
780
781         <itemizedlist>
782                 <listitem><para>
783                 LDAP support (client) is not installed on the system.
784                 </para></listitem>
785
786                 <listitem><para>
787                 There are mitigating circumstances forcing a decision not to use LDAP.
788                 </para></listitem>
789
790                 <listitem><para>
791                 The Samba Domain Member server must be part of a Windows NT4 Domain.
792                 </para></listitem>
793         </itemizedlist>
794
795         <para><indexterm>
796             <primary>Windows ADS Domain</primary>
797           </indexterm><indexterm>
798             <primary>Samba Domain</primary>
799           </indexterm><indexterm>
800             <primary>LDAP</primary>
801           </indexterm>
802         Later in the chapter, you can see how to configure a Samba Domain Member server for a Windows ADS Domain.
803         Right now your objective is to configure a Samba server that can be a member of a Windows NT4 style
804         Domain and/or does not use LDAP.
805         </para>
806
807         <note><para><indexterm>
808               <primary>duplicate accounts</primary>
809             </indexterm>
810         If you use <command>winbind</command> for Identity resolution, do make sure that there are no
811         duplicate accounts.
812         </para>
813
814           <para><indexterm>
815               <primary>/etc/passwd</primary>
816             </indexterm>
817         For example, do not have more than one account that has UID=0 in the password database. If there 
818         is an account called <constant>root</constant> in the <filename>/etc/passwd</filename> database, 
819         it is okay to have an account called <constant>root</constant> in the LDAP ldapsam or in the 
820         tdbsam. But if there are two accounts in the passdb backend that have the same UID, winbind will 
821         break. This means that the <constant>Administrator</constant> account must be called 
822         <constant>root</constant>.
823         </para>
824
825           <para><indexterm>
826               <primary>/etc/passwd</primary>
827             </indexterm><indexterm>
828               <primary>ldapsam</primary>
829             </indexterm><indexterm>
830               <primary>tdbsam</primary>
831             </indexterm>
832         Winbind will break if there is an account in <filename>/etc/passwd</filename> that has 
833         the same UID as an account that is in LDAP ldapsam (or in tdbsam) but that differs in name only.
834         </para></note>
835
836         <para><indexterm>
837             <primary>credentials</primary>
838           </indexterm><indexterm>
839             <primary>traverse</primary>
840           </indexterm><indexterm>
841             <primary>wide-area</primary>
842           </indexterm><indexterm>
843             <primary>network</primary>
844             <secondary>wide-area</secondary>
845           </indexterm><indexterm>
846             <primary>tdbdump</primary>
847           </indexterm>
848         The following configuration uses CIFS/SMB protocols alone to obtain user and group credentials.
849         The winbind information is locally cached in the <filename>winbindd_cache.tdb winbindd_idmap.tdb</filename>
850         files. This provides considerable performance benefits compared with the LDAP solution, particularly
851         where the LDAP lookups must traverse wide-area network links. You may examine the contents of these
852         files using the tool <command>tdbdump</command>, though you may have to build this from the Samba
853         source code if it has not been supplied as part of a binary package distribution that you may be using.
854         </para>
855
856         <procedure>
857         <title>Configuration of Winbind-Based Identity Resolution</title>
858
859                 <step><para>
860                 Using your favorite text editor, create the &smb.conf; file so it has the contents
861                 shown in <link linkend="ch0-NT4DSDM"/>.
862                 </para></step>
863
864           <step><para><indexterm>
865                 <primary>/etc/nsswitch.conf</primary>
866               </indexterm>
867                 Edit the <filename>/etc/nsswitch.conf</filename> so it has the entries shown in
868                 <link linkend="ch9-nsswbnd"/>.
869                 </para></step>
870
871           <step><para><indexterm>
872                 <primary>net</primary>
873                 <secondary>rpc</secondary>
874                 <tertiary>join</tertiary>
875               </indexterm>
876                 The system is ready to join the Domain. Execute the following:
877 <screen>
878 net rpc join -U root%not24et
879 Joined domain MEGANET2.
880 </screen>
881                 This indicates that the Domain join succeed.
882
883                 </para></step>
884
885           <step><para><indexterm>
886                 <primary>winbind</primary>
887               </indexterm><indexterm>
888                 <primary>wbinfo</primary>
889               </indexterm>
890                 Validate operation of <command>winbind</command> using the <command>wbinfo</command>
891                 tool as follows:
892 <screen>
893 &rootprompt; wbinfo -u
894 MEGANET2+root
895 MEGANET2+nobody
896 MEGANET2+jht
897 MEGANET2+maryv
898 MEGANET2+billr
899 MEGANET2+jelliott
900 MEGANET2+dbrady
901 MEGANET2+joeg
902 MEGANET2+balap
903 </screen>
904                 This shows that Domain users have been listed correctly.
905 <screen>
906 &rootprompt; wbinfo -g
907 MEGANET2+Domain Admins
908 MEGANET2+Domain Users
909 MEGANET2+Domain Guests
910 MEGANET2+Accounts
911 MEGANET2+Finances
912 MEGANET2+PIOps
913 </screen>
914                 This shows that Domain groups have been correctly obtained also.
915                 </para></step>
916
917           <step><para><indexterm>
918                 <primary>NSS</primary>
919               </indexterm><indexterm>
920                 <primary>getent</primary>
921               </indexterm><indexterm>
922                 <primary>winbind</primary>
923               </indexterm>
924                 The next step verifies that NSS is able to obtain this information
925                 correctly from <command>winbind</command> also.
926 <screen>
927 &rootprompt; getent passwd
928 ...
929 MEGANET2+root:x:10000:10001:NetBIOS Domain Admin:
930                       /home/MEGANET2/root:/bin/bash
931 MEGANET2+nobody:x:10001:10001:nobody:
932                       /home/MEGANET2/nobody:/bin/bash
933 MEGANET2+jht:x:10002:10001:John H Terpstra:
934                       /home/MEGANET2/jht:/bin/bash
935 MEGANET2+maryv:x:10003:10001:Mary Vortexis:
936                       /home/MEGANET2/maryv:/bin/bash
937 MEGANET2+billr:x:10004:10001:William Randalph:
938                       /home/MEGANET2/billr:/bin/bash
939 MEGANET2+jelliott:x:10005:10001:John G Elliott:
940                       /home/MEGANET2/jelliott:/bin/bash
941 MEGANET2+dbrady:x:10006:10001:Darren Brady:
942                       /home/MEGANET2/dbrady:/bin/bash
943 MEGANET2+joeg:x:10007:10001:Joe Green:
944                       /home/MEGANET2/joeg:/bin/bash
945 MEGANET2+balap:x:10008:10001:Bala Pillay:
946                       /home/MEGANET2/balap:/bin/bash
947 </screen>
948                 The user account information has been correctly obtained. This information has
949                 been merged with the winbind template information configured in the &smb.conf; file.
950 <screen>
951 &rootprompt;# getent group
952 ...
953 MEGANET2+Domain Admins:x:10000:MEGANET2+root,MEGANET2+jht
954 MEGANET2+Domain Users:x:10001:MEGANET2+jht,MEGANET2+maryv,\
955         MEGANET2+billr,MEGANET2+jelliott,MEGANET2+dbrady,\
956         MEGANET2+joeg,MEGANET2+balap
957 MEGANET2+Domain Guests:x:10002:MEGANET2+nobody
958 MEGANET2+Accounts:x:10003:
959 MEGANET2+Finances:x:10004:
960 MEGANET2+PIOps:x:10005:
961 </screen>
962                 </para></step>
963
964                 <step><para>
965                 The Samba member server of a Windows NT4 Domain is ready for use.
966                 </para></step>
967         </procedure>
968
969 <smbconfexample id="ch0-NT4DSDM">
970 <title>Samba Domain Member Server &smb.conf; File for NT4 Domain</title>
971 <smbconfcomment>Global parameters</smbconfcomment>
972 <smbconfsection name="[global]"/>
973 <smbconfoption name="unix charset">LOCALE</smbconfoption>
974 <smbconfoption name="workgroup">MEGANET2</smbconfoption>
975 <smbconfoption name="security">DOMAIN</smbconfoption>
976 <smbconfoption name="username map">/etc/samba/smbusers</smbconfoption>
977 <smbconfoption name="log level">1</smbconfoption>
978 <smbconfoption name="syslog">0</smbconfoption>
979 <smbconfoption name="log file">/var/log/samba/%m</smbconfoption>
980 <smbconfoption name="max log size">0</smbconfoption>
981 <smbconfoption name="smb ports">139 445</smbconfoption>
982 <smbconfoption name="name resolve order">wins bcast hosts</smbconfoption>
983 <smbconfoption name="printcap name">CUPS</smbconfoption>
984 <smbconfoption name="wins server">192.168.2.1</smbconfoption>
985 <smbconfoption name="idmap uid">10000-20000</smbconfoption>
986 <smbconfoption name="idmap gid">10000-20000</smbconfoption>
987 <smbconfoption name="template primary group">"Domain Users"</smbconfoption>
988 <smbconfoption name="template shell">/bin/bash</smbconfoption>
989 <smbconfoption name="winbind separator">+</smbconfoption>
990 <smbconfoption name="printer admin">root</smbconfoption>
991 <smbconfoption name="hosts allow">192.168.2., 192.168.3., 127.</smbconfoption>
992 <smbconfoption name="printing">cups</smbconfoption>
993
994 <smbconfsection name="[homes]"/>
995 <smbconfoption name="comment">Home Directories</smbconfoption>
996 <smbconfoption name="valid users">%S</smbconfoption>
997 <smbconfoption name="read only">No</smbconfoption>
998 <smbconfoption name="browseable">No</smbconfoption>
999
1000 <smbconfsection name="[printers]"/>
1001 <smbconfoption name="comment">SMB Print Spool</smbconfoption>
1002 <smbconfoption name="path">/var/spool/samba</smbconfoption>
1003 <smbconfoption name="guest ok">Yes</smbconfoption>
1004 <smbconfoption name="printable">Yes</smbconfoption>
1005 <smbconfoption name="browseable">No</smbconfoption>
1006
1007 <smbconfsection name="[print$]"/>
1008 <smbconfoption name="comment">Printer Drivers</smbconfoption>
1009 <smbconfoption name="path">/var/lib/samba/drivers</smbconfoption>
1010 <smbconfoption name="admin users">root, Administrator</smbconfoption>
1011 <smbconfoption name="write list">root</smbconfoption>
1012 </smbconfexample>
1013
1014 <example id="ch9-nsswbnd">
1015 <title>Name Service Switch Control File: <filename>/etc/nsswitch.conf</filename></title>
1016 <screen>
1017 # /etc/nsswitch.conf
1018
1019 passwd:         compat winbind
1020 group:          compat winbind
1021
1022 hosts:          files dns wins
1023 networks:       files dns
1024
1025 services:       files
1026 protocols:      files
1027 rpc:            files
1028 ethers:         files
1029 netmasks:       files
1030 netgroup:       files
1031 publickey:      files
1032
1033 bootparams:     files
1034 automount:      files
1035 aliases:        files
1036 </screen>
1037 </example>
1038
1039         </sect2>
1040
1041         <sect2 id="adssdm">
1042         <title>Active Directory Domain with Samba Domain Member Server</title>
1043
1044         <para><indexterm>
1045             <primary>Active Directory</primary>
1046             <secondary>join</secondary>
1047           </indexterm><indexterm>
1048             <primary>Kerberos</primary>
1049           </indexterm><indexterm>
1050             <primary>Domain Member</primary>
1051             <secondary>server</secondary>
1052           </indexterm>
1053         One of the much-sought-after features new to Samba-3 is the ability to join an Active Directory
1054         Domain using Kerberos protocols. This makes it possible to operate an entire Windows network
1055         without the need to run NetBIOS over TCP/IP and permits more secure networking in general. An
1056         exhaustively complete discussion of the protocols is not possible in this book; perhaps a
1057         later book may explore the intricacies of the NetBIOS-less operation that Samba-3 can participate
1058         in. For now, we simply focus on how a Samba-3 server can be made a Domain Member server.
1059         </para>
1060
1061         <para><indexterm>
1062             <primary>Active Directory</primary>
1063           </indexterm><indexterm>
1064             <primary>LDAP</primary>
1065           </indexterm><indexterm>
1066             <primary>Identity resolution</primary>
1067           </indexterm><indexterm>
1068             <primary>Kerberos</primary>
1069           </indexterm>
1070         The diagram in <link linkend="ch9-adsdc"/> demonstrates how Samba-3 interfaces with
1071         Microsoft Active Directory components. It should be noted that if Microsoft Windows Services
1072         for UNIX has been installed and correctly configured, it is possible to use client LDAP
1073         for Identity resolution just as can be done with Samba-3 when using an LDAP passdb backend.
1074         The UNIX tool that you need for this, as in the case of LDAP on UNIX/Linux, is the PADL
1075         Software nss_ldap tool-set. Compared with use of winbind and Kerberos, the use of 
1076         LDAP-based Identity resolution is a little less secure. In view of the fact that this solution
1077         requires additional software to be installed on the Windows 200x ADS Domain Controllers,
1078         and that means more management overhead, it is likely that most Samba-3 ADS client sites
1079         may elect to use winbind.
1080         </para>
1081
1082         <para>
1083         Do not attempt to use this procedure if you are not 100 percent certain that the build of Samba-3
1084         you are using has been compiled and linked with all the tools necessary for this to work.
1085         Given the importance of this step, you must first validate that the Samba-3 message block
1086         daemon (<command>smbd</command>) has the necessary features.
1087         </para>
1088
1089         <para>
1090         The hypothetical domain you are using in this example assumes that the Abmas London office
1091         decided to take their own lead (some would say this is a typical behavior in a global
1092         corporate world; besides, a little divergence and conflict makes for an interesting life).
1093         The Windows Server 2003 ADS Domain is called <constant>london.abmas.biz</constant> and the
1094         name of the server is <constant>W2K3S</constant>. In ADS realm terms, the Domain Controller
1095         is known as <constant>w2k3s.london.abmas.biz</constant>. In NetBIOS nomenclature, the
1096         Domain Name is <constant>LONDON</constant> and the server name is <constant>W2K3S</constant>.
1097         </para>
1098
1099         <image id="ch9-adsdc">
1100                 <imagedescription>Active Directory Domain: Samba Member Server</imagedescription>
1101                 <imagefile scale="60">chap9-ADSDC</imagefile>
1102         </image>
1103
1104         <procedure>
1105           <step><para><indexterm>
1106                 <primary>smbd</primary>
1107               </indexterm>
1108                 Before you try to use Samba-3, you want to know for certain that your executables have
1109                 support for Kerberos and for LDAP. Execute the following to identify whether or
1110                 not this build is perhaps suitable for use:
1111 <screen>
1112 &rootprompt; cd /usr/sbin
1113 &rootprompt; smbd -b | grep KRB
1114    HAVE_KRB5_H
1115    HAVE_ADDR_TYPE_IN_KRB5_ADDRESS
1116    HAVE_KRB5
1117    HAVE_KRB5_AUTH_CON_SETKEY
1118    HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES
1119    HAVE_KRB5_GET_PW_SALT
1120    HAVE_KRB5_KEYBLOCK_KEYVALUE
1121    HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK
1122    HAVE_KRB5_MK_REQ_EXTENDED
1123    HAVE_KRB5_PRINCIPAL_GET_COMP_STRING
1124    HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES
1125    HAVE_KRB5_STRING_TO_KEY
1126    HAVE_KRB5_STRING_TO_KEY_SALT
1127    HAVE_LIBKRB5
1128 </screen>
1129                 The above output was obtained on a SuSE Linux system and shows the output for
1130                 Samba that has been compiled and linked with the Heimdal Kerberos libraries.
1131                 The following is a typical output that will be found on a Red Hat Linux system that
1132                 has been linked with the MIT Kerberos libraries:
1133 <screen>
1134 &rootprompt; cd /usr/sbin
1135 &rootprompt; smbd -b | grep KRB
1136    HAVE_KRB5_H
1137    HAVE_ADDRTYPE_IN_KRB5_ADDRESS
1138    HAVE_KRB5
1139    HAVE_KRB5_AUTH_CON_SETUSERUSERKEY
1140    HAVE_KRB5_ENCRYPT_DATA
1141    HAVE_KRB5_FREE_DATA_CONTENTS
1142    HAVE_KRB5_FREE_KTYPES
1143    HAVE_KRB5_GET_PERMITTED_ENCTYPES
1144    HAVE_KRB5_KEYTAB_ENTRY_KEY
1145    HAVE_KRB5_LOCATE_KDC
1146    HAVE_KRB5_MK_REQ_EXTENDED
1147    HAVE_KRB5_PRINCIPAL2SALT
1148    HAVE_KRB5_PRINC_COMPONENT
1149    HAVE_KRB5_SET_DEFAULT_TGS_KTYPES
1150    HAVE_KRB5_SET_REAL_TIME
1151    HAVE_KRB5_STRING_TO_KEY
1152    HAVE_KRB5_TKT_ENC_PART2
1153    HAVE_KRB5_USE_ENCTYPE
1154    HAVE_LIBGSSAPI_KRB5
1155    HAVE_LIBKRB5
1156 </screen>
1157                 You can validate that Samba has been compiled and linked with LDAP support
1158                 by executing:
1159 <screen>
1160 &rootprompt; smbd -b | grep LDAP
1161 massive:/usr/sbin # smbd -b | grep LDAP
1162    HAVE_LDAP_H
1163    HAVE_LDAP
1164    HAVE_LDAP_DOMAIN2HOSTLIST
1165    HAVE_LDAP_INIT
1166    HAVE_LDAP_INITIALIZE
1167    HAVE_LDAP_SET_REBIND_PROC
1168    HAVE_LIBLDAP
1169    LDAP_SET_REBIND_PROC_ARGS
1170 </screen>
1171                 This does look promising; <command>smbd</command> has been built with Kerberos and LDAP
1172                 support. You are relieved to know that it is safe to progress.
1173                 </para></step>
1174
1175           <step><para><indexterm>
1176                 <primary>Kerberos</primary>
1177                 <secondary>libraries</secondary>
1178               </indexterm><indexterm>
1179                 <primary>MIT Kerberos</primary>
1180               </indexterm><indexterm>
1181                 <primary>Heimdal Kerberos</primary>
1182               </indexterm><indexterm>
1183                 <primary>Kerberos</primary>
1184                 <secondary>MIT</secondary>
1185               </indexterm><indexterm>
1186                 <primary>Kerberos</primary>
1187                 <secondary>Heimdal</secondary>
1188               </indexterm><indexterm>
1189                 <primary>Red Hat Linux</primary>
1190               </indexterm><indexterm>
1191                 <primary>SUSE Linux</primary>
1192               </indexterm><indexterm>
1193                 <primary>SerNet</primary>
1194               </indexterm><indexterm>
1195                 <primary>validated</primary>
1196               </indexterm>
1197                 The next step is to identify which version of the Kerberos libraries have been used.
1198                 In order to permit Samba-3 to interoperate with Windows 2003 Active Directory, it is
1199                 essential that it has been linked with either MIT Kerberos version 1.3.1 or later,
1200                 or that it has been linked with Heimdal Kerberos 0.6 plus specific patches. You may
1201                 identify what version of the MIT Kerberos libraries are installed on your system by
1202                 executing (on Red Hat Linux):
1203 <screen>
1204 &rootprompt; rpm -q krb5
1205 </screen>
1206                 Or on SUSE Linux, execute:
1207 <screen>
1208 &rootprompt; rpm -q heimdal
1209 </screen>
1210                 Please note that the RPMs provided by the Samba-Team are known to be working and have
1211                 been validated. Red Hat Linux RPMs may be obtained from the Samba FTP sites. SUSE
1212                 Linux RPMs may be obtained from <ulink url="ftp://ftp.sernet.de">Sernet</ulink> in
1213                 Germany.
1214                 </para>
1215
1216                 <para>
1217                 From this point on, you are certain that the Samba-3 build you are using has the
1218                 necessary capabilities. You can now configure Samba-3 and the name service 
1219                 switcher (NSS). 
1220                 </para></step>
1221
1222                 <step><para>
1223                 Using you favorite editor, configure the &smb.conf; file that is located in the 
1224                 <filename>/etc/samba</filename> directory so that it has the contents shown 
1225                 in <link linkend="ch9-adssdm"/>.
1226                 </para></step>
1227
1228                 <step><para>
1229                 Edit or create the NSS control file so it has the contents shown in <link linkend="ch9-nsswbnd"/>.
1230                 </para></step>
1231
1232           <step><para><indexterm>
1233                 <primary>/etc/samba/secrets.tdb</primary>
1234               </indexterm>
1235                 Delete the file <filename>/etc/samba/secrets.tdb</filename>, if it exists. Of course, you
1236                 do keep a backup, don't you?
1237                 </para></step>
1238
1239                 <step><para>
1240                 Delete the tdb files that cache Samba information. You keep a backup of the old
1241                 files, of course. You also remove all files to ensure that nothing can pollute your
1242                 nice, new configuration. Execute the following (example is for SUSE Linux):
1243 <screen>
1244 &rootprompt; rm /var/lib/samba/*tdb
1245 </screen>
1246                 </para></step>
1247
1248           <step><para><indexterm>
1249                 <primary>testparm</primary>
1250               </indexterm>
1251                 Validate your &smb.conf; file using <command>testparm</command> (as you have
1252                 done previously). Correct all errors reported before proceeding. The command you
1253                 execute is:
1254 <screen>
1255 &rootprompt; testparm -s | less
1256 </screen>
1257                 Now that you are satisfied that your Samba server is ready to join the Windows
1258                 ADS Domain, let's move on.
1259                 </para></step>
1260
1261           <step><para><indexterm>
1262                 <primary>net</primary>
1263                 <secondary>ads</secondary>
1264                 <tertiary>join</tertiary>
1265               </indexterm><indexterm>
1266                 <primary>Kerberos</primary>
1267               </indexterm>
1268                 This is a good time to double-check everything and then execute the following
1269                 command when everything you have done has checked out okay:
1270 <screen>
1271 &rootprompt; net ads join -UAdministrator%not24get
1272 Using short domain name -- LONDON
1273 Joined 'FRAN' to realm 'LONDON.ABMAS.BIZ'
1274 </screen>
1275                 You have successfully made your Samba-3 server a member of the ADS Domain
1276                 using Kerberos protocols.
1277                 </para>
1278
1279             <para><indexterm>
1280                 <primary>silent return</primary>
1281               </indexterm><indexterm>
1282                 <primary>failed join</primary>
1283               </indexterm>
1284                 In the event that you receive no output messages, a silent return means that the
1285                 Domain join failed. You should use <command>ethereal</command> to identify what
1286                 may be failing. Common causes of a failed join include:
1287
1288                 <itemizedlist>
1289                 <listitem><para><indexterm>
1290                       <primary>name resolution</primary>
1291                       <secondary>Defective</secondary>
1292                     </indexterm>
1293                         Defective or misconfigured DNS name resolution.
1294                         </para></listitem>
1295
1296                 <listitem><para><indexterm>
1297                       <primary>Restrictive security</primary>
1298                     </indexterm>
1299                         Restrictive security settings on the Windows 200x ADS Domain controller
1300                         preventing needed communications protocols. You can check this by searching
1301                         the Windows Server 200x Event Viewer.
1302                         </para></listitem>
1303
1304                         <listitem><para>
1305                         Incorrectly configured &smb.conf; file settings.
1306                         </para></listitem>
1307
1308                         <listitem><para>
1309                         Lack of support of necessary Kerberos protocols because the version of MIT
1310                         Kerberos (or Heimdal) in use is not up to date enough to support the necessary
1311                         functionality.
1312                         </para></listitem>
1313                 </itemizedlist>
1314               <indexterm>
1315                 <primary>net</primary>
1316                 <secondary>rpc</secondary>
1317                 <tertiary>join</tertiary>
1318               </indexterm><indexterm>
1319                 <primary>RPC</primary>
1320               </indexterm><indexterm>
1321                 <primary>mixed mode</primary>
1322               </indexterm>
1323                 In any case, never execute the <command>net rpc join</command> command in an attempt
1324                 to join the Samba server to the Domain, unless you wish not to use the Kerberos
1325                 security protocols. Use of the older RPC-based Domain join facility requires that
1326                 Windows Server 200x ADS has been configured appropriately for mixed mode operation.
1327                 </para></step>
1328
1329           <step><para><indexterm>
1330                 <primary>tdbdump</primary>
1331               </indexterm><indexterm>
1332                 <primary>/etc/samba/secrets.tdb</primary>
1333               </indexterm>
1334                 If the <command>tdbdump</command> is installed on your system (not essential),
1335                 you can look inside the <filename>/etc/samba/secrets.tdb</filename> file. If
1336                 you wish to do this, execute:
1337 <screen>
1338 &rootprompt; tdbdump secrets.tdb
1339 {
1340 key = "SECRETS/SID/LONDON"
1341 data = "\01\04\00\00\00\00\00\05\15\00\00\00\EBw\86\F1\ED\BD\
1342    F6{\5C6\E5W\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\
1343    00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\
1344    00\00\00\00\00\00\00\00"
1345 }
1346 {
1347 key = "SECRETS/MACHINE_PASSWORD/LONDON"
1348 data = "le3Q5FPnN5.ueC\00"
1349 }
1350 {
1351 key = "SECRETS/MACHINE_SEC_CHANNEL_TYPE/LONDON"
1352 data = "\02\00\00\00"
1353 }
1354 {
1355 key = "SECRETS/MACHINE_LAST_CHANGE_TIME/LONDON"
1356 data = "E\89\F6?"
1357 }
1358 </screen>
1359                 This is given to demonstrate to the skeptics that this process truly does work.
1360                 </para></step>
1361
1362                 <step><para>
1363                 It is now time to start Samba in the usual way (as has been done many time before
1364                 in this book).  
1365                 </para></step>
1366
1367           <step><para><indexterm>
1368                 <primary>wbinfo</primary>
1369               </indexterm>
1370                 This is a good time to verify that everything is working. First, check that
1371                 winbind is able to obtain the list of users and groups from the ADS Domain Controller.
1372                 Execute the following:
1373 <screen>
1374 &rootprompt; wbinfo -u
1375 LONDON+Administrator
1376 LONDON+Guest
1377 LONDON+SUPPORT_388945a0
1378 LONDON+krbtgt
1379 LONDON+jht
1380 </screen>
1381                 Good, the list of users was obtained. Now do likewise for group accounts:
1382 <screen>
1383 &rootprompt; wbinfo -g
1384 LONDON+Domain Computers
1385 LONDON+Domain Controllers
1386 LONDON+Schema Admins
1387 LONDON+Enterprise Admins
1388 LONDON+Domain Admins
1389 LONDON+Domain Users
1390 LONDON+Domain Guests
1391 LONDON+Group Policy Creator Owners
1392 LONDON+DnsUpdateProxy
1393 </screen>
1394                 Excellent. That worked also, as expected.
1395                 </para></step>
1396
1397           <step><para><indexterm>
1398                 <primary>getent</primary>
1399               </indexterm>
1400                 Now repeat this via NSS to validate that full Identity resolution is
1401                 functional as required. Execute:
1402 <screen>
1403 &rootprompt; getent passwd
1404 ...
1405 LONDON+Administrator:x:10000:10000:Administrator:
1406              /home/LONDON/administrator:/bin/bash
1407 LONDON+Guest:x:10001:10001:Guest:
1408              /home/LONDON/guest:/bin/bash
1409 LONDON+SUPPORT_388945a0:x:10002:10000:SUPPORT_388945a0:
1410              /home/LONDON/support_388945a0:/bin/bash
1411 LONDON+krbtgt:x:10003:10000:krbtgt:
1412              /home/LONDON/krbtgt:/bin/bash
1413 LONDON+jht:x:10004:10000:John H. Terpstra:
1414              /home/LONDON/jht:/bin/bash
1415 </screen>
1416                 Okay, ADS user accounts are being resolved. Now you try group resolution as follows:
1417 <screen>
1418 &rootprompt; getent group
1419 ...
1420 LONDON+Domain Computers:x:10002:
1421 LONDON+Domain Controllers:x:10003:
1422 LONDON+Schema Admins:x:10004:LONDON+Administrator
1423 LONDON+Enterprise Admins:x:10005:LONDON+Administrator
1424 LONDON+Domain Admins:x:10006:LONDON+jht,LONDON+Administrator
1425 LONDON+Domain Users:x:10000:
1426 LONDON+Domain Guests:x:10001:
1427 LONDON+Group Policy Creator Owners:x:10007:LONDON+Administrator
1428 LONDON+DnsUpdateProxy:x:10008:
1429 </screen>
1430                 This is very pleasing. Everything works as expected.
1431                 </para></step>
1432
1433           <step><para><indexterm>
1434                 <primary>net</primary>
1435                 <secondary>ads</secondary>
1436                 <tertiary>info</tertiary>
1437               </indexterm><indexterm>
1438                 <primary>Active Directory</primary>
1439                 <secondary>server</secondary>
1440               </indexterm><indexterm>
1441                 <primary>Kerberos</primary>
1442               </indexterm>
1443                 You may now perform final verification that communications between Samba-3 winbind and
1444                 the Active Directory server is using Kerberos protocols. Execute the following:
1445 <screen>
1446 &rootprompt; net ads info
1447 LDAP server: 192.168.2.123
1448 LDAP server name: w2k3s
1449 Realm: LONDON.ABMAS.BIZ
1450 Bind Path: dc=LONDON,dc=ABMAS,dc=BIZ
1451 LDAP port: 389
1452 Server time: Sat, 03 Jan 2004 02:44:44 GMT
1453 KDC server: 192.168.2.123
1454 Server time offset: 2
1455 </screen>
1456                 It should be noted that Kerberos protocols are time-clock critical. You should
1457                 keep all server time clocks synchronized using the network time protocol (NTP).
1458                 In any case, the output we obtained confirms that all systems are operational.
1459                 </para></step>
1460
1461           <step><para><indexterm>
1462                 <primary>net</primary>
1463                 <secondary>ads</secondary>
1464                 <tertiary>status</tertiary>
1465               </indexterm>
1466                 There is one more action you elect to take, just because you are paranoid and disbelieving,
1467                 so you execute the following command:
1468 <programlisting>
1469 &rootprompt; net ads status -UAdministrator%not24get
1470 objectClass: top
1471 objectClass: person
1472 objectClass: organizationalPerson
1473 objectClass: user
1474 objectClass: computer
1475 cn: fran
1476 distinguishedName: CN=fran,CN=Computers,DC=london,DC=abmas,DC=biz
1477 instanceType: 4
1478 whenCreated: 20040103092006.0Z
1479 whenChanged: 20040103092006.0Z
1480 uSNCreated: 28713
1481 uSNChanged: 28717
1482 name: fran
1483 objectGUID: 58f89519-c467-49b9-acb0-f099d73696e
1484 userAccountControl: 69632
1485 badPwdCount: 0
1486 codePage: 0
1487 countryCode: 0
1488 badPasswordTime: 0
1489 lastLogoff: 0
1490 lastLogon: 127175965783327936
1491 localPolicyFlags: 0
1492 pwdLastSet: 127175952062598496
1493 primaryGroupID: 515
1494 objectSid: S-1-5-21-4052121579-2079768045-1474639452-1109
1495 accountExpires: 9223372036854775807
1496 logonCount: 13
1497 sAMAccountName: fran$
1498 sAMAccountType: 805306369
1499 operatingSystem: Samba
1500 operatingSystemVersion: 3.0.12-SUSE
1501 dNSHostName: fran
1502 userPrincipalName: HOST/fran@LONDON.ABMAS.BIZ
1503 servicePrincipalName: CIFS/fran.london.abmas.biz
1504 servicePrincipalName: CIFS/fran
1505 servicePrincipalName: HOST/fran.london.abmas.biz
1506 servicePrincipalName: HOST/fran
1507 objectCategory: CN=Computer,CN=Schema,CN=Configuration,
1508                               DC=london,DC=abmas,DC=biz
1509 isCriticalSystemObject: FALSE
1510 -------------- Security Descriptor (revision: 1, type: 0x8c14)
1511 owner SID: S-1-5-21-4052121579-2079768045-1474639452-512
1512 group SID: S-1-5-21-4052121579-2079768045-1474639452-513
1513 ------- (system) ACL (revision: 4, size: 120, number of ACEs: 2)
1514 ------- ACE (type: 0x07, flags: 0x5a, size: 0x38, 
1515                mask: 0x20, object flags: 0x3)
1516 access SID:  S-1-1-0
1517 access type: AUDIT OBJECT
1518 Permissions:
1519         [Write All Properties]
1520 ------- ACE (type: 0x07, flags: 0x5a, size: 0x38, 
1521                mask: 0x20, object flags: 0x3)
1522 access SID:  S-1-1-0
1523 access type: AUDIT OBJECT
1524 Permissions:
1525         [Write All Properties]
1526 ------- (user) ACL (revision: 4, size: 1944, number of ACEs: 40)
1527 ------- ACE (type: 0x00, flags: 0x00, size: 0x24, mask: 0xf01ff)
1528 access SID:  S-1-5-21-4052121579-2079768045-1474639452-512
1529 access type: ALLOWED
1530 Permissions: [Full Control]
1531 ------- ACE (type: 0x00, flags: 0x00, size: 0x18, mask: 0xf01ff)
1532 access SID:  S-1-5-32-548
1533 ...
1534 ------- ACE (type: 0x05, flags: 0x12, size: 0x38, 
1535                 mask: 0x10, object flags: 0x3)
1536 access SID:  S-1-5-9
1537 access type: ALLOWED OBJECT
1538 Permissions:
1539         [Read All Properties]
1540 -------------- End Of Security Descriptor
1541 </programlisting>
1542                 And now you have conclusive proof that your Samba-3 ADS Domain Member Server
1543                 called <constant>FRAN</constant>, is able to communicate fully with the ADS
1544                 Domain Controllers.
1545                 </para></step>
1546         </procedure>
1547
1548
1549         <para>
1550         Your Samba-3 ADS Domain Member server is ready for use. During training sessions,
1551         you may be asked what is inside the <filename>winbindd_cache.tdb and winbindd_idmap.tdb</filename>
1552         files. Since curiosity just took hold of you, execute the following:
1553 <programlisting>
1554 &rootprompt; tdbdump /var/lib/samba/winbindd_idmap.tdb
1555 {
1556 key = "S-1-5-21-4052121579-2079768045-1474639452-501\00"
1557 data = "UID 10001\00"
1558 }
1559 {
1560 key = "UID 10005\00"
1561 data = "S-1-5-21-4052121579-2079768045-1474639452-1111\00"
1562 }
1563 {
1564 key = "GID 10004\00"
1565 data = "S-1-5-21-4052121579-2079768045-1474639452-518\00"
1566 }
1567 {
1568 key = "S-1-5-21-4052121579-2079768045-1474639452-502\00"
1569 data = "UID 10003\00"
1570 }
1571 ...
1572
1573 &rootprompt; tdbdump /var/lib/samba/winbindd_cache.tdb
1574 {
1575 key = "UL/LONDON"
1576 data = "\00\00\00\00bp\00\00\06\00\00\00\0DAdministrator\0D
1577    Administrator-S-1-5-21-4052121579-2079768045-1474639452-500-
1578    S-1-5-21-4052121579-2079768045-1474639452-513\05Guest\05
1579    Guest-S-1-5-21-4052121579-2079768045-1474639452-501-
1580    S-1-5-21-4052121579-2079768045-1474639452-514\10
1581    SUPPORT_388945a0\10SUPPORT_388945a0.
1582    S-1-5-21-4052121579-2079768045-1474639452-1001-
1583    S-1-5-21-4052121579-2079768045-1474639452-513\06krbtgt\06
1584    krbtgt-S-1-5-21-4052121579-2079768045-1474639452-502-
1585    S-1-5-21-4052121579-2079768045-1474639452-513\03jht\10
1586    John H. Terpstra.S-1-5-21-4052121579-2079768045-1474639452-1110-
1587    S-1-5-21-4052121579-2079768045-1474639452-513"
1588 }
1589 {
1590 key = "GM/S-1-5-21-4052121579-2079768045-1474639452-512"
1591 data = "\00\00\00\00bp\00\00\02\00\00\00.
1592    S-1-5-21-4052121579-2079768045-1474639452-1110\03
1593    jht\01\00\00\00-S-1-5-21-4052121579-2079768045-1474639452-500\0D
1594    Administrator\01\00\00\00"
1595 }
1596 {
1597 key = "SN/S-1-5-21-4052121579-2079768045-1474639452-513"
1598 data = "\00\00\00\00xp\00\00\02\00\00\00\0CDomain Users"
1599 }
1600 {
1601 key = "GM/S-1-5-21-4052121579-2079768045-1474639452-518"
1602 data = "\00\00\00\00bp\00\00\01\00\00\00-
1603    S-1-5-21-4052121579-2079768045-1474639452-500\0D
1604    Administrator\01\00\00\00"
1605 }
1606 {
1607 key = "SEQNUM/LONDON\00"
1608 data = "xp\00\00C\92\F6?"
1609 }
1610 {
1611 key = "U/S-1-5-21-4052121579-2079768045-1474639452-1110"
1612 data = "\00\00\00\00xp\00\00\03jht\10John H. Terpstra.
1613    S-1-5-21-4052121579-2079768045-1474639452-1110-
1614    S-1-5-21-4052121579-2079768045-1474639452-513"
1615 }
1616 {
1617 key = "NS/S-1-5-21-4052121579-2079768045-1474639452-502"
1618 data = "\00\00\00\00bp\00\00-
1619    S-1-5-21-4052121579-2079768045-1474639452-502"
1620 }
1621 {
1622 key = "SN/S-1-5-21-4052121579-2079768045-1474639452-1001"
1623 data = "\00\00\00\00bp\00\00\01\00\00\00\10SUPPORT_388945a0"
1624 }
1625 {
1626 key = "SN/S-1-5-21-4052121579-2079768045-1474639452-500"
1627 data = "\00\00\00\00bp\00\00\01\00\00\00\0DAdministrator"
1628 }
1629 {
1630 key = "U/S-1-5-21-4052121579-2079768045-1474639452-502"
1631 data = "\00\00\00\00bp\00\00\06krbtgt\06krbtgt-
1632    S-1-5-21-4052121579-2079768045-1474639452-502-
1633    S-1-5-21-4052121579-2079768045-1474639452-513"
1634 }
1635 ....
1636 </programlisting>
1637         Now all is revealed. Your curiosity, as well as that of those with you, has been put at ease.
1638         May this server serve well all who happen upon it.
1639         </para>
1640
1641 <smbconfexample id="ch9-adssdm">
1642 <title>Samba Domain Member &smb.conf; File for Active Directory Membership</title>
1643 <smbconfcomment>Global parameters</smbconfcomment>
1644 <smbconfsection name="[global]"/>
1645 <smbconfoption name="unix charset">LOCALE</smbconfoption>
1646 <smbconfoption name="workgroup">LONDON</smbconfoption>
1647 <smbconfoption name="realm">LONDON.ABMAS.BIZ</smbconfoption>
1648 <smbconfoption name="server string">Samba 3.0.12</smbconfoption>
1649 <smbconfoption name="security">ADS</smbconfoption>
1650 <smbconfoption name="username map">/etc/samba/smbusers</smbconfoption>
1651 <smbconfoption name="log level">1</smbconfoption>
1652 <smbconfoption name="syslog">0</smbconfoption>
1653 <smbconfoption name="log file">/var/log/samba/%m</smbconfoption>
1654 <smbconfoption name="max log size">50</smbconfoption>
1655 <smbconfoption name="printcap name">CUPS</smbconfoption>
1656 <smbconfoption name="ldap ssl">no</smbconfoption>
1657 <smbconfoption name="idmap uid">10000-20000</smbconfoption>
1658 <smbconfoption name="idmap gid">10000-20000</smbconfoption>
1659 <smbconfoption name="template primary group">"Domain Users"</smbconfoption>
1660 <smbconfoption name="template shell">/bin/bash</smbconfoption>
1661 <smbconfoption name="winbind separator">+</smbconfoption>
1662 <smbconfoption name="printing">cups</smbconfoption>
1663
1664 <smbconfsection name="[homes]"/>
1665 <smbconfoption name="comment">Home Directories</smbconfoption>
1666 <smbconfoption name="valid users">%S</smbconfoption>
1667 <smbconfoption name="read only">No</smbconfoption>
1668 <smbconfoption name="browseable">No</smbconfoption>
1669
1670 <smbconfsection name="[printers]"/>
1671 <smbconfoption name="comment">SMB Print Spool</smbconfoption>
1672 <smbconfoption name="path">/var/spool/samba</smbconfoption>
1673 <smbconfoption name="guest ok">Yes</smbconfoption>
1674 <smbconfoption name="printable">Yes</smbconfoption>
1675 <smbconfoption name="browseable">No</smbconfoption>
1676
1677 <smbconfsection name="[print$]"/>
1678 <smbconfoption name="comment">Printer Drivers</smbconfoption>
1679 <smbconfoption name="path">/var/lib/samba/drivers</smbconfoption>
1680 <smbconfoption name="admin users">root, Administrator</smbconfoption>
1681 <smbconfoption name="write list">root</smbconfoption>
1682 </smbconfexample>
1683
1684         </sect2>
1685
1686         <sect2>
1687         <title>UNIX/Linux Client Domain Member</title>
1688
1689         <para><indexterm>
1690             <primary>user credentials</primary>
1691           </indexterm>
1692         So far this chapter has been mainly concerned with the provision of file and print
1693         services for Domain Member servers. However, an increasing number of UNIX/Linux
1694         workstations are being installed that do not act as file or print servers to anyone
1695         other than a single desktop user. The key demand for desktop systems is to be able
1696         to log onto any UNIX/Linux or Windows desktop using the same network user credentials.
1697         </para>
1698
1699         <para><indexterm>
1700             <primary>Single Sign-On</primary>
1701             <see>SOS</see>
1702           </indexterm>
1703         The ability to use a common set of user credential across a variety of network systems
1704         is generally regarded as a Single Sign-On (SOS) solution. SOS systems are sold by a
1705         large number of vendors and include a range of technologies such as:
1706         </para>
1707
1708         <itemizedlist>
1709                 <listitem><para>
1710                 Proxy sign-on
1711                 </para></listitem>
1712
1713                 <listitem><para>
1714                 Federated directory provisioning
1715                 </para></listitem>
1716
1717                 <listitem><para>
1718                 Meta-directory server solutions
1719                 </para></listitem>
1720
1721                 <listitem><para>
1722                 Replacement authentication systems
1723                 </para></listitem>
1724         </itemizedlist>
1725
1726         <para><indexterm>
1727             <primary>Identity management</primary>
1728           </indexterm>
1729         There are really only three solutions that provide integrated authentication and
1730         user Identity management facilities:
1731         </para>
1732
1733         <itemizedlist>
1734                 <listitem><para>
1735                 Samba Winbind (free)
1736                 </para></listitem>
1737
1738                 <listitem><para>
1739                 <ulink url="http://www.padl.com">PADL</ulink> PAM and LDAP Tools (free)
1740                 </para></listitem>
1741
1742                 <listitem><para>
1743                 <ulink url="http://www.vintela.com">Vintela</ulink> Authentication Services (Commercial)
1744                 </para></listitem>
1745         </itemizedlist>
1746
1747         <para>
1748         The following guidelines are pertinent in respect of the deployment of winbind-based authentication
1749         and Identity resolution with the express purpose of allowing users to log onto UNIX/Linux desktops
1750         using Windows network Domain user credentials (username and password).
1751         </para>
1752
1753         <para>
1754         You should note that it is possible to use LDAP-based PAM and NSS tools to permit distributed
1755         systems logons (SSO) providing user and group accounts are stored in an LDAP directory. This
1756         provides logon services for UNIX/Linux users, while Windows users obtain their sign-on
1757         support via Samba-3.
1758         </para>
1759
1760         <para><indexterm>
1761             <primary>Windows Services for UNIX</primary>
1762             <see>SUS</see>
1763           </indexterm>
1764         On the other hand, if the authentication and Identity resolution backend must be provided by
1765         a Windows NT4 style Domain or from an Active Directory Domain that does not have the Microsoft
1766         Windows Services for UNIX (SUS) installed, winbind is your best friend. Specific guidance for these
1767         situations now follows.
1768         </para>
1769
1770         <para><indexterm>
1771             <primary>PAM</primary>
1772           </indexterm><indexterm>
1773             <primary>Identity resolution</primary>
1774           </indexterm><indexterm>
1775             <primary>NSS</primary>
1776           </indexterm>
1777         To permit users to log onto a Linux system using Windows network credentials, you need to
1778         configure Identity resolution (NSS) and PAM. This means that the basic steps include those
1779         outlined above with the addition of PAM configuration. Given that most workstations (desktop/client)
1780         usually do not need to provide file and print services to a group of users, the configuration
1781         of shares and printers is generally less important. Often this allows the share specifications
1782         to be entirely removed from the &smb.conf; file. That is obviously an administrator decision.
1783         </para>
1784
1785                 <sect3>
1786                 <title>NT4 Domain Member</title>
1787
1788                 <para>
1789                 The following steps provide a Linux system that users can log onto using
1790                 Windows NT4 Domain (or Samba-3) Domain network credentials:
1791                 </para>
1792
1793                 <procedure>
1794                         <step><para>
1795                         Follow the steps outlined in <link linkend="wdcsdm"/> and ensure that
1796                         all validation tests function as shown.
1797                         </para></step>
1798
1799                         <step><para>
1800                         Identify what services users must log onto. On Red Hat Linux, if it is
1801                         intended that the user shall be given access to all services, it may be
1802                         most expeditious to simply configure the file 
1803                         <filename>/etc/pam.d/system-auth</filename>.
1804                         </para></step>
1805
1806                         <step><para>
1807                         Carefully make a backup copy of all PAM configuration files before you
1808                         begin making changes. If you break the PAM configuration, please note
1809                         that you may need to use an emergency boot process to recover your Linux
1810                         system. It is possible to break the ability to log into the system if
1811                         PAM files are incorrectly configured. The entire directory 
1812                         <filename>/etc/pam.d</filename> should be backed up to a safe location.
1813                         </para></step>
1814
1815                         <step><para>
1816                         If you require only console login support, edit the <filename>/etc/pam.d/login</filename>
1817                         so it matches <link linkend="ch9-pamwnbdlogin"/>.
1818                         </para></step>
1819
1820                         <step><para>
1821                         To provide the ability to log onto the graphical desktop interface, you must edit
1822                         the files <filename>gdm</filename> and <filename>xdm</filename> in the 
1823                         <filename>/etc/pam.d</filename> directory.
1824                         </para></step>
1825
1826                         <step><para>
1827                         Edit only one file at a time. Carefully validate its operation before attempting
1828                         to reboot the machine.
1829                         </para></step>
1830                 </procedure>
1831
1832                 </sect3>
1833
1834                 <sect3>
1835                 <title>ADS Domain Member</title>
1836
1837                 <para>
1838                 This procedure should be followed to permit a Linux network client (workstation/desktop)
1839                 to permit users to log on using Microsoft Active Directory based user credentials.
1840                 </para>
1841
1842                 <procedure>
1843                         <step><para>
1844                         Follow the steps outlined in <link linkend="adssdm"/> and ensure that
1845                         all validation tests function as shown.
1846                         </para></step>
1847
1848                         <step><para>
1849                         Identify what services users must log onto. On Red Hat Linux, if it is
1850                         intended that the user shall be given access to all services, it may be
1851                         most expeditious to simply configure the file 
1852                         <filename>/etc/pam.d/system-auth</filename> as shown in <link linkend="ch9-rhsysauth"/>.
1853                         </para></step>
1854
1855                         <step><para>
1856                         Carefully make a backup copy of all PAM configuration files before you
1857                         begin making changes. If you break the PAM configuration, please note
1858                         that you may need to use an emergency boot process to recover your Linux
1859                         system. It is possible to break the ability to log into the system if
1860                         PAM files are incorrectly configured. The entire directory 
1861                         <filename>/etc/pam.d</filename> should be backed up to a safe location.
1862                         </para></step>
1863
1864                         <step><para>
1865                         If you require only console login support, edit the <filename>/etc/pam.d/login</filename>
1866                         so it matches <link linkend="ch9-pamwnbdlogin"/>.
1867                         </para></step>
1868
1869                         <step><para>
1870                         To provide the ability to log onto the graphical desktop interface, you must edit
1871                         the files <filename>gdm</filename> and <filename>xdm</filename> in the 
1872                         <filename>/etc/pam.d</filename> directory.
1873                         </para></step>
1874
1875                         <step><para>
1876                         Edit only one file at a time. Carefully validate its operation before attempting
1877                         to reboot the machine.
1878                         </para></step>
1879                 </procedure>
1880
1881                 </sect3>
1882
1883 <example id="ch9-pamwnbdlogin">
1884 <title>SUSE: PAM <filename>login</filename> Module Using Winbind</title>
1885 <screen>
1886 # /etc/pam.d/login
1887
1888 #%PAM-1.0
1889 auth sufficient pam_unix2.so    nullok
1890 auth sufficient pam_winbind.so use_first_pass use_authtok
1891 auth required   pam_securetty.so
1892 auth required   pam_nologin.so
1893 auth required   pam_env.so
1894 auth required   pam_mail.so
1895 account sufficient      pam_unix2.so
1896 account sufficient      pam_winbind.so user_first_pass use_authtok
1897 password required       pam_pwcheck.so  nullok
1898 password sufficient     pam_unix2.so    nullok use_first_pass use_authtok
1899 password sufficient     pam_winbind.so  use_first_pass use_authtok
1900 session sufficient      pam_unix2.so    none
1901 session sufficient      pam_winbind.so  use_first_pass use_authtok
1902 session required        pam_limits.so
1903 </screen>
1904 </example>
1905
1906 <example id="ch9-pamwbndxdm">
1907 <title>SUSE: PAM <filename>xdm</filename> Module Using Winbind</title>
1908 <screen>
1909 # /etc/pam.d/gdm (/etc/pam.d/xdm)
1910
1911 #%PAM-1.0
1912 auth     sufficient     pam_unix2.so     nullok
1913 auth     sufficient     pam_winbind.so   use_first_pass use_authtok
1914 account  sufficient     pam_unix2.so
1915 account  sufficient     pam_winbind.so   use_first_pass use_authtok
1916 password sufficient     pam_unix2.so
1917 password sufficient     pam_winbind.so   use_first_pass use_authtok
1918 session  sufficient     pam_unix2.so
1919 session  sufficient     pam_winbind.so   use_first_pass use_authtok
1920 session  required       pam_dev perm.so
1921 session  required       pam_resmgr.so
1922 </screen>
1923 </example>
1924
1925 <example id="ch9-rhsysauth">
1926 <title>Red Hat 9: PAM System Authentication File: <filename>/etc/pam.d/system-auth</filename> Module Using Winbind</title>
1927 <screen>
1928 #%PAM-1.0
1929 auth        required      /lib/security/$ISA/pam_env.so
1930 auth        sufficient    /lib/security/$ISA/pam_unix.so likeauth nullok
1931 auth        sufficient    /lib/security/$ISA/pam_winbind.so use_first_pass
1932 auth        required      /lib/security/$ISA/pam_deny.so
1933
1934 account     required      /lib/security/$ISA/pam_unix.so
1935 account     sufficient    /lib/security/$ISA/pam_winbind.so use_first_pass
1936
1937 password    required      /lib/security/$ISA/pam_cracklib.so retry=3 type=
1938 # Note: The above line is complete. There is nothing following the '='
1939 password    sufficient    /lib/security/$ISA/pam_unix.so \
1940                                              nullok use_authtok md5 shadow
1941 password    sufficient    /lib/security/$ISA/pam_winbind.so use_first_pass
1942 password    required      /lib/security/$ISA/pam_deny.so
1943
1944 session     required      /lib/security/$ISA/pam_limits.so
1945 session     sufficient    /lib/security/$ISA/pam_unix.so
1946 session     sufficient    /lib/security/$ISA/pam_winbind.so use_first_pass
1947 </screen>
1948 </example>
1949
1950         </sect2>
1951
1952         <sect2>
1953                 <title>Key Points Learned</title>
1954
1955                 <para>
1956                 The addition of UNIX/Linux Samba servers and clients is a common requirement. In this chapter, you
1957                 learned how to integrate such servers so that the UID/GID mappings they use can be consistent
1958                 across all Domain Member servers. You also discovered how to implement the ability to use Samba
1959                 or Windows Domain account credentials to log onto a UNIX/Linux client.
1960                 </para>
1961
1962                 <para>
1963                 The following are key points noted:
1964                 </para>
1965
1966                 <itemizedlist>
1967                         <listitem><para>
1968                         Domain Controllers are always authoritative for the Domain.
1969                         </para></listitem>
1970
1971                         <listitem><para>
1972                         Domain Members may have local accounts and must be able to resolve the identity of 
1973                         Domain user accounts. Domain user account identity must map to a local UID/GID. That 
1974                         local UID/GID can be stored in LDAP. This way, it is possible to share the IDMAP data 
1975                         across all Domain Member machines.
1976                         </para></listitem>
1977
1978                         <listitem><para>
1979                         Resolution of user and group identities on Domain Member machines may be implemented 
1980                         using direct LDAP services or using winbind.
1981                         </para></listitem>
1982
1983                         <listitem><para>
1984                         On NSS/PAM enabled UNIX/Linux systems, NSS is responsible for Identity management 
1985                         and PAM is responsible for authentication of logon credentials (user name and password).
1986                         </para></listitem>
1987                 </itemizedlist>
1988
1989         </sect2>
1990
1991 </sect1>
1992
1993 <sect1>
1994         <title>Questions and Answers</title>
1995
1996         <para>
1997         The following questions were obtained from the mailing list and also from private discussions
1998         with Windows network administrators.
1999         </para>
2000
2001         <qandaset defaultlabel="chap09qa" type="number">
2002         <qandaentry>
2003         <question>
2004
2005                 <para>
2006                 We use NIS for all UNIX accounts. Why do we need winbind?
2007                 </para>
2008
2009         </question>
2010         <answer>
2011
2012             <para><indexterm>
2013                 <primary>NIS</primary>
2014               </indexterm><indexterm>
2015                 <primary>encrypted passwords</primary>
2016               </indexterm><indexterm>
2017                 <primary>smbpasswd</primary>
2018               </indexterm><indexterm>
2019                 <primary>tdbsam</primary>
2020               </indexterm><indexterm>
2021                 <primary>passdb backend</primary>
2022               </indexterm><indexterm>
2023                 <primary>Winbind</primary>
2024               </indexterm>
2025                 You can use NIS for your UNIX accounts. NIS does not store the Windows encrypted
2026                 passwords that need to be stored in one of the acceptable passdb backends.
2027                 Your choice of backend is limited to <parameter>smbpasswd</parameter> or
2028                 <parameter>tdbsam</parameter>. Winbind is needed to handle the resolution of
2029                 SIDs from trusted domains to local UID/GID values.
2030                 </para>
2031
2032             <para><indexterm>
2033                 <primary>winbind trusted domains only</primary>
2034               </indexterm><indexterm>
2035                 <primary>getpwnam()</primary>
2036               </indexterm>
2037                 On a Domain Member server, you effectively map Windows Domain users to local users
2038                 that are in your NIS database by specifying the <parameter>winbind trusted domains
2039                 only</parameter>. This causes user and group account lookups to be routed via
2040                 the <command>getpwnam()</command> family of systems calls. On an NIS-enabled client,
2041                 this pushes the resolution of users and groups out through NIS.
2042                 </para>
2043
2044                 <para>
2045                 As a general rule, it is always a good idea to run winbind on all Samba servers.
2046                 </para>
2047
2048         </answer>
2049         </qandaentry>
2050
2051         <qandaentry>
2052         <question>
2053
2054                 <para>
2055                 Our IT management people do not like LDAP, but are looking at Microsoft Active Directory. 
2056               Which is better?<indexterm>
2057                 <primary>Active Directory</primary>
2058               </indexterm>
2059                 </para>
2060
2061         </question>
2062         <answer>
2063
2064             <para><indexterm>
2065                 <primary>LDAP</primary>
2066                 <secondary>server</secondary>
2067               </indexterm><indexterm>
2068                 <primary>Kerberos</primary>
2069               </indexterm><indexterm>
2070                 <primary>schema</primary>
2071               </indexterm>
2072                 Microsoft Active Directory is an LDAP server that is intricately tied to a Kerberos
2073                 infrastructure. Most IT managers who object to LDAP do so because of the fact that
2074                 an LDAP server is most often supplied as a raw tool that needs to be configured, and
2075                 for which the administrator must create the schema, create the administration tools and
2076                 devise the backup and recovery facilities in a site dependent manner. LDAP servers
2077                 in general are seen as a high-energy, high-risk facility.
2078                 </para>
2079
2080             <para><indexterm>
2081                 <primary>management</primary>
2082               </indexterm>
2083                 Microsoft Active Directory by comparison is easy to install, configure, and
2084                 is supplied with all tools necessary to implement and manage the directory. For sites
2085                 that lack a lot of technical competence, Active Directory is a good choice. For sites
2086                 that have the technical competence to handle Active Directory well, LDAP is a good
2087                 alternative. The real issue that needs to be addressed is what type of solution does
2088                 the site want? If management wants a choice to use an alternative, they may want to
2089                 consider the options. On the other hand, if management just wants a solution that works,
2090                 Microsoft Active Directory is a good solution.
2091                 </para>
2092
2093         </answer>
2094         </qandaentry>
2095
2096         <qandaentry>
2097         <question>
2098
2099                 <para>
2100                 We want to implement a Samba PDC, four Samba BDCs, and 10 Samba servers. Is it possible 
2101                 to use NIS in place of LDAP?
2102                 </para>
2103
2104         </question>
2105         <answer>
2106
2107             <para><indexterm>
2108                 <primary>NIS</primary>
2109               </indexterm><indexterm>
2110                 <primary>LDAP</primary>
2111               </indexterm><indexterm>
2112                 <primary>encrypted passwords</primary>
2113               </indexterm><indexterm>
2114                 <primary>synchronized</primary>
2115               </indexterm><indexterm>
2116                 <primary>secure account password</primary>
2117               </indexterm><indexterm>
2118                 <primary>PDC</primary>
2119               </indexterm><indexterm>
2120                 <primary>BDC</primary>
2121               </indexterm>
2122                 Yes, it is possible to use NIS in place of LDAP, but there may be problems with keeping
2123                 the Windows (SMB) encrypted passwords database correctly synchronized across the entire
2124                 network. Workstations (Windows client machines) periodically change their Domain
2125                 Membership secure account password. How can you keep changes that are on remote BDCs
2126                 synchronized on the PDC?
2127                 </para>
2128
2129             <para><indexterm>
2130                 <primary>centralized storage</primary>
2131               </indexterm><indexterm>
2132                 <primary>management</primary>
2133               </indexterm><indexterm>
2134                 <primary>network Identities</primary>
2135               </indexterm>
2136                 LDAP is a more elegant solution because it permits centralized storage and management
2137                 of all network Identities (user, group and machine accounts) together with all information
2138                 Samba needs to provide to network clients and their users.
2139                 </para>
2140
2141         </answer>
2142         </qandaentry>
2143
2144         <qandaentry>
2145         <question>
2146
2147                 <para>
2148                 Are you suggesting that users should not log onto a Domain Member server? If so, why?
2149                 </para>
2150
2151         </question>
2152         <answer>
2153
2154             <para><indexterm>
2155                 <primary>security</primary>
2156               </indexterm><indexterm>
2157                 <primary>data</primary>
2158                 <secondary>integrity</secondary>
2159               </indexterm><indexterm>
2160                 <primary>mapped drives</primary>
2161               </indexterm>
2162                 Many UNIX administrators mock the model that the Personal Computer industry has adopted
2163                 as normative since the early days of Novell Netware. One may well argue that the old
2164                 perception of the necessity to keep users off file and print servers was a result of
2165                 fears concerning the security and integrity of data. It was a simple and generally
2166                 effective measure to keep users away from servers, except through mapped drives.
2167                 </para>
2168
2169             <para><indexterm>
2170                 <primary>user logins</primary>
2171               </indexterm><indexterm>
2172                 <primary>risk</primary>
2173               </indexterm><indexterm>
2174                 <primary>user errors</primary>
2175               </indexterm><indexterm>
2176                 <primary>strategy</primary>
2177               </indexterm><indexterm>
2178                 <primary>policy</primary>
2179               </indexterm>
2180                 UNIX administrators are fully correct in asserting that UNIX servers and workstations
2181                 are identical in terms of the software that is installed. They correctly assert that
2182                 in a well secured environment it is safe to store files on a system that has hundreds
2183                 of users. But all network administrators must factor into the decision to allow or
2184                 reject general user logins to a UNIX system that is principally a file and print
2185                 server. One must take account of the risk to operations through simple user errors.
2186                 Only then can one begin to appraise the best strategy and adopt a site-specific
2187                 policy that best protects the needs of users and of the organization alike.
2188                 </para>
2189
2190             <para><indexterm>
2191                 <primary>system level logins</primary>
2192               </indexterm>
2193                 From experience, it is my recommendation to keep general system level logins to a
2194                 practical minimum and to eliminate them if possible. This should not be taken as a
2195                 hard rule, though. The better question is, what works best for the site?
2196                 </para>
2197
2198         </answer>
2199         </qandaentry>
2200
2201         <qandaentry>
2202         <question>
2203
2204             <para><indexterm>
2205                 <primary>winbind enable local accounts</primary>
2206               </indexterm><indexterm>
2207                 <primary>/etc/passwd</primary>
2208               </indexterm><indexterm>
2209                 <primary>options list</primary>
2210               </indexterm><indexterm>
2211                 <primary>ACL</primary>
2212               </indexterm><indexterm>
2213                 <primary>share</primary>
2214               </indexterm>
2215                 In my &smb.conf; file, I enabled the parameter <parameter>winbind enable local accounts
2216                 </parameter> on all Domain Member servers, but it does not work. The accounts I put in 
2217                 <filename>/etc/passwd</filename> do not show up in the options list when I try to set an
2218                 ACL on a share. What have I done wrong?
2219                 </para>
2220
2221         </question>
2222         <answer>
2223
2224             <para><indexterm>
2225                 <primary>local users</primary>
2226               </indexterm><indexterm>
2227                 <primary>local groups</primary>
2228               </indexterm><indexterm>
2229                 <primary>UNIX account</primary>
2230               </indexterm><indexterm>
2231                 <primary>getpwnam()</primary>
2232               </indexterm><indexterm>
2233                 <primary>getgrgid()</primary>
2234               </indexterm><indexterm>
2235                 <primary>Identity resolution</primary>
2236               </indexterm><indexterm>
2237                 <primary>failure</primary>
2238               </indexterm><indexterm>
2239                 <primary>Domain</primary>
2240               </indexterm>
2241                 The manual page for this &smb.conf; file parameter clearly says, <quote>This parameter 
2242                 controls whether or not winbindd will act as a stand in replacement for the various 
2243                 account management hooks in smb.conf (for example, add user script). If enabled, winbindd 
2244                 will support the creation of local users and groups as another source of UNIX account 
2245                 information available via getpwnam() or getgrgid(), etc...</quote> By default this
2246                 parameter is already enabled; therefore, the action you are seeing is a result of a failure
2247                 of Identity resolution in the Domain.
2248                 </para>
2249
2250             <para><indexterm>
2251                 <primary>Domain logons</primary>
2252               </indexterm><indexterm>
2253                 <primary>Identity resolution</primary>
2254               </indexterm><indexterm>
2255                 <primary>Domain</primary>
2256                 <secondary>user</secondary>
2257               </indexterm><indexterm>
2258                 <primary>Domain</primary>
2259                 <secondary>group</secondary>
2260               </indexterm><indexterm>
2261                 <primary>UID</primary>
2262               </indexterm><indexterm>
2263                 <primary>GID</primary>
2264               </indexterm>
2265                 These are the accounts that are available for Windows network Domain logons. Providing 
2266                 Identity resolution has been correctly configured on the Domain Controllers, as well as 
2267                 on Domain Member servers. The Domain user and group identities automatically map 
2268                 to a valid local UID and GID pair.
2269                 </para>
2270
2271         </answer>
2272         </qandaentry>
2273
2274         <qandaentry>
2275         <question>
2276
2277             <para><indexterm>
2278                 <primary>trusted domains</primary>
2279               </indexterm><indexterm>
2280                 <primary>domain</primary>
2281                 <secondary>trusted</secondary>
2282               </indexterm><indexterm>
2283                 <primary>winbind trusted domains only</primary>
2284               </indexterm><indexterm>
2285                 <primary>domain members</primary>
2286               </indexterm>
2287                 We want to ensure that only users from our own domain plus from trusted domains can use our
2288                 Samba servers. In the &smb.conf; file on all servers, we have enabled the <parameter>winbind
2289                 trusted domains only</parameter> parameter. We now find that users from trusted domains 
2290                 cannot access our servers, and users from Windows clients that are not domain members
2291                 can also access our servers. Is this a Samba bug?
2292                 </para>
2293
2294         </question>
2295         <answer>
2296
2297             <para><indexterm>
2298                 <primary>distributed</primary>
2299               </indexterm><indexterm>
2300                 <primary>NIS</primary>
2301               </indexterm><indexterm>
2302                 <primary>rsync</primary>
2303               </indexterm><indexterm>
2304                 <primary>LDAP</primary>
2305               </indexterm><indexterm>
2306                 <primary>winbindd</primary>
2307               </indexterm><indexterm>
2308                 <primary>/etc/passwd</primary>
2309               </indexterm>
2310                 The manual page for this <parameter>winbind trusted domains only</parameter> parameter says,
2311                 <quote>This parameter is designed to allow Samba servers that are members of a Samba controlled 
2312                 domain to use UNIX accounts distributed vi NIS, rsync, or LDAP as the UIDs for winbindd users 
2313                 in the hosts primary domain. Therefore,  the user <constant>SAMBA\user1</constant> would be 
2314                 mapped to the account <constant>user1</constant> in <filename>/etc/passwd</filename> instead 
2315                 of allocating a new UID for him or her.</quote> This would clearly suggest that you are trying
2316                 to use this parameter inappropriately.
2317                 </para>
2318
2319             <para><indexterm>
2320                 <primary>valid users</primary>
2321               </indexterm>
2322                 A far better solution would be to use the <parameter>valid users</parameter> by specifying
2323                 precisely the Domain users and groups that should be permitted access to the shares. You could, 
2324                 for example, set the following parameters:
2325 <screen>
2326 [demoshare]
2327         path = /export/demodata
2328         valid users = @"Domain Users", @"OTHERDOMAIN\Domain Users"
2329 </screen>
2330                 </para>
2331
2332
2333         </answer>
2334         </qandaentry>
2335
2336         <qandaentry>
2337         <question>
2338
2339                 <para>
2340                 What are the benefits of using LDAP for my Domain Member servers?
2341                 </para>
2342
2343         </question>
2344         <answer>
2345
2346             <para><indexterm>
2347                 <primary>LDAP</primary>
2348               </indexterm><indexterm>
2349                 <primary>benefit</primary>
2350               </indexterm><indexterm>
2351                 <primary>UID</primary>
2352               </indexterm><indexterm>
2353                 <primary>GID</primary>
2354               </indexterm><indexterm>
2355                 <primary>Domain Controllers</primary>
2356               </indexterm><indexterm>
2357                 <primary>Domain Member servers</primary>
2358               </indexterm><indexterm>
2359                 <primary>copy</primary>
2360               </indexterm><indexterm>
2361                 <primary>replicate</primary>
2362               </indexterm><indexterm>
2363                 <primary>identity</primary>
2364               </indexterm>
2365                 The key benefit of using LDAP is that the UID of all users and the GID of all groups
2366                 are globally consistent on Domain Controllers as well as on Domain Member servers.
2367                 This means that it is possible to copy/replicate files across servers without
2368                 loss of identity.
2369                 </para>
2370
2371             <para><indexterm>
2372                 <primary>Identity resolution</primary>
2373               </indexterm><indexterm>
2374                 <primary>winbind</primary>
2375               </indexterm><indexterm>
2376                 <primary>IDMAP backend</primary>
2377               </indexterm><indexterm>
2378                 <primary>LDAP</primary>
2379               </indexterm><indexterm>
2380                 <primary>Domain Controllers</primary>
2381               </indexterm><indexterm>
2382                 <primary>Domain Member</primary>
2383                 <secondary>servers</secondary>
2384               </indexterm><indexterm>
2385                 <primary>Posix</primary>
2386               </indexterm><indexterm>
2387                 <primary>account information</primary>
2388               </indexterm>
2389                 When use is made of account Identity resolution via winbind, even when an IDMAP backend
2390                 is stored in LDAP, the UID/GID on Domain Member servers is consistent, but differs
2391                 from the ID that the user/group has on Domain Controllers. The winbind allocated UID/GID
2392                 that is stored in LDAP (or locally) will be in the numeric range specified in the <parameter>
2393                 idmap uid/gid</parameter> in the &smb.conf; file. On Domain Controllers, the UID/GID is
2394                 that of the Posix value assigned in the LDAP directory as part of the Posix account information.
2395                 </para>
2396
2397         </answer>
2398         </qandaentry>
2399
2400         <qandaentry>
2401         <question>
2402
2403                 <para>
2404                 Is proper DNS operation necessary for Samba-3 plus LDAP? If so, what must I put into
2405                 my DNS configuration?
2406                 </para>
2407
2408         </question>
2409         <answer>
2410
2411             <para><indexterm>
2412                 <primary>DNS</primary>
2413                 <secondary>configuration</secondary>
2414               </indexterm><indexterm>
2415                 <primary>DNS</primary>
2416                 <secondary>lookup</secondary>
2417               </indexterm><indexterm>
2418                 <primary>hosts</primary>
2419               </indexterm><indexterm>
2420                 <primary>/etc/nsswitch.conf</primary>
2421               </indexterm><indexterm>
2422                 <primary>NSS</primary>
2423               </indexterm><indexterm>
2424                 <primary>/etc/hosts</primary>
2425               </indexterm><indexterm>
2426                 <primary>WINS</primary>
2427                 <secondary>lookup</secondary>
2428               </indexterm>
2429                 Samba depends on correctly functioning resolution of host names to their IP address. Samba
2430                 makes no direct DNS lookup calls, but rather redirects all name to address calls via the
2431                 <command>getXXXbyXXX()</command> function calls. The configuration of the <constant>hosts</constant>
2432                 entry in the NSS <filename>/etc/nsswitch.conf</filename> file determines how the underlying
2433                 resolution process is implemented. If the <constant>hosts</constant> entry in your NSS
2434                 control file says:
2435 <screen>
2436 hosts: files dns wins
2437 </screen>
2438                 This means that a host name lookup first tries the <filename>/etc/hosts</filename>.
2439                 If this fails to resolve, it attempts a DNS lookup and if that fails, it tries a
2440                 WINS lookup.
2441                 </para>
2442
2443             <para><indexterm>
2444                 <primary>NetBIOS</primary>
2445               </indexterm><indexterm>
2446                 <primary>TCP/IP</primary>
2447               </indexterm><indexterm>
2448                 <primary>name resolution</primary>
2449               </indexterm>
2450                 The addition of the WINS-based name lookup makes sense only if NetBIOS over TCP/IP has
2451                 been enabled on all Windows clients. Where NetBIOS over TCP/IP has been disabled, DNS
2452                 is the preferred name resolution technology. This usually makes most sense when Samba
2453                 is a client of an Active Directory Domain, where NetBIOS use has been disabled. In this
2454                 case, the Windows 200x auto-registers all locator records it needs with its own DNS
2455                 server/s.
2456                 </para>
2457
2458         </answer>
2459         </qandaentry>
2460
2461         <qandaentry>
2462         <question>
2463
2464                 <para>
2465                 Our Windows 2003 Server Active Directory Domain runs with NetBIOS disabled. Can we
2466                 use Samba-3 with that configuration?
2467                 </para>
2468
2469         </question>
2470         <answer>
2471
2472                 <para>
2473                 Yes.
2474                 </para>
2475
2476         </answer>
2477         </qandaentry>
2478
2479         <qandaentry>
2480         <question>
2481
2482             <para><indexterm>
2483                 <primary>net</primary>
2484                 <secondary>ads</secondary>
2485                 <tertiary>join</tertiary>
2486               </indexterm><indexterm>
2487                 <primary>net</primary>
2488                 <secondary>rpc</secondary>
2489                 <tertiary>join</tertiary>
2490               </indexterm>
2491                 When I tried to execute <quote>net ads join</quote>, I got no output. It did not work, so
2492                 I think that it failed. I then executed <quote>net rpc join</quote> and that worked fine.
2493                 That is okay, isn't it?
2494                 </para>
2495
2496         </question>
2497         <answer>
2498
2499             <para><indexterm>
2500                 <primary>Kerberos</primary>
2501               </indexterm><indexterm>
2502                 <primary>authentication</primary>
2503               </indexterm>
2504                 No. This is not okay. It means that your Samba-3 client has joined the ADS Domain as
2505                 a Windows NT4 client, and Samba-3 will not be using Kerberos-based authentication.
2506                 </para>
2507
2508         </answer>
2509         </qandaentry>
2510
2511         </qandaset>
2512
2513 </sect1>
2514
2515 </chapter>