1mailto(samba@samba.org)
2
3article(Joining an NT Domain with Samba 2.0)(Jeremy Allison, Samba Team)(7th October 1999)
4
5center(Joining an NT Domain with Samba 2.0)
6center(-----------------------------------)
7
8In order for a Samba-2 server to join an NT domain, you must first add
9the NetBIOS name of the Samba server to the NT domain on the PDC using
10Server Manager for Domains.  This creates the machine account in the
11domain (PDC) SAM. Note that you should add the Samba server as a "Windows
12NT Workstation or Server", em(NOT) as a Primary or backup domain controller.
13
14Assume you have a Samba-2 server with a NetBIOS name of tt(SERV1) and are
15joining an NT domain called tt(DOM), which has a PDC with a NetBIOS name
16of tt(DOMPDC) and two backup domain controllers with NetBIOS names tt(DOMBDC1)
17and tt(DOMBDC2).
18
19In order to join the domain, first stop all Samba daemons and run the
20command
21
22tt(smbpasswd -j DOM -r DOMPDC)
23
24as we are joining the domain DOM and the PDC for that domain (the only
25machine that has write access to the domain SAM database) is DOMPDC. If this is
26successful you will see the message:
27
28tt(smbpasswd: Joined domain DOM.)
29
30in your terminal window. See the url(bf(smbpasswd))(smbpasswd.8.html)
31man page for more details.
32
33This command goes through the machine account password change
34protocol, then writes the new (random) machine account password for
35this Samba server into a file in the same directory in which an
36smbpasswd file would be stored - normally :
37
38tt(/usr/local/samba/private)
39
40The filename looks like this:
41
42tt(<NT DOMAIN NAME>.<Samba Server Name>.mac)
43
44The tt(.mac) suffix stands for machine account password file. So in
45our example above, the file would be called:
46
47tt(DOM.SERV1.mac)
48
49This file is created and owned by root and is not readable by any
50other user. It is the key to the domain-level security for your
51system, and should be treated as carefully as a shadow password file.
52
53Now, before restarting the Samba daemons you must edit your
54url(bf(smb.conf))(smb.conf.5.html) file to tell Samba it should now
55use domain security.
56
57Change (or add) your 
58
59url(bf("security ="))(smb.conf.5.html#security)
60
61line in the url(bf([global]))(smb.conf.5.html#global) section of your
62url(bf(smb.conf))(smb.conf.5.html) to read:
63
64tt(security = domain)
65
66Next change the 
67
68url(bf("workgroup ="))(smb.conf.5.html#workgroup)
69
70line in the url(bf([global]))(smb.conf.5.html#global) section to read: 
71
72tt(workgroup = DOM)
73
74as this is the name of the domain we are joining. 
75
76You must also have the parameter url(bf("encrypt passwords"))(smb.conf.5.html#encryptpasswords)
77set to tt("yes") in order for your users to authenticate to the
78NT PDC.
79
80Finally, add (or modify) a:
81
82url(bf("password server ="))(smb.conf.5.html#passwordserver)
83
84line in the url(bf([global]))(smb.conf.5.html#global) section to read: 
85
86tt(password server = DOMPDC DOMBDC1 DOMBDC2)
87
88These are the primary and backup domain controllers Samba will attempt
89to contact in order to authenticate users. Samba will try to contact
90each of these servers in order, so you may want to rearrange this list
91in order to spread out the authentication load among domain
92controllers.
93
94Alternatively, if you want smbd to automatically determine the
95list of Domain controllers to use for authentication, you may set this line to be :
96
97tt(password server = *)
98
99This method, which is new in Samba 2.0.6 and above, allows Samba
100to use exactly the same mechanism that NT does. This method either broadcasts or
101uses a WINS database in order to find domain controllers to
102authenticate against.
103
104Finally, restart your Samba daemons and get ready for clients to begin
105using domain security!
106
107
108center(Why is this better than security = server?)
109center(------------------------------------------)
110
111Currently, domain security in Samba doesn't free you from having to
112create local Unix users to represent the users attaching to your
113server. This means that if domain user tt(DOM\fred) attaches to your
114domain security Samba server, there needs to be a local Unix user fred
115to represent that user in the Unix filesystem. This is very similar to
116the older Samba security mode url(bf("security=server"))(smb.conf.5.html#securityequalserver), where Samba would pass
117through the authentication request to a Windows NT server in the same
118way as a Windows 95 or Windows 98 server would.
119
120The advantage to domain-level security is that the authentication in
121domain-level security is passed down the authenticated RPC channel in
122exactly the same way that an NT server would do it. This means Samba
123servers now participate in domain trust relationships in exactly the
124same way NT servers do (i.e., you can add Samba servers into a
125resource domain and have the authentication passed on from a resource
126domain PDC to an account domain PDC.
127
128In addition, with url(bf("security=server"))(smb.conf.5.html#securityequalserver) every Samba daemon on a
129server has to keep a connection open to the authenticating server for
130as long as that daemon lasts. This can drain the connection resources
131on a Microsoft NT server and cause it to run out of available
132connections. With url(bf("security =domain"))(smb.conf.5.html#securityequaldomain), however, the Samba
133daemons connect to the PDC/BDC only for as long as is necessary to
134authenticate the user, and then drop the connection, thus conserving
135PDC connection resources.
136
137And finally, acting in the same manner as an NT server authenticating
138to a PDC means that as part of the authentication reply, the Samba
139server gets the user identification information such as the user SID,
140the list of NT groups the user belongs to, etc. All this information
141will allow Samba to be extended in the future into a mode the
142developers currently call appliance mode. In this mode, no local Unix
143users will be necessary, and Samba will generate Unix uids and gids
144from the information passed back from the PDC when a user is
145authenticated, making a Samba server truly plug and play in an NT
146domain environment. Watch for this code soon.
147
148em(NOTE:) Much of the text of this document was first published in the
149Web magazine url(bf("LinuxWorld"))(http://www.linuxworld.com) as the article url(bf("Doing the NIS/NT Samba"))(http://www.linuxworld.com/linuxworld/lw-1998-10/lw-10-samba.html).
150