Initial import
[samba] / docs / htmldocs / Samba3-HOWTO / domain-member.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 6. Domain Membership</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="index.html" title="The Official Samba-3 HOWTO and Reference Guide"><link rel="up" href="type.html" title="Part II. Server Configuration Basics"><link rel="prev" href="samba-bdc.html" title="Chapter 5. Backup Domain Control"><link rel="next" href="StandAloneServer.html" title="Chapter 7. Standalone Servers"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 6. Domain Membership</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="samba-bdc.html">Prev</a> </td><th width="60%" align="center">Part II. Server Configuration Basics</th><td width="20%" align="right"> <a accesskey="n" href="StandAloneServer.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="domain-member"></a>Chapter 6. Domain Membership</h2></div><div><div class="author"><h3 class="author"><span class="firstname">John</span> <span class="othername">H.</span> <span class="surname">Terpstra</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email">&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Jeremy</span> <span class="surname">Allison</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email">&lt;<a href="mailto:jra@samba.org">jra@samba.org</a>&gt;</code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Gerald</span> <span class="othername">(Jerry)</span> <span class="surname">Carter</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email">&lt;<a href="mailto:jerry@samba.org">jerry@samba.org</a>&gt;</code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Andrew</span> <span class="surname">Tridgell</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email">&lt;<a href="mailto:tridge@samba.org">tridge@samba.org</a>&gt;</code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Jelmer</span> <span class="othername">R.</span> <span class="surname">Vernooij</span></h3><div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><code class="email">&lt;<a href="mailto:jelmer@samba.org">jelmer@samba.org</a>&gt;</code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Guenther</span> <span class="surname">Deschner</span></h3><span class="contrib">LDAP updates</span><div class="affiliation"><span class="orgname">SuSE<br></span><div class="address"><p><code class="email">&lt;<a href="mailto:gd@suse.de">gd@suse.de</a>&gt;</code></p></div></div></div></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="domain-member.html#id2536846">Features and Benefits</a></span></dt><dt><span class="sect1"><a href="domain-member.html#machine-trust-accounts">MS Windows Workstation/Server Machine Trust Accounts</a></span></dt><dd><dl><dt><span class="sect2"><a href="domain-member.html#id2537529">Manual Creation of Machine Trust Accounts</a></span></dt><dt><span class="sect2"><a href="domain-member.html#id2537965">Managing Domain Machine Accounts using NT4 Server Manager</a></span></dt><dt><span class="sect2"><a href="domain-member.html#id2538241">On-the-Fly Creation of Machine Trust Accounts</a></span></dt><dt><span class="sect2"><a href="domain-member.html#id2538348">Making an MS Windows Workstation or Server a Domain Member</a></span></dt></dl></dd><dt><span class="sect1"><a href="domain-member.html#domain-member-server">Domain Member Server</a></span></dt><dd><dl><dt><span class="sect2"><a href="domain-member.html#id2538809">Joining an NT4-type Domain with Samba-3</a></span></dt><dt><span class="sect2"><a href="domain-member.html#id2539532">Why Is This Better Than <em class="parameter"><code>security = server</code></em>?</a></span></dt></dl></dd><dt><span class="sect1"><a href="domain-member.html#ads-member">Samba ADS Domain Membership</a></span></dt><dd><dl><dt><span class="sect2"><a href="domain-member.html#id2539802">Configure <code class="filename">smb.conf</code></a></span></dt><dt><span class="sect2"><a href="domain-member.html#id2539989">Configure <code class="filename">/etc/krb5.conf</code></a></span></dt><dt><span class="sect2"><a href="domain-member.html#ads-create-machine-account">Create the Computer Account</a></span></dt><dt><span class="sect2"><a href="domain-member.html#ads-test-server">Testing Server Setup</a></span></dt><dt><span class="sect2"><a href="domain-member.html#ads-test-smbclient">Testing with <span class="application">smbclient</span></a></span></dt><dt><span class="sect2"><a href="domain-member.html#id2541086">Notes</a></span></dt></dl></dd><dt><span class="sect1"><a href="domain-member.html#id2541158">Sharing User ID Mappings between Samba Domain Members</a></span></dt><dt><span class="sect1"><a href="domain-member.html#id2541357">Common Errors</a></span></dt><dd><dl><dt><span class="sect2"><a href="domain-member.html#id2541397">Cannot Add Machine Back to Domain</a></span></dt><dt><span class="sect2"><a href="domain-member.html#id2541473">Adding Machine to Domain Fails</a></span></dt><dt><span class="sect2"><a href="domain-member.html#id2541695">I Can't Join a Windows 2003 PDC</a></span></dt></dl></dd></dl></div><p>
2 <a class="indexterm" name="id2536794"></a>
3 <a class="indexterm" name="id2536800"></a>
4 <a class="indexterm" name="id2536808"></a>
5 Domain membership is a subject of vital concern. Samba must be able to
6 participate as a member server in a Microsoft domain security context, and
7 Samba must be capable of providing domain machine member trust accounts;
8 otherwise it would not be able to offer a viable option for many users.
9 </p><p>
10 <a class="indexterm" name="id2536823"></a>
11 <a class="indexterm" name="id2536830"></a>
12 This chapter covers background information pertaining to domain membership,
13 the Samba configuration for it, and MS Windows client procedures for joining a
14 domain. Why is this necessary? Because both are areas in which there exists
15 within the current MS Windows networking world, and particularly in the
16 UNIX/Linux networking and administration world, a considerable level of
17 misinformation, incorrect understanding, and lack of knowledge. Hopefully
18 this chapter will fill the voids.
19 </p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2536846"></a>Features and Benefits</h2></div></div></div><p>
20 <a class="indexterm" name="id2536854"></a>
21 <a class="indexterm" name="id2536861"></a>
22 <a class="indexterm" name="id2536868"></a>
23 MS Windows workstations and servers that want to participate in domain security need to
24 be made domain members. Participating in domain security is often called 
25 <span class="emphasis"><em>single sign-on</em></span>, or <span class="acronym">SSO</span> for short. This
26 chapter describes the process that must be followed to make a workstation
27 (or another server  be it an <span class="application">MS Windows NT4/200x</span>
28 server) or a Samba server a member of an MS Windows domain security context.
29 </p><p>
30 <a class="indexterm" name="id2536900"></a>
31 <a class="indexterm" name="id2536906"></a>
32 <a class="indexterm" name="id2536913"></a>
33 <a class="indexterm" name="id2536920"></a>
34 Samba-3 can join an MS Windows NT4-style domain as a native member server, an 
35 MS Windows Active Directory domain as a native member server, or a Samba domain
36 control network. Domain membership has many advantages:
37 </p><div class="itemizedlist"><ul type="disc"><li><p>
38         <a class="indexterm" name="id2536939"></a>
39         MS Windows workstation users get the benefit of SSO.
40         </p></li><li><p>
41         <a class="indexterm" name="id2536951"></a>
42         <a class="indexterm" name="id2536958"></a>
43         <a class="indexterm" name="id2536965"></a>
44         <a class="indexterm" name="id2536972"></a>
45         Domain user access rights and file ownership/access controls can be set
46         from the single Domain Security Account Manager (SAM) database 
47         (works with domain member servers as well as with MS Windows workstations
48         that are domain members).
49         </p></li><li><p>
50         <a class="indexterm" name="id2536987"></a>
51         <a class="indexterm" name="id2536994"></a>
52         Only <span class="application">MS Windows NT4/200x/XP Professional</span>
53         workstations that are domain members can use network logon facilities.
54         </p></li><li><p>
55         <a class="indexterm" name="id2537013"></a>
56         <a class="indexterm" name="id2537020"></a>
57         <a class="indexterm" name="id2537027"></a>
58         <a class="indexterm" name="id2537034"></a>
59         Domain member workstations can be better controlled through the use of
60         policy files (<code class="filename">NTConfig.POL</code>) and desktop profiles.
61         </p></li><li><p>
62         <a class="indexterm" name="id2537053"></a>
63         <a class="indexterm" name="id2537060"></a>
64         <a class="indexterm" name="id2537067"></a>
65         Through the use of logon scripts, users can be given transparent access to network
66         applications that run off application servers.
67         </p></li><li><p>
68         <a class="indexterm" name="id2537080"></a>
69         <a class="indexterm" name="id2537087"></a>
70         <a class="indexterm" name="id2537094"></a>
71         <a class="indexterm" name="id2537101"></a>
72         Network administrators gain better application and user access management
73         abilities because there is no need to maintain user accounts on any network
74         client or server other than the central domain database 
75         (either NT4/Samba SAM-style domain, NT4 domain that is backend-ed with an
76         LDAP directory, or via an Active Directory infrastructure).
77         </p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="machine-trust-accounts"></a>MS Windows Workstation/Server Machine Trust Accounts</h2></div></div></div><p>
78 <a class="indexterm" name="id2537129"></a>
79 <a class="indexterm" name="id2537136"></a>
80 <a class="indexterm" name="id2537143"></a>
81 <a class="indexterm" name="id2537150"></a>
82 A Machine Trust Account is an account that is used to authenticate a client machine (rather than a user) to
83 the domain controller server. In Windows terminology, this is known as a &#8220;<span class="quote">computer account.</span>&#8221; The
84 purpose of the machine trust account is to prevent a rogue user and domain controller from colluding to gain
85 access to a domain member workstation.
86 </p><p>
87 <a class="indexterm" name="id2537169"></a>
88 <a class="indexterm" name="id2537178"></a>
89 <a class="indexterm" name="id2537185"></a>
90 <a class="indexterm" name="id2537192"></a>
91 <a class="indexterm" name="id2537200"></a>
92 The password of a Machine Trust Account acts as the shared secret for secure communication with the domain
93 controller. This is a security feature to prevent an unauthorized machine with the same NetBIOS name from
94 joining the domain, participating in domain security operations, and gaining access to domain user/group
95 accounts. Windows NT/200x/XP Professional clients use machine trust accounts, but Windows 9x/Me/XP Home
96 clients do not. Hence, a Windows 9x/Me/XP Home client is never a true member of a domain because it does not
97 possess a Machine Trust Account, and, thus, has no shared secret with the domain controller.
98 </p><p>
99 <a class="indexterm" name="id2537220"></a>
100 <a class="indexterm" name="id2537227"></a>
101 <a class="indexterm" name="id2537234"></a>
102 <a class="indexterm" name="id2537240"></a>
103 A Windows NT4 PDC stores each Machine Trust Account in the Windows Registry.
104 The introduction of MS Windows 2000 saw the introduction of Active Directory,
105 the new repository for Machine Trust Accounts. A Samba PDC, however, stores
106 each Machine Trust Account in two parts,
107 as follows:
108
109 </p><div class="itemizedlist"><ul type="disc"><li><p>
110         <a class="indexterm" name="id2537258"></a>
111         <a class="indexterm" name="id2537265"></a>
112         <a class="indexterm" name="id2537272"></a>
113         A domain security account (stored in the <a class="indexterm" name="id2537279"></a>passdb backend) that has been configured in
114         the <code class="filename">smb.conf</code> file. The precise nature of the account information that is stored depends on the type of
115         backend database that has been chosen.
116         </p><p>
117         <a class="indexterm" name="id2537299"></a>
118         <a class="indexterm" name="id2537305"></a>
119         <a class="indexterm" name="id2537312"></a>
120         <a class="indexterm" name="id2537319"></a>
121         <a class="indexterm" name="id2537326"></a>
122         <a class="indexterm" name="id2537333"></a>
123         The older format of this data is the <code class="filename">smbpasswd</code> database
124         that contains the UNIX login ID, the UNIX user identifier (UID), and the
125         LanMan and NT-encrypted passwords. There is also some other information in
126         this file that we do not need to concern ourselves with here.
127         </p><p>
128         <a class="indexterm" name="id2537356"></a>
129         <a class="indexterm" name="id2537362"></a>
130         <a class="indexterm" name="id2537369"></a>
131         <a class="indexterm" name="id2537376"></a>
132         The two newer database types are called ldapsam and tdbsam. Both store considerably more data than the older
133         <code class="filename">smbpasswd</code> file did. The extra information enables new user account controls to be
134         implemented.
135         </p></li><li><p>
136         <a class="indexterm" name="id2537396"></a>
137         <a class="indexterm" name="id2537403"></a>
138         A corresponding UNIX account, typically stored in <code class="filename">/etc/passwd</code>. Work is in progress to
139         allow a simplified mode of operation that does not require UNIX user accounts, but this has not been a feature
140         of the early releases of Samba-3, and is not currently planned for release either.
141         </p></li></ul></div><p>
142 </p><p>
143 <a class="indexterm" name="id2537429"></a>
144 There are three ways to create Machine Trust Accounts:
145 </p><div class="itemizedlist"><ul type="disc"><li><p>
146         <a class="indexterm" name="id2537446"></a>
147         Manual creation from the UNIX/Linux command line. Here, both the Samba and
148         corresponding UNIX account are created by hand.
149         </p></li><li><p>
150         <a class="indexterm" name="id2537459"></a>
151         <a class="indexterm" name="id2537466"></a>
152         Using the MS Windows NT4 Server Manager, either from an NT4 domain member
153         server or using the Nexus toolkit available from the Microsoft Web site.
154         This tool can be run from any MS Windows machine as long as the user is
155         logged on as the administrator account.
156         </p></li><li><p>
157         <a class="indexterm" name="id2537482"></a>
158         <a class="indexterm" name="id2537489"></a>
159         &#8220;<span class="quote">On-the-fly</span>&#8221; creation. The Samba Machine Trust Account is automatically
160         created by Samba at the time the client is joined to the domain.
161         (For security, this is the recommended method.) The corresponding UNIX
162         account may be created automatically or manually. 
163         </p></li></ul></div><p>
164 <a class="indexterm" name="id2537508"></a>
165 <a class="indexterm" name="id2537515"></a>
166 Neither MS Windows NT4/200x/XP Professional, nor Samba, provide any method for enforcing the method of machine
167 trust account creation. This is a matter of the administrator's choice.
168 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2537529"></a>Manual Creation of Machine Trust Accounts</h3></div></div></div><p>
169 <a class="indexterm" name="id2537537"></a>
170 <a class="indexterm" name="id2537544"></a>
171 <a class="indexterm" name="id2537549"></a>
172 <a class="indexterm" name="id2537556"></a>
173 The first step in manually creating a Machine Trust Account is to manually
174 create the corresponding UNIX account in <code class="filename">/etc/passwd</code>. 
175 This can be done using <span><strong class="command">vipw</strong></span> or another &#8220;<span class="quote">adduser</span>&#8221; command
176 that is normally used to create new UNIX accounts. The following is an example for
177 a Linux-based Samba server:
178 </p><pre class="screen">
179 <code class="prompt">root# </code><strong class="userinput"><code>/usr/sbin/useradd -g machines -d /var/lib/nobody \
180    -c <em class="replaceable"><code>"machine nickname"</code></em> \
181    -s /bin/false <em class="replaceable"><code>machine_name</code></em>$ </code></strong>
182
183 <code class="prompt">root# </code><strong class="userinput"><code>passwd -l <em class="replaceable"><code>machine_name</code></em>$</code></strong>
184 </pre><p>
185 </p><p>
186 <a class="indexterm" name="id2537625"></a>
187 <a class="indexterm" name="id2537632"></a>
188 <a class="indexterm" name="id2537638"></a>
189 In the example above there is an existing system group &#8220;<span class="quote">machines</span>&#8221; which is used
190 as the primary group for all machine accounts. In the following examples the &#8220;<span class="quote">machines</span>&#8221; group
191 numeric GID is 100.
192 </p><p>
193 <a class="indexterm" name="id2537658"></a>
194 <a class="indexterm" name="id2537665"></a>
195 On *BSD systems, this can be done using the <span><strong class="command">chpass</strong></span> utility:
196 </p><pre class="screen">
197 <code class="prompt">root# </code><strong class="userinput"><code>chpass -a \
198 '<em class="replaceable"><code>machine_name</code></em>$:*:101:100::0:0:Windows <em class="replaceable"><code>machine_name</code></em>:/dev/null:/sbin/nologin'</code></strong>
199 </pre><p>
200 </p><p>
201 <a class="indexterm" name="id2537706"></a>
202 <a class="indexterm" name="id2537713"></a>
203 <a class="indexterm" name="id2537720"></a>
204 <a class="indexterm" name="id2537726"></a>
205 The <code class="filename">/etc/passwd</code> entry will list the machine name 
206 with a &#8220;<span class="quote">$</span>&#8221; appended, and will not have a password, will have a null shell and no 
207 home directory. For example, a machine named &#8220;<span class="quote">doppy</span>&#8221; would have an 
208 <code class="filename">/etc/passwd</code> entry like this:
209 </p><pre class="programlisting">
210 doppy$:x:505:100:<em class="replaceable"><code>machine_nickname</code></em>:/dev/null:/bin/false
211 </pre><p>
212 </p><p>
213 <a class="indexterm" name="id2537769"></a>
214 <a class="indexterm" name="id2537776"></a>
215 <a class="indexterm" name="id2537783"></a>
216 in which <em class="replaceable"><code>machine_nickname</code></em> can be any
217 descriptive name for the client, such as BasementComputer.
218 <em class="replaceable"><code>machine_name</code></em> absolutely must be the NetBIOS
219 name of the client to be joined to the domain. The &#8220;<span class="quote">$</span>&#8221; must be
220 appended to the NetBIOS name of the client or Samba will not recognize
221 this as a Machine Trust Account.
222 </p><p>
223 <a class="indexterm" name="id2537808"></a>
224 <a class="indexterm" name="id2537815"></a>
225 <a class="indexterm" name="id2537822"></a>
226 Now that the corresponding UNIX account has been created, the next step is to create 
227 the Samba account for the client containing the well-known initial 
228 Machine Trust Account password. This can be done using the 
229 <span><strong class="command">smbpasswd</strong></span> command 
230 as shown here:
231 </p><pre class="screen">
232 <code class="prompt">root# </code><strong class="userinput"><code>smbpasswd -a -m <em class="replaceable"><code>machine_name</code></em></code></strong>
233 </pre><p>
234 </p><p>
235 <a class="indexterm" name="id2537864"></a>
236 <a class="indexterm" name="id2537871"></a>
237 <a class="indexterm" name="id2537878"></a>
238 <a class="indexterm" name="id2537884"></a>
239 where <em class="replaceable"><code>machine_name</code></em> is the machine's NetBIOS
240 name. The RID of the new machine account is generated from the UID of 
241 the corresponding UNIX account.
242 </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Join the client to the domain immediately</h3><p>
243 <a class="indexterm" name="id2537906"></a>
244 <a class="indexterm" name="id2537913"></a>
245 <a class="indexterm" name="id2537920"></a>
246 <a class="indexterm" name="id2537927"></a>
247 <a class="indexterm" name="id2537934"></a>
248 Manually creating a Machine Trust Account using this method is the 
249 equivalent of creating a Machine Trust Account on a Windows NT PDC using 
250 <a class="indexterm" name="id2537943"></a>
251 the <span class="application">Server Manager</span>. From the time at which the 
252 account is created to the time the client joins the domain and 
253 changes the password, your domain is vulnerable to an intruder joining 
254 your domain using a machine with the same NetBIOS name. A PDC inherently 
255 trusts members of the domain and will serve out a large degree of user 
256 information to such clients. You have been warned!
257 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2537965"></a>Managing Domain Machine Accounts using NT4 Server Manager</h3></div></div></div><p>
258 <a class="indexterm" name="id2537974"></a>
259 <a class="indexterm" name="id2537981"></a>
260 <a class="indexterm" name="id2537988"></a>
261 A working <a class="indexterm" name="id2537995"></a>add machine script is essential
262 for machine trust accounts to be automatically created. This applies no matter whether
263 you use automatic account creation or the NT4 Domain Server Manager.
264 </p><p>
265 <a class="indexterm" name="id2538009"></a>
266 <a class="indexterm" name="id2538016"></a>
267 <a class="indexterm" name="id2538022"></a>
268 <a class="indexterm" name="id2538029"></a>
269 If the machine from which you are trying to manage the domain is an 
270 <span class="application">MS Windows NT4 workstation or MS Windows 200x/XP Professional</span>,
271 the tool of choice is the package called <span><strong class="command">SRVTOOLS.EXE</strong></span>. 
272 When executed in the target directory it will unpack <span><strong class="command">SrvMgr.exe</strong></span>
273 and <span><strong class="command">UsrMgr.exe</strong></span> (both are domain management tools for MS Windows NT4 workstation).
274 </p><p>
275 <a class="indexterm" name="id2538068"></a>
276 <a class="indexterm" name="id2538075"></a>
277 If your workstation is a <span class="application">Microsoft Windows 9x/Me</span> family product,
278  you should download the <span><strong class="command">Nexus.exe</strong></span> package from the Microsoft Web site.
279 When executed from the target directory, it will unpack the same tools but for use on 
280 this platform.
281 </p><p>
282 Further information about these tools may be obtained from Knowledge Base articles
283 <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;173673" target="_top">173673</a>, and
284 <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;172540" target="_top">172540</a>
285 </p><p>
286 <a class="indexterm" name="id2538119"></a>
287 <a class="indexterm" name="id2538126"></a>
288 Launch the <span><strong class="command">srvmgr.exe</strong></span> (Server Manager for Domains) and follow these steps:
289 </p><div class="procedure"><a name="id2538142"></a><p class="title"><b>Procedure 6.1. Server Manager Account Machine Account Management</b></p><ol type="1"><li><p>
290         From the menu select <span class="guimenu">Computer</span>.
291         </p></li><li><p>
292         Click <span class="guimenuitem">Select Domain</span>.
293         </p></li><li><p>
294         Click the name of the domain you wish to administer in the
295         <span class="guilabel">Select Domain</span> panel and then click 
296         <span class="guibutton">OK</span>.
297         </p></li><li><p>
298         Again from the menu select <span class="guimenu">Computer</span>.
299         </p></li><li><p>
300         Select <span class="guimenuitem">Add to Domain</span>.
301         </p></li><li><p>
302         In the dialog box, click the radio button to 
303         <span class="guilabel">Add NT Workstation of Server</span>, then
304         enter the machine name in the field provided, and click the 
305         <span class="guibutton">Add</span> button.
306         </p></li></ol></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2538241"></a>On-the-Fly Creation of Machine Trust Accounts</h3></div></div></div><p>
307 <a class="indexterm" name="id2538250"></a>
308 The third (and recommended) way of creating Machine Trust Accounts is simply to allow the Samba server to
309 create them as needed when the client is joined to the domain.
310 </p><p>
311 <a class="indexterm" name="id2538265"></a>
312 <a class="indexterm" name="id2538275"></a>
313 <a class="indexterm" name="id2538282"></a>
314 Since each Samba Machine Trust Account requires a corresponding UNIX account, a method
315 for automatically creating the UNIX account is usually supplied; this requires configuration of the
316 add machine script option in <code class="filename">smb.conf</code>. This method is not required; however, corresponding UNIX
317 accounts may also be created manually.
318 </p><p>
319 <a class="indexterm" name="id2538303"></a>
320 <a class="indexterm" name="id2538310"></a>
321 Here is an example for a Red Hat Linux system:
322 </p><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[global]</code></em></td></tr><tr><td><a class="indexterm" name="id2538332"></a><em class="parameter"><code>add machine script = /usr/sbin/useradd -d /var/lib/nobody -g 100 -s /bin/false -M %u</code></em></td></tr></table><p>
323 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2538348"></a>Making an MS Windows Workstation or Server a Domain Member</h3></div></div></div><p>
324 The procedure for making an MS Windows workstation or server a member of the domain varies
325 with the version of Windows.
326 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2538359"></a>Windows 200x/XP Professional Client</h4></div></div></div><p>
327 <a class="indexterm" name="id2538367"></a>
328 <a class="indexterm" name="id2538374"></a>
329 <a class="indexterm" name="id2538384"></a>
330 <a class="indexterm" name="id2538390"></a>
331         When the user elects to make the client a domain member, Windows 200x prompts for
332         an account and password that has privileges to create  machine accounts in the domain.
333         A Samba administrator account (i.e., a Samba account that has <code class="constant">root</code> privileges on the
334         Samba server) must be entered here; the operation will fail if an ordinary user
335         account is given. 
336         </p><p>
337 <a class="indexterm" name="id2538410"></a>
338 <a class="indexterm" name="id2538417"></a>
339         For security reasons, the password for this administrator account should be set
340         to a password that is other than that used for the root user in <code class="filename">/etc/passwd</code>.
341         </p><p>
342 <a class="indexterm" name="id2538435"></a>
343 <a class="indexterm" name="id2538442"></a>
344 <a class="indexterm" name="id2538449"></a>
345 <a class="indexterm" name="id2538456"></a>
346         The name of the account that is used to create domain member machine trust accounts can be
347         anything the network administrator may choose. If it is other than <code class="constant">root</code>,
348         then this is easily mapped to <code class="constant">root</code> in the file named in the <code class="filename">smb.conf</code> parameter
349         <a class="indexterm" name="id2538480"></a>username map = /etc/samba/smbusers.
350         </p><p>
351 <a class="indexterm" name="id2538491"></a>
352 <a class="indexterm" name="id2538498"></a>
353 <a class="indexterm" name="id2538505"></a>
354         The session key of the Samba administrator account acts as an encryption key for setting the password of the machine trust
355         account. The Machine Trust Account will be created on-the-fly, or updated if it already exists.
356         </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2538518"></a>Windows NT4 Client</h4></div></div></div><p>
357 <a class="indexterm" name="id2538526"></a>
358 <a class="indexterm" name="id2538533"></a>
359 <a class="indexterm" name="id2538540"></a>
360         If the Machine Trust Account was created manually, on the
361         Identification Changes menu enter the domain name, but do not
362         check the box <span class="guilabel">Create a Computer Account in the Domain</span>.
363         In this case, the existing Machine Trust Account is used to join the machine 
364         to the domain.
365         </p><p>
366 <a class="indexterm" name="id2538560"></a>
367 <a class="indexterm" name="id2538567"></a>
368 <a class="indexterm" name="id2538574"></a>
369 <a class="indexterm" name="id2538581"></a>
370         If the Machine Trust Account is to be created on the fly, on the Identification Changes menu enter the domain
371         name and check the box <span class="guilabel">Create a Computer Account in the Domain</span>. In this case, joining
372         the domain proceeds as above for Windows 2000 (i.e., you must supply a Samba administrator account when
373         prompted).
374         </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2538601"></a>Samba Client</h4></div></div></div><p>
375 <a class="indexterm" name="id2538609"></a>
376         Joining a Samba client to a domain is documented in <a href="domain-member.html#domain-member-server" title="Domain Member Server">the next section</a>.
377         </p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="domain-member-server"></a>Domain Member Server</h2></div></div></div><p>
378 <a class="indexterm" name="id2538640"></a>
379 <a class="indexterm" name="id2538647"></a>
380 <a class="indexterm" name="id2538654"></a>
381 <a class="indexterm" name="id2538661"></a>
382 This mode of server operation involves the Samba machine being made a member
383 of a domain security context. This means by definition that all user
384 authentication will be done from a centrally defined authentication regime. 
385 The authentication regime may come from an NT3/4-style (old domain technology)
386 server, or it may be provided from an Active Directory server (ADS) running on
387 MS Windows 2000 or later.
388 </p><p>
389 <span class="emphasis"><em>
390 <a class="indexterm" name="id2538680"></a>
391 <a class="indexterm" name="id2538690"></a>
392 <a class="indexterm" name="id2538697"></a>
393 <a class="indexterm" name="id2538703"></a>
394 <a class="indexterm" name="id2538710"></a>
395 <a class="indexterm" name="id2538717"></a>
396 <a class="indexterm" name="id2538724"></a>
397 <a class="indexterm" name="id2538730"></a>
398 Of course it should be clear that the authentication backend itself could be
399 from any distributed directory architecture server that is supported by Samba.
400 This can be LDAP (from OpenLDAP), or Sun's iPlanet, or Novell e-Directory
401 Server, and so on.
402 </em></span>
403 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
404 <a class="indexterm" name="id2538747"></a>
405 <a class="indexterm" name="id2538754"></a>
406 <a class="indexterm" name="id2538760"></a>
407 When Samba is configured to use an LDAP or other identity management and/or
408 directory service, it is Samba that continues to perform user and machine
409 authentication. It should be noted that the LDAP server does not perform
410 authentication handling in place of what Samba is designed to do.
411 </p></div><p>
412 <a class="indexterm" name="id2538776"></a>
413 <a class="indexterm" name="id2538783"></a>
414 <a class="indexterm" name="id2538790"></a>
415 Please refer to <a href="samba-pdc.html" title="Chapter 4. Domain Control">Domain Control</a>, for more information regarding
416 how to create a domain machine account for a domain member server as well as for
417 information on how to enable the Samba domain member machine to join the domain
418 and be fully trusted by it.
419 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2538809"></a>Joining an NT4-type Domain with Samba-3</h3></div></div></div><p><a href="domain-member.html#assumptions" title="Table 6.1. Assumptions">Assumptions</a> lists names that are used in the remainder of this chapter.</p><div class="table"><a name="assumptions"></a><p class="title"><b>Table 6.1. Assumptions</b></p><table summary="Assumptions" border="1"><colgroup><col align="right"><col align="left"></colgroup><tbody><tr><td align="right">Samba DMS NetBIOS name:</td><td align="left">SERV1</td></tr><tr><td align="right">Windows 200x/NT domain name:</td><td align="left">MIDEARTH</td></tr><tr><td align="right">Domain's PDC NetBIOS name:</td><td align="left">DOMPDC</td></tr><tr><td align="right">Domain's BDC NetBIOS names:</td><td align="left">DOMBDC1 and DOMBDC2</td></tr></tbody></table></div><p>
420 <a class="indexterm" name="id2538894"></a>
421 First, you must edit your <code class="filename">smb.conf</code> file to tell Samba it should now use domain security.
422 </p><p>
423 <a class="indexterm" name="id2538910"></a>
424 <a class="indexterm" name="id2538917"></a>
425 <a class="indexterm" name="id2538924"></a>
426 <a class="indexterm" name="id2538931"></a>
427 Change (or add) your <a class="indexterm" name="id2538938"></a>security line in the [global] section 
428 of your <code class="filename">smb.conf</code> to read:
429 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2538957"></a><em class="parameter"><code>security = domain</code></em></td></tr></table><p>
430 Note that if the parameter <em class="parameter"><code>security = user</code></em> is used, this machine would function as a
431 standalone server and not as a domain member server. Domain security mode causes Samba to work within the
432 domain security context.
433 </p><p>
434 Next change the <a class="indexterm" name="id2538983"></a>workgroup line in the <em class="parameter"><code>[global]</code></em>
435 section to read: 
436 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2539002"></a><em class="parameter"><code>workgroup = MIDEARTH</code></em></td></tr></table><p>
437 This is the name of the domain we are joining.
438 </p><p>
439 <a class="indexterm" name="id2539019"></a>
440 <a class="indexterm" name="id2539026"></a>
441 You must also have the parameter <a class="indexterm" name="id2539033"></a>encrypt passwords
442 set to <code class="constant">yes</code> in order for your users to authenticate to the NT PDC.
443 This is the default setting if this parameter is not specified. There is no need to specify this
444 parameter, but if it is specified in the <code class="filename">smb.conf</code> file, it must be set to <code class="constant">Yes</code>.
445 </p><p>
446 <a class="indexterm" name="id2539060"></a>
447 <a class="indexterm" name="id2539066"></a>
448 <a class="indexterm" name="id2539073"></a>
449 <a class="indexterm" name="id2539080"></a>
450 Finally, add (or modify) a <a class="indexterm" name="id2539087"></a>password server line in the [global]
451 section to read: 
452 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2539101"></a><em class="parameter"><code>password server = DOMPDC DOMBDC1 DOMBDC2</code></em></td></tr></table><p>
453 These are the PDC and BDCs Samba 
454 will attempt to contact in order to authenticate users. Samba will 
455 try to contact each of these servers in order, so you may want to 
456 rearrange this list in order to spread out the authentication load 
457 among Domain Controllers.
458 </p><p>
459 <a class="indexterm" name="id2539122"></a>
460 <a class="indexterm" name="id2539129"></a>
461 <a class="indexterm" name="id2539136"></a>
462 <a class="indexterm" name="id2539143"></a>
463 Alternatively, if you want smbd to determine automatically the list of domain controllers to use for
464 authentication, you may set this line to be:
465 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2539158"></a><em class="parameter"><code>password server = *</code></em></td></tr></table><p>
466 <a class="indexterm" name="id2539171"></a>
467 This method allows Samba to use exactly the same mechanism that NT does. The 
468 method either uses broadcast-based name resolution, performs a WINS database
469 lookup in order to find a domain controller against which to authenticate,
470 or locates the domain controller using DNS name resolution.
471 </p><p>
472 To join the domain, run this command:
473 <a class="indexterm" name="id2539186"></a>
474 </p><pre class="screen">
475 <code class="prompt">root# </code><strong class="userinput"><code>net rpc join -S DOMPDC -U<em class="replaceable"><code>Administrator%password</code></em></code></strong>
476 </pre><p>
477 </p><p>
478 <a class="indexterm" name="id2539220"></a>
479 <a class="indexterm" name="id2539226"></a>
480 <a class="indexterm" name="id2539233"></a>
481 <a class="indexterm" name="id2539240"></a>
482 If the <code class="option">-S DOMPDC</code> argument is not given, the domain name will be obtained from <code class="filename">smb.conf</code> and
483 the NetBIOS name of the PDC will be obtained either using a WINS lookup or via NetBIOS broadcast based name
484 look up.
485 </p><p>
486 <a class="indexterm" name="id2539263"></a>
487 <a class="indexterm" name="id2539270"></a>
488 <a class="indexterm" name="id2539276"></a>
489 <a class="indexterm" name="id2539283"></a>
490 The machine is joining the domain DOM, and the PDC for that domain (the only machine
491 that has write access to the domain SAM database) is DOMPDC; therefore, use the <code class="option">-S</code>
492 option. The <em class="replaceable"><code>Administrator%password</code></em> is the login name and
493 password for an account that has the necessary privilege to add machines to the
494 domain. If this is successful, you will see the following message in your terminal window.
495 Where the older NT4-style domain architecture is used:
496 </p><pre class="screen">
497 <code class="computeroutput">Joined domain DOM.</code>
498 </pre><p>
499 </p><p>
500 <a class="indexterm" name="id2539319"></a>
501 <a class="indexterm" name="id2539330"></a>
502 <a class="indexterm" name="id2539337"></a>
503 Where Active Directory is used, the command used to join the ADS domain is:
504 </p><pre class="screen">
505 <code class="prompt">root# </code> net ads join -U<em class="replaceable"><code>Administrator%password</code></em>
506 </pre><p>
507 And the following output is indicative of a successful outcome:
508 </p><pre class="screen">
509 <code class="computeroutput">Joined SERV1 to realm MYREALM.</code>
510 </pre><p>
511 </p><p>
512 Refer to the <span><strong class="command">net</strong></span> man page and to <a href="NetCommand.html" title="Chapter 12. Remote and Local Management: The Net Command">the chapter on remote
513 administration</a> for further information.
514 </p><p>
515 <a class="indexterm" name="id2539394"></a>
516 <a class="indexterm" name="id2539401"></a>
517 <a class="indexterm" name="id2539408"></a>
518 This process joins the server to the domain without separately having to create the machine
519 trust account on the PDC beforehand.
520 </p><p>
521 <a class="indexterm" name="id2539420"></a>
522 <a class="indexterm" name="id2539430"></a>
523 <a class="indexterm" name="id2539437"></a>
524 <a class="indexterm" name="id2539444"></a>
525 This command goes through the machine account password change protocol, then writes the new (random) machine
526 account password for this Samba server into a file in the same directory in which a smbpasswd file would be
527 normally stored. The trust account information that is needed by the DMS is written into the file
528 <code class="filename">/usr/local/samba/private/secrets.tdb</code> or <code class="filename">/etc/samba/secrets.tdb</code>.
529 </p><p>
530 <a class="indexterm" name="id2539473"></a>
531 <a class="indexterm" name="id2539480"></a>
532 This file is created and owned by root and is not readable by any other user. It is
533 the key to the domain-level security for your system and should be treated as carefully 
534 as a shadow password file.
535 </p><p>
536 <a class="indexterm" name="id2539494"></a>
537 <a class="indexterm" name="id2539500"></a>
538 <a class="indexterm" name="id2539507"></a>
539 Finally, restart your Samba daemons and get ready for clients to begin using domain
540 security. The way you can restart your Samba daemons depends on your distribution,
541 but in most cases the following will suffice:
542 </p><pre class="screen">
543 <code class="prompt">root# </code>/etc/init.d/samba restart
544 </pre><p>
545 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2539532"></a>Why Is This Better Than <em class="parameter"><code>security = server</code></em>?</h3></div></div></div><p>
546 <a class="indexterm" name="id2539546"></a>
547 <a class="indexterm" name="id2539553"></a>
548 <a class="indexterm" name="id2539560"></a>
549 Currently, domain security in Samba does not free you from having to create local UNIX users to represent the
550 users attaching to your server. This means that if domain user <code class="constant">DOM\fred</code> attaches to your
551 domain security Samba server, there needs to be a local UNIX user fred to represent that user in the UNIX file
552 system. This is similar to the older Samba security mode <a class="indexterm" name="id2539576"></a>security = server, where Samba would pass through the authentication request to a Windows
553 NT server in the same way as a Windows 95 or Windows 98 server would.
554 </p><p>
555 <a class="indexterm" name="id2539589"></a>
556 <a class="indexterm" name="id2539596"></a>
557 <a class="indexterm" name="id2539602"></a>
558 Please refer to <a href="winbind.html" title="Chapter 23. Winbind: Use of Domain Accounts">Winbind: Use of Domain Accounts</a>, for information on a system
559 to automatically assign UNIX UIDs and GIDs to Windows NT domain users and groups.
560 </p><p>
561 <a class="indexterm" name="id2539622"></a>
562 <a class="indexterm" name="id2539629"></a>
563 <a class="indexterm" name="id2539636"></a>
564 The advantage of domain-level security is that the authentication in domain-level security is passed down the
565 authenticated RPC channel in exactly the same way that an NT server would do it. This means Samba servers now
566 participate in domain trust relationships in exactly the same way NT servers do (i.e., you can add Samba
567 servers into a resource domain and have the authentication passed on from a resource domain PDC to an account
568 domain PDC).
569 </p><p>
570 <a class="indexterm" name="id2539653"></a>
571 <a class="indexterm" name="id2539660"></a>
572 <a class="indexterm" name="id2539666"></a>
573 In addition, with <a class="indexterm" name="id2539674"></a>security = server, every Samba daemon on a server has to
574 keep a connection open to the authenticating server for as long as that daemon lasts. This can drain the
575 connection resources on a Microsoft NT server and cause it to run out of available connections. With
576 <a class="indexterm" name="id2539685"></a>security = domain, however, the Samba daemons connect to the PDC or BDC
577 only for as long as is necessary to authenticate the user and then drop the connection, thus conserving PDC
578 connection resources.
579 </p><p>
580 <a class="indexterm" name="id2539699"></a>
581 <a class="indexterm" name="id2539705"></a>
582 <a class="indexterm" name="id2539712"></a>
583 <a class="indexterm" name="id2539719"></a>
584 Finally, acting in the same manner as an NT server authenticating to a PDC means that as part of the
585 authentication reply, the Samba server gets the user identification information such as the user SID, the list
586 of NT groups the user belongs to, and so on.
587 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
588 Much of the text of this document was first published in the Web magazine 
589 <a href="http://www.linuxworld.com" target="_top"><span class="emphasis"><em>LinuxWorld</em></span></a> as the article <a href="http://www.linuxworld.com/linuxworld/lw-1998-10/lw-10-samba.html" target="_top">http://www.linuxworld.com/linuxworld/lw-1998-10/lw-10-samba.html</a>
590 <span class="emphasis"><em>Doing the NIS/NT Samba</em></span>.
591 </p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ads-member"></a>Samba ADS Domain Membership</h2></div></div></div><p>
592 <a class="indexterm" name="id2539769"></a>
593 <a class="indexterm" name="id2539776"></a>
594 <a class="indexterm" name="id2539785"></a>
595 <a class="indexterm" name="id2539792"></a>
596 This is a rough guide to setting up Samba-3 with Kerberos authentication against a
597 Windows 200x KDC. A familiarity with Kerberos is assumed.
598 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2539802"></a>Configure <code class="filename">smb.conf</code></h3></div></div></div><p>
599 You must use at least the following three options in <code class="filename">smb.conf</code>:
600 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2539828"></a><em class="parameter"><code>realm = your.kerberos.REALM</code></em></td></tr><tr><td><a class="indexterm" name="id2539840"></a><em class="parameter"><code>security = ADS</code></em></td></tr><tr><td># The following parameter need only be specified if present.</td></tr><tr><td># The default setting if not present is Yes.</td></tr><tr><td><a class="indexterm" name="id2539862"></a><em class="parameter"><code>encrypt passwords = yes</code></em></td></tr></table><p>
601 <a class="indexterm" name="id2539877"></a>
602 <a class="indexterm" name="id2539883"></a>
603 <a class="indexterm" name="id2539890"></a>
604 <a class="indexterm" name="id2539897"></a>
605 <a class="indexterm" name="id2539903"></a>
606 In case samba cannot correctly identify the appropriate ADS server using the realm name, use the 
607 <a class="indexterm" name="id2539912"></a>password server option in <code class="filename">smb.conf</code>:
608 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2539931"></a><em class="parameter"><code>password server = your.kerberos.server</code></em></td></tr></table><p>
609 The most common reason for which Samba may not be able to locate the ADS domain controller is a consequence of
610 sites maintaining some DNS servers on UNIX systems without regard for the DNS requirements of the ADS
611 infrastructure. There is no harm in specifying a preferred ADS domain controller using the <em class="parameter"><code>password
612 server</code></em>.
613 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
614 <a class="indexterm" name="id2539959"></a>
615 <a class="indexterm" name="id2539966"></a>
616 You do <span class="emphasis"><em>not</em></span> need an smbpasswd file, and older clients will be authenticated as 
617 if <a class="indexterm" name="id2539978"></a>security = domain, although it will not do any harm and 
618 allows you to have local users not in the domain.
619 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2539989"></a>Configure <code class="filename">/etc/krb5.conf</code></h3></div></div></div><p>
620 <a class="indexterm" name="id2540002"></a>
621 <a class="indexterm" name="id2540008"></a>
622 <a class="indexterm" name="id2540018"></a>
623 <a class="indexterm" name="id2540025"></a>
624 With both MIT and Heimdal Kerberos, it is unnecessary to configure the <code class="filename">/etc/krb5.conf</code>,
625 and it may be detrimental.
626 </p><p>
627 <a class="indexterm" name="id2540043"></a>
628 <a class="indexterm" name="id2540049"></a>
629 <a class="indexterm" name="id2540056"></a>
630 <a class="indexterm" name="id2540063"></a>
631 <a class="indexterm" name="id2540069"></a>
632 Microsoft ADS automatically create SRV records in the DNS zone 
633 <em class="parameter"><code>_kerberos._tcp.REALM.NAME</code></em> for each KDC in the realm. This is part
634 of the installation and configuration process used to create an Active Directory domain.
635 A KDC is a Kerberos Key Distribution Center and forms an integral part of the Microsoft
636 active directory infrastructure.
637 </p><p>
638 <a class="indexterm" name="id2540091"></a>
639 <a class="indexterm" name="id2540098"></a>
640 <a class="indexterm" name="id2540105"></a>
641 <a class="indexterm" name="id2540111"></a>
642 <a class="indexterm" name="id2540118"></a>
643 <a class="indexterm" name="id2540125"></a>
644 UNIX systems can use kinit and the DES-CBC-MD5 or DES-CBC-CRC encryption types to authenticate to the Windows
645 2000 KDC. For further information regarding Windows 2000 ADS kerberos interoperability please refer to the
646 Microsoft Windows 2000 Kerberos <a href="http://www.microsoft.com/windows2000/techinfo/planning/security/kerbsteps.asp" target="_top">Interoperability</a>
647 guide. Another very useful document that may be referred to for general information regarding Kerberos
648 interoperability is <a href="http://www.ietf.org/rfc/rfc1510.txt?number=1510" target="_top">RFC1510</a>. This RFC
649 explains much of the magic behind the operation of Kerberos.
650 </p><p>
651 <a class="indexterm" name="id2540157"></a>
652 <a class="indexterm" name="id2540163"></a>
653 <a class="indexterm" name="id2540170"></a>
654 <a class="indexterm" name="id2540177"></a>
655 <a class="indexterm" name="id2540184"></a>
656 <a class="indexterm" name="id2540190"></a>
657 MIT's, as well as Heimdal's, recent KRB5 libraries default to checking for SRV records, so they will 
658 automatically find the KDCs. In addition, <code class="filename">krb5.conf</code> only allows specifying 
659 a single KDC, even there if there may be more than one. Using the DNS lookup allows the KRB5 
660 libraries to use whichever KDCs are available.
661 </p><p>
662 <a class="indexterm" name="id2540212"></a>
663 When manually configuring <code class="filename">krb5.conf</code>, the minimal configuration is:
664 </p><pre class="screen">
665 [libdefaults]
666         default_realm = YOUR.KERBEROS.REALM
667
668 [realms]
669         YOUR.KERBEROS.REALM = {
670         kdc = your.kerberos.server
671         }
672
673 [domain_realms]
674         .kerberos.server = YOUR.KERBEROS.REALM
675 </pre><p>
676 </p><p>
677 <a class="indexterm" name="id2540237"></a>
678 When using Heimdal versions before 0.6, use the following configuration settings:
679 </p><pre class="screen">
680 [libdefaults]
681         default_realm      = YOUR.KERBEROS.REALM
682         default_etypes     = des-cbc-crc des-cbc-md5
683         default_etypes_des = des-cbc-crc des-cbc-md5
684
685 [realms]
686         YOUR.KERBEROS.REALM = {
687         kdc = your.kerberos.server
688         }
689
690 [domain_realms]
691         .kerberos.server = YOUR.KERBEROS.REALM
692 </pre><p>
693 </p><p>
694 <a class="indexterm" name="id2540259"></a>
695 <a class="indexterm" name="id2540266"></a>
696 Test your config by doing a <strong class="userinput"><code>kinit
697 <em class="replaceable"><code>USERNAME</code></em>@<em class="replaceable"><code>REALM</code></em></code></strong> and
698 making sure that your password is accepted by the Win2000 KDC.
699 </p><p>
700 <a class="indexterm" name="id2540289"></a>
701 <a class="indexterm" name="id2540296"></a>
702 <a class="indexterm" name="id2540303"></a>
703 <a class="indexterm" name="id2540309"></a>
704 With Heimdal versions earlier than 0.6.x you can use only newly created accounts
705 in ADS or accounts that have had the password changed once after migration, or
706 in case of <code class="constant">Administrator</code> after installation. At the
707 moment, a Windows 2003 KDC can only be used with Heimdal releases later than 0.6
708 (and no default etypes in krb5.conf). Unfortunately, this whole area is still
709 in a state of flux.
710 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
711 <a class="indexterm" name="id2540331"></a>
712 <a class="indexterm" name="id2540338"></a>
713 <a class="indexterm" name="id2540344"></a>
714 The realm must be in uppercase or you will get a &#8220;<span class="quote"><span class="errorname">Cannot find KDC for
715 requested realm while getting initial credentials</span></span>&#8221; error (Kerberos
716 is case-sensitive!).
717 </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
718 <a class="indexterm" name="id2540362"></a>
719 <a class="indexterm" name="id2540369"></a>
720 <a class="indexterm" name="id2540376"></a>
721 <a class="indexterm" name="id2540383"></a>
722 Time between the two servers must be synchronized. You will get a &#8220;<span class="quote"><span class="errorname">kinit(v5): Clock skew too
723 great while getting initial credentials</span></span>&#8221; if the time difference (clock skew) is more than five minutes.
724 </p></div><p>
725 <a class="indexterm" name="id2540401"></a>
726 <a class="indexterm" name="id2540408"></a>
727 Clock skew limits are configurable in the Kerberos protocols. The default setting is five minutes.
728 </p><p>
729 <a class="indexterm" name="id2540420"></a>
730 <a class="indexterm" name="id2540426"></a>
731 <a class="indexterm" name="id2540433"></a>
732 <a class="indexterm" name="id2540439"></a>
733 You also must ensure that you can do a reverse DNS lookup on the IP address of your KDC. Also, the name that
734 this reverse lookup maps to must either be the NetBIOS name of the KDC (i.e., the hostname with no domain
735 attached) or it can be the NetBIOS name followed by the realm.
736 </p><p>
737 <a class="indexterm" name="id2540454"></a>
738 <a class="indexterm" name="id2540461"></a>
739 <a class="indexterm" name="id2540468"></a>
740 The easiest way to ensure you get this right is to add a <code class="filename">/etc/hosts</code> entry mapping the IP
741 address of your KDC to its NetBIOS name. If you do not get this correct, then you will get a <span class="errorname">local
742 error</span> when you try to join the realm.
743 </p><p>
744 <a class="indexterm" name="id2540490"></a>
745 <a class="indexterm" name="id2540497"></a>
746 <a class="indexterm" name="id2540504"></a>
747 <a class="indexterm" name="id2540511"></a>
748 If all you want is Kerberos support in <span class="application">smbclient</span>, then you can skip directly to <a href="domain-member.html#ads-test-smbclient" title="Testing with smbclient">Testing with <span class="application">smbclient</span></a> now.  <a href="domain-member.html#ads-create-machine-account" title="Create the Computer Account">Create the Computer Account</a> and <a href="domain-member.html#ads-test-server" title="Testing Server Setup">Testing Server Setup</a> are needed only if you want Kerberos support for <span class="application">smbd</span>
749 and <span class="application">winbindd</span>.
750 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="ads-create-machine-account"></a>Create the Computer Account</h3></div></div></div><p>
751 <a class="indexterm" name="id2540583"></a>
752 <a class="indexterm" name="id2540589"></a>
753 <a class="indexterm" name="id2540596"></a>
754 <a class="indexterm" name="id2540603"></a>
755 As a user who has write permission on the Samba private directory (usually root), run:
756 </p><pre class="screen">
757 <code class="prompt">root# </code> <strong class="userinput"><code>net ads join -U Administrator%password</code></strong>
758 </pre><p>
759 The Administrator account can be any account that has been designated in the ADS domain security settings with
760 permission to add machines to the ADS domain. It is, of course, a good idea to use an account other than Administrator.
761 On the UNIX/Linux system, this command must be executed by an account that has UID=0 (root).
762 </p><p>
763 <a class="indexterm" name="id2540643"></a>
764 <a class="indexterm" name="id2540650"></a>
765 <a class="indexterm" name="id2540657"></a>
766 <a class="indexterm" name="id2540664"></a>
767 <a class="indexterm" name="id2540671"></a>
768 <a class="indexterm" name="id2540677"></a>
769 When making a Windows client a member of an ADS domain within a complex organization, you
770 may want to create the machine trust account within a particular organizational unit. Samba-3 permits
771 this to be done using the following syntax:
772 </p><pre class="screen">
773 <code class="prompt">root# </code> <strong class="userinput"><code>kinit Administrator@your.kerberos.REALM</code></strong>
774 <code class="prompt">root# </code> <strong class="userinput"><code>net ads join "organizational_unit"</code></strong>
775 </pre><p>
776 Your ADS manager will be able to advise what should be specified for the "organizational_unit" parameter.
777 </p><p>
778 <a class="indexterm" name="id2540727"></a>
779 <a class="indexterm" name="id2540734"></a>
780 <a class="indexterm" name="id2540741"></a>
781 <a class="indexterm" name="id2540748"></a>
782 For example, you may want to create the machine trust account in a container called &#8220;<span class="quote">Servers</span>&#8221;
783 under the organizational directory &#8220;<span class="quote">Computers\BusinessUnit\Department,</span>&#8221; like this:
784 </p><pre class="screen">
785 <code class="prompt">root# </code> <strong class="userinput"><code>net ads join "Computers\BusinessUnit\Department\Servers"</code></strong>
786 </pre><p>
787 This command will place the Samba server machine trust account in the container
788 <code class="literal">Computers\BusinessUnit\Department\Servers</code>. The container should exist in the ADS directory
789 before executing this command.
790 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2540793"></a>Possible Errors</h4></div></div></div><p>
791 </p><div class="variablelist"><dl><dt><span class="term"><span class="errorname">ADS support not compiled in</span></span></dt><dd><p>
792         <a class="indexterm" name="id2540812"></a>
793         <a class="indexterm" name="id2540819"></a>
794         <a class="indexterm" name="id2540826"></a>
795         Samba must be reconfigured (remove config.cache) and recompiled (make clean all install) after the
796         Kerberos libraries and headers files are installed.
797         </p></dd><dt><span class="term"><span class="errorname">net ads join prompts for user name</span></span></dt><dd><p>
798         <a class="indexterm" name="id2540846"></a>
799         <a class="indexterm" name="id2540852"></a>
800         You need to log in to the domain using <strong class="userinput"><code>kinit
801         <em class="replaceable"><code>USERNAME</code></em>@<em class="replaceable"><code>REALM</code></em></code></strong>.
802         <em class="replaceable"><code>USERNAME</code></em> must be a user who has rights to add a machine to the domain.
803         </p></dd><dt><span class="term">Unsupported encryption/or checksum types</span></dt><dd><p>
804         <a class="indexterm" name="id2540886"></a>
805         <a class="indexterm" name="id2540892"></a>
806         <a class="indexterm" name="id2540900"></a>
807         Make sure that the <code class="filename">/etc/krb5.conf</code> is correctly configured
808         for the type and version of Kerberos installed on the system.
809         </p></dd></dl></div><p>
810 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="ads-test-server"></a>Testing Server Setup</h3></div></div></div><p>
811 <a class="indexterm" name="id2540931"></a>
812 <a class="indexterm" name="id2540938"></a>
813 <a class="indexterm" name="id2540945"></a>
814 If the join was successful, you will see a new computer account with the
815 NetBIOS name of your Samba server in Active Directory (in the &#8220;<span class="quote">Computers</span>&#8221;
816 folder under Users and Computers.
817 </p><p>
818 <a class="indexterm" name="id2540961"></a>
819 <a class="indexterm" name="id2540968"></a>
820 <a class="indexterm" name="id2540977"></a>
821 On a Windows 2000 client, try <strong class="userinput"><code>net use * \\server\share</code></strong>. You should
822 be logged in with Kerberos without needing to know a password. If this fails, then run
823 <strong class="userinput"><code>klist tickets</code></strong>. Did you get a ticket for the server? Does it have
824 an encryption type of DES-CBC-MD5? 
825 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
826 <a class="indexterm" name="id2541004"></a>
827 <a class="indexterm" name="id2541011"></a>
828 <a class="indexterm" name="id2541018"></a>
829 Samba can use both DES-CBC-MD5 encryption as well as ARCFOUR-HMAC-MD5 encoding.
830 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="ads-test-smbclient"></a>Testing with <span class="application">smbclient</span></h3></div></div></div><p>
831 <a class="indexterm" name="id2541045"></a>
832 <a class="indexterm" name="id2541052"></a>
833 <a class="indexterm" name="id2541058"></a>
834 On your Samba server try to log in to a Windows 2000 server or your Samba
835 server using <span class="application">smbclient</span> and Kerberos. Use <span class="application">smbclient</span> as usual, but
836 specify the <code class="option">-k</code> option to choose Kerberos authentication.
837 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2541086"></a>Notes</h3></div></div></div><p>
838 <a class="indexterm" name="id2541093"></a>
839 <a class="indexterm" name="id2541100"></a>
840 <a class="indexterm" name="id2541107"></a>
841 You must change the administrator password at least once after installing a domain controller, 
842 to create the right encryption types.
843 </p><p>
844 <a class="indexterm" name="id2541120"></a>
845 <a class="indexterm" name="id2541127"></a>
846 <a class="indexterm" name="id2541134"></a>
847 Windows 200x does not seem to create the <em class="parameter"><code>_kerberos._udp</code></em> and
848 <em class="parameter"><code>_ldap._tcp</code></em> in the default DNS setup. Perhaps this will be fixed later in service packs.
849 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2541158"></a>Sharing User ID Mappings between Samba Domain Members</h2></div></div></div><p>
850 <a class="indexterm" name="id2541166"></a>
851 <a class="indexterm" name="id2541173"></a>
852 <a class="indexterm" name="id2541180"></a>
853 <a class="indexterm" name="id2541186"></a>
854 Samba maps UNIX users and groups (identified by UIDs and GIDs) to Windows users and groups (identified by SIDs).
855 These mappings are done by the <em class="parameter"><code>idmap</code></em> subsystem of Samba.
856 </p><p>
857 <a class="indexterm" name="id2541205"></a>
858 <a class="indexterm" name="id2541212"></a>
859 <a class="indexterm" name="id2541219"></a>
860 In some cases it is useful to share these mappings between Samba domain members,
861 so <span class="emphasis"><em>name-&gt;id</em></span> mapping is identical on all machines.
862 This may be needed in particular when sharing files over both CIFS and NFS.
863 </p><p>
864 <a class="indexterm" name="id2541236"></a>
865 <a class="indexterm" name="id2541243"></a>
866 To use the <span class="emphasis"><em>LDAP</em></span> <em class="parameter"><code>ldap idmap suffix</code></em>, set:
867 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2541266"></a><em class="parameter"><code>ldap idmap suffix = ou=Idmap,dc=quenya,dc=org</code></em></td></tr></table><p>
868 See the <code class="filename">smb.conf</code> man page entry for the <a class="indexterm" name="id2541288"></a>ldap idmap suffix
869 parameter for further information.
870 </p><p>
871 <a class="indexterm" name="id2541299"></a>
872 <a class="indexterm" name="id2541306"></a>
873 <a class="indexterm" name="id2541313"></a>
874 Do not forget to specify also the <a class="indexterm" name="id2541321"></a>ldap admin dn
875 and to make certain to set the LDAP administrative password into the <code class="filename">secrets.tdb</code> using:
876 </p><pre class="screen">
877 <code class="prompt">root# </code> smbpasswd -w ldap-admin-password
878 </pre><p>
879 In place of <code class="literal">ldap-admin-password</code>, substitute the LDAP administration password for your
880 system.
881 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2541357"></a>Common Errors</h2></div></div></div><p>
882 <a class="indexterm" name="id2541365"></a>
883 <a class="indexterm" name="id2541372"></a>
884 In the process of adding/deleting/re-adding domain member machine trust accounts, there are
885 many traps for the unwary player and many &#8220;<span class="quote">little</span>&#8221; things that can go wrong.
886 It is particularly interesting how often subscribers on the Samba mailing list have concluded
887 after repeated failed attempts to add a machine account that it is necessary to &#8220;<span class="quote">reinstall</span>&#8221;
888 MS Windows on the machine. In truth, it is seldom necessary to reinstall because of this type
889 of problem. The real solution is often quite simple, and with an understanding of how MS Windows
890 networking functions, it is easy to overcome.
891 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2541397"></a>Cannot Add Machine Back to Domain</h3></div></div></div><p>
892 <a class="indexterm" name="id2541405"></a>
893 <a class="indexterm" name="id2541412"></a>
894 &#8220;<span class="quote">A Windows workstation was reinstalled. The original domain machine trust
895 account was deleted and added immediately. The workstation will not join the domain if I use 
896 the same machine name. Attempts to add the machine fail with a message that the machine already
897 exists on the network  I know it does not. Why is this failing?</span>&#8221;
898 </p><p>
899 <a class="indexterm" name="id2541434"></a>
900 <a class="indexterm" name="id2541440"></a>
901 The original name is still in the NetBIOS name cache and must expire after machine account
902 deletion before adding that same name as a domain member again. The best advice is to delete
903 the old account and then add the machine with a new name. Alternately, the name cache can be flushed and
904 reloaded with current data using the <span><strong class="command">nbtstat</strong></span> command on the Windows client:
905 </p><pre class="screen">
906 <code class="prompt">C:\&gt; </code> nbtstat -R
907 </pre><p>
908 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2541473"></a>Adding Machine to Domain Fails</h3></div></div></div><p>
909 <a class="indexterm" name="id2541481"></a>
910 <a class="indexterm" name="id2541488"></a>
911 &#8220;<span class="quote">Adding a Windows 200x or XP Professional machine to the Samba PDC Domain fails with a
912 message that says, <span class="errorname">"The machine could not be added at this time, there is a network problem.
913 Please try again later."</span> Why?</span>&#8221;
914 </p><p>
915 <a class="indexterm" name="id2541508"></a>
916 You should check that there is an <a class="indexterm" name="id2541515"></a>add machine script in your <code class="filename">smb.conf</code>
917 file. If there is not, please add one that is appropriate for your OS platform. If a script
918 has been defined, you will need to debug its operation. Increase the <a class="indexterm" name="id2541531"></a>log level
919 in the <code class="filename">smb.conf</code> file to level 10, then try to rejoin the domain. Check the logs to see which
920 operation is failing.
921 </p><p>
922 Possible causes include:
923 </p><div class="itemizedlist"><ul type="disc"><li><p>
924 <a class="indexterm" name="id2541556"></a>
925 <a class="indexterm" name="id2541563"></a>
926         The script does not actually exist, or could not be located in the path specified.
927         </p><p>
928 <a class="indexterm" name="id2541575"></a>
929 <a class="indexterm" name="id2541582"></a>
930         <span class="emphasis"><em>Corrective action:</em></span> Fix it. Make sure when run manually
931         that the script will add both the UNIX system account and the Samba SAM account.
932         </p></li><li><p>
933 <a class="indexterm" name="id2541599"></a>
934 <a class="indexterm" name="id2541606"></a>
935         The machine could not be added to the UNIX system accounts file <code class="filename">/etc/passwd</code>.
936         </p><p>
937 <a class="indexterm" name="id2541623"></a>
938 <a class="indexterm" name="id2541630"></a>
939         <span class="emphasis"><em>Corrective action:</em></span> Check that the machine name is a legal UNIX
940         system account name. If the UNIX utility <span><strong class="command">useradd</strong></span> is called,
941         then make sure that the machine name you are trying to add can be added using this
942         tool. <span><strong class="command">Useradd</strong></span> on some systems will not allow any uppercase characters
943         nor will it allow spaces in the name.
944         </p></li></ul></div><p>
945 <a class="indexterm" name="id2541661"></a>
946 <a class="indexterm" name="id2541668"></a>
947 <a class="indexterm" name="id2541675"></a>
948 The <a class="indexterm" name="id2541682"></a>add machine script does not create the
949 machine account in the Samba backend database; it is there only to create a UNIX system
950 account to which the Samba backend database account can be mapped.
951 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2541695"></a>I Can't Join a Windows 2003 PDC</h3></div></div></div><p>
952 <a class="indexterm" name="id2541703"></a>
953 <a class="indexterm" name="id2541710"></a>
954 <a class="indexterm" name="id2541716"></a>
955 <a class="indexterm" name="id2541723"></a>
956         Windows 2003 requires SMB signing. Client-side SMB signing has been implemented in Samba-3.0.
957         Set <a class="indexterm" name="id2541732"></a>client use spnego = yes when communicating 
958         with a Windows 2003 server. This will not interfere with other Windows clients that do not
959         support the more advanced security features of Windows 2003 because the client will simply
960         negotiate a protocol tha both it and the server suppport. This is a well-known fall-back facility
961         that is built into the SMB/CIFS protocols.
962         </p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="samba-bdc.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="type.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="StandAloneServer.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 5. Backup Domain Control </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 7. Standalone Servers</td></tr></table></div></body></html>