Another update.
[Samba/gebeck_regimport.git] / docs / Samba-Guide / SBE-AddingUNIXClients.xml
blob49db512a44e2ee2bea427588129843a988341867
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>
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 2 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 <emphasis>Open Magazine</emphasis> found 
13         that of all respondents, 97 percent use Samba for file and print services, and 68 percent 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, are shown in
16         <link linkend="ch09openmag"/>.
17         </para>
19         <image id="ch09openmag">
20                 <imagedescription>Open Magazine Samba Survey</imagedescription>
21                 <imagefile scale="60">openmag</imagefile>
22         </image>
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 our good friends at Abmas.
30         </para>
32 <sect1>
33         <title>Introduction</title>
35       <para><indexterm>
36           <primary>Linux desktop</primary>
37         </indexterm><indexterm>
38           <primary>Domain Member</primary>
39           <secondary>server</secondary>
40         </indexterm>
41         Looking back over the achievements of the past year or two, daily events at Abmas are rather straightforward
42         with not too many distractions or problems. 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>
47       <para><indexterm>
48           <primary>Domain Member</primary>
49           <secondary>desktop</secondary>
50         </indexterm>
51         Stan 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.
54         </para>
56         <sect2>
57         <title>Assignment Tasks</title>
59         <para><indexterm>
60             <primary>Active Directory</primary>
61           </indexterm>
62         You must now add UNIX/Linux domain member servers to your network. You have a friend who has a Windows 2003
63         Active Directory domain network who wants to add a Samba/Linux server and has asked Christine to help him
64         out. Your real objective is to help Christine to see more of the way the Microsoft world lives and use
65         her help to get validation that Samba really does live up to expectations.
66         </para>
68         <para>
69         Over the past 6 months, you have hired several new staff who want Linux on their desktops. You must integrate
70         these systems to make sure that Abmas is not building islands of technology. You ask Christine to
71         do likewise at Swodniw Biz NL (your friend's company) to help them to evaluate a Linux desktop. You want to make
72         the right decision, don't you?
73         </para>
75         </sect2>
76 </sect1>
78 <sect1>
79         <title>Dissection and Discussion</title>
81         <para>
82         <indexterm><primary>winbind</primary></indexterm>
83         Recent Samba mailing-list activity is witness to how many sites are using winbind. Some have no trouble
84         at all with it, yet to others the problems seem insurmountable. Periodically there are complaints concerning
85         an inability to achieve identical user and group IDs between Windows and UNIX environments.
86         </para>
88         <para>
89         You provide step-by-step implementations of the various tools that can be used for identity
90         resolution. You also provide working examples of solutions for integrated authentication for
91         both UNIX/Linux and Windows environments.
92         </para>
94         <sect2>
95                 <title>Technical Issues</title>
97                 <para>
98                 One of the great challenges we face when people ask us, <quote>What is the best way to solve
99                 this problem?</quote> is to get beyond the facts so we not only can clearly comprehend
100                 the immediate technical problem, but also can understand how needs may change.
101                 </para>
103                 <para>
104                 <indexterm><primary>integrate</primary></indexterm>
105                 There are a few facts we should note when dealing with the question of how best to
106                 integrate UNIX/Linux clients and servers into a Windows networking environment:
107                 </para>
109                 <itemizedlist>
110                         <listitem><para>
111                         <indexterm><primary>Domain Controller</primary></indexterm>
112                         <indexterm><primary>authoritative</primary></indexterm>
113                         <indexterm><primary>accounts</primary><secondary>authoritative</secondary></indexterm>
114                         <indexterm><primary>PDC</primary></indexterm>
115                         <indexterm><primary>BDC</primary></indexterm>
116                         A domain controller (PDC or BDC) is always authoritative for all accounts in its domain.
117                         This means that a BDC must (of necessity) be able to resolve all account UIDs and GIDs
118                         to the same values that the PDC resolved them to.
119                         </para></listitem>
121                         <listitem><para>
122                         <indexterm><primary>local accounts</primary></indexterm>
123                         <indexterm><primary>Domain Member</primary><secondary>authoritative</secondary><tertiary>local accounts</tertiary></indexterm>
124                         <indexterm><primary>Domain accounts</primary></indexterm>
125                         <indexterm><primary>winbindd</primary></indexterm>
126                         A domain member can be authoritative for local accounts, but is never authoritative for
127                         domain accounts. If a user is accessing a domain member server and that user's account
128                         is not known locally, the domain member server must resolve the identity of that user
129                         from the domain in which that user's account resides. It must then map that ID to a
130                         UID/GID pair that it can use locally. This is handled by <command>winbindd</command>.
131                         </para></listitem>
133                         <listitem><para>
134                         Samba, when running on a domain member server, can resolve user identities from a
135                         number of sources:
136                         </para>
138                         <itemizedlist>
139                                 <listitem><para>
140                                 <indexterm><primary>getpwnam</primary></indexterm>
141                                 <indexterm><primary>getgrnam</primary></indexterm>
142                                 <indexterm><primary>NSS</primary></indexterm>
143                                 <indexterm><primary>LDAP</primary></indexterm>
144                                 <indexterm><primary>NIS</primary></indexterm>
145                                 By executing a system <command>getpwnam()</command> or <command>getgrnam()</command> call. 
146                                 On systems that support it, this utilizes the name service switch (NSS) facility to 
147                                 resolve names according to the configuration of the <filename>/etc/nsswitch.conf</filename> 
148                                 file. NSS can be configured to use LDAP, winbind, NIS, or local files.
149                                 </para></listitem>
151                                 <listitem><para>
152                                 <indexterm><primary>passdb backend</primary></indexterm>
153                                 <indexterm><primary>PADL</primary></indexterm>
154                                 <indexterm><primary>nss_ldap</primary></indexterm>
155                                 Performing, via NSS, a direct LDAP search (where an LDAP passdb backend has been configured).
156                                 This requires the use of the PADL nss_ldap tool (or equivalent).
157                                 </para></listitem>
159                                 <listitem><para>
160                                 <indexterm><primary>winbindd</primary></indexterm>
161                                 <indexterm><primary>SID</primary></indexterm>
162                                 <indexterm><primary>winbindd_idmap.tdb</primary></indexterm>
163                                 <indexterm><primary>winbindd_cache.tdb</primary></indexterm>
164                                 Directly by querying <command>winbindd</command>. The <command>winbindd</command>
165                                 contacts a domain controller to attempt to resolve the identity of the user or group. It
166                                 receives the Windows networking security identifier (SID) for that appropriate
167                                 account and then allocates a local UID or GID from the range of available IDs and
168                                 creates an entry in its <filename>winbindd_idmap.tdb</filename> and 
169                                 <filename>winbindd_cache.tdb</filename> files.
170                                 </para>
172                                 <para>
173                                 <indexterm><primary>idmap backend</primary></indexterm>
174                                 <indexterm><primary>mapping</primary></indexterm>
175                                 If the parameter <smbconfoption name="idmap backend">ldap:ldap://myserver.domain</smbconfoption>
176                                 was specified and the LDAP server has been configured with a container in which it may
177                                 store the IDMAP entries, all domain members may share a common mapping.
178                                 </para></listitem>
179                         </itemizedlist>
181                         <para>
182                         Irrespective of how &smb.conf; is configured, winbind creates and caches a local copy of
183                         the ID mapping database. It uses the <filename>winbindd_idmap.tdb</filename> and
184                                 <filename>winbindd_cache.tdb</filename> files to do this.
185                         </para>
187                         <para>
188                         Which of the resolver methods is chosen is determined by the way that Samba is configured 
189                         in the &smb.conf; file. Some of the configuration options are rather less than obvious to the 
190                         casual user.
191                         </para></listitem>
193                         <listitem><para>
194                         <indexterm><primary>winbind enable local accounts</primary></indexterm>
195                         <indexterm><primary>Domain Member</primary><secondary>servers</secondary></indexterm>
196                         <indexterm><primary>Domain Controllers</primary></indexterm>
197                         If you wish to make use of accounts (users and/or groups) that are local to (i.e., capable
198                         of being resolved using) the NSS facility, it is imperative to use the 
199                         <smbconfoption name="winbind enable local accounts">Yes</smbconfoption>
200                         in the &smb.conf; file. This parameter specifically applies only to domain controllers, 
201                         not to domain member servers.
202                         </para></listitem>
204                 </itemizedlist>
206                 <para>
207                 <indexterm><primary>Posix accounts</primary></indexterm>
208                 <indexterm><primary>Samba accounts</primary></indexterm>
209                 <indexterm><primary>LDAP</primary></indexterm>
210                 For many administrators, it should be plain that the use of an LDAP-based repository for all network
211                 accounts (both for POSIX accounts and for Samba accounts) provides the most elegant and
212                 controllable facility. You eventually appreciate the decision to use LDAP.
213                 </para>
215                 <para>
216                 <indexterm><primary>nss_ldap</primary></indexterm>
217                 <indexterm><primary>identifiers</primary></indexterm>
218                 <indexterm><primary>resolve</primary></indexterm>
219                 If your network account information resides in an LDAP repository, you should use it ahead of any
220                 alternative method. This means that if it is humanly possible to use the <command>nss_ldap</command>
221                 tools to resolve UNIX account UIDs/GIDs via LDAP, this is the preferred solution, because it provides
222                 a more readily controllable method for asserting the exact same user and group identifiers 
223                 throughout the network.
224                 </para>
226                 <para>
227                 <indexterm><primary>Domain Member</primary><secondary>server</secondary></indexterm>
228                 <indexterm><primary>winbind trusted domains only</primary></indexterm>
229                 <indexterm><primary>getpwnam</primary></indexterm>
230                 <indexterm><primary>smbd</primary></indexterm>
231                 <indexterm><primary>Trusted Domains</primary></indexterm>
232                 <indexterm><primary>External Domains</primary></indexterm>
233                 In the situation where UNIX accounts are held on the domain member server itself, the only effective
234                 way to use them involves the &smb.conf; entry 
235                 <smbconfoption name="winbind trusted domains only">Yes</smbconfoption>. This forces 
236                 Samba (<command>smbd</command>) to perform a <command>getpwnam()</command> system call that can
237                 then be controlled via <filename>/etc/nsswitch.conf</filename> file settings. The use of this parameter
238                 disables the use of Samba with trusted domains (i.e., external domains).
239                 </para>
241                 <para>
242                 <indexterm><primary>appliance mode</primary></indexterm>
243                 <indexterm><primary>Domain Member</primary><secondary>server</secondary></indexterm>
244                 <indexterm><primary>winbindd</primary></indexterm>
245                 <indexterm><primary>automatically allocate</primary></indexterm>
246                 Winbind can be used to create an appliance mode domain member server. In this capacity, <command>winbindd</command>
247                 is configured to automatically allocate UIDs/GIDs from numeric ranges set in the &smb.conf; file. The allocation
248                 is made for all accounts that connect to that domain member server, whether within its own domain or from
249                 trusted domains. If not stored in an LDAP backend, each domain member maintains its own unique mapping database.
250                 This means that it is almost certain that a given user who accesses two domain member servers does not have the
251                 same UID/GID on both servers &smbmdash; however, this is transparent to the Windows network user. This data
252                 is stored in the <filename>winbindd_idmap.tdb</filename> and <filename>winbindd_cache.tdb</filename> files.
253                 </para>
254         
255                 <para>
256                 <indexterm><primary>mapping</primary></indexterm>
257                 The use of an LDAP backend for the Winbind IDMAP facility permits Windows domain SIDs
258                 mappings to UIDs/GIDs to be stored centrally. The result is a consistent mapping across all domain member
259                 servers so configured. This solves one of the major headaches for network administrators who need to copy
260                 files between or across network file servers.
261                 </para>
263         </sect2>
265         <sect2>
266                 <title>Political Issues</title>
268                 <para>
269                 <indexterm><primary>OpenLDAP</primary></indexterm>
270                 <indexterm><primary>NIS</primary></indexterm>
271                 <indexterm><primary>yellow pages</primary><see>NIS</see></indexterm>
272                 <indexterm><primary>identity management</primary></indexterm>
273                 One of the most fierce conflicts recently being waged is resistance to the adoption of LDAP, in
274                 particular OpenLDAP, as a replacement for UNIX NIS (previously called Yellow Pages). Let's face it, LDAP
275                 is different and requires a new approach to the need for a better identity management solution. The more
276                 you work with LDAP, the more its power and flexibility emerges from its dark, cavernous chasm.
277                 </para>
279                 <para>
280                 LDAP is a most suitable solution for heterogenous environments. If you need crypto, add Kerberos. 
281                 The reason these are preferable is because they are heterogenous. Windows solutions of this sort are <emphasis>not</emphasis> 
282                 heterogenous by design. This is fundamental &smbmdash; it isn't religious or political. This also doesn't say that 
283                 you can't use Windows Active Directory in a heterogenous environment &smbmdash; it can be done, it just requires 
284                 commercial integration products. But it's not what Active Directory was designed for.
285                 </para>
287                 <para>
288                 <indexterm><primary>directory</primary></indexterm>
289                 <indexterm><primary>management</primary></indexterm>
290                 A number of long-term UNIX devotees have recently commented in various communications that the Samba Team
291                 is the first application group to almost force network administrators to use LDAP. It should be pointed
292                 out that we resisted this for as long as we could. It is not out of laziness or malice that LDAP has
293                 finally emerged as the preferred identity management backend for Samba. We recommend LDAP for your total
294                 organizational directory needs.
295                 </para>
297         </sect2>
299 </sect1>
301 <sect1>
302         <title>Implementation</title>
304         <para>
305         <indexterm><primary>Domain Member</primary><secondary>server</secondary></indexterm>
306         <indexterm><primary>Domain Member</primary><secondary>client</secondary></indexterm>
307         <indexterm><primary>Domain Controller</primary></indexterm>
308         The domain member server and the domain member client are at the center of focus in this chapter.
309         Configuration of Samba-3 domain controller is covered in earlier chapters, so if your 
310         interest is in domain controller configuration, you will not find that here. You will find good
311         oil that helps you to add domain member servers and clients.
312         </para>
314         <para>
315         <indexterm><primary>Domain Member</primary><secondary>workstations</secondary></indexterm>
316         In practice, domain member servers and domain member workstations are very different entities, but in
317         terms of technology they share similar core infrastructure. A technologist would argue that servers
318         and workstations are identical. Many users would argue otherwise, given that in a well-disciplined
319         environment a workstation (client) is a device from which a user creates documents and files that
320         are located on servers. A workstation is frequently viewed as a disposable (easy to replace) item,
321         but a server is viewed as a core component of the business.
322         </para>
324         <para>
325         <indexterm><primary>workstation</primary></indexterm>
326         We can look at this another way. If a workstation breaks down, one user is affected, but if a
327         server breaks down, hundreds of users may not be able to work. The services that a workstation
328         must provide are document- and file-production oriented; a server provides information storage
329         and is distribution oriented.
330         </para>
332         <para>
333         <indexterm><primary>authentication process</primary></indexterm>
334         <indexterm><primary>logon process</primary></indexterm>
335         <indexterm><primary>user identities</primary></indexterm>
336         <emphasis>Why is this important?</emphasis> For starters, we must identify what
337         components of the operating system and its environment must be configured. Also, it is necessary
338         to recognize where the interdependencies between the various services to be used are.
339         In particular, it is important to understand the operation of each critical part of the
340         authentication process, the logon process, and how user identities get resolved and applied
341         within the operating system and applications (like Samba) that depend on this and may
342         actually contribute to it.
343         </para>
345         <para>
346         So, in this chapter we demonstrate how to implement the technology. It is done within a context of
347         what type of service need must be fulfilled.
348         </para>
350         <sect2 id="sdcsdmldap">
351         <title>Samba Domain with Samba Domain Member Server &smbmdash; Using NSS LDAP</title>
353         <para>
354         <indexterm><primary>ldapsam</primary></indexterm>
355         <indexterm><primary>ldapsam backend</primary></indexterm>
356         <indexterm><primary>IDMAP</primary></indexterm>
357         <indexterm><primary>mapping</primary><secondary>consistent</secondary></indexterm>
358         <indexterm><primary>winbindd</primary></indexterm>
359         <indexterm><primary>foreign SID</primary></indexterm>
360         In this example, it is assumed that you have Samba PDC/BDC servers. This means you are using
361         an LDAP ldapsam backend. We are adding to the LDAP backend database (directory)
362         containers for use by the IDMAP facility. This makes it possible to have globally consistent
363         mapping of SIDs to and from UIDs and GIDs. This means that it is necessary to run 
364         <command>winbindd</command> as part of your configuration. The primary purpose of running
365         <command>winbindd</command> (within this operational context) is to permit mapping of foreign
366         SIDs (those not originating from the the local Samba server). Foreign SIDs can come from any
367         domain member client or server, or from Windows clients that do not belong to a domain. Another
368         way to explain the necessity to run <command>winbindd</command> is that Samba can locally
369         resolve only accounts that belong to the security context of its own machine SID. Winbind
370         handles all non-local SIDs and maps them to a local UID/GID value. The UID and GID are allocated
371         from the parameter values set in the &smb.conf; file for the <parameter>idmap uid</parameter> and
372         <parameter>idmap gid</parameter> ranges. Where LDAP is used, the mappings can be stored in LDAP
373         so that all domain member servers can use a consistent mapping.
374         </para>
376         <para>
377         <indexterm><primary>winbindd</primary></indexterm>
378         <indexterm><primary>getpwnam</primary></indexterm>
379         <indexterm><primary>NSS</primary></indexterm>
380         If your installation is accessed only from clients that are members of your own domain, and all 
381         user accounts are present in a local passdb backend then it is not necessary to run
382         <command>winbindd</command>. The local passdb backend can be in smbpasswd, tdbsam, or in ldapsam.
383         </para>
385         <para>
386         It is possible to use a local passdb backend with any convenient means of resolving the POSIX
387         user and group account information. The POSIX information is usually obtained using the
388         <command>getpwnam()</command> system call. On NSS-enabled systems, the actual POSIX account
389         source can be provided from
390         </para>
392         <itemizedlist>
393                 <listitem><para>
394                 <indexterm><primary>/etc/passwd</primary></indexterm>
395                 <indexterm><primary>/etc/group</primary></indexterm>
396                 Accounts in <filename>/etc/passwd</filename> or in <filename>/etc/group</filename>.
397                 </para></listitem>
399                 <listitem><para>
400                 <indexterm><primary>NSS</primary></indexterm>
401                 <indexterm><primary>compat</primary></indexterm>
402                 <indexterm><primary>ldap</primary></indexterm>
403                 <indexterm><primary>nis</primary></indexterm>
404                 <indexterm><primary>nisplus</primary></indexterm>
405                 <indexterm><primary>hesiod</primary></indexterm>
406                 <indexterm><primary>ldap</primary></indexterm>
407                 <indexterm><primary>nss_ldap</primary></indexterm>
408                 <indexterm><primary>PADL Software</primary></indexterm>
409                 Resolution via NSS. On NSS-enabled systems, there is usually a facility to resolve IDs
410                 via multiple methods. The methods typically include <command>files</command>,
411                 <command>compat</command>, <command>db</command>, <command>ldap</command>, 
412                 <command>nis</command>, <command>nisplus</command>, <command>hesiod.</command>  When
413                 correctly installed, Samba adds to this list the <command>winbindd</command> facility.
414                 The ldap facility is frequently the nss_ldap tool provided by PADL Software.
415                 </para></listitem>
416         </itemizedlist>
418         <note><para>
419         To advoid confusion the use of the term <literal>local passdb backend</literal> means that
420         the user account backend is not shared by any other Samba server &smbmdash; instead, it is
421         used only locally on the Samba domain member server under discussion.
422         </para></note>
424         <para>
425         <indexterm><primary>Identity resolution</primary></indexterm>
426         The diagram in <link linkend="ch9-sambadc"/> demonstrates the relationship of Samba and system 
427         components that are involved in the identity resolution process where Samba is used as a domain
428         member server within a Samba domain control network.
429         </para>
431 <image id="ch9-sambadc">
432         <imagedescription>Samba Domain: Samba Member Server</imagedescription>
433         <imagefile scale="60">chap9-SambaDC</imagefile>
434 </image>
436         <para>
437         <indexterm><primary>IDMAP</primary></indexterm>
438         <indexterm><primary>foreign</primary></indexterm>
439         In this example configuration, Samba will directly search the LDAP-based passwd backend ldapsam
440         to obtain authentication and user identity information. The IDMAP information is stored in the LDAP
441         backend so that it can be shared by all domain member servers so that every user will have a
442         consistent UID and GID across all of them. The IDMAP facility will be used for all foreign
443         (i.e., not having the same SID as the domain it is a member of) domains. The configuration of 
444         NSS will ensure that all UNIX processes will obtain a consistent UID/GID.
445         </para>
447         <para>
448         The instructions given here apply to the Samba environment shown in <link linkend="happy"/> and <link linkend="2000users"/>.
449         If the network does not have an LDAP slave server (i.e., <link linkend="happy"/> configuration), 
450         change the target LDAP server from <constant>lapdc</constant> to <constant>massive.</constant>
451         </para>
453         <procedure>
454         <title>Configuration of NSS_LDAP-Based Identity Resolution</title>
456                 <step><para>
457                 Create the &smb.conf; file as shown in <link linkend="ch9-sdmsdc"/>. Locate
458                 this file in the directory <filename>/etc/samba</filename>.
459                 </para></step>
461                 <step><para>
462                 <indexterm><primary>ldap.conf</primary></indexterm>
463                 Configure the file that will be used by <constant>nss_ldap</constant> to
464                 locate and communicate with the LDAP server. This file is called <filename>ldap.conf</filename>.
465                 If your implementation of <constant>nss_ldap</constant> is consistent with
466                 the defaults suggested by PADL (the authors), it will be located in the
467                 <filename>/etc</filename> directory. On some systems, the default location is
468                 the <filename>/etc/openldap</filename> directory, however this file is intended
469                 for use by the OpenLDAP utilities and should not really be used by the nss_ldap
470                 utility since its content and structure serves the specific purpose of enabling
471                 the resolution of user and group IDs via NSS.
472                 </para>
474                 <para>
475                 Change the parameters inside the file that is located on your OS so it matches
476                 <link linkend="ch9-sdmlcnf"/>.  To find the correct location of this file, you
477                 can obtain this from the library that will be used by executing the following:
478 <screen>
479 &rootprompt; strings /lib/libnss_ldap* | grep ldap.conf
480 /etc/ldap.conf
481 </screen>
482                 </para></step>
484                 <step><para>
485                 Configure the NSS control file so it matches the one shown in
486                 <link linkend="ch9-sdmnss"/>.
487                 </para></step>
489                 <step><para>
490                 <indexterm><primary>Identity resolution</primary></indexterm>
491                 <indexterm><primary>getent</primary></indexterm>
492                 Before proceeding to configure Samba, validate the operation of the NSS identity 
493                 resolution via LDAP by executing:
494 <screen>
495 &rootprompt; getent passwd
497 root:x:0:512:Netbios Domain Administrator:/root:/bin/false
498 nobody:x:999:514:nobody:/dev/null:/bin/false
499 bobj:x:1000:513:Robert Jordan:/home/bobj:/bin/bash
500 stans:x:1001:513:Stanley Soroka:/home/stans:/bin/bash
501 chrisr:x:1002:513:Christine Roberson:/home/chrisr:/bin/bash
502 maryv:x:1003:513:Mary Vortexis:/home/maryv:/bin/bash
503 jht:x:1004:513:John H Terpstra:/home/jht:/bin/bash
504 bldg1$:x:1006:553:bldg1$:/dev/null:/bin/false
505 temptation$:x:1009:553:temptation$:/dev/null:/bin/false
506 vaioboss$:x:1005:553:vaioboss$:/dev/null:/bin/false
507 fran$:x:1008:553:fran$:/dev/null:/bin/false
508 josephj:x:1007:513:Joseph James:/home/josephj:/bin/bash
509 </screen>
510                 You should notice the location of the users' home directories. First, make certain that
511                 the home directories exist on the domain member server; otherwise, the home directory
512                 share is not available. The home directories could be mounted off a domain controller
513                 using NFS or by any other suitable means. Second, the absence of the domain name in the
514                 home directory path is indicative that identity resolution is not being done via winbind.
515 <screen>
516 &rootprompt; getent group
518 Domain Admins:x:512:root,jht
519 Domain Users:x:513:bobj,stans,chrisr,maryv,jht,josephj
520 Domain Guests:x:514:
521 Accounts:x:1000:
522 Finances:x:1001:
523 PIOps:x:1002:
524 sammy:x:4321:
525 </screen>
526                 <indexterm><primary>secondary group</primary></indexterm>
527                 <indexterm><primary>primary group</primary></indexterm>
528                 <indexterm><primary>group membership</primary></indexterm>
529                 This shows that all is working as it should be. Notice that in the LDAP database
530                 the users' primary and secondary group memberships are identical. It is not
531                 necessary to add secondary group memberships (in the group database) if the
532                 user is already a member via primary group membership in the password database.
533                 When using winbind, it is in fact undesirable to do this because it results in
534                 doubling up of group memberships and may cause problems with winbind under certain 
535                 conditions. It is intended that these limitations with winbind will be resolved soon
536                 after Samba-3.0.20 has been released.
537                 </para></step>
539                 <step><para>
540                 <indexterm><primary>slapcat</primary></indexterm>
541                 The LDAP directory must have a container object for IDMAP data. There are several ways you can
542                 check that your LDAP database is able to receive IDMAP information. One of the simplest is to
543                 execute:
544 <screen>
545 &rootprompt; slapcat | grep -i idmap
546 dn: ou=Idmap,dc=abmas,dc=biz
547 ou: idmap
548 </screen>
549                 <indexterm><primary>ldapadd</primary></indexterm>
550                 If the execution of this command does not return IDMAP entries, you need to create an LDIF
551                 template file (see <link linkend="ch9-ldifadd"/>). You can add the required entries using
552                 the following command:
553 <screen>
554 &rootprompt; ldapadd -x -D "cn=Manager,dc=abmas,dc=biz" \
555                 -w not24get &lt; /etc/openldap/idmap.LDIF
556 </screen>
557                 </para></step>
559                 <step><para>
560                 Samba automatically populates the LDAP directory container when it needs to. To permit Samba
561                 write access to the LDAP directory it is necessary to set the LDAP administrative password
562                 in the <filename>secrets.tdb</filename> file as shown here:
563 <screen>
564 &rootprompt; smbpasswd -w not24get
565 </screen>
566                 </para></step>
568                 <step><para>
569                 <indexterm><primary>net</primary><secondary>rpc</secondary><tertiary>join</tertiary></indexterm>
570                 <indexterm><primary>Domain join</primary></indexterm>
571                 The system is ready to join the domain. Execute the following:
572 <screen>
573 &rootprompt; net rpc join -U root%not24get
574 Joined domain MEGANET2.
575 </screen>
576                 This indicates that the domain join succeeded.
577                 </para>
579                 <para>
580                 Failure to join the domain could be caused by any number of variables. The most common
581                 causes of failure to join are:
582                 </para>
584                 <para>
585                 <itemizedlist>
586                         <listitem><para>Broken resolution of NetBIOS names to the respective IP address.</para></listitem>
587                         <listitem><para>Incorrect username and password credentials.</para></listitem>
588                         <listitem><para>The NT4 <parameter>restrict anonymous</parameter> is set to exclude anonymous
589                                 connections.</para></listitem>
590                 </itemizedlist> 
591                 </para>
593                 <para>
594                 The connection setup can be diagnosed by executing:
595 <screen>
596 &rootprompt; net rpc join -S 'pdc-name' -U administrator%password -d 5
597 </screen>
598                 <indexterm><primary>failed</primary></indexterm>
599                 <indexterm><primary>failed join</primary></indexterm>
600                 <indexterm><primary>rejected</primary></indexterm>
601                 <indexterm><primary>restrict anonymous</primary></indexterm>
602                 Note: Use "root" for UNIX/Linux and Samba, use "Administrator" for Windows NT4/200X. If the cause of
603                 the failure appears to be related to a rejected or failed NT_SESSION_SETUP*  or an error message that
604                 says NT_STATUS_ACCESS_DENIED immediately check the Windows registry setting that controls the
605                 <constant>restrict anonymous</constant> setting. Set this to the value 0 so that an anonymous connection
606                 can be sustained, then try again.
607                 </para>
609                 <para>
610                 It is possible (perhaps even recommended) to use the following to validate the ability to connect
611                 to an NT4 PDC/BDC:
612 <screen>
613 &rootprompt; net rpc info -S 'pdc-name' -U Administrator%not24get
614 Domain Name: MEGANET2
615 Domain SID: S-1-5-21-422319763-4138913805-7168186429
616 Sequence number: 1519909596
617 Num users: 7003
618 Num domain groups: 821
619 Num local groups: 8
621 &rootprompt; net rpc testjoin -S 'pdc-name' -U Administrator%not24get
622 Join to 'MEGANET2' is OK
623 </screen>
624                 If for any reason the following response is obtained to the last command above,it is time to
625                 call in the Networking Super-Snooper task force (i.e., start debugging):
626 <screen>
627 NT_STATUS_ACCESS_DENIED
628 Join to 'MEGANET2' failed.
629 </screen>
630                 </para></step>
632                 <step><para>
633                 <indexterm><primary>wbinfo</primary></indexterm>
634                 Just joining the domain is not quite enough; you must now provide a privileged set
635                 of credentials through which <command>winbindd</command> can interact with the 
636                 domain servers. Execute the following to implant the necessary credentials:
637 <screen>
638 &rootprompt; wbinfo --set-auth-user=Administrator%not24get
639 </screen>
640                 The configuration is now ready to obtain the Samba domain user and group information.
641                 </para></step>
643                 <step><para>
644                 You may now start Samba in the usual manner, and your Samba domain member server
645                 is ready for use. Just add shares as required.
646                 </para></step>
648         </procedure>
650 <smbconfexample id="ch9-sdmsdc">
651 <title>Samba Domain Member in Samba Domain Using LDAP &smbmdash; &smb.conf; File</title>
652 <smbconfcomment>Global parameters</smbconfcomment>
653 <smbconfsection name="[global]"/>
654 <smbconfoption name="unix charset">LOCALE</smbconfoption>
655 <smbconfoption name="workgroup">MEGANET2</smbconfoption>
656 <smbconfoption name="security">DOMAIN</smbconfoption>
657 <smbconfoption name="username map">/etc/samba/smbusers</smbconfoption>
658 <smbconfoption name="log level">10</smbconfoption>
659 <smbconfoption name="syslog">0</smbconfoption>
660 <smbconfoption name="log file">/var/log/samba/%m</smbconfoption>
661 <smbconfoption name="max log size">50</smbconfoption>
662 <smbconfoption name="smb ports">139 445</smbconfoption>
663 <smbconfoption name="name resolve order">wins bcast hosts</smbconfoption>
664 <smbconfoption name="printcap name">CUPS</smbconfoption>
665 <smbconfoption name="wins server">192.168.2.1</smbconfoption>
666 <smbconfoption name="ldap suffix">dc=abmas,dc=biz</smbconfoption>
667 <smbconfoption name="ldap machine suffix">ou=People</smbconfoption>
668 <smbconfoption name="ldap user suffix">ou=People</smbconfoption>
669 <smbconfoption name="ldap group suffix">ou=Groups</smbconfoption>
670 <smbconfoption name="ldap idmap suffix">ou=Idmap</smbconfoption>
671 <smbconfoption name="ldap admin dn">cn=Manager,dc=abmas,dc=biz</smbconfoption>
672 <smbconfoption name="idmap backend">ldap:ldap://lapdc.abmas.biz</smbconfoption>
673 <smbconfoption name="idmap uid">10000-20000</smbconfoption>
674 <smbconfoption name="idmap gid">10000-20000</smbconfoption>
675 <smbconfoption name="winbind trusted domains only">Yes</smbconfoption>
676 <smbconfoption name="printer admin">root</smbconfoption>
677 <smbconfoption name="printing">cups</smbconfoption>
679 <smbconfsection name="[homes]"/>
680 <smbconfoption name="comment">Home Directories</smbconfoption>
681 <smbconfoption name="valid users">%S</smbconfoption>
682 <smbconfoption name="read only">No</smbconfoption>
683 <smbconfoption name="browseable">No</smbconfoption>
685 <smbconfsection name="[printers]"/>
686 <smbconfoption name="comment">SMB Print Spool</smbconfoption>
687 <smbconfoption name="path">/var/spool/samba</smbconfoption>
688 <smbconfoption name="guest ok">Yes</smbconfoption>
689 <smbconfoption name="printable">Yes</smbconfoption>
690 <smbconfoption name="browseable">No</smbconfoption>
692 <smbconfsection name="[print$]"/>
693 <smbconfoption name="comment">Printer Drivers</smbconfoption>
694 <smbconfoption name="path">/var/lib/samba/drivers</smbconfoption>
695 <smbconfoption name="admin users">root, Administrator</smbconfoption>
696 <smbconfoption name="write list">root</smbconfoption>
697 </smbconfexample>
699 <example id="ch9-ldifadd">
700 <title>LDIF IDMAP Add-On Load File &smbmdash; File: /etc/openldap/idmap.LDIF</title>
701 <screen>
702 dn: ou=Idmap,dc=abmas,dc=biz
703 objectClass: organizationalUnit
704 ou: idmap
705 structuralObjectClass: organizationalUnit
706 </screen>
707 </example>
709 <example id="ch9-sdmlcnf">
710 <title>Configuration File for NSS LDAP Support &smbmdash; <filename>/etc/ldap.conf</filename></title>
711 <screen>
712 URI     ldap://massive.abmas.biz ldap://massive.abmas.biz:636
713 host    192.168.2.1
714 base    dc=abmas,dc=biz
715 binddn  cn=Manager,dc=abmas,dc=biz
716 bindpw  not24get
718 pam_password exop
720 nss_base_passwd ou=People,dc=abmas,dc=biz?one
721 nss_base_shadow ou=People,dc=abmas,dc=biz?one
722 nss_base_group  ou=Groups,dc=abmas,dc=biz?one
723 ssl     no
724 </screen>
725 </example>
727 <example id="ch9-sdmnss">
728 <title>NSS using LDAP for Identity Resolution &smbmdash; File: <filename>/etc/nsswitch.conf</filename></title>
729 <screen>
730 passwd:         files ldap
731 shadow:         files ldap
732 group:          files ldap
734 hosts:          files dns wins
735 networks:       files dns
737 services:       files
738 protocols:      files
739 rpc:            files
740 ethers:         files
741 netmasks:       files
742 netgroup:       files
743 publickey:      files
745 bootparams:     files
746 automount:      files
747 aliases:        files
748 </screen>
749 </example>
751         </sect2>
753         <sect2 id="wdcsdm">
754                 <title>NT4/Samba Domain with Samba Domain Member Server: Using NSS and Winbind</title>
756         <para>
757         You need to use this method for creating a Samba domain member server if any of the following conditions
758         prevail:
759         </para>
761         <itemizedlist>
762                 <listitem><para>
763                 LDAP support (client) is not installed on the system.
764                 </para></listitem>
766                 <listitem><para>
767                 There are mitigating circumstances forcing a decision not to use LDAP.
768                 </para></listitem>
770                 <listitem><para>
771                 The Samba domain member server must be part of a Windows NT4 Domain, or a Samba Domain.
772                 </para></listitem>
773         </itemizedlist>
775         <para>
776         <indexterm><primary>Windows ADS Domain</primary></indexterm>
777         <indexterm><primary>Samba Domain</primary></indexterm>
778         <indexterm><primary>LDAP</primary></indexterm>
779         Later in the chapter, you can see how to configure a Samba domain member server for a Windows ADS domain.
780         Right now your objective is to configure a Samba server that can be a member of a Windows NT4-style
781         domain and/or does not use LDAP.
782         </para>
784         <note><para>
785         <indexterm><primary>duplicate accounts</primary></indexterm>
786         If you use <command>winbind</command> for identity resolution, make sure that there are no
787         duplicate accounts.
788         </para>
790         <para>
791         <indexterm><primary>/etc/passwd</primary></indexterm>
792         For example, do not have more than one account that has UID=0 in the password database. If there 
793         is an account called <constant>root</constant> in the <filename>/etc/passwd</filename> database, 
794         it is okay to have an account called <constant>root</constant> in the LDAP ldapsam or in the 
795         tdbsam. But if there are two accounts in the passdb backend that have the same UID, winbind will 
796         break. This means that the <constant>Administrator</constant> account must be called 
797         <constant>root</constant>.
798         </para>
800         <para>
801         <indexterm><primary>/etc/passwd</primary></indexterm>
802         <indexterm><primary>ldapsam</primary></indexterm>
803         <indexterm><primary>tdbsam</primary></indexterm>
804         Winbind will break if there is an account in <filename>/etc/passwd</filename> that has 
805         the same UID as an account that is in LDAP ldapsam (or in tdbsam) but that differs in name only.
806         </para></note>
808         <para>
809         <indexterm><primary>credentials</primary></indexterm>
810         <indexterm><primary>traverse</primary></indexterm>
811         <indexterm><primary>wide-area</primary></indexterm>
812         <indexterm><primary>network</primary><secondary>wide-area</secondary></indexterm>
813         <indexterm><primary>tdbdump</primary></indexterm>
814         The following configuration uses CIFS/SMB protocols alone to obtain user and group credentials.
815         The winbind information is locally cached in the <filename>winbindd_cache.tdb winbindd_idmap.tdb</filename>
816         files. This provides considerable performance benefits compared with the LDAP solution, particularly
817         where the LDAP lookups must traverse WAN links. You may examine the contents of these
818         files using the tool <command>tdbdump</command>, though you may have to build this from the Samba
819         source code if it has not been supplied as part of a binary package distribution that you may be using.
820         </para>
822         <procedure>
823         <title>Configuration of Winbind-Based Identity Resolution</title>
825                 <step><para>
826                 Using your favorite text editor, create the &smb.conf; file so it has the contents
827                 shown in <link linkend="ch0-NT4DSDM"/>.
828                 </para></step>
830                 <step><para>
831                 <indexterm><primary>/etc/nsswitch.conf</primary></indexterm>
832                 Edit the <filename>/etc/nsswitch.conf</filename> so it has the entries shown in
833                 <link linkend="ch9-sdmnss"/>.
834                 </para></step>
836                 <step><para>
837                 <indexterm><primary>net</primary><secondary>rpc</secondary><tertiary>join</tertiary></indexterm>
838                 The system is ready to join the domain. Execute the following:
839 <screen>
840 net rpc join -U root%not2g4et
841 Joined domain MEGANET2.
842 </screen>
843                 This indicates that the domain join succeed.
845                 </para></step>
847                 <step><para>
848                 <indexterm><primary>winbind</primary></indexterm>
849                 <indexterm><primary>wbinfo</primary></indexterm>
850                 Validate operation of <command>winbind</command> using the <command>wbinfo</command>
851                 tool as follows:
852 <screen>
853 &rootprompt; wbinfo -u
854 MEGANET2+root
855 MEGANET2+nobody
856 MEGANET2+jht
857 MEGANET2+maryv
858 MEGANET2+billr
859 MEGANET2+jelliott
860 MEGANET2+dbrady
861 MEGANET2+joeg
862 MEGANET2+balap
863 </screen>
864                 This shows that domain users have been listed correctly.
865 <screen>
866 &rootprompt; wbinfo -g
867 MEGANET2+Domain Admins
868 MEGANET2+Domain Users
869 MEGANET2+Domain Guests
870 MEGANET2+Accounts
871 MEGANET2+Finances
872 MEGANET2+PIOps
873 </screen>
874                 This shows that domain groups have been correctly obtained also.
875                 </para></step>
877                 <step><para>
878                 <indexterm><primary>NSS</primary></indexterm>
879                 <indexterm><primary>getent</primary></indexterm>
880                 <indexterm><primary>winbind</primary></indexterm>
881                 The next step verifies that NSS is able to obtain this information
882                 correctly from <command>winbind</command> also.
883 <screen>
884 &rootprompt; getent passwd
886 MEGANET2+root:x:10000:10001:NetBIOS Domain Admin:
887                       /home/MEGANET2/root:/bin/bash
888 MEGANET2+nobody:x:10001:10001:nobody:
889                       /home/MEGANET2/nobody:/bin/bash
890 MEGANET2+jht:x:10002:10001:John H Terpstra:
891                       /home/MEGANET2/jht:/bin/bash
892 MEGANET2+maryv:x:10003:10001:Mary Vortexis:
893                       /home/MEGANET2/maryv:/bin/bash
894 MEGANET2+billr:x:10004:10001:William Randalph:
895                       /home/MEGANET2/billr:/bin/bash
896 MEGANET2+jelliott:x:10005:10001:John G Elliott:
897                       /home/MEGANET2/jelliott:/bin/bash
898 MEGANET2+dbrady:x:10006:10001:Darren Brady:
899                       /home/MEGANET2/dbrady:/bin/bash
900 MEGANET2+joeg:x:10007:10001:Joe Green:
901                       /home/MEGANET2/joeg:/bin/bash
902 MEGANET2+balap:x:10008:10001:Bala Pillay:
903                       /home/MEGANET2/balap:/bin/bash
904 </screen>
905                 The user account information has been correctly obtained. This information has
906                 been merged with the winbind template information configured in the &smb.conf; file.
907 <screen>
908 &rootprompt;# getent group
910 MEGANET2+Domain Admins:x:10000:MEGANET2+root,MEGANET2+jht
911 MEGANET2+Domain Users:x:10001:MEGANET2+jht,MEGANET2+maryv,\
912         MEGANET2+billr,MEGANET2+jelliott,MEGANET2+dbrady,\
913         MEGANET2+joeg,MEGANET2+balap
914 MEGANET2+Domain Guests:x:10002:MEGANET2+nobody
915 MEGANET2+Accounts:x:10003:
916 MEGANET2+Finances:x:10004:
917 MEGANET2+PIOps:x:10005:
918 </screen>
919                 </para></step>
921                 <step><para>
922                 The Samba member server of a Windows NT4 domain is ready for use.
923                 </para></step>
925         </procedure>
927 <smbconfexample id="ch0-NT4DSDM">
928 <title>Samba Domain Member Server Using Winbind &smb.conf; File for NT4 Domain</title>
929 <smbconfcomment>Global parameters</smbconfcomment>
930 <smbconfsection name="[global]"/>
931 <smbconfoption name="unix charset">LOCALE</smbconfoption>
932 <smbconfoption name="workgroup">MEGANET2</smbconfoption>
933 <smbconfoption name="security">DOMAIN</smbconfoption>
934 <smbconfoption name="username map">/etc/samba/smbusers</smbconfoption>
935 <smbconfoption name="log level">1</smbconfoption>
936 <smbconfoption name="syslog">0</smbconfoption>
937 <smbconfoption name="log file">/var/log/samba/%m</smbconfoption>
938 <smbconfoption name="max log size">0</smbconfoption>
939 <smbconfoption name="smb ports">139 445</smbconfoption>
940 <smbconfoption name="name resolve order">wins bcast hosts</smbconfoption>
941 <smbconfoption name="printcap name">CUPS</smbconfoption>
942 <smbconfoption name="wins server">192.168.2.1</smbconfoption>
943 <smbconfoption name="idmap uid">10000-20000</smbconfoption>
944 <smbconfoption name="idmap gid">10000-20000</smbconfoption>
945 <smbconfoption name="template primary group">"Domain Users"</smbconfoption>
946 <smbconfoption name="template shell">/bin/bash</smbconfoption>
947 <smbconfoption name="winbind separator">+</smbconfoption>
948 <smbconfoption name="printer admin">root</smbconfoption>
949 <smbconfoption name="hosts allow">192.168.2., 192.168.3., 127.</smbconfoption>
950 <smbconfoption name="printing">cups</smbconfoption>
952 <smbconfsection name="[homes]"/>
953 <smbconfoption name="comment">Home Directories</smbconfoption>
954 <smbconfoption name="valid users">%S</smbconfoption>
955 <smbconfoption name="read only">No</smbconfoption>
956 <smbconfoption name="browseable">No</smbconfoption>
958 <smbconfsection name="[printers]"/>
959 <smbconfoption name="comment">SMB Print Spool</smbconfoption>
960 <smbconfoption name="path">/var/spool/samba</smbconfoption>
961 <smbconfoption name="guest ok">Yes</smbconfoption>
962 <smbconfoption name="printable">Yes</smbconfoption>
963 <smbconfoption name="browseable">No</smbconfoption>
965 <smbconfsection name="[print$]"/>
966 <smbconfoption name="comment">Printer Drivers</smbconfoption>
967 <smbconfoption name="path">/var/lib/samba/drivers</smbconfoption>
968 <smbconfoption name="admin users">root, Administrator</smbconfoption>
969 <smbconfoption name="write list">root</smbconfoption>
970 </smbconfexample>
972         </sect2>
974         <sect2 id="dcwonss">
975         <title>NT4/Samba Domain with Samba Domain Member Server without NSS Support</title>
977         <para>
978         No matter how many UNIX/Linux administrators there may be who believe that a UNIX operating
979         system that does not have NSS and PAM support to be outdated, the fact is there
980         are still many such systems in use today. Samba can be used without NSS support, but this
981         does limit it to the use of local user and group accounts only.
982         </para>
984         <para>
985         The following steps may be followed to implement Samba with support for local accounts.
986         In this configuration Samba is made a domain member server. All incoming connections
987         to the Samba server will cause the look-up of the incoming username. If the account
988         is found, it is used. If the account is not found, one will be automatically created
989         on the local machine so that it can then be used for all access controls.
990         </para>
992         <procedure>
993         <title>Configuration Using Local Accounts Only</title>
995                 <step><para>
996                 Using your favorite text editor, create the &smb.conf; file so it has the contents
997                 shown in <link linkend="ch0-NT4DSCM"/>.
998                 </para></step>
1000                 <step>
1001                 <para><indexterm><primary>net</primary><secondary>rpc</secondary><tertiary>join</tertiary></indexterm>
1002                 The system is ready to join the domain. Execute the following:
1003 <screen>
1004 net rpc join -U root%not24get
1005 Joined domain MEGANET2.
1006 </screen>
1007                 This indicates that the domain join succeed.
1008                 </para></step>
1010                 <step><para>
1011                 Be sure to run all three Samba daemons: <command>smbd</command>, <command>nmbd</command>, <command>winbindd</command>.
1012                 </para></step>
1014                 <step><para>
1015                 The Samba member server of a Windows NT4 domain is ready for use.
1016                 </para></step>
1017         </procedure>
1019 <smbconfexample id="ch0-NT4DSCM">
1020 <title>Samba Domain Member Server Using Local Accounts &smb.conf; File for NT4 Domain</title>
1021 <smbconfcomment>Global parameters</smbconfcomment>
1022 <smbconfsection name="[global]"/>
1023 <smbconfoption name="unix charset">LOCALE</smbconfoption>
1024 <smbconfoption name="workgroup">MEGANET3</smbconfoption>
1025 <smbconfoption name="netbios name">BSDBOX</smbconfoption>
1026 <smbconfoption name="security">DOMAIN</smbconfoption>
1027 <smbconfoption name="username map">/etc/samba/smbusers</smbconfoption>
1028 <smbconfoption name="log level">1</smbconfoption>
1029 <smbconfoption name="syslog">0</smbconfoption>
1030 <smbconfoption name="add user script">/usr/sbin/useradd -m '%u'</smbconfoption>
1031 <smbconfoption name="add machine script">/usr/sbin/useradd -M '%u'</smbconfoption>
1032 <smbconfoption name="add group script">/usr/sbin/groupadd '%g'</smbconfoption>
1033 <smbconfoption name="winbind enable local accounts">Yes</smbconfoption>
1034 <smbconfoption name="log file">/var/log/samba/%m</smbconfoption>
1035 <smbconfoption name="max log size">0</smbconfoption>
1036 <smbconfoption name="smb ports">139 445</smbconfoption>
1037 <smbconfoption name="name resolve order">wins bcast hosts</smbconfoption>
1038 <smbconfoption name="printcap name">CUPS</smbconfoption>
1039 <smbconfoption name="wins server">192.168.2.1</smbconfoption>
1040 <smbconfoption name="printer admin">root</smbconfoption>
1041 <smbconfoption name="hosts allow">192.168.2., 192.168.3., 127.</smbconfoption>
1042 <smbconfoption name="printing">cups</smbconfoption>
1044 <smbconfsection name="[homes]"/>
1045 <smbconfoption name="comment">Home Directories</smbconfoption>
1046 <smbconfoption name="valid users">%S</smbconfoption>
1047 <smbconfoption name="read only">No</smbconfoption>
1048 <smbconfoption name="browseable">No</smbconfoption>
1050 <smbconfsection name="[printers]"/>
1051 <smbconfoption name="comment">SMB Print Spool</smbconfoption>
1052 <smbconfoption name="path">/var/spool/samba</smbconfoption>
1053 <smbconfoption name="guest ok">Yes</smbconfoption>
1054 <smbconfoption name="printable">Yes</smbconfoption>
1055 <smbconfoption name="browseable">No</smbconfoption>
1057 <smbconfsection name="[print$]"/>
1058 <smbconfoption name="comment">Printer Drivers</smbconfoption>
1059 <smbconfoption name="path">/var/lib/samba/drivers</smbconfoption>
1060 <smbconfoption name="admin users">root, Administrator</smbconfoption>
1061 <smbconfoption name="write list">root</smbconfoption>
1062 </smbconfexample>
1063         </sect2>
1065         <sect2 id="adssdm">
1066         <title>Active Directory Domain with Samba Domain Member Server</title>
1068         <para>
1069         <indexterm><primary>Active Directory</primary><secondary>join</secondary></indexterm>
1070         <indexterm><primary>Kerberos</primary></indexterm>
1071         <indexterm><primary>Domain Member</primary><secondary>server</secondary></indexterm>
1072         One of the much-sought-after features new to Samba-3 is the ability to join an Active Directory
1073         domain using Kerberos protocols. This makes it possible to operate an entire Windows network
1074         without the need to run NetBIOS over TCP/IP and permits more secure networking in general. An
1075         exhaustively complete discussion of the protocols is not possible in this book; perhaps a
1076         later book may explore the intricacies of the NetBIOS-less operation that Samba-3 can participate
1077         in. For now, we simply focus on how a Samba-3 server can be made a domain member server.
1078         </para>
1080         <para>
1081         <indexterm><primary>Active Directory</primary></indexterm>
1082         <indexterm><primary>LDAP</primary></indexterm>
1083         <indexterm><primary>Identity resolution</primary></indexterm>
1084         <indexterm><primary>Kerberos</primary></indexterm>
1085         The diagram in <link linkend="ch9-adsdc"/> demonstrates how Samba-3 interfaces with
1086         Microsoft Active Directory components. It should be noted that if Microsoft Windows Services
1087         for UNIX (SFU) has been installed and correctly configured, it is possible to use client LDAP
1088         for identity resolution just as can be done with Samba-3 when using an LDAP passdb backend.
1089         The UNIX tool that you need for this, as in the case of LDAP on UNIX/Linux, is the PADL
1090         Software nss_ldap tool-set. Compared with use of winbind and Kerberos, the use of 
1091         LDAP-based identity resolution is a little less secure. In view of the fact that this solution
1092         requires additional software to be installed on the Windows 200x ADS domain controllers,
1093         and that means more management overhead, it is likely that most Samba-3 ADS client sites
1094         may elect to use winbind.
1095         </para>
1097         <para>
1098         Do not attempt to use this procedure if you are not 100 percent certain that the build of Samba-3
1099         you are using has been compiled and linked with all the tools necessary for this to work.
1100         Given the importance of this step, you must first validate that the Samba-3 message block
1101         daemon (<command>smbd</command>) has the necessary features.
1102         </para>
1104         <para>
1105         The hypothetical domain you are using in this example assumes that the Abmas London office
1106         decided to take its own lead (some would say this is a typical behavior in a global
1107         corporate world; besides, a little divergence and conflict makes for an interesting life).
1108         The Windows Server 2003 ADS domain is called <constant>london.abmas.biz</constant> and the
1109         name of the server is <constant>W2K3S</constant>. In ADS realm terms, the domain controller
1110         is known as <constant>w2k3s.london.abmas.biz</constant>. In NetBIOS nomenclature, the
1111         domain name is <constant>LONDON</constant> and the server name is <constant>W2K3S</constant>.
1112         </para>
1114         <image id="ch9-adsdc">
1115                 <imagedescription>Active Directory Domain: Samba Member Server</imagedescription>
1116                 <imagefile scale="60">chap9-ADSDC</imagefile>
1117         </image>
1119         <procedure>
1120         <title>Joining a Samba Server as an ADS Domain Member</title>
1122                 <step><para>
1123                 <indexterm><primary>smbd</primary></indexterm>
1124                 Before you try to use Samba-3, you want to know for certain that your executables have
1125                 support for Kerberos and for LDAP. Execute the following to identify whether or
1126                 not this build is perhaps suitable for use:
1127 <screen>
1128 &rootprompt; cd /usr/sbin
1129 &rootprompt; smbd -b | grep KRB
1130    HAVE_KRB5_H
1131    HAVE_ADDR_TYPE_IN_KRB5_ADDRESS
1132    HAVE_KRB5
1133    HAVE_KRB5_AUTH_CON_SETKEY
1134    HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES
1135    HAVE_KRB5_GET_PW_SALT
1136    HAVE_KRB5_KEYBLOCK_KEYVALUE
1137    HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK
1138    HAVE_KRB5_MK_REQ_EXTENDED
1139    HAVE_KRB5_PRINCIPAL_GET_COMP_STRING
1140    HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES
1141    HAVE_KRB5_STRING_TO_KEY
1142    HAVE_KRB5_STRING_TO_KEY_SALT
1143    HAVE_LIBKRB5
1144 </screen>
1145                 This output was obtained on a SUSE Linux system and shows the output for
1146                 Samba that has been compiled and linked with the Heimdal Kerberos libraries.
1147                 The following is a typical output that will be found on a Red Hat Linux system that
1148                 has been linked with the MIT Kerberos libraries:
1149 <screen>
1150 &rootprompt; cd /usr/sbin
1151 &rootprompt; smbd -b | grep KRB
1152    HAVE_KRB5_H
1153    HAVE_ADDRTYPE_IN_KRB5_ADDRESS
1154    HAVE_KRB5
1155    HAVE_KRB5_AUTH_CON_SETUSERUSERKEY
1156    HAVE_KRB5_ENCRYPT_DATA
1157    HAVE_KRB5_FREE_DATA_CONTENTS
1158    HAVE_KRB5_FREE_KTYPES
1159    HAVE_KRB5_GET_PERMITTED_ENCTYPES
1160    HAVE_KRB5_KEYTAB_ENTRY_KEY
1161    HAVE_KRB5_LOCATE_KDC
1162    HAVE_KRB5_MK_REQ_EXTENDED
1163    HAVE_KRB5_PRINCIPAL2SALT
1164    HAVE_KRB5_PRINC_COMPONENT
1165    HAVE_KRB5_SET_DEFAULT_TGS_KTYPES
1166    HAVE_KRB5_SET_REAL_TIME
1167    HAVE_KRB5_STRING_TO_KEY
1168    HAVE_KRB5_TKT_ENC_PART2
1169    HAVE_KRB5_USE_ENCTYPE
1170    HAVE_LIBGSSAPI_KRB5
1171    HAVE_LIBKRB5
1172 </screen>
1173                 You can validate that Samba has been compiled and linked with LDAP support
1174                 by executing:
1175 <screen>
1176 &rootprompt; smbd -b | grep LDAP
1177 massive:/usr/sbin # smbd -b | grep LDAP
1178    HAVE_LDAP_H
1179    HAVE_LDAP
1180    HAVE_LDAP_DOMAIN2HOSTLIST
1181    HAVE_LDAP_INIT
1182    HAVE_LDAP_INITIALIZE
1183    HAVE_LDAP_SET_REBIND_PROC
1184    HAVE_LIBLDAP
1185    LDAP_SET_REBIND_PROC_ARGS
1186 </screen>
1187                 This does look promising; <command>smbd</command> has been built with Kerberos and LDAP
1188                 support. You are relieved to know that it is safe to progress.
1189                 </para></step>
1191                 <step><para>
1192                 <indexterm><primary>Kerberos</primary><secondary>libraries</secondary></indexterm>
1193                 <indexterm><primary>MIT Kerberos</primary></indexterm>
1194                 <indexterm><primary>Heimdal Kerberos</primary></indexterm>
1195                 <indexterm><primary>Kerberos</primary><secondary>MIT</secondary></indexterm>
1196                 <indexterm><primary>Kerberos</primary><secondary>Heimdal</secondary></indexterm>
1197                 <indexterm><primary>Red Hat Linux</primary></indexterm>
1198                 <indexterm><primary>SUSE Linux</primary></indexterm>
1199                 <indexterm><primary>SerNet</primary></indexterm>
1200                 <indexterm><primary>validated</primary></indexterm>
1201                 The next step is to identify which version of the Kerberos libraries have been used.
1202                 In order to permit Samba-3 to interoperate with Windows 2003 Active Directory, it is
1203                 essential that it has been linked with either MIT Kerberos version 1.3.1 or later,
1204                 or that it has been linked with Heimdal Kerberos 0.6 plus specific patches. You may
1205                 identify what version of the MIT Kerberos libraries are installed on your system by
1206                 executing (on Red Hat Linux):
1207 <screen>
1208 &rootprompt; rpm -q krb5
1209 </screen>
1210                 Or on SUSE Linux, execute:
1211 <screen>
1212 &rootprompt; rpm -q heimdal
1213 </screen>
1214                 Please note that the RPMs provided by the Samba-Team are known to be working and have
1215                 been validated. Red Hat Linux RPMs may be obtained from the Samba FTP sites. SUSE
1216                 Linux RPMs may be obtained from <ulink url="ftp://ftp.sernet.de">Sernet</ulink> in
1217                 Germany.
1218                 </para>
1220                 <para>
1221                 From this point on, you are certain that the Samba-3 build you are using has the
1222                 necessary capabilities. You can now configure Samba-3 and the NSS. 
1223                 </para></step>
1225                 <step><para>
1226                 Using you favorite editor, configure the &smb.conf; file that is located in the 
1227                 <filename>/etc/samba</filename> directory so that it has the contents shown 
1228                 in <link linkend="ch9-adssdm"/>.
1229                 </para></step>
1231                 <step><para>
1232                 Edit or create the NSS control file so it has the contents shown in <link linkend="ch9-sdmnss"/>.
1233                 </para></step>
1235                 <step><para>
1236                 <indexterm><primary>/etc/samba/secrets.tdb</primary></indexterm>
1237                 Delete the file <filename>/etc/samba/secrets.tdb</filename> if it exists. Of course, you
1238                 do keep a backup, don't you?
1239                 </para></step>
1241                 <step><para>
1242                 Delete the tdb files that cache Samba information. You keep a backup of the old
1243                 files, of course. You also remove all files to ensure that nothing can pollute your
1244                 nice, new configuration. Execute the following (example is for SUSE Linux):
1245 <screen>
1246 &rootprompt; rm /var/lib/samba/*tdb
1247 </screen>
1248                 </para></step>
1250                 <step><para>
1251                 <indexterm><primary>testparm</primary></indexterm>
1252                 Validate your &smb.conf; file using <command>testparm</command> (as you have
1253                 done previously). Correct all errors reported before proceeding. The command you
1254                 execute is:
1255 <screen>
1256 &rootprompt; testparm -s | less
1257 </screen>
1258                 Now that you are satisfied that your Samba server is ready to join the Windows
1259                 ADS domain, let's move on.
1260                 </para></step>
1262                 <step><para>
1263                 <indexterm><primary>net</primary><secondary>ads</secondary><tertiary>join</tertiary></indexterm>
1264                 <indexterm><primary>Kerberos</primary></indexterm>
1265                 This is a good time to double-check everything and then execute the following
1266                 command when everything you have done has checked out okay:
1267 <screen>
1268 &rootprompt; net ads join -UAdministrator%not24get
1269 Using short domain name -- LONDON
1270 Joined 'FRAN' to realm 'LONDON.ABMAS.BIZ'
1271 </screen>
1272                 You have successfully made your Samba-3 server a member of the ADS domain
1273                 using Kerberos protocols.
1274                 </para>
1276             <para>
1277                 <indexterm><primary>silent return</primary></indexterm>
1278                 <indexterm><primary>failed join</primary></indexterm>
1279                 In the event that you receive no output messages, a silent return means that the
1280                 domain join failed. You should use <command>ethereal</command> to identify what
1281                 may be failing. Common causes of a failed join include:
1283                 <itemizedlist>
1284                         <listitem><para>
1285                         <indexterm><primary>name resolution</primary><secondary>Defective</secondary></indexterm>
1286                         Defective or misconfigured DNS name resolution.
1287                         </para></listitem>
1289                         <listitem><para>
1290                         <indexterm><primary>Restrictive security</primary></indexterm>
1291                         Restrictive security settings on the Windows 200x ADS domain controller
1292                         preventing needed communications protocols. You can check this by searching
1293                         the Windows Server 200x Event Viewer.
1294                         </para></listitem>
1296                         <listitem><para>
1297                         Incorrectly configured &smb.conf; file settings.
1298                         </para></listitem>
1300                         <listitem><para>
1301                         Lack of support of necessary Kerberos protocols because the version of MIT
1302                         Kerberos (or Heimdal) in use is not up to date enough to support the necessary
1303                         functionality.
1304                         </para></listitem>
1305                 </itemizedlist>
1307                 <indexterm><primary>net</primary><secondary>rpc</secondary><tertiary>join</tertiary></indexterm>
1308                 <indexterm><primary>RPC</primary></indexterm>
1309                 <indexterm><primary>mixed mode</primary></indexterm>
1310                 In any case, never execute the <command>net rpc join</command> command in an attempt
1311                 to join the Samba server to the domain, unless you wish not to use the Kerberos
1312                 security protocols. Use of the older RPC-based domain join facility requires that
1313                 Windows Server 200x ADS has been configured appropriately for mixed mode operation.
1314                 </para></step>
1316                 <step><para>
1317                 <indexterm><primary>tdbdump</primary></indexterm>
1318                 <indexterm><primary>/etc/samba/secrets.tdb</primary></indexterm>
1319                 If the <command>tdbdump</command> is installed on your system (not essential),
1320                 you can look inside the <filename>/etc/samba/secrets.tdb</filename> file. If
1321                 you wish to do this, execute:
1322 <screen>
1323 &rootprompt; tdbdump secrets.tdb
1325 key = "SECRETS/SID/LONDON"
1326 data = "\01\04\00\00\00\00\00\05\15\00\00\00\EBw\86\F1\ED\BD\
1327    F6{\5C6\E5W\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\
1328    00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\
1329    00\00\00\00\00\00\00\00"
1332 key = "SECRETS/MACHINE_PASSWORD/LONDON"
1333 data = "le3Q5FPnN5.ueC\00"
1336 key = "SECRETS/MACHINE_SEC_CHANNEL_TYPE/LONDON"
1337 data = "\02\00\00\00"
1340 key = "SECRETS/MACHINE_LAST_CHANGE_TIME/LONDON"
1341 data = "E\89\F6?"
1343 </screen>
1344                 This is given to demonstrate to the skeptics that this process truly does work.
1345                 </para></step>
1347                 <step><para>
1348                 It is now time to start Samba in the usual way (as has been done many time before
1349                 in this book).  
1350                 </para></step>
1352                 <step><para>
1353                 <indexterm><primary>wbinfo</primary></indexterm>
1354                 This is a good time to verify that everything is working. First, check that
1355                 winbind is able to obtain the list of users and groups from the ADS domain controller.
1356                 Execute the following:
1357 <screen>
1358 &rootprompt; wbinfo -u
1359 LONDON+Administrator
1360 LONDON+Guest
1361 LONDON+SUPPORT_388945a0
1362 LONDON+krbtgt
1363 LONDON+jht
1364 </screen>
1365                 Good, the list of users was obtained. Now do likewise for group accounts:
1366 <screen>
1367 &rootprompt; wbinfo -g
1368 LONDON+Domain Computers
1369 LONDON+Domain Controllers
1370 LONDON+Schema Admins
1371 LONDON+Enterprise Admins
1372 LONDON+Domain Admins
1373 LONDON+Domain Users
1374 LONDON+Domain Guests
1375 LONDON+Group Policy Creator Owners
1376 LONDON+DnsUpdateProxy
1377 </screen>
1378                 Excellent. That worked also, as expected.
1379                 </para></step>
1381           <step><para><indexterm>
1382                 <primary>getent</primary>
1383               </indexterm>
1384                 Now repeat this via NSS to validate that full identity resolution is
1385                 functional as required. Execute:
1386 <screen>
1387 &rootprompt; getent passwd
1389 LONDON+Administrator:x:10000:10000:Administrator:
1390              /home/LONDON/administrator:/bin/bash
1391 LONDON+Guest:x:10001:10001:Guest:
1392              /home/LONDON/guest:/bin/bash
1393 LONDON+SUPPORT_388945a0:x:10002:10000:SUPPORT_388945a0:
1394              /home/LONDON/support_388945a0:/bin/bash
1395 LONDON+krbtgt:x:10003:10000:krbtgt:
1396              /home/LONDON/krbtgt:/bin/bash
1397 LONDON+jht:x:10004:10000:John H. Terpstra:
1398              /home/LONDON/jht:/bin/bash
1399 </screen>
1400                 Okay, ADS user accounts are being resolved. Now you try group resolution:
1401 <screen>
1402 &rootprompt; getent group
1404 LONDON+Domain Computers:x:10002:
1405 LONDON+Domain Controllers:x:10003:
1406 LONDON+Schema Admins:x:10004:LONDON+Administrator
1407 LONDON+Enterprise Admins:x:10005:LONDON+Administrator
1408 LONDON+Domain Admins:x:10006:LONDON+jht,LONDON+Administrator
1409 LONDON+Domain Users:x:10000:
1410 LONDON+Domain Guests:x:10001:
1411 LONDON+Group Policy Creator Owners:x:10007:LONDON+Administrator
1412 LONDON+DnsUpdateProxy:x:10008:
1413 </screen>
1414                 This is very pleasing. Everything works as expected.
1415                 </para></step>
1417                 <step><para>
1418                 <indexterm><primary>net</primary><secondary>ads</secondary><tertiary>info</tertiary></indexterm>
1419                 <indexterm><primary>Active Directory</primary><secondary>server</secondary></indexterm>
1420                 <indexterm><primary>Kerberos</primary></indexterm>
1421                 You may now perform final verification that communications between Samba-3 winbind and
1422                 the Active Directory server is using Kerberos protocols. Execute the following:
1423 <screen>
1424 &rootprompt; net ads info
1425 LDAP server: 192.168.2.123
1426 LDAP server name: w2k3s
1427 Realm: LONDON.ABMAS.BIZ
1428 Bind Path: dc=LONDON,dc=ABMAS,dc=BIZ
1429 LDAP port: 389
1430 Server time: Sat, 03 Jan 2004 02:44:44 GMT
1431 KDC server: 192.168.2.123
1432 Server time offset: 2
1433 </screen>
1434                 It should be noted that Kerberos protocols are time-clock critical. You should
1435                 keep all server time clocks synchronized using the network time protocol (NTP).
1436                 In any case, the output we obtained confirms that all systems are operational.
1437                 </para></step>
1439                 <step><para>
1440                 <indexterm><primary>net</primary><secondary>ads</secondary><tertiary>status</tertiary></indexterm>
1441                 There is one more action you elect to take, just because you are paranoid and disbelieving,
1442                 so you execute the following command:
1443 <programlisting>
1444 &rootprompt; net ads status -UAdministrator%not24get
1445 objectClass: top
1446 objectClass: person
1447 objectClass: organizationalPerson
1448 objectClass: user
1449 objectClass: computer
1450 cn: fran
1451 distinguishedName: CN=fran,CN=Computers,DC=london,DC=abmas,DC=biz
1452 instanceType: 4
1453 whenCreated: 20040103092006.0Z
1454 whenChanged: 20040103092006.0Z
1455 uSNCreated: 28713
1456 uSNChanged: 28717
1457 name: fran
1458 objectGUID: 58f89519-c467-49b9-acb0-f099d73696e
1459 userAccountControl: 69632
1460 badPwdCount: 0
1461 codePage: 0
1462 countryCode: 0
1463 badPasswordTime: 0
1464 lastLogoff: 0
1465 lastLogon: 127175965783327936
1466 localPolicyFlags: 0
1467 pwdLastSet: 127175952062598496
1468 primaryGroupID: 515
1469 objectSid: S-1-5-21-4052121579-2079768045-1474639452-1109
1470 accountExpires: 9223372036854775807
1471 logonCount: 13
1472 sAMAccountName: fran$
1473 sAMAccountType: 805306369
1474 operatingSystem: Samba
1475 operatingSystemVersion: 3.0.20-SUSE
1476 dNSHostName: fran
1477 userPrincipalName: HOST/fran@LONDON.ABMAS.BIZ
1478 servicePrincipalName: CIFS/fran.london.abmas.biz
1479 servicePrincipalName: CIFS/fran
1480 servicePrincipalName: HOST/fran.london.abmas.biz
1481 servicePrincipalName: HOST/fran
1482 objectCategory: CN=Computer,CN=Schema,CN=Configuration,
1483                               DC=london,DC=abmas,DC=biz
1484 isCriticalSystemObject: FALSE
1485 -------------- Security Descriptor (revision: 1, type: 0x8c14)
1486 owner SID: S-1-5-21-4052121579-2079768045-1474639452-512
1487 group SID: S-1-5-21-4052121579-2079768045-1474639452-513
1488 ------- (system) ACL (revision: 4, size: 120, number of ACEs: 2)
1489 ------- ACE (type: 0x07, flags: 0x5a, size: 0x38, 
1490                mask: 0x20, object flags: 0x3)
1491 access SID:  S-1-1-0
1492 access type: AUDIT OBJECT
1493 Permissions:
1494         [Write All Properties]
1495 ------- ACE (type: 0x07, flags: 0x5a, size: 0x38, 
1496                mask: 0x20, object flags: 0x3)
1497 access SID:  S-1-1-0
1498 access type: AUDIT OBJECT
1499 Permissions:
1500         [Write All Properties]
1501 ------- (user) ACL (revision: 4, size: 1944, number of ACEs: 40)
1502 ------- ACE (type: 0x00, flags: 0x00, size: 0x24, mask: 0xf01ff)
1503 access SID:  S-1-5-21-4052121579-2079768045-1474639452-512
1504 access type: ALLOWED
1505 Permissions: [Full Control]
1506 ------- ACE (type: 0x00, flags: 0x00, size: 0x18, mask: 0xf01ff)
1507 access SID:  S-1-5-32-548
1509 ------- ACE (type: 0x05, flags: 0x12, size: 0x38, 
1510                 mask: 0x10, object flags: 0x3)
1511 access SID:  S-1-5-9
1512 access type: ALLOWED OBJECT
1513 Permissions:
1514         [Read All Properties]
1515 -------------- End Of Security Descriptor
1516 </programlisting>
1517                 And now you have conclusive proof that your Samba-3 ADS domain member server
1518                 called <constant>FRAN</constant> is able to communicate fully with the ADS
1519                 domain controllers.
1520                 </para></step>
1522         </procedure>
1525         <para>
1526         Your Samba-3 ADS domain member server is ready for use. During training sessions,
1527         you may be asked what is inside the <filename>winbindd_cache.tdb and winbindd_idmap.tdb</filename>
1528         files. Since curiosity just took hold of you, execute the following:
1529 <programlisting>
1530 &rootprompt; tdbdump /var/lib/samba/winbindd_idmap.tdb
1532 key = "S-1-5-21-4052121579-2079768045-1474639452-501\00"
1533 data = "UID 10001\00"
1536 key = "UID 10005\00"
1537 data = "S-1-5-21-4052121579-2079768045-1474639452-1111\00"
1540 key = "GID 10004\00"
1541 data = "S-1-5-21-4052121579-2079768045-1474639452-518\00"
1544 key = "S-1-5-21-4052121579-2079768045-1474639452-502\00"
1545 data = "UID 10003\00"
1549 &rootprompt; tdbdump /var/lib/samba/winbindd_cache.tdb
1551 key = "UL/LONDON"
1552 data = "\00\00\00\00bp\00\00\06\00\00\00\0DAdministrator\0D
1553    Administrator-S-1-5-21-4052121579-2079768045-1474639452-500-
1554    S-1-5-21-4052121579-2079768045-1474639452-513\05Guest\05
1555    Guest-S-1-5-21-4052121579-2079768045-1474639452-501-
1556    S-1-5-21-4052121579-2079768045-1474639452-514\10
1557    SUPPORT_388945a0\10SUPPORT_388945a0.
1558    S-1-5-21-4052121579-2079768045-1474639452-1001-
1559    S-1-5-21-4052121579-2079768045-1474639452-513\06krbtgt\06
1560    krbtgt-S-1-5-21-4052121579-2079768045-1474639452-502-
1561    S-1-5-21-4052121579-2079768045-1474639452-513\03jht\10
1562    John H. Terpstra.S-1-5-21-4052121579-2079768045-1474639452-1110-
1563    S-1-5-21-4052121579-2079768045-1474639452-513"
1566 key = "GM/S-1-5-21-4052121579-2079768045-1474639452-512"
1567 data = "\00\00\00\00bp\00\00\02\00\00\00.
1568    S-1-5-21-4052121579-2079768045-1474639452-1110\03
1569    jht\01\00\00\00-S-1-5-21-4052121579-2079768045-1474639452-500\0D
1570    Administrator\01\00\00\00"
1573 key = "SN/S-1-5-21-4052121579-2079768045-1474639452-513"
1574 data = "\00\00\00\00xp\00\00\02\00\00\00\0CDomain Users"
1577 key = "GM/S-1-5-21-4052121579-2079768045-1474639452-518"
1578 data = "\00\00\00\00bp\00\00\01\00\00\00-
1579    S-1-5-21-4052121579-2079768045-1474639452-500\0D
1580    Administrator\01\00\00\00"
1583 key = "SEQNUM/LONDON\00"
1584 data = "xp\00\00C\92\F6?"
1587 key = "U/S-1-5-21-4052121579-2079768045-1474639452-1110"
1588 data = "\00\00\00\00xp\00\00\03jht\10John H. Terpstra.
1589    S-1-5-21-4052121579-2079768045-1474639452-1110-
1590    S-1-5-21-4052121579-2079768045-1474639452-513"
1593 key = "NS/S-1-5-21-4052121579-2079768045-1474639452-502"
1594 data = "\00\00\00\00bp\00\00-
1595    S-1-5-21-4052121579-2079768045-1474639452-502"
1598 key = "SN/S-1-5-21-4052121579-2079768045-1474639452-1001"
1599 data = "\00\00\00\00bp\00\00\01\00\00\00\10SUPPORT_388945a0"
1602 key = "SN/S-1-5-21-4052121579-2079768045-1474639452-500"
1603 data = "\00\00\00\00bp\00\00\01\00\00\00\0DAdministrator"
1606 key = "U/S-1-5-21-4052121579-2079768045-1474639452-502"
1607 data = "\00\00\00\00bp\00\00\06krbtgt\06krbtgt-
1608    S-1-5-21-4052121579-2079768045-1474639452-502-
1609    S-1-5-21-4052121579-2079768045-1474639452-513"
1611 ....
1612 </programlisting>
1613         Now all is revealed. Your curiosity, as well as that of your team, has been put at ease.
1614         May this server serve well all who happen upon it.
1615         </para>
1617 <smbconfexample id="ch9-adssdm">
1618 <title>Samba Domain Member &smb.conf; File for Active Directory Membership</title>
1619 <smbconfcomment>Global parameters</smbconfcomment>
1620 <smbconfsection name="[global]"/>
1621 <smbconfoption name="unix charset">LOCALE</smbconfoption>
1622 <smbconfoption name="workgroup">LONDON</smbconfoption>
1623 <smbconfoption name="realm">LONDON.ABMAS.BIZ</smbconfoption>
1624 <smbconfoption name="server string">Samba 3.0.20</smbconfoption>
1625 <smbconfoption name="security">ADS</smbconfoption>
1626 <smbconfoption name="username map">/etc/samba/smbusers</smbconfoption>
1627 <smbconfoption name="log level">1</smbconfoption>
1628 <smbconfoption name="syslog">0</smbconfoption>
1629 <smbconfoption name="log file">/var/log/samba/%m</smbconfoption>
1630 <smbconfoption name="max log size">50</smbconfoption>
1631 <smbconfoption name="printcap name">CUPS</smbconfoption>
1632 <smbconfoption name="ldap ssl">no</smbconfoption>
1633 <smbconfoption name="idmap uid">10000-20000</smbconfoption>
1634 <smbconfoption name="idmap gid">10000-20000</smbconfoption>
1635 <smbconfoption name="template primary group">"Domain Users"</smbconfoption>
1636 <smbconfoption name="template shell">/bin/bash</smbconfoption>
1637 <smbconfoption name="winbind separator">+</smbconfoption>
1638 <smbconfoption name="printing">cups</smbconfoption>
1640 <smbconfsection name="[homes]"/>
1641 <smbconfoption name="comment">Home Directories</smbconfoption>
1642 <smbconfoption name="valid users">%S</smbconfoption>
1643 <smbconfoption name="read only">No</smbconfoption>
1644 <smbconfoption name="browseable">No</smbconfoption>
1646 <smbconfsection name="[printers]"/>
1647 <smbconfoption name="comment">SMB Print Spool</smbconfoption>
1648 <smbconfoption name="path">/var/spool/samba</smbconfoption>
1649 <smbconfoption name="guest ok">Yes</smbconfoption>
1650 <smbconfoption name="printable">Yes</smbconfoption>
1651 <smbconfoption name="browseable">No</smbconfoption>
1653 <smbconfsection name="[print$]"/>
1654 <smbconfoption name="comment">Printer Drivers</smbconfoption>
1655 <smbconfoption name="path">/var/lib/samba/drivers</smbconfoption>
1656 <smbconfoption name="admin users">root, Administrator</smbconfoption>
1657 <smbconfoption name="write list">root</smbconfoption>
1658 </smbconfexample>
1660         <sect3>
1661         <title>IDMAP_RID with Winbind</title>
1663         <para>
1664         <indexterm><primary>idmap_rid</primary></indexterm>
1665         <indexterm><primary>SID</primary></indexterm>
1666         <indexterm><primary>RID</primary></indexterm>
1667         <indexterm><primary>IDMAP</primary></indexterm>
1668         The <command>idmap_rid</command> facility is a new tool that, unlike native winbind, creates a
1669         predictable mapping of MS Windows SIDs to UNIX UIDs and GIDs. The key benefit of this method
1670         of implementing the Samba IDMAP facility is that it eliminates the need to store the IDMAP data
1671         in a central place. The downside is that it can be used only within a single ADS domain and
1672         is not compatible with trusted domain implementations.
1673         </para>
1675         <para>
1676         <indexterm><primary>SID</primary></indexterm>
1677         <indexterm><primary>allow trusted domains</primary></indexterm>
1678         <indexterm><primary>idmap uid</primary></indexterm>
1679         <indexterm><primary>idmap gid</primary></indexterm>
1680         This alternate method of SID to UID/GID  mapping can be achieved with the idmap_rid
1681         plug-in. This plug-in uses the RID of the user SID to derive the UID and GID by adding the
1682         RID to a base value specified. This utility requires that the parameter
1683         <quote>allow trusted domains = No</quote> must be specified, as it is not compatible
1684         with multiple domain environments. The <parameter>idmap uid</parameter> and
1685         <parameter>idmap gid</parameter> ranges must be specified.
1686         </para>
1688         <para>
1689         <indexterm><primary>idmap_rid</primary></indexterm>
1690         <indexterm><primary>realm</primary></indexterm>
1691         The idmap_rid facility can be used both for NT4/Samba-style domains as well as with Active Directory.
1692         To use this with an NT4 domain, the <parameter>realm</parameter> is not used. Additionally the
1693         method used to join the domain uses the <constant>net rpc join</constant> process.
1694         </para>
1696         <para>
1697         An example &smb.conf; file for an ADS domain environment is shown in <link linkend="sbe-idmapridex"/>.
1698         </para>
1700 <smbconfexample id="sbe-idmapridex">
1701 <title>Example &smb.conf; File Using <constant>idmap_rid</constant></title>
1702 <smbconfcomment>Global parameters</smbconfcomment>
1703 <smbconfsection name="[global]"/>
1704 <smbconfoption name="workgroup">KPAK</smbconfoption>
1705 <smbconfoption name="netbios name">BIGJOE</smbconfoption>
1706 <smbconfoption name="realm">CORP.KPAK.COM</smbconfoption>
1707 <smbconfoption name="server string">Office Server</smbconfoption>
1708 <smbconfoption name="security">ADS</smbconfoption>
1709 <smbconfoption name="allow trusted domains">No</smbconfoption>
1710 <smbconfoption name="idmap backend">idmap_rid:KPAK=500-100000000</smbconfoption>
1711 <smbconfoption name="idmap uid">500-100000000</smbconfoption>
1712 <smbconfoption name="idmap gid">500-100000000</smbconfoption>
1713 <smbconfoption name="template shell">/bin/bash</smbconfoption>
1714 <smbconfoption name="winbind use default domain">Yes</smbconfoption>
1715 <smbconfoption name="winbind enum users">No</smbconfoption>
1716 <smbconfoption name="winbind enum groups">No</smbconfoption>
1717 <smbconfoption name="winbind nested groups">Yes</smbconfoption>
1718 <smbconfoption name="printer admin">"KPAK\Domain Admins"</smbconfoption>
1719 </smbconfexample>
1721         <para>
1722         <indexterm><primary>large domain</primary></indexterm>
1723         <indexterm><primary>Active Directory</primary></indexterm>
1724         <indexterm><primary>response</primary></indexterm>
1725         <indexterm><primary>getent</primary></indexterm>
1726         In a large domain with many users, it is imperative to disable enumeration of users and groups.
1727         For example, at a site that has 22,000 users in Active Directory the winbind-based user and
1728         group resolution is unavailable for nearly 12 minutes following first start-up of
1729         <command>winbind</command>. Disabling of such enumeration results in instantaneous response.
1730         The disabling of user and group enumeration means that it will not be possible to list users
1731         or groups using the <command>getent passwd</command> and <command>getent group</command>
1732         commands. It will be possible to perform the lookup for individual users, as shown in the procedure
1733         below.
1734         </para>
1736         <para>
1737         <indexterm><primary>NSS</primary></indexterm>
1738         <indexterm><primary>/etc/nsswitch.conf</primary></indexterm>
1739         The use of this tool requires configuration of NSS as per the native use of winbind. Edit the
1740         <filename>/etc/nsswitch.conf</filename> so it has the following parameters:
1741 <screen>
1743 passwd: files winbind
1744 shadow: files winbind
1745 group:  files winbind
1747 hosts:  files wins
1749 </screen>
1750         </para>
1752         <para>
1753         The following procedure can be used to utilize the idmap_rid facility:
1754         </para>
1756         <procedure>
1757                 <step><para>
1758                 Create or install and &smb.conf; file with the above configuration.
1759                 </para></step>
1761                 <step><para>
1762                 Edit the <filename>/etc/nsswitch.conf</filename> file as shown above.
1763                 </para></step>
1765                 <step><para>
1766                 Execute:
1767 <screen>
1768 &rootprompt; net ads join -UAdministrator%password
1769 Using short domain name -- KPAK
1770 Joined 'BIGJOE' to realm 'CORP.KPAK.COM'
1771 </screen>
1772                 </para>
1774                 <para>
1775                 <indexterm><primary>failed join</primary></indexterm>
1776                 An invalid or failed join can be detected by executing:
1777 <screen>
1778 &rootprompt; net ads testjoin
1779 BIGJOE$@'s password:
1780 [2004/11/05 16:53:03, 0] utils/net_ads.c:ads_startup(186)
1781   ads_connect: No results returned
1782 Join to domain is not valid
1783 </screen>
1784                 The specific error message may differ from the above because it depends on the type of failure that
1785                 may have occurred. Increase the <parameter>log level</parameter> to 10, repeat the above test,
1786                 and then examine the log files produced to identify the nature of the failure.
1787                 </para></step>
1789                 <step><para>
1790                 Start the <command>nmbd</command>, <command>winbind,</command> and <command>smbd</command> daemons in the order shown.
1791                 </para></step>
1793                 <step><para>
1794                 Validate the operation of this configuration by executing:
1795                 <indexterm><primary></primary></indexterm>
1796 <screen>
1797 &rootprompt; getent passwd administrator
1798 administrator:x:1000:1013:Administrator:/home/BE/administrator:/bin/bash
1799 </screen>
1800                 </para></step>
1801         </procedure>
1803         </sect3>
1805         <sect3>
1806         <title>IDMAP Storage in LDAP using Winbind</title>
1808         <para>
1809         <indexterm><primary>ADAM</primary></indexterm>
1810         <indexterm><primary>ADS</primary></indexterm>
1811         The storage of IDMAP information in LDAP can be used with both NT4/Samba-3-style domains as well as
1812         with ADS domains. OpenLDAP is a commonly used LDAP server for this purpose, although any standards-compliant
1813         LDAP server can be used. It is therefore possible to deploy this IDMAP configuration using
1814         the Sun iPlanet LDAP server, Novell eDirectory, Microsoft ADS plus ADAM, and so on.
1815         </para>
1817         <para>
1818         The example in <link linkend="sbeunxa"/> is for an ADS-style domain.
1819         </para>
1821 <smbconfexample id="sbeunxa">
1822 <title>Typical ADS Style Domain &smb.conf; File</title>
1823 <smbconfcomment>Global parameters</smbconfcomment>
1824 <smbconfsection name="[global]"/>
1825 <smbconfoption name="workgroup">SNOWSHOW</smbconfoption>
1826 <smbconfoption name="netbios name">GOODELF</smbconfoption>
1827 <smbconfoption name="realm">SNOWSHOW.COM</smbconfoption>
1828 <smbconfoption name="server string">Samba Server</smbconfoption>
1829 <smbconfoption name="security">ADS</smbconfoption>
1830 <smbconfoption name="log level">1 ads:10 auth:10 sam:10 rpc:10</smbconfoption>
1831 <smbconfoption name="ldap admin dn">cn=Manager,dc=SNOWSHOW,dc=COM</smbconfoption>
1832 <smbconfoption name="ldap idmap suffix">ou=Idmap</smbconfoption>
1833 <smbconfoption name="ldap suffix">dc=SNOWSHOW,dc=COM</smbconfoption>
1834 <smbconfoption name="idmap backend">ldap:ldap://ldap.snowshow.com</smbconfoption>
1835 <smbconfoption name="idmap uid">150000-550000</smbconfoption>
1836 <smbconfoption name="idmap gid">150000-550000</smbconfoption>
1837 <smbconfoption name="template shell">/bin/bash</smbconfoption>
1838 <smbconfoption name="winbind use default domain">Yes</smbconfoption>
1839 </smbconfexample>
1841         <para>
1842         <indexterm><primary>realm</primary></indexterm>
1843         In the case of an NT4 or Samba-3-style domain the <parameter>realm</parameter> is not used, and the
1844         command used to join the domain is <command>net rpc join</command>. The above example also demonstrates
1845         advanced error reporting techniques that are documented in the chapter called "Reporting Bugs" in
1846         <quote>The Official Samba-3 HOWTO and Reference Guide</quote> (TOSHARG).
1847         </para>
1849         <para>
1850         <indexterm><primary>MIT kerberos</primary></indexterm>
1851         <indexterm><primary>Heimdal kerberos</primary></indexterm>
1852         <indexterm><primary>/etc/krb5.conf</primary></indexterm>
1853         Where MIT kerberos is installed (version 1.3.4 or later), edit the <filename>/etc/krb5.conf</filename>
1854         file so it has the following contents:
1855 <screen>
1856 [logging]
1857  default = FILE:/var/log/krb5libs.log
1858  kdc = FILE:/var/log/krb5kdc.log
1859  admin_server = FILE:/var/log/kadmind.log
1861 [libdefaults]
1862  default_realm = SNOWSHOW.COM
1863  dns_lookup_realm = false
1864  dns_lookup_kdc = true
1866 [appdefaults]
1867  pam = {
1868    debug = false
1869    ticket_lifetime = 36000
1870    renew_lifetime = 36000
1871    forwardable = true
1872    krb4_convert = false
1874 </screen>
1875         </para>
1877         <para>
1878         Where Heimdal kerberos is installed, edit the <filename>/etc/krb5.conf</filename>
1879         file so it is either empty (i.e., no contents) or it has the following contents:
1880 <screen>
1881 [libdefaults]
1882         default_realm = SNOWSHOW.COM
1883         clockskew = 300
1885 [realms]
1886         SNOWSHOW.COM = {
1887                 kdc = ADSDC.SHOWSHOW.COM
1888         }
1890 [domain_realm]
1891         .snowshow.com = SNOWSHOW.COM
1892 </screen>
1893         </para>
1895         <note><para>
1896         Samba cannot use the Heimdal libraries if there is no <filename>/etc/krb5.conf</filename> file.
1897         So long as there is an empty file, the Heimdal kerberos libraries will be usable. There is no
1898         need to specify any settings because Samba, using the Heimdal libraries, can figure this out automatically.
1899         </para></note>
1900         <para>
1901         Edit the NSS control file <filename>/etc/nsswitch.conf</filename> so it has the following entries:
1902 <screen>
1904 passwd: files ldap
1905 shadow: files ldap
1906 group:  files ldap
1908 hosts:  files wins
1910 </screen>
1911         </para>
1913         <para>
1914         <indexterm><primary>PADL</primary></indexterm>
1915         <indexterm><primary>/etc/ldap.conf</primary></indexterm>
1916         You will need the <ulink url="http://www.padl.com">PADL</ulink> <command>nss_ldap</command>
1917         tool set for this solution. Configure the <filename>/etc/ldap.conf</filename> file so it has
1918         the information needed. The following is an example of a working file:
1919 <screen>
1920 host    192.168.2.1
1921 base    dc=snowshow,dc=com
1922 binddn  cn=Manager,dc=snowshow,dc=com
1923 bindpw  not24get
1925 pam_password exop
1927 nss_base_passwd ou=People,dc=snowshow,dc=com?one
1928 nss_base_shadow ou=People,dc=snowshow,dc=com?one
1929 nss_base_group  ou=Groups,dc=snowshow,dc=com?one
1930 ssl     no
1931 </screen>
1932         </para>
1934         <para>
1935         The following procedure may be followed to affect a working configuration:
1936         </para>
1937         <procedure>
1938                 <step><para>
1939                 Configure the &smb.conf; file as shown above.
1940                 </para></step>
1942                 <step><para>
1943                 Create the <filename>/etc/krb5.conf</filename> file following the indications above.
1944                 </para></step>
1946                 <step><para>
1947                 Configure the <filename>/etc/nsswitch.conf</filename> file as shown above.
1948                 </para></step>
1950                 <step><para>
1951                 Download, build, and install the PADL nss_ldap tool set. Configure the
1952                 <filename>/etc/ldap.conf</filename> file as shown above.
1953                 </para></step>
1955                 <step><para>
1956                 Configure an LDAP server and initialize the directory with the top-level entries needed by IDMAP
1957                 as shown in the following LDIF file:
1958 <screen>
1959 dn: dc=snowshow,dc=com
1960 objectClass: dcObject
1961 objectClass: organization
1962 dc: snowshow
1963 o: The Greatest Snow Show in Singapore.
1964 description: Posix and Samba LDAP Identity Database
1966 dn: cn=Manager,dc=snowshow,dc=com
1967 objectClass: organizationalRole
1968 cn: Manager
1969 description: Directory Manager
1971 dn: ou=Idmap,dc=snowshow,dc=com
1972 objectClass: organizationalUnit
1973 ou: idmap
1974 </screen>
1975                 </para></step>
1977                 <step><para>
1978                 Execute the command to join the Samba domain member server to the ADS domain as shown here:
1979 <screen>
1980 &rootprompt; net ads testjoin
1981 Using short domain name -- SNOWSHOW
1982 Joined 'GOODELF' to realm 'SNOWSHOW.COM'
1983 </screen>
1984                 </para></step>
1986                 <step><para>
1987                 Store the LDAP server access password in the Samba <filename>secrets.tdb</filename> file as follows:
1988 <screen>
1989 &rootprompt; smbpasswd -w not24get
1990 </screen>
1991                 </para></step>
1993                 <step><para>
1994                 Start the <command>nmbd</command>, <command>winbind</command>, and <command>smbd</command> daemons in the order shown.
1995                 </para></step>
1996         </procedure>
1999         <para>
2000         <indexterm><primary>diagnostic</primary></indexterm>
2001         Follow the diagnostic procedures shown earlier in this chapter to identify success or failure of the join.
2002         In many cases a failure is indicated by a silent return to the command prompt with no indication of the
2003         reason for failure.
2004         </para>
2006         </sect3>
2008         <sect3>
2009         <title>IDMAP and NSS Using LDAP from ADS with RFC2307bis Schema Extension</title>
2011         <para>
2012         <indexterm><primary>rfc2307bis</primary></indexterm>
2013         <indexterm><primary>schema</primary></indexterm>
2014         The use of this method is messy. The information provided in this section is for guidance only
2015         and is very definitely not complete. This method does work; it is used in a number of large sites
2016         and has an acceptable level of performance.
2017         </para>
2019         <para>
2020         An example &smb.conf; file is shown in <link linkend="sbewinbindex"/>.
2021         </para>
2023 <smbconfexample id="sbewinbindex">
2024 <title>ADS Membership Using RFC2307bis Identity Resolution &smb.conf; File</title>
2025 <smbconfcomment>Global parameters</smbconfcomment>
2026 <smbconfsection name="[global]"/>
2027 <smbconfoption name="workgroup">BUBBAH</smbconfoption>
2028 <smbconfoption name="netbios name">MADMAX</smbconfoption>
2029 <smbconfoption name="realm">BUBBAH.COM</smbconfoption>
2030 <smbconfoption name="server string">Samba Server</smbconfoption>
2031 <smbconfoption name="security">ADS</smbconfoption>
2032 <smbconfoption name="idmap uid">150000-550000</smbconfoption>
2033 <smbconfoption name="idmap gid">150000-550000</smbconfoption>
2034 <smbconfoption name="template shell">/bin/bash</smbconfoption>
2035 <smbconfoption name="winbind use default domain">Yes</smbconfoption>
2036 <smbconfoption name="winbind trusted domains only">Yes</smbconfoption>
2037 <smbconfoption name="winbind nested groups">Yes</smbconfoption>
2038 </smbconfexample>
2040         <para>
2041         <indexterm><primary>nss_ldap</primary></indexterm>
2042         The DMS must be joined to the domain using the usual procedure. Additionally, it is necessary
2043         to build and install the PADL nss_ldap tool set. Be sure to build this tool set with the
2044         following:
2045 <screen>
2046 ./configure --enable-rfc2307bis --enable-schema-mapping
2047 make install
2048 </screen>
2049         </para>
2051         <para>
2052         <indexterm><primary>/etc/nsswitch.conf</primary></indexterm>
2053         The following <filename>/etc/nsswitch.conf</filename> file contents are required:
2054 <screen>
2056 passwd: files ldap
2057 shadow: files ldap
2058 group:  files ldap
2060 hosts:  files wins
2062 </screen>
2063         </para>
2065         <para>
2066         <indexterm><primary>/etc/ldap.conf</primary></indexterm>
2067         <indexterm><primary>nss_ldap</primary></indexterm>
2068         The <filename>/etc/ldap.conf</filename> file must be configured also. Refer to the PADL documentation
2069         and source code for nss_ldap instructions.
2070         </para>
2072         <para>
2073         The next step involves preparation on the ADS schema. This is briefly discussed in the remaining
2074         part of this chapter.
2075         </para>
2077                 <sect4>
2078                 <title>IDMAP, Active Directory, and MS Services for UNIX 3.5</title>
2080                 <para>
2081                 <indexterm><primary>SFU</primary></indexterm>
2082                 The Microsoft Windows Service for UNIX version 3.5 is available for free
2083                 <ulink url="http://www.microsoft.com/windows/sfu/">download</ulink>
2084                 from the Microsoft Web site. You will need to download this tool and install it following
2085                 Microsoft instructions.
2086                 </para>
2088                 </sect4>
2090                 <sect4>
2091                 <title>IDMAP, Active Directory, and AD4UNIX</title>
2093                 <para>
2094                 Instructions for obtaining and installing the AD4UNIX tool set can be found from the
2095                 <ulink url="http://www.geekcomix.com/cgi-bin/classnotes/wiki.pl?LDAP01/An_Alternative_Approach">
2096                 Geekcomix</ulink> Web site.
2097                 </para>
2099                 </sect4>
2101         </sect3>
2103         </sect2>
2106         <sect2>
2107         <title>UNIX/Linux Client Domain Member</title>
2109         <para><indexterm>
2110             <primary>user credentials</primary>
2111           </indexterm>
2112         So far this chapter has been mainly concerned with the provision of file and print
2113         services for domain member servers. However, an increasing number of UNIX/Linux
2114         workstations are being installed that do not act as file or print servers to anyone
2115         other than a single desktop user. The key demand for desktop systems is to be able
2116         to log onto any UNIX/Linux or Windows desktop using the same network user credentials.
2117         </para>
2119         <para><indexterm>
2120             <primary>Single Sign-On</primary>
2121             <see>SSO</see>
2122           </indexterm>
2123         The ability to use a common set of user credential across a variety of network systems
2124         is generally regarded as a single sign-on (SSO) solution. SSO systems are sold by a
2125         large number of vendors and include a range of technologies such as:
2126         </para>
2128         <itemizedlist>
2129                 <listitem><para>
2130                 Proxy sign-on
2131                 </para></listitem>
2133                 <listitem><para>
2134                 Federated directory provisioning
2135                 </para></listitem>
2137                 <listitem><para>
2138                 Metadirectory server solutions
2139                 </para></listitem>
2141                 <listitem><para>
2142                 Replacement authentication systems
2143                 </para></listitem>
2144         </itemizedlist>
2146         <para><indexterm>
2147             <primary>Identity management</primary>
2148           </indexterm>
2149         There are really only three solutions that provide integrated authentication and
2150         user identity management facilities:
2151         </para>
2153         <itemizedlist>
2154                 <listitem><para>
2155                 Samba winbind (free)
2156                 </para></listitem>
2158                 <listitem><para>
2159                 <ulink url="http://www.padl.com">PADL</ulink> PAM and LDAP tools (free)
2160                 </para></listitem>
2162                 <listitem><para>
2163                 <ulink url="http://www.vintela.com">Vintela</ulink> Authentication Services (commercial)
2164                 </para></listitem>
2165         </itemizedlist>
2167         <para>
2168         The following guidelines are pertinent to the deployment of winbind-based authentication
2169         and identity resolution with the express purpose of allowing users to log on to UNIX/Linux desktops
2170         using Windows network domain user credentials (username and password).
2171         </para>
2173         <para>
2174         You should note that it is possible to use LDAP-based PAM and NSS tools to permit distributed
2175         systems logons (SSO), providing user and group accounts are stored in an LDAP directory. This
2176         provides logon services for UNIX/Linux users, while Windows users obtain their sign-on
2177         support via Samba-3.
2178         </para>
2180         <para>
2181         <indexterm><primary>Windows Services for UNIX</primary><see>SUS</see></indexterm>
2182         On the other hand, if the authentication and identity resolution backend must be provided by
2183         a Windows NT4-style domain or from an Active Directory Domain that does not have the Microsoft
2184         Windows Services for UNIX installed, winbind is your best friend. Specific guidance for these
2185         situations now follows.
2186         </para>
2188         <para>
2189         <indexterm><primary>PAM</primary></indexterm>
2190         <indexterm><primary>Identity resolution</primary></indexterm>
2191         <indexterm><primary>NSS</primary></indexterm>
2192         To permit users to log on to a Linux system using Windows network credentials, you need to
2193         configure identity resolution (NSS) and PAM. This means that the basic steps include those
2194         outlined above with the addition of PAM configuration. Given that most workstations (desktop/client)
2195         usually do not need to provide file and print services to a group of users, the configuration
2196         of shares and printers is generally less important. Often this allows the share specifications
2197         to be entirely removed from the &smb.conf; file. That is obviously an administrator decision.
2198         </para>
2200                 <sect3>
2201                 <title>NT4 Domain Member</title>
2203                 <para>
2204                 The following steps provide a Linux system that users can log onto using
2205                 Windows NT4 (or Samba-3) domain network credentials:
2206                 </para>
2208                 <procedure>
2209                         <step><para>
2210                         Follow the steps outlined in <link linkend="wdcsdm"/> and ensure that
2211                         all validation tests function as shown.
2212                         </para></step>
2214                         <step><para>
2215                         Identify what services users must log on to. On Red Hat Linux, if it is
2216                         intended that the user shall be given access to all services, it may be
2217                         most expeditious to simply configure the file 
2218                         <filename>/etc/pam.d/system-auth</filename>.
2219                         </para></step>
2221                         <step><para>
2222                         Carefully make a backup copy of all PAM configuration files before you
2223                         begin making changes. If you break the PAM configuration, please note
2224                         that you may need to use an emergency boot process to recover your Linux
2225                         system. It is possible to break the ability to log into the system if
2226                         PAM files are incorrectly configured. The entire directory 
2227                         <filename>/etc/pam.d</filename> should be backed up to a safe location.
2228                         </para></step>
2230                         <step><para>
2231                         If you require only console login support, edit the <filename>/etc/pam.d/login</filename>
2232                         so it matches <link linkend="ch9-pamwnbdlogin"/>.
2233                         </para></step>
2235                         <step><para>
2236                         To provide the ability to log onto the graphical desktop interface, you must edit
2237                         the files <filename>gdm</filename> and <filename>xdm</filename> in the 
2238                         <filename>/etc/pam.d</filename> directory.
2239                         </para></step>
2241                         <step><para>
2242                         Edit only one file at a time. Carefully validate its operation before attempting
2243                         to reboot the machine.
2244                         </para></step>
2245                 </procedure>
2247                 </sect3>
2249                 <sect3>
2250                 <title>ADS Domain Member</title>
2252                 <para>
2253                 This procedure should be followed to permit a Linux network client (workstation/desktop)
2254                 to permit users to log on using Microsoft Active Directory-based user credentials.
2255                 </para>
2257                 <procedure>
2258                         <step><para>
2259                         Follow the steps outlined in <link linkend="adssdm"/> and ensure that
2260                         all validation tests function as shown.
2261                         </para></step>
2263                         <step><para>
2264                         Identify what services users must log on to. On Red Hat Linux, if it is
2265                         intended that the user shall be given access to all services, it may be
2266                         most expeditious to simply configure the file 
2267                         <filename>/etc/pam.d/system-auth</filename> as shown in <link linkend="ch9-rhsysauth"/>.
2268                         </para></step>
2270                         <step><para>
2271                         Carefully make a backup copy of all PAM configuration files before you
2272                         begin making changes. If you break the PAM configuration, please note
2273                         that you may need to use an emergency boot process to recover your Linux
2274                         system. It is possible to break the ability to log into the system if
2275                         PAM files are incorrectly configured. The entire directory 
2276                         <filename>/etc/pam.d</filename> should be backed up to a safe location.
2277                         </para></step>
2279                         <step><para>
2280                         If you require only console login support, edit the <filename>/etc/pam.d/login</filename>
2281                         so it matches <link linkend="ch9-pamwnbdlogin"/>.
2282                         </para></step>
2284                         <step><para>
2285                         To provide the ability to log onto the graphical desktop interface, you must edit
2286                         the files <filename>gdm</filename> and <filename>xdm</filename> in the 
2287                         <filename>/etc/pam.d</filename> directory.
2288                         </para></step>
2290                         <step><para>
2291                         Edit only one file at a time. Carefully validate its operation before attempting
2292                         to reboot the machine.
2293                         </para></step>
2294                 </procedure>
2296                 </sect3>
2298 <example id="ch9-pamwnbdlogin">
2299 <title>SUSE: PAM <filename>login</filename> Module Using Winbind</title>
2300 <screen>
2301 # /etc/pam.d/login
2303 #%PAM-1.0
2304 auth sufficient pam_unix2.so    nullok
2305 auth sufficient pam_winbind.so use_first_pass use_authtok
2306 auth required   pam_securetty.so
2307 auth required   pam_nologin.so
2308 auth required   pam_env.so
2309 auth required   pam_mail.so
2310 account sufficient      pam_unix2.so
2311 account sufficient      pam_winbind.so user_first_pass use_authtok
2312 password required       pam_pwcheck.so  nullok
2313 password sufficient     pam_unix2.so    nullok use_first_pass use_authtok
2314 password sufficient     pam_winbind.so  use_first_pass use_authtok
2315 session sufficient      pam_unix2.so    none
2316 session sufficient      pam_winbind.so  use_first_pass use_authtok
2317 session required        pam_limits.so
2318 </screen>
2319 </example>
2321 <example id="ch9-pamwbndxdm">
2322 <title>SUSE: PAM <filename>xdm</filename> Module Using Winbind</title>
2323 <screen>
2324 # /etc/pam.d/gdm (/etc/pam.d/xdm)
2326 #%PAM-1.0
2327 auth     sufficient     pam_unix2.so     nullok
2328 auth     sufficient     pam_winbind.so   use_first_pass use_authtok
2329 account  sufficient     pam_unix2.so
2330 account  sufficient     pam_winbind.so   use_first_pass use_authtok
2331 password sufficient     pam_unix2.so
2332 password sufficient     pam_winbind.so   use_first_pass use_authtok
2333 session  sufficient     pam_unix2.so
2334 session  sufficient     pam_winbind.so   use_first_pass use_authtok
2335 session  required       pam_dev perm.so
2336 session  required       pam_resmgr.so
2337 </screen>
2338 </example>
2340 <example id="ch9-rhsysauth">
2341 <title>Red Hat 9: PAM System Authentication File: <filename>/etc/pam.d/system-auth</filename> Module Using Winbind</title>
2342 <screen>
2343 #%PAM-1.0
2344 auth        required      /lib/security/$ISA/pam_env.so
2345 auth        sufficient    /lib/security/$ISA/pam_unix.so likeauth nullok
2346 auth        sufficient    /lib/security/$ISA/pam_winbind.so use_first_pass
2347 auth        required      /lib/security/$ISA/pam_deny.so
2349 account     required      /lib/security/$ISA/pam_unix.so
2350 account     sufficient    /lib/security/$ISA/pam_winbind.so use_first_pass
2352 password    required      /lib/security/$ISA/pam_cracklib.so retry=3 type=
2353 # Note: The above line is complete. There is nothing following the '='
2354 password    sufficient    /lib/security/$ISA/pam_unix.so \
2355                                              nullok use_authtok md5 shadow
2356 password    sufficient    /lib/security/$ISA/pam_winbind.so use_first_pass
2357 password    required      /lib/security/$ISA/pam_deny.so
2359 session     required      /lib/security/$ISA/pam_limits.so
2360 session     sufficient    /lib/security/$ISA/pam_unix.so
2361 session     sufficient    /lib/security/$ISA/pam_winbind.so use_first_pass
2362 </screen>
2363 </example>
2365         </sect2>
2367         <sect2>
2368                 <title>Key Points Learned</title>
2370                 <para>
2371                 The addition of UNIX/Linux Samba servers and clients is a common requirement. In this chapter, you
2372                 learned how to integrate such servers so that the UID/GID mappings they use can be consistent
2373                 across all domain member servers. You also discovered how to implement the ability to use Samba
2374                 or Windows domain account credentials to log on to a UNIX/Linux client.
2375                 </para>
2377                 <para>
2378                 The following are key points made in this chapter:
2379                 </para>
2381                 <itemizedlist>
2382                         <listitem><para>
2383                         Domain controllers are always authoritative for the domain.
2384                         </para></listitem>
2386                         <listitem><para>
2387                         Domain members may have local accounts and must be able to resolve the identity of 
2388                         domain user accounts. Domain user account identity must map to a local UID/GID. That 
2389                         local UID/GID can be stored in LDAP. This way, it is possible to share the IDMAP data 
2390                         across all domain member machines.
2391                         </para></listitem>
2393                         <listitem><para>
2394                         Resolution of user and group identities on domain member machines may be implemented 
2395                         using direct LDAP services or using winbind.
2396                         </para></listitem>
2398                         <listitem><para>
2399                         On NSS/PAM enabled UNIX/Linux systems, NSS is responsible for identity management 
2400                         and PAM is responsible for authentication of logon credentials (username and password).
2401                         </para></listitem>
2402                 </itemizedlist>
2404         </sect2>
2406 </sect1>
2408 <sect1>
2409         <title>Questions and Answers</title>
2411         <para>
2412         The following questions were obtained from the mailing list and also from private discussions
2413         with Windows network administrators.
2414         </para>
2416         <qandaset defaultlabel="chap09qa" type="number">
2417         <qandaentry>
2418         <question>
2420                 <para>
2421                 We use NIS for all UNIX accounts. Why do we need winbind?
2422                 </para>
2424         </question>
2425         <answer>
2427             <para>
2428                 <indexterm><primary>NIS</primary></indexterm>
2429                 <indexterm><primary>encrypted passwords</primary></indexterm>
2430                 <indexterm><primary>smbpasswd</primary></indexterm>
2431                 <indexterm><primary>tdbsam</primary></indexterm>
2432                 <indexterm><primary>passdb backend</primary></indexterm>
2433                 <indexterm><primary>Winbind</primary></indexterm>
2434                 You can use NIS for your UNIX accounts. NIS does not store the Windows encrypted
2435                 passwords that need to be stored in one of the acceptable passdb backends.
2436                 Your choice of backend is limited to <parameter>smbpasswd</parameter> or
2437                 <parameter>tdbsam</parameter>. Winbind is needed to handle the resolution of
2438                 SIDs from trusted domains to local UID/GID values.
2439                 </para>
2441             <para>
2442                 <indexterm><primary>winbind trusted domains only</primary></indexterm>
2443                 <indexterm><primary>getpwnam()</primary></indexterm>
2444                 On a domain member server, you effectively map Windows domain users to local users
2445                 that are in your NIS database by specifying the <parameter>winbind trusted domains
2446                 only</parameter>. This causes user and group account lookups to be routed via
2447                 the <command>getpwnam()</command> family of systems calls. On an NIS-enabled client,
2448                 this pushes the resolution of users and groups out through NIS.
2449                 </para>
2451                 <para>
2452                 As a general rule, it is always a good idea to run winbind on all Samba servers.
2453                 </para>
2455         </answer>
2456         </qandaentry>
2458         <qandaentry>
2459         <question>
2461                 <para>
2462                 Our IT management people do not like LDAP but are looking at Microsoft Active Directory. 
2463               Which is better?<indexterm>
2464                 <primary>Active Directory</primary>
2465               </indexterm>
2466                 </para>
2468         </question>
2469         <answer>
2471             <para><indexterm>
2472                 <primary>LDAP</primary>
2473                 <secondary>server</secondary>
2474               </indexterm><indexterm>
2475                 <primary>Kerberos</primary>
2476               </indexterm><indexterm>
2477                 <primary>schema</primary>
2478               </indexterm>
2479                 Microsoft Active Directory is an LDAP server that is intricately tied to a Kerberos
2480                 infrastructure. Most IT managers who object to LDAP do so because
2481                 an LDAP server is most often supplied as a raw tool that needs to be configured and
2482                 for which the administrator must create the schema, create the administration tools, and
2483                 devise the backup and recovery facilities in a site-dependent manner. LDAP servers
2484                 in general are seen as a high-energy, high-risk facility.
2485                 </para>
2487             <para><indexterm>
2488                 <primary>management</primary>
2489               </indexterm>
2490                 Microsoft Active Directory by comparison is easy to install and configure and
2491                 is supplied with all tools necessary to implement and manage the directory. For sites
2492                 that lack a lot of technical competence, Active Directory is a good choice. For sites
2493                 that have the technical competence to handle Active Directory well, LDAP is a good
2494                 alternative. The real issue is, What type of solution does
2495                 the site want? If management wants a choice to use an alternative, they may want to
2496                 consider the options. On the other hand, if management just wants a solution that works,
2497                 Microsoft Active Directory is a good solution.
2498                 </para>
2500         </answer>
2501         </qandaentry>
2503         <qandaentry>
2504         <question>
2506                 <para>
2507                 We want to implement a Samba PDC, four Samba BDCs, and 10 Samba servers. Is it possible 
2508                 to use NIS in place of LDAP?
2509                 </para>
2511         </question>
2512         <answer>
2514             <para><indexterm>
2515                 <primary>NIS</primary>
2516               </indexterm><indexterm>
2517                 <primary>LDAP</primary>
2518               </indexterm><indexterm>
2519                 <primary>encrypted passwords</primary>
2520               </indexterm><indexterm>
2521                 <primary>synchronized</primary>
2522               </indexterm><indexterm>
2523                 <primary>secure account password</primary>
2524               </indexterm><indexterm>
2525                 <primary>PDC</primary>
2526               </indexterm><indexterm>
2527                 <primary>BDC</primary>
2528               </indexterm>
2529                 Yes, it is possible to use NIS in place of LDAP, but there may be problems with keeping
2530                 the Windows (SMB) encrypted passwords database correctly synchronized across the entire
2531                 network. Workstations (Windows client machines) periodically change their domain
2532                 membership secure account password. How can you keep changes that are on remote BDCs
2533                 synchronized on the PDC?
2534                 </para>
2536             <para><indexterm>
2537                 <primary>centralized storage</primary>
2538               </indexterm><indexterm>
2539                 <primary>management</primary>
2540               </indexterm><indexterm>
2541                 <primary>network Identities</primary>
2542               </indexterm>
2543                 LDAP is a more elegant solution because it permits centralized storage and management
2544                 of all network identities (user, group, and machine accounts) together with all information
2545                 Samba needs to provide to network clients and their users.
2546                 </para>
2548         </answer>
2549         </qandaentry>
2551         <qandaentry>
2552         <question>
2554                 <para>
2555                 Are you suggesting that users should not log on to a domain member server? If so, why?
2556                 </para>
2558         </question>
2559         <answer>
2561             <para><indexterm>
2562                 <primary>security</primary>
2563               </indexterm><indexterm>
2564                 <primary>data</primary>
2565                 <secondary>integrity</secondary>
2566               </indexterm><indexterm>
2567                 <primary>mapped drives</primary>
2568               </indexterm>
2569                 Many UNIX administrators mock the model that the personal computer industry has adopted
2570                 as normative since the early days of Novell NetWare. The old
2571                 perception of the necessity to keep users off file and print servers was a result of
2572                 fears concerning the security and integrity of data. It was a simple and generally
2573                 effective measure to keep users away from servers, except through mapped drives.
2574                 </para>
2576             <para><indexterm>
2577                 <primary>user logins</primary>
2578               </indexterm><indexterm>
2579                 <primary>risk</primary>
2580               </indexterm><indexterm>
2581                 <primary>user errors</primary>
2582               </indexterm><indexterm>
2583                 <primary>strategy</primary>
2584               </indexterm><indexterm>
2585                 <primary>policy</primary>
2586               </indexterm>
2587                 UNIX administrators are fully correct in asserting that UNIX servers and workstations
2588                 are identical in terms of the software that is installed. They correctly assert that
2589                 in a well-secured environment it is safe to store files on a system that has hundreds
2590                 of users. But all network administrators must factor into the decision to allow or
2591                 reject general user logins to a UNIX system that is principally a file and print
2592                 server the risk to operations through simple user errors.
2593                 Only then can one begin to appraise the best strategy and adopt a site-specific
2594                 policy that best protects the needs of users and of the organization alike.
2595                 </para>
2597             <para><indexterm>
2598                 <primary>system level logins</primary>
2599               </indexterm>
2600                 From experience, it is my recommendation to keep general system-level logins to a
2601                 practical minimum and to eliminate them if possible. This should not be taken as a
2602                 hard rule, though. The better question is, what works best for the site?
2603                 </para>
2605         </answer>
2606         </qandaentry>
2608         <qandaentry>
2609         <question>
2611             <para><indexterm>
2612                 <primary>winbind enable local accounts</primary>
2613               </indexterm><indexterm>
2614                 <primary>/etc/passwd</primary>
2615               </indexterm><indexterm>
2616                 <primary>options list</primary>
2617               </indexterm><indexterm>
2618                 <primary>ACL</primary>
2619               </indexterm><indexterm>
2620                 <primary>share</primary>
2621               </indexterm>
2622                 In my &smb.conf; file, I enabled the parameter <parameter>winbind enable local accounts
2623                 </parameter> on all domain member servers, but it does not work. The accounts I put in 
2624                 <filename>/etc/passwd</filename> do not show up in the options list when I try to set an
2625                 ACL on a share. What have I done wrong?
2626                 </para>
2628         </question>
2629         <answer>
2631             <para><indexterm>
2632                 <primary>local users</primary>
2633               </indexterm><indexterm>
2634                 <primary>local groups</primary>
2635               </indexterm><indexterm>
2636                 <primary>UNIX account</primary>
2637               </indexterm><indexterm>
2638                 <primary>getpwnam()</primary>
2639               </indexterm><indexterm>
2640                 <primary>getgrgid()</primary>
2641               </indexterm><indexterm>
2642                 <primary>Identity resolution</primary>
2643               </indexterm><indexterm>
2644                 <primary>failure</primary>
2645               </indexterm><indexterm>
2646                 <primary>Domain</primary>
2647               </indexterm>
2648                 The manual page for this &smb.conf; file parameter clearly says, <quote>This parameter 
2649                 controls whether or not winbindd will act as a stand-in replacement for the various 
2650                 account management hooks in smb.conf (for example, add user script). If enabled, winbindd 
2651                 will support the creation of local users and groups as another source of UNIX account 
2652                 information available via getpwnam() or getgrgid(), etc....</quote> By default this
2653                 parameter is already enabled; therefore, the action you are seeing is a result of a failure
2654                 of identity resolution in the domain.
2655                 </para>
2657             <para><indexterm>
2658                 <primary>Domain logons</primary>
2659               </indexterm><indexterm>
2660                 <primary>Identity resolution</primary>
2661               </indexterm><indexterm>
2662                 <primary>Domain</primary>
2663                 <secondary>user</secondary>
2664               </indexterm><indexterm>
2665                 <primary>Domain</primary>
2666                 <secondary>group</secondary>
2667               </indexterm><indexterm>
2668                 <primary>UID</primary>
2669               </indexterm><indexterm>
2670                 <primary>GID</primary>
2671               </indexterm>
2672                 These are the accounts that are available for Windows network domain logons. Providing 
2673                 identity resolution has been correctly configured on the domain controllers as well as 
2674                 on domain member servers. The domain user and group identities automatically map 
2675                 to a valid local UID and GID pair.
2676                 </para>
2678         </answer>
2679         </qandaentry>
2681         <qandaentry>
2682         <question>
2684             <para><indexterm>
2685                 <primary>trusted domains</primary>
2686               </indexterm><indexterm>
2687                 <primary>domain</primary>
2688                 <secondary>trusted</secondary>
2689               </indexterm><indexterm>
2690                 <primary>winbind trusted domains only</primary>
2691               </indexterm><indexterm>
2692                 <primary>domain members</primary>
2693               </indexterm>
2694                 We want to ensure that only users from our own domain plus from trusted domains can use our
2695                 Samba servers. In the &smb.conf; file on all servers, we have enabled the <parameter>winbind
2696                 trusted domains only</parameter> parameter. We now find that users from trusted domains 
2697                 cannot access our servers, and users from Windows clients that are not domain members
2698                 can also access our servers. Is this a Samba bug?
2699                 </para>
2701         </question>
2702         <answer>
2704             <para><indexterm>
2705                 <primary>distributed</primary>
2706               </indexterm><indexterm>
2707                 <primary>NIS</primary>
2708               </indexterm><indexterm>
2709                 <primary>rsync</primary>
2710               </indexterm><indexterm>
2711                 <primary>LDAP</primary>
2712               </indexterm><indexterm>
2713                 <primary>winbindd</primary>
2714               </indexterm><indexterm>
2715                 <primary>/etc/passwd</primary>
2716               </indexterm>
2717                 The manual page for this <parameter>winbind trusted domains only</parameter> parameter says,
2718                 <quote>This parameter is designed to allow Samba servers that are members of a Samba-controlled 
2719                 domain to use UNIX accounts distributed vi NIS, rsync, or LDAP as the UIDs for winbindd users 
2720                 in the hosts primary domain. Therefore,  the user <constant>SAMBA\user1</constant> would be 
2721                 mapped to the account <constant>user1</constant> in <filename>/etc/passwd</filename> instead 
2722                 of allocating a new UID for him or her.</quote> This clearly suggests that you are trying
2723                 to use this parameter inappropriately.
2724                 </para>
2726             <para><indexterm>
2727                 <primary>valid users</primary>
2728               </indexterm>
2729                 A far better solution is to use the <parameter>valid users</parameter> by specifying
2730                 precisely the domain users and groups that should be permitted access to the shares. You could, 
2731                 for example, set the following parameters:
2732 <screen>
2733 [demoshare]
2734         path = /export/demodata
2735         valid users = @"Domain Users", @"OTHERDOMAIN\Domain Users"
2736 </screen>
2737                 </para>
2740         </answer>
2741         </qandaentry>
2743         <qandaentry>
2744         <question>
2746                 <para>
2747                 What are the benefits of using LDAP for my domain member servers?
2748                 </para>
2750         </question>
2751         <answer>
2753             <para><indexterm>
2754                 <primary>LDAP</primary>
2755               </indexterm><indexterm>
2756                 <primary>benefit</primary>
2757               </indexterm><indexterm>
2758                 <primary>UID</primary>
2759               </indexterm><indexterm>
2760                 <primary>GID</primary>
2761               </indexterm><indexterm>
2762                 <primary>Domain Controllers</primary>
2763               </indexterm><indexterm>
2764                 <primary>Domain Member servers</primary>
2765               </indexterm><indexterm>
2766                 <primary>copy</primary>
2767               </indexterm><indexterm>
2768                 <primary>replicate</primary>
2769               </indexterm><indexterm>
2770                 <primary>identity</primary>
2771               </indexterm>
2772                 The key benefit of using LDAP is that the UID of all users and the GID of all groups
2773                 are globally consistent on domain controllers as well as on domain member servers.
2774                 This means that it is possible to copy/replicate files across servers without
2775                 loss of identity.
2776                 </para>
2778             <para><indexterm>
2779                 <primary>Identity resolution</primary>
2780               </indexterm><indexterm>
2781                 <primary>winbind</primary>
2782               </indexterm><indexterm>
2783                 <primary>IDMAP backend</primary>
2784               </indexterm><indexterm>
2785                 <primary>LDAP</primary>
2786               </indexterm><indexterm>
2787                 <primary>Domain Controllers</primary>
2788               </indexterm><indexterm>
2789                 <primary>Domain Member</primary>
2790                 <secondary>servers</secondary>
2791               </indexterm><indexterm>
2792                 <primary>Posix</primary>
2793               </indexterm><indexterm>
2794                 <primary>account information</primary>
2795               </indexterm>
2796                 When use is made of account identity resolution via winbind, even when an IDMAP backend
2797                 is stored in LDAP, the UID/GID on domain member servers is consistent, but differs
2798                 from the ID that the user/group has on domain controllers. The winbind allocated UID/GID
2799                 that is stored in LDAP (or locally) will be in the numeric range specified in the <parameter>
2800                 idmap uid/gid</parameter> in the &smb.conf; file. On domain controllers, the UID/GID is
2801                 that of the POSIX value assigned in the LDAP directory as part of the POSIX account information.
2802                 </para>
2804         </answer>
2805         </qandaentry>
2807         <qandaentry>
2808         <question>
2810                 <para>
2811                 Is proper DNS operation necessary for Samba-3 plus LDAP? If so, what must I put into
2812                 my DNS configuration?
2813                 </para>
2815         </question>
2816         <answer>
2818             <para><indexterm>
2819                 <primary>DNS</primary>
2820                 <secondary>configuration</secondary>
2821               </indexterm><indexterm>
2822                 <primary>DNS</primary>
2823                 <secondary>lookup</secondary>
2824               </indexterm><indexterm>
2825                 <primary>hosts</primary>
2826               </indexterm><indexterm>
2827                 <primary>/etc/nsswitch.conf</primary>
2828               </indexterm><indexterm>
2829                 <primary>NSS</primary>
2830               </indexterm><indexterm>
2831                 <primary>/etc/hosts</primary>
2832               </indexterm><indexterm>
2833                 <primary>WINS</primary>
2834                 <secondary>lookup</secondary>
2835               </indexterm>
2836                 Samba depends on correctly functioning resolution of hostnames to their IP address. Samba
2837                 makes no direct DNS lookup calls, but rather redirects all name-to-address calls via the
2838                 <command>getXXXbyXXX()</command> function calls. The configuration of the <constant>hosts</constant>
2839                 entry in the NSS <filename>/etc/nsswitch.conf</filename> file determines how the underlying
2840                 resolution process is implemented. If the <constant>hosts</constant> entry in your NSS
2841                 control file says:
2842 <screen>
2843 hosts: files dns wins
2844 </screen>
2845                 this means that a hostname lookup first tries the <filename>/etc/hosts</filename>.
2846                 If this fails to resolve, it attempts a DNS lookup, and if that fails, it tries a
2847                 WINS lookup.
2848                 </para>
2850             <para><indexterm>
2851                 <primary>NetBIOS</primary>
2852               </indexterm><indexterm>
2853                 <primary>TCP/IP</primary>
2854               </indexterm><indexterm>
2855                 <primary>name resolution</primary>
2856               </indexterm>
2857                 The addition of the WINS-based name lookup makes sense only if NetBIOS over TCP/IP has
2858                 been enabled on all Windows clients. Where NetBIOS over TCP/IP has been disabled, DNS
2859                 is the preferred name resolution technology. This usually makes most sense when Samba
2860                 is a client of an Active Directory domain, where NetBIOS use has been disabled. In this
2861                 case, the Windows 200x autoregisters all locator records it needs with its own DNS
2862                 server or servers.
2863                 </para>
2865         </answer>
2866         </qandaentry>
2868         <qandaentry>
2869         <question>
2871                 <para>
2872                 Our Windows 2003 Server Active Directory domain runs with NetBIOS disabled. Can we
2873                 use Samba-3 with that configuration?
2874                 </para>
2876         </question>
2877         <answer>
2879                 <para>
2880                 Yes.
2881                 </para>
2883         </answer>
2884         </qandaentry>
2886         <qandaentry>
2887         <question>
2889             <para><indexterm>
2890                 <primary>net</primary>
2891                 <secondary>ads</secondary>
2892                 <tertiary>join</tertiary>
2893               </indexterm><indexterm>
2894                 <primary>net</primary>
2895                 <secondary>rpc</secondary>
2896                 <tertiary>join</tertiary>
2897               </indexterm>
2898                 When I tried to execute net ads join, I got no output. It did not work, so
2899                 I think that it failed. I then executed net rpc join and that worked fine.
2900                 That is okay, isn't it?
2901                 </para>
2903         </question>
2904         <answer>
2906             <para><indexterm>
2907                 <primary>Kerberos</primary>
2908               </indexterm><indexterm>
2909                 <primary>authentication</primary>
2910               </indexterm>
2911                 No. This is not okay. It means that your Samba-3 client has joined the ADS domain as
2912                 a Windows NT4 client, and Samba-3 will not be using Kerberos-based authentication.
2913                 </para>
2915         </answer>
2916         </qandaentry>
2918         </qandaset>
2920 </sect1>
2922 </chapter>