This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.
[kai/samba.git] / docs / htmldocs / domain-security.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >security = domain in Samba 2.x</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="PREVIOUS"
13 TITLE="Security levels"
14 HREF="securitylevels.html"><LINK
15 REL="NEXT"
16 TITLE="Unified Logons between Windows NT and UNIX using Winbind"
17 HREF="winbind.html"></HEAD
18 ><BODY
19 CLASS="CHAPTER"
20 BGCOLOR="#FFFFFF"
21 TEXT="#000000"
22 LINK="#0000FF"
23 VLINK="#840084"
24 ALINK="#0000FF"
25 ><DIV
26 CLASS="NAVHEADER"
27 ><TABLE
28 SUMMARY="Header navigation table"
29 WIDTH="100%"
30 BORDER="0"
31 CELLPADDING="0"
32 CELLSPACING="0"
33 ><TR
34 ><TH
35 COLSPAN="3"
36 ALIGN="center"
37 >SAMBA Project Documentation</TH
38 ></TR
39 ><TR
40 ><TD
41 WIDTH="10%"
42 ALIGN="left"
43 VALIGN="bottom"
44 ><A
45 HREF="securitylevels.html"
46 ACCESSKEY="P"
47 >Prev</A
48 ></TD
49 ><TD
50 WIDTH="80%"
51 ALIGN="center"
52 VALIGN="bottom"
53 ></TD
54 ><TD
55 WIDTH="10%"
56 ALIGN="right"
57 VALIGN="bottom"
58 ><A
59 HREF="winbind.html"
60 ACCESSKEY="N"
61 >Next</A
62 ></TD
63 ></TR
64 ></TABLE
65 ><HR
66 ALIGN="LEFT"
67 WIDTH="100%"></DIV
68 ><DIV
69 CLASS="CHAPTER"
70 ><H1
71 ><A
72 NAME="DOMAIN-SECURITY"
73 ></A
74 >Chapter 9. security = domain in Samba 2.x</H1
75 ><DIV
76 CLASS="SECT1"
77 ><H1
78 CLASS="SECT1"
79 ><A
80 NAME="AEN1133"
81 ></A
82 >9.1. Joining an NT Domain with Samba 2.2</H1
83 ><P
84 >Assume you have a Samba 2.x server with a NetBIOS name of 
85         <TT
86 CLASS="CONSTANT"
87 >SERV1</TT
88 > and are joining an NT domain called
89         <TT
90 CLASS="CONSTANT"
91 >DOM</TT
92 >, which has a PDC with a NetBIOS name
93         of <TT
94 CLASS="CONSTANT"
95 >DOMPDC</TT
96 > and two backup domain controllers 
97         with NetBIOS names <TT
98 CLASS="CONSTANT"
99 >DOMBDC1</TT
100 > and <TT
101 CLASS="CONSTANT"
102 >DOMBDC2
103         </TT
104 >.</P
105 ><P
106 >In order to join the domain, first stop all Samba daemons 
107         and run the command:</P
108 ><P
109 ><TT
110 CLASS="PROMPT"
111 >root# </TT
112 ><TT
113 CLASS="USERINPUT"
114 ><B
115 >smbpasswd -j DOM -r DOMPDC
116         -U<TT
117 CLASS="REPLACEABLE"
118 ><I
119 >Administrator%password</I
120 ></TT
121 ></B
122 ></TT
123 ></P
124 ><P
125 >as we are joining the domain DOM and the PDC for that domain 
126         (the only machine that has write access to the domain SAM database) 
127         is DOMPDC. The <TT
128 CLASS="REPLACEABLE"
129 ><I
130 >Administrator%password</I
131 ></TT
132 > is 
133         the login name and password for an account which has the necessary 
134         privilege to add machines to the domain.  If this is successful 
135         you will see the message:</P
136 ><P
137 ><TT
138 CLASS="COMPUTEROUTPUT"
139 >smbpasswd: Joined domain DOM.</TT
140 >
141         </P
142 ><P
143 >in your terminal window. See the <A
144 HREF="smbpasswd.8.html"
145 TARGET="_top"
146 >       smbpasswd(8)</A
147 > man page for more details.</P
148 ><P
149 >There is existing development code to join a domain
150         without having to create the machine trust account on the PDC
151         beforehand.  This code will hopefully be available soon
152         in release branches as well.</P
153 ><P
154 >This command goes through the machine account password 
155         change protocol, then writes the new (random) machine account 
156         password for this Samba server into a file in the same directory 
157         in which an smbpasswd file would be stored - normally :</P
158 ><P
159 ><TT
160 CLASS="FILENAME"
161 >/usr/local/samba/private</TT
162 ></P
163 ><P
164 >In Samba 2.0.x, the filename looks like this:</P
165 ><P
166 ><TT
167 CLASS="FILENAME"
168 ><TT
169 CLASS="REPLACEABLE"
170 ><I
171 >&lt;NT DOMAIN NAME&gt;</I
172 ></TT
173 >.<TT
174 CLASS="REPLACEABLE"
175 ><I
176 >&lt;Samba 
177         Server Name&gt;</I
178 ></TT
179 >.mac</TT
180 ></P
181 ><P
182 >The <TT
183 CLASS="FILENAME"
184 >.mac</TT
185 > suffix stands for machine account 
186         password file. So in our example above, the file would be called:</P
187 ><P
188 ><TT
189 CLASS="FILENAME"
190 >DOM.SERV1.mac</TT
191 ></P
192 ><P
193 >In Samba 2.2, this file has been replaced with a TDB 
194         (Trivial Database) file named <TT
195 CLASS="FILENAME"
196 >secrets.tdb</TT
197 >.
198         </P
199 ><P
200 >This file is created and owned by root and is not 
201         readable by any other user. It is the key to the domain-level 
202         security for your system, and should be treated as carefully 
203         as a shadow password file.</P
204 ><P
205 >Now, before restarting the Samba daemons you must 
206         edit your <A
207 HREF="smb.conf.5.html"
208 TARGET="_top"
209 ><TT
210 CLASS="FILENAME"
211 >smb.conf(5)</TT
212 >
213         </A
214 > file to tell Samba it should now use domain security.</P
215 ><P
216 >Change (or add) your <A
217 HREF="smb.conf.5.html#SECURITY"
218 TARGET="_top"
219 >       <TT
220 CLASS="PARAMETER"
221 ><I
222 >security =</I
223 ></TT
224 ></A
225 > line in the [global] section 
226         of your smb.conf to read:</P
227 ><P
228 ><B
229 CLASS="COMMAND"
230 >security = domain</B
231 ></P
232 ><P
233 >Next change the <A
234 HREF="smb.conf.5.html#WORKGROUP"
235 TARGET="_top"
236 ><TT
237 CLASS="PARAMETER"
238 ><I
239 >       workgroup =</I
240 ></TT
241 ></A
242 > line in the [global] section to read: </P
243 ><P
244 ><B
245 CLASS="COMMAND"
246 >workgroup = DOM</B
247 ></P
248 ><P
249 >as this is the name of the domain we are joining. </P
250 ><P
251 >You must also have the parameter <A
252 HREF="smb.conf.5.html#ENCRYPTPASSWORDS"
253 TARGET="_top"
254 >       <TT
255 CLASS="PARAMETER"
256 ><I
257 >encrypt passwords</I
258 ></TT
259 ></A
260 > set to <TT
261 CLASS="CONSTANT"
262 >yes
263         </TT
264 > in order for your users to authenticate to the NT PDC.</P
265 ><P
266 >Finally, add (or modify) a <A
267 HREF="smb.conf.5.html#PASSWORDSERVER"
268 TARGET="_top"
269 >       <TT
270 CLASS="PARAMETER"
271 ><I
272 >password server =</I
273 ></TT
274 ></A
275 > line in the [global]
276         section to read: </P
277 ><P
278 ><B
279 CLASS="COMMAND"
280 >password server = DOMPDC DOMBDC1 DOMBDC2</B
281 ></P
282 ><P
283 >These are the primary and backup domain controllers Samba 
284         will attempt to contact in order to authenticate users. Samba will 
285         try to contact each of these servers in order, so you may want to 
286         rearrange this list in order to spread out the authentication load 
287         among domain controllers.</P
288 ><P
289 >Alternatively, if you want smbd to automatically determine 
290         the list of Domain controllers to use for authentication, you may 
291         set this line to be :</P
292 ><P
293 ><B
294 CLASS="COMMAND"
295 >password server = *</B
296 ></P
297 ><P
298 >This method, which was introduced in Samba 2.0.6, 
299         allows Samba to use exactly the same mechanism that NT does. This 
300         method either broadcasts or uses a WINS database in order to
301         find domain controllers to authenticate against.</P
302 ><P
303 >Finally, restart your Samba daemons and get ready for 
304         clients to begin using domain security!</P
305 ></DIV
306 ><DIV
307 CLASS="SECT1"
308 ><H1
309 CLASS="SECT1"
310 ><A
311 NAME="AEN1197"
312 ></A
313 >9.2. Samba and Windows 2000 Domains</H1
314 ><P
315 >Many people have asked regarding the state of Samba's ability to participate in
316 a Windows 2000 Domain.  Samba 2.2 is able to act as a member server of a Windows
317 2000 domain operating in mixed or native mode.</P
318 ><P
319 >There is much confusion between the circumstances that require a "mixed" mode
320 Win2k DC and a when this host can be switched to "native" mode.  A "mixed" mode
321 Win2k domain controller is only needed if Windows NT BDCs must exist in the same
322 domain.  By default, a Win2k DC in "native" mode will still support
323 NetBIOS and NTLMv1 for authentication of legacy clients such as Windows 9x and 
324 NT 4.0.  Samba has the same requirements as a Windows NT 4.0 member server.</P
325 ><P
326 >The steps for adding a Samba 2.2 host to a Win2k domain are the same as those
327 for adding a Samba server to a Windows NT 4.0 domain. The only exception is that 
328 the "Server Manager" from NT 4 has been replaced by the "Active Directory Users and 
329 Computers" MMC (Microsoft Management Console) plugin.</P
330 ></DIV
331 ><DIV
332 CLASS="SECT1"
333 ><H1
334 CLASS="SECT1"
335 ><A
336 NAME="AEN1202"
337 ></A
338 >9.3. Why is this better than security = server?</H1
339 ><P
340 >Currently, domain security in Samba doesn't free you from 
341         having to create local Unix users to represent the users attaching 
342         to your server. This means that if domain user <TT
343 CLASS="CONSTANT"
344 >DOM\fred
345         </TT
346 > attaches to your domain security Samba server, there needs 
347         to be a local Unix user fred to represent that user in the Unix 
348         filesystem. This is very similar to the older Samba security mode 
349         <A
350 HREF="smb.conf.5.html#SECURITYEQUALSSERVER"
351 TARGET="_top"
352 >security = server</A
353 >, 
354         where Samba would pass through the authentication request to a Windows 
355         NT server in the same way as a Windows 95 or Windows 98 server would.
356         </P
357 ><P
358 >Please refer to the <A
359 HREF="winbind.html"
360 TARGET="_top"
361 >Winbind 
362         paper</A
363 > for information on a system to automatically
364         assign UNIX uids and gids to Windows NT Domain users and groups.
365         This code is available in development branches only at the moment,
366         but will be moved to release branches soon.</P
367 ><P
368 >The advantage to domain-level security is that the 
369         authentication in domain-level security is passed down the authenticated 
370         RPC channel in exactly the same way that an NT server would do it. This 
371         means Samba servers now participate in domain trust relationships in 
372         exactly the same way NT servers do (i.e., you can add Samba servers into 
373         a resource domain and have the authentication passed on from a resource
374         domain PDC to an account domain PDC.</P
375 ><P
376 >In addition, with <B
377 CLASS="COMMAND"
378 >security = server</B
379 > every Samba 
380         daemon on a server has to keep a connection open to the 
381         authenticating server for as long as that daemon lasts. This can drain 
382         the connection resources on a Microsoft NT server and cause it to run 
383         out of available connections. With <B
384 CLASS="COMMAND"
385 >security = domain</B
386 >, 
387         however, the Samba daemons connect to the PDC/BDC only for as long 
388         as is necessary to authenticate the user, and then drop the connection, 
389         thus conserving PDC connection resources.</P
390 ><P
391 >And finally, acting in the same manner as an NT server 
392         authenticating to a PDC means that as part of the authentication 
393         reply, the Samba server gets the user identification information such 
394         as the user SID, the list of NT groups the user belongs to, etc. All 
395         this information will allow Samba to be extended in the future into 
396         a mode the developers currently call appliance mode. In this mode, 
397         no local Unix users will be necessary, and Samba will generate Unix 
398         uids and gids from the information passed back from the PDC when a 
399         user is authenticated, making a Samba server truly plug and play 
400         in an NT domain environment. Watch for this code soon.</P
401 ><P
402 ><SPAN
403 CLASS="emphasis"
404 ><I
405 CLASS="EMPHASIS"
406 >NOTE:</I
407 ></SPAN
408 > Much of the text of this document 
409         was first published in the Web magazine <A
410 HREF="http://www.linuxworld.com"
411 TARGET="_top"
412 >       
413         LinuxWorld</A
414 > as the article <A
415 HREF="http://www.linuxworld.com/linuxworld/lw-1998-10/lw-10-samba.html"
416 TARGET="_top"
417 >Doing 
418         the NIS/NT Samba</A
419 >.</P
420 ></DIV
421 ></DIV
422 ><DIV
423 CLASS="NAVFOOTER"
424 ><HR
425 ALIGN="LEFT"
426 WIDTH="100%"><TABLE
427 SUMMARY="Footer navigation table"
428 WIDTH="100%"
429 BORDER="0"
430 CELLPADDING="0"
431 CELLSPACING="0"
432 ><TR
433 ><TD
434 WIDTH="33%"
435 ALIGN="left"
436 VALIGN="top"
437 ><A
438 HREF="securitylevels.html"
439 ACCESSKEY="P"
440 >Prev</A
441 ></TD
442 ><TD
443 WIDTH="34%"
444 ALIGN="center"
445 VALIGN="top"
446 ><A
447 HREF="samba-howto-collection.html"
448 ACCESSKEY="H"
449 >Home</A
450 ></TD
451 ><TD
452 WIDTH="33%"
453 ALIGN="right"
454 VALIGN="top"
455 ><A
456 HREF="winbind.html"
457 ACCESSKEY="N"
458 >Next</A
459 ></TD
460 ></TR
461 ><TR
462 ><TD
463 WIDTH="33%"
464 ALIGN="left"
465 VALIGN="top"
466 >Security levels</TD
467 ><TD
468 WIDTH="34%"
469 ALIGN="center"
470 VALIGN="top"
471 >&nbsp;</TD
472 ><TD
473 WIDTH="33%"
474 ALIGN="right"
475 VALIGN="top"
476 >Unified Logons between Windows NT and UNIX using Winbind</TD
477 ></TR
478 ></TABLE
479 ></DIV
480 ></BODY
481 ></HTML
482 >