Regenerate
[ira/wip.git] / docs / htmldocs / samba-bdc.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >How to Act as a Backup Domain Controller in a Purely Samba Controlled Domain</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.77+"><LINK
9 REL="HOME"
10 TITLE="SAMBA Project Documentation"
11 HREF="samba-howto-collection.html"><LINK
12 REL="UP"
13 TITLE="Type of installation"
14 HREF="type.html"><LINK
15 REL="PREVIOUS"
16 TITLE="Samba as a NT4 or Win2k Primary Domain Controller"
17 HREF="samba-pdc.html"><LINK
18 REL="NEXT"
19 TITLE="Samba as a ADS domain member"
20 HREF="ads.html"></HEAD
21 ><BODY
22 CLASS="CHAPTER"
23 BGCOLOR="#FFFFFF"
24 TEXT="#000000"
25 LINK="#0000FF"
26 VLINK="#840084"
27 ALINK="#0000FF"
28 ><DIV
29 CLASS="NAVHEADER"
30 ><TABLE
31 SUMMARY="Header navigation table"
32 WIDTH="100%"
33 BORDER="0"
34 CELLPADDING="0"
35 CELLSPACING="0"
36 ><TR
37 ><TH
38 COLSPAN="3"
39 ALIGN="center"
40 >SAMBA Project Documentation</TH
41 ></TR
42 ><TR
43 ><TD
44 WIDTH="10%"
45 ALIGN="left"
46 VALIGN="bottom"
47 ><A
48 HREF="samba-pdc.html"
49 ACCESSKEY="P"
50 >Prev</A
51 ></TD
52 ><TD
53 WIDTH="80%"
54 ALIGN="center"
55 VALIGN="bottom"
56 ></TD
57 ><TD
58 WIDTH="10%"
59 ALIGN="right"
60 VALIGN="bottom"
61 ><A
62 HREF="ads.html"
63 ACCESSKEY="N"
64 >Next</A
65 ></TD
66 ></TR
67 ></TABLE
68 ><HR
69 ALIGN="LEFT"
70 WIDTH="100%"></DIV
71 ><DIV
72 CLASS="CHAPTER"
73 ><H1
74 ><A
75 NAME="SAMBA-BDC"
76 ></A
77 >Chapter 6. How to Act as a Backup Domain Controller in a Purely Samba Controlled Domain</H1
78 ><DIV
79 CLASS="SECT1"
80 ><H1
81 CLASS="SECT1"
82 ><A
83 NAME="AEN1274"
84 ></A
85 >6.1. Prerequisite Reading</H1
86 ><P
87 >Before you continue reading in this chapter, please make sure
88 that you are comfortable with configuring a Samba PDC
89 as described in the <A
90 HREF="Samba-PDC-HOWTO.html"
91 TARGET="_top"
92 >Samba-PDC-HOWTO</A
93 >.</P
94 ></DIV
95 ><DIV
96 CLASS="SECT1"
97 ><H1
98 CLASS="SECT1"
99 ><A
100 NAME="AEN1278"
101 ></A
102 >6.2. Background</H1
103 ><P
104 >What is a Domain Controller? It is a machine that is able to answer
105 logon requests from workstations in a Windows NT Domain. Whenever a
106 user logs into a Windows NT Workstation, the workstation connects to a
107 Domain Controller and asks him whether the username and password the
108 user typed in is correct.  The Domain Controller replies with a lot of
109 information about the user, for example the place where the users
110 profile is stored, the users full name of the user. All this
111 information is stored in the NT user database, the so-called SAM.</P
112 ><P
113 >There are two kinds of Domain Controller in a NT 4 compatible Domain:
114 A Primary Domain Controller (PDC) and one or more Backup Domain
115 Controllers (BDC). The PDC contains the master copy of the
116 SAM. Whenever the SAM has to change, for example when a user changes
117 his password, this change has to be done on the PDC. A Backup Domain
118 Controller is a machine that maintains a read-only copy of the
119 SAM. This way it is able to reply to logon requests and authenticate
120 users in case the PDC is not available. During this time no changes to
121 the SAM are possible. Whenever changes to the SAM are done on the PDC,
122 all BDC receive the changes from the PDC.</P
123 ><P
124 >Since version 2.2 Samba officially supports domain logons for all
125 current Windows Clients, including Windows 2000 and XP. This text
126 assumes the domain to be named SAMBA. To be able to act as a PDC, some
127 parameters in the [global]-section of the smb.conf have to be set:</P
128 ><P
129 ><PRE
130 CLASS="PROGRAMLISTING"
131 >workgroup = SAMBA
132 domain master = yes
133 domain logons = yes</PRE
134 ></P
135 ><P
136 >Several other things like a [homes] and a [netlogon] share also may be
137 set along with settings for the profile path, the users home drive and
138 others. This will not be covered in this document.</P
139 ></DIV
140 ><DIV
141 CLASS="SECT1"
142 ><H1
143 CLASS="SECT1"
144 ><A
145 NAME="AEN1286"
146 ></A
147 >6.3. What qualifies a Domain Controller on the network?</H1
148 ><P
149 >Every machine that is a Domain Controller for the domain SAMBA has to
150 register the NetBIOS group name SAMBA#1c with the WINS server and/or
151 by broadcast on the local network. The PDC also registers the unique
152 NetBIOS name SAMBA#1b with the WINS server. The name type #1b is
153 normally reserved for the domain master browser, a role that has
154 nothing to do with anything related to authentication, but the
155 Microsoft Domain implementation requires the domain master browser to
156 be on the same machine as the PDC.</P
157 ><DIV
158 CLASS="SECT2"
159 ><H2
160 CLASS="SECT2"
161 ><A
162 NAME="AEN1289"
163 ></A
164 >6.3.1. How does a Workstation find its domain controller?</H2
165 ><P
166 >A NT workstation in the domain SAMBA that wants a local user to be
167 authenticated has to find the domain controller for SAMBA. It does
168 this by doing a NetBIOS name query for the group name SAMBA#1c. It
169 assumes that each of the machines it gets back from the queries is a
170 domain controller and can answer logon requests. To not open security
171 holes both the workstation and the selected (TODO: How is the DC
172 chosen) domain controller authenticate each other. After that the
173 workstation sends the user's credentials (his name and password) to
174 the domain controller, asking for approval.</P
175 ></DIV
176 ><DIV
177 CLASS="SECT2"
178 ><H2
179 CLASS="SECT2"
180 ><A
181 NAME="AEN1292"
182 ></A
183 >6.3.2. When is the PDC needed?</H2
184 ><P
185 >Whenever a user wants to change his password, this has to be done on
186 the PDC. To find the PDC, the workstation does a NetBIOS name query
187 for SAMBA#1b, assuming this machine maintains the master copy of the
188 SAM. The workstation contacts the PDC, both mutually authenticate and
189 the password change is done.</P
190 ></DIV
191 ></DIV
192 ><DIV
193 CLASS="SECT1"
194 ><H1
195 CLASS="SECT1"
196 ><A
197 NAME="AEN1295"
198 ></A
199 >6.4. Can Samba be a Backup Domain Controller to an NT PDC?</H1
200 ><P
201 >With version 2.2, no. The native NT SAM replication protocols have
202 not yet been fully implemented. The Samba Team is working on
203 understanding and implementing the protocols, but this work has not
204 been finished for version 2.2.</P
205 ><P
206 >With version 3.0, the work on both the replication protocols and a
207 suitable storage mechanism has progressed, and some form of NT4 BDC
208 support is expected soon.</P
209 ><P
210 >Can I get the benefits of a BDC with Samba?  Yes. The main reason for
211 implementing a BDC is availability. If the PDC is a Samba machine,
212 a second Samba machine can be set up to
213 service logon requests whenever the PDC is down.</P
214 ></DIV
215 ><DIV
216 CLASS="SECT1"
217 ><H1
218 CLASS="SECT1"
219 ><A
220 NAME="AEN1300"
221 ></A
222 >6.5. How do I set up a Samba BDC?</H1
223 ><P
224 >Several things have to be done:</P
225 ><P
226 ></P
227 ><UL
228 ><LI
229 ><P
230 >The domain SID has to be the same on the PDC and the BDC. This used to
231 be stored in the file private/MACHINE.SID. This file is not created
232 anymore since Samba 2.2.5 or even earlier. Nowadays the domain SID is
233 stored in the file private/secrets.tdb. Simply copying the secrets.tdb
234 from the PDC to the BDC does not work, as the BDC would
235 generate a new SID for itself and override the domain SID with this
236 new BDC SID.</P
237 ><P
238 >To retrieve the domain SID from the PDC or an existing BDC and store it in the
239 secrets.tdb, execute 'net rpc getsid' on the BDC.</P
240 ></LI
241 ><LI
242 ><P
243 >The Unix user database has to be synchronized from the PDC to the
244 BDC. This means that both the /etc/passwd and /etc/group have to be
245 replicated from the PDC to the BDC. This can be done manually
246 whenever changes are made, or the PDC is set up as a NIS master
247 server and the BDC as a NIS slave server. To set up the BDC as a
248 mere NIS client would not be enough, as the BDC would not be able to
249 access its user database in case of a PDC failure.</P
250 ></LI
251 ><LI
252 ><P
253 >The Samba password database in the file private/smbpasswd has to be
254 replicated from the PDC to the BDC. This is a bit tricky, see the
255 next section.</P
256 ></LI
257 ><LI
258 ><P
259 >Any netlogon share has to be replicated from the PDC to the
260 BDC. This can be done manually whenever login scripts are changed,
261 or it can be done automatically together with the smbpasswd
262 synchronization.</P
263 ></LI
264 ></UL
265 ><P
266 >Finally, the BDC has to be found by the workstations. This can be done
267 by setting</P
268 ><P
269 ><PRE
270 CLASS="PROGRAMLISTING"
271 >workgroup = samba
272 domain master = no
273 domain logons = yes</PRE
274 ></P
275 ><P
276 >in the [global]-section of the smb.conf of the BDC. This makes the BDC
277 only register the name SAMBA#1c with the WINS server. This is no
278 problem as the name SAMBA#1c is a NetBIOS group name that is meant to
279 be registered by more than one machine. The parameter 'domain master =
280 no' forces the BDC not to register SAMBA#1b which as a unique NetBIOS
281 name is reserved for the Primary Domain Controller.</P
282 ><DIV
283 CLASS="SECT2"
284 ><H2
285 CLASS="SECT2"
286 ><A
287 NAME="AEN1317"
288 ></A
289 >6.5.1. How do I replicate the smbpasswd file?</H2
290 ><P
291 >Replication of the smbpasswd file is sensitive. It has to be done
292 whenever changes to the SAM are made. Every user's password change is
293 done in the smbpasswd file and has to be replicated to the BDC. So
294 replicating the smbpasswd file very often is necessary.</P
295 ><P
296 >As the smbpasswd file contains plain text password equivalents, it
297 must not be sent unencrypted over the wire. The best way to set up
298 smbpasswd replication from the PDC to the BDC is to use the utility
299 rsync. rsync can use ssh as a transport. ssh itself can be set up to
300 accept *only* rsync transfer without requiring the user to type a
301 password.</P
302 ></DIV
303 ><DIV
304 CLASS="SECT2"
305 ><H2
306 CLASS="SECT2"
307 ><A
308 NAME="AEN1321"
309 ></A
310 >6.5.2. Can I do this all with LDAP?</H2
311 ><P
312 >The simple answer is YES.  Samba's pdb_ldap code supports
313 binding to a replica LDAP server, and will also follow referrals and
314 rebind to the master if it ever needs to make a modification to the
315 database.  (Normally BDCs are read only, so this will not occur
316 often).</P
317 ></DIV
318 ></DIV
319 ></DIV
320 ><DIV
321 CLASS="NAVFOOTER"
322 ><HR
323 ALIGN="LEFT"
324 WIDTH="100%"><TABLE
325 SUMMARY="Footer navigation table"
326 WIDTH="100%"
327 BORDER="0"
328 CELLPADDING="0"
329 CELLSPACING="0"
330 ><TR
331 ><TD
332 WIDTH="33%"
333 ALIGN="left"
334 VALIGN="top"
335 ><A
336 HREF="samba-pdc.html"
337 ACCESSKEY="P"
338 >Prev</A
339 ></TD
340 ><TD
341 WIDTH="34%"
342 ALIGN="center"
343 VALIGN="top"
344 ><A
345 HREF="samba-howto-collection.html"
346 ACCESSKEY="H"
347 >Home</A
348 ></TD
349 ><TD
350 WIDTH="33%"
351 ALIGN="right"
352 VALIGN="top"
353 ><A
354 HREF="ads.html"
355 ACCESSKEY="N"
356 >Next</A
357 ></TD
358 ></TR
359 ><TR
360 ><TD
361 WIDTH="33%"
362 ALIGN="left"
363 VALIGN="top"
364 >Samba as a NT4 or Win2k Primary Domain Controller</TD
365 ><TD
366 WIDTH="34%"
367 ALIGN="center"
368 VALIGN="top"
369 ><A
370 HREF="type.html"
371 ACCESSKEY="U"
372 >Up</A
373 ></TD
374 ><TD
375 WIDTH="33%"
376 ALIGN="right"
377 VALIGN="top"
378 >Samba as a ADS domain member</TD
379 ></TR
380 ></TABLE
381 ></DIV
382 ></BODY
383 ></HTML
384 >