syncing docs with HEAD
[kai/samba.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="How to Configure Samba as a NT4 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 8. 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="AEN1143"
84 ></A
85 >8.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="AEN1147"
101 ></A
102 >8.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="AEN1155"
146 ></A
147 >8.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="AEN1158"
163 ></A
164 >8.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="AEN1161"
182 ></A
183 >8.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="AEN1164"
198 ></A
199 >8.4. Can Samba be a Backup Domain Controller?</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 >Can I get the benefits of a BDC with Samba?  Yes. The main reason for
207 implementing a BDC is availability. If the PDC is a Samba machine,
208 a second Samba machine can be set up to
209 service logon requests whenever the PDC is down.</P
210 ></DIV
211 ><DIV
212 CLASS="SECT1"
213 ><H1
214 CLASS="SECT1"
215 ><A
216 NAME="AEN1168"
217 ></A
218 >8.5. How do I set up a Samba BDC?</H1
219 ><P
220 >Several things have to be done:</P
221 ><P
222 ></P
223 ><UL
224 ><LI
225 ><P
226 >The domain SID has to be the same on the PDC and the BDC. This used to
227 be stored in the file private/MACHINE.SID. This file is not created
228 anymore since Samba 2.2.5 or even earlier. Nowadays the domain SID is
229 stored in the file private/secrets.tdb. Simply copying the secrets.tdb
230 from the PDC to the BDC does not work, as the BDC would
231 generate a new SID for itself and override the domain SID with this
232 new BDC SID.</P
233 ><P
234 >To retrieve the domain SID from the PDC or an existing BDC and store it in the
235 secrets.tdb, execute 'net rpc getsid' on the BDC.</P
236 ></LI
237 ><LI
238 ><P
239 >The Unix user database has to be synchronized from the PDC to the
240 BDC. This means that both the /etc/passwd and /etc/group have to be
241 replicated from the PDC to the BDC. This can be done manually
242 whenever changes are made, or the PDC is set up as a NIS master
243 server and the BDC as a NIS slave server. To set up the BDC as a
244 mere NIS client would not be enough, as the BDC would not be able to
245 access its user database in case of a PDC failure.</P
246 ></LI
247 ><LI
248 ><P
249 >The Samba password database in the file private/smbpasswd has to be
250 replicated from the PDC to the BDC. This is a bit tricky, see the
251 next section.</P
252 ></LI
253 ><LI
254 ><P
255 >Any netlogon share has to be replicated from the PDC to the
256 BDC. This can be done manually whenever login scripts are changed,
257 or it can be done automatically together with the smbpasswd
258 synchronization.</P
259 ></LI
260 ></UL
261 ><P
262 >Finally, the BDC has to be found by the workstations. This can be done
263 by setting</P
264 ><P
265 ><PRE
266 CLASS="PROGRAMLISTING"
267 >workgroup = samba
268 domain master = no
269 domain logons = yes</PRE
270 ></P
271 ><P
272 >in the [global]-section of the smb.conf of the BDC. This makes the BDC
273 only register the name SAMBA#1c with the WINS server. This is no
274 problem as the name SAMBA#1c is a NetBIOS group name that is meant to
275 be registered by more than one machine. The parameter 'domain master =
276 no' forces the BDC not to register SAMBA#1b which as a unique NetBIOS
277 name is reserved for the Primary Domain Controller.</P
278 ><DIV
279 CLASS="SECT2"
280 ><H2
281 CLASS="SECT2"
282 ><A
283 NAME="AEN1185"
284 ></A
285 >8.5.1. How do I replicate the smbpasswd file?</H2
286 ><P
287 >Replication of the smbpasswd file is sensitive. It has to be done
288 whenever changes to the SAM are made. Every user's password change is
289 done in the smbpasswd file and has to be replicated to the BDC. So
290 replicating the smbpasswd file very often is necessary.</P
291 ><P
292 >As the smbpasswd file contains plain text password equivalents, it
293 must not be sent unencrypted over the wire. The best way to set up
294 smbpasswd replication from the PDC to the BDC is to use the utility
295 rsync. rsync can use ssh as a transport. ssh itself can be set up to
296 accept *only* rsync transfer without requiring the user to type a
297 password.</P
298 ></DIV
299 ></DIV
300 ></DIV
301 ><DIV
302 CLASS="NAVFOOTER"
303 ><HR
304 ALIGN="LEFT"
305 WIDTH="100%"><TABLE
306 SUMMARY="Footer navigation table"
307 WIDTH="100%"
308 BORDER="0"
309 CELLPADDING="0"
310 CELLSPACING="0"
311 ><TR
312 ><TD
313 WIDTH="33%"
314 ALIGN="left"
315 VALIGN="top"
316 ><A
317 HREF="samba-pdc.html"
318 ACCESSKEY="P"
319 >Prev</A
320 ></TD
321 ><TD
322 WIDTH="34%"
323 ALIGN="center"
324 VALIGN="top"
325 ><A
326 HREF="samba-howto-collection.html"
327 ACCESSKEY="H"
328 >Home</A
329 ></TD
330 ><TD
331 WIDTH="33%"
332 ALIGN="right"
333 VALIGN="top"
334 ><A
335 HREF="ads.html"
336 ACCESSKEY="N"
337 >Next</A
338 ></TD
339 ></TR
340 ><TR
341 ><TD
342 WIDTH="33%"
343 ALIGN="left"
344 VALIGN="top"
345 >How to Configure Samba as a NT4 Primary Domain Controller</TD
346 ><TD
347 WIDTH="34%"
348 ALIGN="center"
349 VALIGN="top"
350 ><A
351 HREF="type.html"
352 ACCESSKEY="U"
353 >Up</A
354 ></TD
355 ><TD
356 WIDTH="33%"
357 ALIGN="right"
358 VALIGN="top"
359 >Samba as a ADS domain member</TD
360 ></TR
361 ></TABLE
362 ></DIV
363 ></BODY
364 ></HTML
365 >