4bede83e964c6432a969cacf9bb7c96926003bfa
[samba.git] / docs / Samba3-HOWTO / TOSHARG-Passdb.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <chapter id="passdb">
4 <chapterinfo>
5         &author.jelmer;
6         &author.jht;
7         &author.jerry;
8         &author.jeremy;
9         <author>&person.gd;<contrib>LDAP updates</contrib></author>
10         <author>
11                 <firstname>Olivier (lem)</firstname><surname>Lemaire</surname>
12                 <affiliation>
13                         <orgname>IDEALX</orgname>
14                         <address><email>olem@IDEALX.org</email></address>
15                 </affiliation>
16         </author>
17         
18         <pubdate>May 24, 2003</pubdate>
19 </chapterinfo>
20 <title>Account Information Databases</title>
21
22 <para>
23 <indexterm><primary>account backends</primary></indexterm>
24 <indexterm><primary>password backends</primary></indexterm>
25 <indexterm><primary>scalability</primary></indexterm>
26 <indexterm><primary>ADS</primary></indexterm>
27 Samba-3 implements a new capability to work concurrently with multiple account backends.
28 The possible new combinations of password backends allows Samba-3 a degree of flexibility
29 and scalability that previously could be achieved only with MS Windows Active Directory (ADS).
30 This chapter describes the new functionality and how to get the most out of it.
31 </para>
32
33 <para>
34 <indexterm><primary>passdb backend</primary></indexterm>
35 <indexterm><primary>smbpasswd</primary></indexterm>
36 <indexterm><primary>tdbsam</primary></indexterm>
37 <indexterm><primary>ldapsam</primary></indexterm>
38 <indexterm><primary>LDAP</primary></indexterm>
39 <indexterm><primary>single repository</primary></indexterm>
40 The three passdb backends that are fully maintained (actively supported) by the Samba Team are:
41 <literal>smbpasswd</literal> (being obsoleted), <literal>tdbsam</literal> (a tdb-based binary file format),
42 and <literal>ldapsam</literal> (LDAP directory).  Of these, only the <literal>ldapsam</literal> backend
43 stores both POSIX (UNIX) and Samba user and group account information in a single repository. The
44 <literal>smbpasswd</literal> and <literal>tdbsam</literal> backends store only Samba user accounts.
45 </para>
46
47 <para>
48 In a strict sense, there are three supported account storage and access systems. One of these is considered
49 obsolete (smbpasswd). It is recommended to use the <literal>tdbsam</literal> method for all simple systems. Use
50 <literal>ldapsam</literal> for larger and more complex networks.
51 </para>
52
53 <para>
54 <indexterm><primary>passdb backend</primary></indexterm>
55 <indexterm><primary>account storage mechanisms</primary></indexterm>
56 <indexterm><primary>account storage system</primary></indexterm>
57 <indexterm><primary>user and trust accounts</primary></indexterm>
58 <indexterm><primary>machine trust accounts</primary></indexterm>
59 <indexterm><primary>computer accounts</primary></indexterm>
60 <indexterm><primary>interdomain trust accounts</primary></indexterm>
61 In a strict and literal sense, the passdb backends are account storage mechanisms (or methods) alone. The choice
62 of terminology can be misleading, however we are stuck with this choice of wording. This chapter documents the
63 nature of the account storage system with a focus on user and trust accounts. Trust accounts have two forms,
64 machine trust accounts (computer accounts) and interdomain trust accounts. These are all treated as user-like
65 entities.
66 </para>
67
68 <sect1>
69 <title>Features and Benefits</title>
70
71 <para>
72 Samba-3 provides for complete backward compatibility with Samba-2.2.x functionality
73 as follows:
74 <indexterm><primary>SAM backend</primary><secondary>smbpasswd</secondary></indexterm>
75 <indexterm><primary>SAM backend</primary><secondary>ldapsam_compat</secondary></indexterm>
76 <indexterm><primary>encrypted passwords</primary></indexterm>
77 </para>
78
79 <sect2>
80         <title>Backward Compatibility Account Storage Systems</title>
81
82 <variablelist>
83         <varlistentry><term>Plaintext</term>
84                 <listitem>
85                         <para>
86 <indexterm><primary>plaintext</primary></indexterm>
87 <indexterm><primary>plaintext authentication</primary></indexterm>
88 <indexterm><primary>/etc/passwd</primary></indexterm>
89 <indexterm><primary>/etc/shadow</primary></indexterm>
90 <indexterm><primary>PAM</primary></indexterm>
91                         This isn't really a backend at all, but is listed here for simplicity.  Samba can be configured to pass
92                         plaintext authentication requests to the traditional UNIX/Linux <filename>/etc/passwd</filename> and
93                         <filename>/etc/shadow</filename>-style subsystems.  On systems that have Pluggable Authentication Modules
94                         (PAM) support, all PAM modules are supported. The behavior is just as it was with Samba-2.2.x, and the
95                         protocol limitations imposed by MS Windows clients apply likewise. Please refer to <link
96                         linkend="passdbtech">Technical Information</link>, for more information regarding the limitations of plaintext
97                         password usage.
98                         </para>
99                 </listitem>
100         </varlistentry>
101
102         <varlistentry><term>smbpasswd</term>
103                 <listitem>
104                         <para>
105 <indexterm><primary>smbpasswd</primary></indexterm>
106 <indexterm><primary>LanMan passwords</primary></indexterm>
107 <indexterm><primary>NT-encrypted passwords</primary></indexterm>
108 <indexterm><primary>SAM</primary></indexterm>
109                         This option allows continued use of the <filename>smbpasswd</filename>
110                         file that maintains a plain ASCII (text) layout that includes the MS Windows
111                         LanMan and NT-encrypted passwords as well as a field that stores some
112                         account information. This form of password backend does not store any of
113                         the MS Windows NT/200x SAM (Security Account Manager) information required to
114                         provide the extended controls that are needed for more comprehensive 
115                         interoperation with MS Windows NT4/200x servers.
116                         </para>
117
118                         <para>
119                         This backend should be used only for backward compatibility with older
120                         versions of Samba. It may be deprecated in future releases.
121                         </para>
122                 </listitem>
123         </varlistentry>
124
125         <varlistentry><term>ldapsam_compat (Samba-2.2 LDAP Compatibility)</term>
126                 <listitem>
127                         <para>
128 <indexterm><primary>ldapsam_compat</primary></indexterm>
129 <indexterm><primary>Samba-2.2.x LDAP schema</primary></indexterm>
130 <indexterm><primary>OpenLDAP backend</primary></indexterm>
131                         There is a password backend option that allows continued operation with
132                         an existing OpenLDAP backend that uses the Samba-2.2.x LDAP schema extension.
133                         This option is provided primarily as a migration tool, although there is
134                         no reason to force migration at this time. This tool will eventually
135                         be deprecated.
136                         </para>
137                 </listitem>
138         </varlistentry>
139 </variablelist>
140
141 </sect2>
142
143 <sect2>
144 <title>New Account Storage Systems</title>
145
146 <para>
147 Samba-3 introduces a number of new password backend capabilities.
148 <indexterm><primary>SAM backend</primary><secondary>tdbsam</secondary></indexterm>
149 <indexterm><primary>SAM backend</primary><secondary>ldapsam</secondary></indexterm>
150 </para>
151
152 <variablelist>
153         <varlistentry><term>tdbsam</term>
154                 <listitem>
155                         <para>
156 <indexterm><primary>rich database backend</primary></indexterm>
157 <indexterm><primary>PDC</primary></indexterm>
158 <indexterm><primary>BDC</primary></indexterm>
159                         This backend provides a rich database backend for local servers. This
160                         backend is not suitable for multiple domain controllers (i.e., PDC + one
161                         or more BDC) installations.
162                         </para>
163
164                         <para>
165 <indexterm><primary>extended SAM</primary></indexterm>
166 <indexterm><primary>TDB</primary></indexterm>
167 <indexterm><primary>binary format TDB</primary></indexterm>
168 <indexterm><primary>trivial database</primary></indexterm>
169 <indexterm><primary>system access controls</primary></indexterm>
170 <indexterm><primary>MS Windows NT4/200x</primary></indexterm>
171                         The <emphasis>tdbsam</emphasis> password backend stores the old <emphasis>
172                         smbpasswd</emphasis> information plus the extended MS Windows NT/200x
173                         SAM information into a binary format TDB (trivial database) file.
174                         The inclusion of the extended information makes it possible for Samba-3
175                         to implement the same account and system access controls that are possible
176                         with MS Windows NT4/200x-based systems.
177                         </para>
178
179                         <para>
180 <indexterm><primary>simple operation</primary></indexterm>
181 <indexterm><primary>OpenLDAP</primary></indexterm>
182 <indexterm><primary>ADS</primary></indexterm>
183                         The inclusion of the <emphasis>tdbsam</emphasis> capability is a direct
184                         response to user requests to allow simple site operation without the overhead
185                         of the complexities of running OpenLDAP. It is recommended to use this only
186                         for sites that have fewer than 250 users. For larger sites or implementations,
187                         the use of OpenLDAP or of Active Directory integration is strongly recommended.
188                         </para>
189                 </listitem>
190         </varlistentry>
191
192         <varlistentry><term>ldapsam</term>
193                 <listitem>
194                         <para>
195 <indexterm><primary>rich directory backend</primary></indexterm>
196 <indexterm><primary>distributed account</primary></indexterm>
197                         This provides a rich directory backend for distributed account installation.    
198                         </para>
199
200                         <para>
201 <indexterm><primary>LDAP</primary></indexterm>
202 <indexterm><primary>OpenLDAP</primary></indexterm>
203 <indexterm><primary>Samba schema</primary></indexterm>
204 <indexterm><primary>schema file</primary></indexterm>
205 <indexterm><primary>examples/LDAP</primary></indexterm>
206                         Samba-3 has a new and extended LDAP implementation that requires configuration
207                         of OpenLDAP with a new format Samba schema. The new format schema file is
208                         included in the <filename class="directory">examples/LDAP</filename> directory of the Samba distribution.
209                         </para>
210
211                         <para>
212 <indexterm><primary>expands control abilities</primary></indexterm>
213 <indexterm><primary>profile</primary></indexterm>
214 <indexterm><primary>home directories</primary></indexterm>
215 <indexterm><primary>account access controls</primary></indexterm>
216 <indexterm><primary>greater scalability</primary></indexterm>
217                         The new LDAP implementation significantly expands the control abilities that
218                         were possible with prior versions of Samba. It is now possible to specify
219                         <quote>per-user</quote> profile settings, home directories, account access controls, and
220                         much more. Corporate sites will see that the Samba Team has listened to their
221                         requests both for capability and greater scalability.
222                         </para>
223                 </listitem>
224         </varlistentry>
225
226 </variablelist>
227
228 </sect2>
229
230 </sect1>
231
232 <sect1 id="passdbtech">
233         <title>Technical Information</title>
234
235         <para>
236 <indexterm><primary>plaintext passwords</primary></indexterm>
237 <indexterm><primary>encrypted passwords</primary></indexterm>
238         Old Windows clients send plaintext passwords over the wire. Samba can check these
239         passwords by encrypting them and comparing them to the hash stored in the UNIX user database.
240         </para>
241
242         <para>
243 <indexterm><primary>encrypted passwords</primary></indexterm>   
244 <indexterm><primary>LanMan</primary></indexterm>
245 <indexterm><primary>plaintext passwords</primary></indexterm>
246 <indexterm><primary>registry</primary></indexterm>
247         Newer Windows clients send encrypted passwords (LanMan and NT hashes) instead of plaintext passwords over
248         the wire. The newest clients will send only encrypted passwords and refuse to send plaintext passwords unless
249         their registry is tweaked.
250         </para>
251
252         <para>
253 <indexterm><primary>UNIX-style encrypted passwords</primary></indexterm>
254 <indexterm><primary>converted</primary></indexterm>
255         Many people ask why Samba cannot simply use the UNIX password database. Windows requires
256         passwords that are encrypted in its own format.  The UNIX passwords can't be converted to 
257         UNIX-style encrypted passwords. Because of that, you can't use the standard UNIX user
258         database, and you have to store the LanMan and NT hashes somewhere else.
259         </para>
260         
261         <para>
262 <indexterm><primary>differently encrypted passwords</primary></indexterm>
263 <indexterm><primary>profile</primary></indexterm>
264 <indexterm><primary>workstations</primary></indexterm>
265 <indexterm><primary>tdbsam</primary></indexterm>
266         In addition to differently encrypted passwords, Windows also stores certain data for each
267         user that is not stored in a UNIX user database: for example, workstations the user may logon from,
268         the location where the user's profile is stored, and so on. Samba retrieves and stores this
269         information using a <smbconfoption name="passdb backend"/>. Commonly available backends are LDAP,
270         tdbsam, and plain text file. For more information, see the man page for &smb.conf; regarding the 
271         <smbconfoption name="passdb backend"/> parameter.
272         </para>
273
274
275         <figure id="idmap-sid2uid">
276                 <title>IDMAP: Resolution of SIDs to UIDs.</title>
277                 <imagefile scale="40">idmap-sid2uid</imagefile>
278         </figure>
279
280         <para>
281         <indexterm><primary>SID</primary></indexterm>
282 <indexterm><primary>UID</primary></indexterm>
283 <indexterm><primary>SID</primary></indexterm>
284         The resolution of SIDs to UIDs is fundamental to correct operation of Samba. In both cases shown, if winbindd
285         is not running or cannot be contacted, then only local SID/UID resolution is possible. See <link
286         linkend="idmap-sid2uid">resolution of SIDs to UIDs</link> and <link linkend="idmap-uid2sid">resolution of UIDs
287         to SIDs</link> diagrams.
288         </para>
289
290         <figure id="idmap-uid2sid">
291                 <title>IDMAP: Resolution of UIDs to SIDs.</title>
292                 <imagefile scale="50">idmap-uid2sid</imagefile>
293         </figure>
294
295         <sect2>
296         <title>Important Notes About Security</title>
297                 
298                 <para>
299 <indexterm><primary>SMB password encryption</primary></indexterm>
300 <indexterm><primary>clear-text passwords</primary></indexterm>
301 <indexterm><primary>hashed password equivalent</primary></indexterm>
302 <indexterm><primary>LDAP</primary></indexterm>
303 <indexterm><primary>secret</primary></indexterm>
304                 The UNIX and SMB password encryption techniques seem similar on the surface. This
305                 similarity is, however, only skin deep. The UNIX scheme typically sends clear-text
306                 passwords over the network when logging in. This is bad. The SMB encryption scheme
307                 never sends the clear-text password over the network, but it does store the 16-byte 
308                 hashed values on disk. This is also bad. Why? Because the 16 byte hashed values
309                 are a <quote>password equivalent.</quote> You cannot derive the user's password from them, but
310                 they could potentially be used in a modified client to gain access to a server.
311                 This would require considerable technical knowledge on behalf of the attacker but
312                 is perfectly possible. You should therefore treat the data stored in whatever passdb
313                 backend you use (smbpasswd file, LDAP) as though it contained the clear-text
314                 passwords of all your users. Its contents must be kept secret, and the file should
315                 be protected accordingly.
316                 </para>
317                 
318                 <para>
319 <indexterm><primary>password scheme</primary></indexterm>
320 <indexterm><primary>plaintext passwords</primary></indexterm>
321 <indexterm><primary>compatible</primary></indexterm>
322                 Ideally, we would like a password scheme that involves neither plaintext passwords
323                 on the network nor plaintext passwords on disk. Unfortunately, this is not available because Samba is stuck with
324                 having to be compatible with other SMB systems (Windows NT, Windows for Workgroups, Windows 9x/Me).
325                 </para>
326
327                 <para>
328 <indexterm><primary>encrypted passwords</primary></indexterm>
329 <indexterm><primary>plaintext passwords</primary></indexterm>
330                 Windows NT 4.0 Service Pack 3 changed the default setting so plaintext passwords
331                 are disabled from being sent over the wire. This mandates either the use of encrypted
332                 password support or editing the Windows NT registry to re-enable plaintext passwords.
333                 </para>
334                 
335                 <para>
336 <indexterm><primary>domain security</primary></indexterm>
337 <indexterm><primary>domain environment</primary></indexterm>
338                 The following versions of Microsoft Windows do not support full domain security protocols,
339                 although they may log onto a domain environment:
340                 </para>
341
342                 <itemizedlist>
343                         <listitem><para>MS DOS Network client 3.0 with the basic network redirector installed.</para></listitem>
344                         <listitem><para>Windows 95 with the network redirector update installed.</para></listitem>
345                         <listitem><para>Windows 98 [Second Edition].</para></listitem>
346                         <listitem><para>Windows Me.</para></listitem>
347                 </itemizedlist>
348
349                 <note>
350                 <para>
351 <indexterm><primary>Windows XP Home</primary></indexterm>
352 <indexterm><primary>domain member</primary></indexterm>
353 <indexterm><primary>domain logons</primary></indexterm>
354                 MS Windows XP Home does not have facilities to become a domain member, and it cannot participate in domain logons.
355                 </para>
356                 </note>
357
358                 <para>
359                 The following versions of MS Windows fully support domain security protocols.
360                 </para>
361
362                 <itemizedlist>
363                         <listitem><para>Windows NT 3.5x.</para></listitem>
364                         <listitem><para>Windows NT 4.0.</para></listitem>
365                         <listitem><para>Windows 2000 Professional.</para></listitem>
366                         <listitem><para>Windows 200x Server/Advanced Server.</para></listitem>
367                         <listitem><para>Windows XP Professional.</para></listitem>
368                 </itemizedlist>
369                         
370                 <para>
371 <indexterm><primary>SMB/CIFS</primary></indexterm>
372 <indexterm><primary>authentication</primary></indexterm>
373 <indexterm><primary>challenge/response mechanis</primary></indexterm>
374 <indexterm><primary>clear-text</primary></indexterm>
375 <indexterm><primary>encrypted</primary></indexterm>
376 <indexterm><primary>negotiate</primary></indexterm>
377                 All current releases of Microsoft SMB/CIFS clients support authentication via the
378                 SMB challenge/response mechanism described here. Enabling clear-text authentication
379                 does not disable the ability of the client to participate in encrypted authentication.
380                 Instead, it allows the client to negotiate either plaintext or encrypted password
381                 handling.
382                 </para>
383
384                 <para>
385 <indexterm><primary>cached encrypted password</primary></indexterm>
386 <indexterm><primary>plaintext passwords</primary></indexterm>
387 <indexterm><primary>registry change</primary></indexterm>
388 <indexterm><primary>auto-reconnect</primary></indexterm>
389 <indexterm><primary>encrypted passwords</primary></indexterm>
390                 MS Windows clients will cache the encrypted password alone. Where plaintext passwords
391                 are re-enabled through the appropriate registry change, the plaintext password is never
392                 cached. This means that in the event that a network connections should become disconnected
393                 (broken), only the cached (encrypted) password will be sent to the resource server to
394                 effect an auto-reconnect. If the resource server does not support encrypted passwords, the
395                 auto-reconnect will fail. Use of encrypted passwords is strongly advised.
396                 </para>
397
398                 <sect3>
399                 <title>Advantages of Encrypted Passwords</title>
400
401                         <itemizedlist>
402                                 <listitem><para>
403 <indexterm><primary>passed across the network</primary></indexterm>
404 <indexterm><primary>network sniffer</primary></indexterm>
405 <indexterm><primary>SMB server</primary></indexterm>
406                                 Plaintext passwords are not passed across the network. Someone using a network sniffer
407                                 cannot just record passwords going to the SMB server.
408                                 </para></listitem>
409
410                                 <listitem><para>
411 <indexterm><primary>not stored anywhere</primary></indexterm>
412 <indexterm><primary>memory</primary></indexterm>
413 <indexterm><primary>disk</primary></indexterm>
414                                 Plaintext passwords are not stored anywhere in memory or on disk.
415                                 </para></listitem>
416                          
417                                 <listitem><para>
418 <indexterm><primary>encrypted passwords</primary></indexterm>
419 <indexterm><primary>user-level security</primary></indexterm>
420 <indexterm><primary>password prompt</primary></indexterm>
421 <indexterm><primary>SMB encryption</primary></indexterm>
422                                 Windows NT does not like talking to a server that does not support encrypted passwords. It will refuse to
423                                 browse the server if the server is also in user-level security mode. It will insist on prompting the user for
424                                 the password on each connection, which is very annoying. The only thing you can do to stop this is to use SMB
425                                 encryption.
426                                 </para></listitem>
427
428                                 <listitem><para>
429 <indexterm><primary>encrypted password</primary></indexterm>
430 <indexterm><primary>automatic reconnects</primary></indexterm>
431                                 Encrypted password support allows automatic share (resource) reconnects.
432                                 </para></listitem>
433
434                                 <listitem><para>
435 <indexterm><primary>PDC</primary></indexterm>
436 <indexterm><primary>BDC</primary></indexterm>
437                                 Encrypted passwords are essential for PDC/BDC operation.
438                                 </para></listitem>
439                         </itemizedlist>
440                 </sect3>
441
442
443                 <sect3>
444                 <title>Advantages of Non-Encrypted Passwords</title>
445
446                         <itemizedlist>
447                                 <listitem><para>
448 <indexterm><primary>cached in memory</primary></indexterm>
449                                 Plaintext passwords are not kept on disk and are not cached in memory.
450                                 </para></listitem>
451                                 
452                                 <listitem><para>
453 <indexterm><primary>Login</primary></indexterm>
454 <indexterm><primary>FTP</primary></indexterm>
455                                 Plaintext passwords use the same password file as other UNIX services, such as Login and FTP.
456                                 </para></listitem>
457                                 
458                                 <listitem><para>
459 <indexterm><primary>Telnet</primary></indexterm>
460 <indexterm><primary>FTP</primary></indexterm>
461                                 Use of other services (such as Telnet and FTP) that send plaintext passwords over
462                                 the network makes sending them for SMB not such a big deal.
463                                 </para></listitem>
464                         </itemizedlist>
465                 </sect3>
466         </sect2>
467
468         <sect2>
469         <title>Mapping User Identifiers between MS Windows and UNIX</title>
470
471         <para>
472 <indexterm><primary>UID</primary></indexterm>
473 <indexterm><primary>SID</primary></indexterm>
474 <indexterm><primary>mapping</primary></indexterm>
475         Every operation in UNIX/Linux requires a user identifier (UID), just as in
476         MS Windows NT4/200x this requires a security identifier (SID). Samba provides
477         two means for mapping an MS Windows user to a UNIX/Linux UID.
478         </para>
479
480         <para>
481 <indexterm><primary>Samba SAM</primary></indexterm>
482 <indexterm><primary>SAM</primary></indexterm>
483 <indexterm><primary>UID</primary></indexterm>
484 <indexterm><primary>account information database</primary></indexterm>
485 <indexterm><primary>local user account</primary></indexterm>
486         First, all Samba SAM database accounts require a UNIX/Linux UID that the account will map to. As users are
487         added to the account information database, Samba will call the <smbconfoption name="add user script"/>
488         interface to add the account to the Samba host OS. In essence all accounts in the local SAM require a local
489         user account.
490         </para>
491
492         <para>
493         <indexterm><primary>idmap uid</primary></indexterm>
494         <indexterm><primary>idmap gid</primary></indexterm>
495         <indexterm><primary>UID</primary></indexterm>
496         <indexterm><primary>SAM</primary></indexterm>
497         <indexterm><primary>foreign domain</primary></indexterm>
498         <indexterm><primary>non-member Windows client</primary></indexterm>
499         <indexterm><primary>SID</primary></indexterm>
500         The second way to map Windows SID to UNIX UID is via the <emphasis>idmap uid</emphasis> and
501         <emphasis>idmap gid</emphasis> parameters in &smb.conf;.  Please refer to the man page for information about
502         these parameters.  These parameters are essential when mapping users from a remote (non-member Windows client
503         or a member of a foreign domain) SAM server.
504         </para>
505
506         </sect2>
507
508         <sect2 id="idmapbackend">
509         <title>Mapping Common UIDs/GIDs on Distributed Machines</title>
510
511         <para>
512 <indexterm><primary>UID</primary></indexterm>
513 <indexterm><primary>GID</primary></indexterm>
514 <indexterm><primary>BDC</primary></indexterm>
515 <indexterm><primary>domain member servers</primary></indexterm>
516 <indexterm><primary>NFS</primary></indexterm>
517 <indexterm><primary>rsync</primary></indexterm>
518         Samba-3 has a special facility that makes it possible to maintain identical UIDs and GIDs
519         on all servers in a distributed network. A distributed network is one where there exists
520         a PDC, one or more BDCs, and/or one or more domain member servers. Why is this important?
521         This is important if files are being shared over more than one protocol (e.g., NFS) and where
522         users are copying files across UNIX/Linux systems using tools such as <command>rsync</command>.
523         </para>
524
525         <para>
526 <indexterm><primary>LDAP-based</primary></indexterm>
527 <indexterm><primary>idmap backend</primary></indexterm>
528 <indexterm><primary>UID</primary></indexterm>
529 <indexterm><primary>GID</primary></indexterm>
530 <indexterm><primary>LDAP</primary></indexterm>
531 <indexterm><primary>SAM backend</primary></indexterm>
532 <indexterm><primary>LDAP idmap Backend</primary></indexterm>
533         <indexterm><primary>idmap backend</primary></indexterm>
534         The special facility is enabled using a parameter called <parameter>idmap backend</parameter>.
535         The default setting for this parameter is an empty string. Technically it is possible to use
536         an LDAP-based idmap backend for UIDs and GIDs, but it makes most sense when this is done for
537         network configurations that also use LDAP for the SAM backend.
538         <link linkend="idmapbackendexample">Example Configuration with the LDAP idmap Backend</link>
539         shows that configuration.
540         </para>
541
542 <indexterm><primary>SAM backend</primary><secondary>ldapsam</secondary></indexterm>
543 <example id="idmapbackendexample">
544 <title>Example Configuration with the LDAP idmap Backend</title>
545 <smbconfblock>
546 <smbconfsection name="[global]"/>
547 <smbconfoption name="idmap backend">ldap:ldap://ldap-server.quenya.org:636</smbconfoption>
548 <smbconfcomment>Alternatively, this could be specified as:</smbconfcomment>
549 <smbconfoption name="idmap backend">ldap:ldaps://ldap-server.quenya.org</smbconfoption>
550 </smbconfblock>
551 </example>
552
553         <para>
554 <indexterm><primary>LDAP backends</primary></indexterm>
555 <indexterm><primary>PADL Software</primary></indexterm>
556         A network administrator who wants to make significant use of LDAP backends will sooner or later be
557         exposed to the excellent work done by PADL Software. PADL <ulink url="http://www.padl.com"/> have
558         produced and released to open source an array of tools that might be of interest. These tools include:
559         </para>
560
561         <itemizedlist>
562                 <listitem>
563                 <para>
564 <indexterm><primary>nss_ldap</primary></indexterm>
565 <indexterm><primary>NSS</primary></indexterm>
566 <indexterm><primary>AIX</primary></indexterm>
567 <indexterm><primary>Linux</primary></indexterm>
568 <indexterm><primary>LDAP</primary></indexterm>
569 <indexterm><primary>Solaris</primary></indexterm>
570 <indexterm><primary>UID</primary></indexterm>
571 <indexterm><primary>GID</primary></indexterm>
572                 <emphasis>nss_ldap:</emphasis> An LDAP name service switch (NSS) module to provide native
573                 name service support for AIX, Linux, Solaris, and other operating systems. This tool
574                 can be used for centralized storage and retrieval of UIDs and GIDs.
575                 </para>
576                 </listitem>
577
578                 <listitem>
579                 <para>
580 <indexterm><primary>pam_ldap</primary></indexterm>
581 <indexterm><primary>PAM</primary></indexterm>
582 <indexterm><primary>LDAP</primary></indexterm>
583 <indexterm><primary>access authentication</primary></indexterm>
584                 <emphasis>pam_ldap:</emphasis> A PAM module that provides LDAP integration for UNIX/Linux
585                 system access authentication.
586                 </para>
587                 </listitem>
588
589                 <listitem>
590                 <para>
591 <indexterm><primary>idmap_ad</primary></indexterm>
592 <indexterm><primary>IDMAP backend</primary></indexterm>
593 <indexterm><primary>RFC 2307</primary></indexterm>
594 <indexterm><primary>PADL</primary></indexterm>
595                 <emphasis>idmap_ad:</emphasis> An IDMAP backend that supports the Microsoft Services for
596                 UNIX RFC 2307 schema available from the PADL Web 
597                 <ulink url="http://www.padl.com/download/xad_oss_plugins.tar.gz">site</ulink>.
598                 </para>
599                 </listitem>
600         </itemizedlist>
601
602         </sect2>
603
604         <sect2>
605         <title>Comments Regarding LDAP</title>
606
607         <para>
608 <indexterm><primary>LDAP</primary><secondary>directories</secondary></indexterm>
609 <indexterm><primary>architecture</primary></indexterm>
610 <indexterm><primary>FIM</primary></indexterm>
611 <indexterm><primary>SSO</primary></indexterm>
612         There is much excitement and interest in LDAP directories in the information technology world
613         today. The LDAP architecture was designed to be highly scalable. It was also designed for
614         use across a huge number of potential areas of application encompassing a wide range of operating
615         systems and platforms. LDAP technologies are at the heart of the current generations of Federated
616         Identity Management (FIM) solutions that can underlie a corporate Single Sign-On (SSO) environment.
617         </para>
618
619         <para>
620 <indexterm><primary>LDAP</primary></indexterm>
621 <indexterm><primary>eDirectory</primary></indexterm>
622 <indexterm><primary>ADS</primary></indexterm>
623 <indexterm><primary>authentication</primary></indexterm>
624         LDAP implementations have been built across a wide variety of platforms. It lies at the core of Microsoft
625         Windows Active Directory services (ADS), Novell's eDirectory, as well as many others. Implementation of the
626         directory services LDAP involves interaction with legacy as well as new generation applications, all of which
627         depend on some form of authentication services.
628         </para>
629
630         <para>
631 <indexterm><primary>LDAP directory</primary></indexterm>
632 <indexterm><primary>authentication</primary></indexterm>
633 <indexterm><primary>access controls</primary></indexterm>
634 <indexterm><primary>intermediate tools</primary></indexterm>
635 <indexterm><primary>middle-ware</primary></indexterm>
636 <indexterm><primary>central environment</primary></indexterm>
637 <indexterm><primary>infrastructure</primary></indexterm>
638 <indexterm><primary>login shells</primary></indexterm>
639 <indexterm><primary>mail</primary></indexterm>
640 <indexterm><primary>messaging systems</primary></indexterm>
641 <indexterm><primary>quota controls</primary></indexterm>
642 <indexterm><primary>printing systems</primary></indexterm>
643 <indexterm><primary>DNS servers</primary></indexterm>
644 <indexterm><primary>DHCP servers</primary></indexterm>
645         UNIX services can utilize LDAP directory information for authentication and access controls
646         through intermediate tools and utilities. The total environment that consists of the LDAP directory
647         and the middle-ware tools and utilities makes it possible for all user access to the UNIX platform
648         to be managed from a central environment and yet distributed to wherever the point of need may
649         be physically located. Applications that benefit from this infrastructure include: UNIX login 
650         shells, mail and messaging systems, quota controls, printing systems, DNS servers, DHCP servers,
651         and also Samba.
652         </para>
653
654         <para>
655 <indexterm><primary>LDAP</primary></indexterm>
656 <indexterm><primary>passdb backend</primary></indexterm>
657 <indexterm><primary>scalable</primary></indexterm>
658 <indexterm><primary>SAM backend</primary></indexterm>
659 <indexterm><primary>LDAP directory</primary></indexterm>
660 <indexterm><primary>management costs</primary></indexterm>
661         Many sites are installing LDAP for the first time in order to provide a scalable passdb backend
662         for Samba. Others are faced with the need to adapt an existing LDAP directory to new uses such
663         as for the Samba SAM backend. Whatever your particular need and attraction to Samba may be,
664         decisions made in respect of the design of the LDAP directory structure and its implementation
665         are of a durable nature for the site. These have far-reaching implications that affect long-term
666         information systems management costs.
667         </para>
668
669         <para>
670 <indexterm><primary>LDAP deployment</primary></indexterm>
671 <indexterm><primary>Directory Information Tree</primary><see>DIT</see></indexterm>
672         Do not rush into an LDAP deployment. Take the time to understand how the design of the Directory
673         Information Tree (DIT) may impact current and future site needs, as well as the ability to meet
674         them. The way that Samba SAM information should be stored within the DIT varies from site to site
675         and with each implementation new experience is gained. It is well understood by LDAP veterans that
676         first implementations create awakening, second implementations of LDAP create fear, and 
677         third-generation deployments bring peace and tranquility.
678         </para>
679
680         <sect3>
681         <title>Caution Regarding LDAP and Samba</title>
682
683         <para>
684 <indexterm><primary>POSIX identity</primary></indexterm>
685 <indexterm><primary>networking environment</primary></indexterm>
686 <indexterm><primary>user accounts</primary></indexterm>
687 <indexterm><primary>group accounts</primary></indexterm>
688 <indexterm><primary>machine trust accounts</primary></indexterm>
689 <indexterm><primary>interdomain trust accounts</primary></indexterm>
690 <indexterm><primary>intermediate information</primary></indexterm>
691         Samba requires UNIX POSIX identity information as well as a place to store information that is
692         specific to Samba and the Windows networking environment. The most used information that must
693         be dealt with includes: user accounts, group accounts, machine trust accounts, interdomain
694         trust accounts, and intermediate information specific to Samba internals.
695         </para>
696
697         <para>
698 <indexterm><primary>deployment guidelines</primary></indexterm>
699 <indexterm><primary>HOWTO documents</primary></indexterm>
700 <indexterm><primary>LDAP</primary></indexterm>
701         The example deployment guidelines in this book, as well as other books and HOWTO documents
702         available from the internet may not fit with established directory designs and implementations.
703         The existing DIT may not be able to accommodate the simple information layout proposed in common
704         sources. Additionally, you may find that the common scripts and tools that are used to provision
705         the LDAP directory for use with Samba may not suit your needs.
706         </para>
707
708         <para>
709 <indexterm><primary>existing LDAP DIT</primary></indexterm>
710         It is not uncommon, for sites that have existing LDAP DITs to find necessity to generate a
711         set of site-specific scripts and utilities to make it possible to deploy Samba within the
712         scope of site operations. The way that user and group accounts are distributed throughout
713         the DIT may make this a challenging matter. The solution will, of course, be rewarding, but
714         the journey to it may be challenging. Take time to understand site needs and do not rush
715         into deployment.
716         </para>
717
718         <para>
719 <indexterm><primary>scripts</primary></indexterm>
720 <indexterm><primary>tools</primary></indexterm>
721         Above all, do not blindly use scripts and tools that are not suitable for your site. Check
722         and validate all scripts before you execute them to make sure that the existing infrastructure
723         will not be damaged by inadvertent use of an inappropriate tool.
724         </para>
725
726         </sect3>
727
728         </sect2>
729
730         <sect2>
731         <title>LDAP Directories and Windows Computer Accounts</title>
732
733                 <para>
734 <indexterm><primary>turnkey solution</primary></indexterm>
735 <indexterm><primary>LDAP.</primary></indexterm>
736 <indexterm><primary>frustrating experience</primary></indexterm>
737                 Samba doesn't provide a turnkey solution to LDAP. It is best to deal with the design and
738                 configuration of an LDAP directory prior to integration with Samba. A working knowledge
739                 of LDAP makes Samba integration easy, and the lack of a working knowledge of LDAP can make
740                 it a frustrating experience.
741                 </para>
742
743                 <para>
744 <indexterm><primary>computer accounts</primary></indexterm>
745 <indexterm><primary>machine accounts</primary></indexterm>
746 <indexterm><primary>LDAP</primary></indexterm>
747                 Computer (machine) accounts can be placed wherever you like in an LDAP directory subject
748                 to some constraints that are described in this chapter.
749                 </para>
750
751                 <para>
752 <indexterm><primary>POSIX</primary></indexterm>
753 <indexterm><primary>sambaSamAccount</primary></indexterm>
754 <indexterm><primary>computer accounts</primary></indexterm>
755 <indexterm><primary>machine accounts</primary></indexterm>
756 <indexterm><primary>Windows NT4/200X</primary></indexterm>
757 <indexterm><primary>user account</primary></indexterm>
758 <indexterm><primary>trust accounts</primary></indexterm>
759                 The POSIX and sambaSamAccount components of computer (machine) accounts are both used by Samba.
760                 Thus, machine accounts are treated inside Samba in the same way that Windows NT4/200X treats
761                 them. A user account and a machine account are indistinquishable from each other, except that
762                 the machine account ends in a $ character, as do trust accounts.
763                 </para>
764
765                 <para>
766 <indexterm><primary>user</primary></indexterm>
767 <indexterm><primary>group</primary></indexterm>
768 <indexterm><primary>machine</primary></indexterm>
769 <indexterm><primary>trust</primary></indexterm>
770 <indexterm><primary>UID</primary></indexterm>
771                 The need for Windows user, group, machine, trust, and other accounts to be tied to a valid UNIX
772                 UID is a design decision that was made a long way back in the history of Samba development. It
773                 is unlikely that this decision will be reversed or changed during the remaining life of the
774                 Samba-3.x series.
775                 </para>
776
777                 <para>
778 <indexterm><primary>UID</primary></indexterm>
779 <indexterm><primary>SID</primary></indexterm>
780 <indexterm><primary>NSS</primary></indexterm>
781                 The resolution of a UID from the Windows SID is achieved within Samba through a mechanism that
782                 must refer back to the host operating system on which Samba is running. The NSS is the preferred
783                 mechanism that shields applications (like Samba) from the need to know everything about every
784                 host OS it runs on.
785                 </para>
786
787                 <para>
788 <indexterm><primary>UID</primary></indexterm>
789 <indexterm><primary>passwd</primary></indexterm>
790 <indexterm><primary>shadow</primary></indexterm>
791 <indexterm><primary>group</primary></indexterm>
792 <indexterm><primary>NSS</primary></indexterm>
793 <indexterm><primary>winbindd</primary></indexterm>
794 <indexterm><primary>LDAP</primary></indexterm>
795                 Samba asks the host OS to provide a UID via the <quote>passwd</quote>, <quote>shadow</quote>,
796                 and <quote>group</quote> facilities in the NSS control (configuration) file. The best tool
797                 for achieving this is left up to the UNIX administrator to determine. It is not imposed by
798                 Samba. Samba provides winbindd with its support libraries as one method. It is
799                 possible to do this via LDAP, and for that Samba provides the appropriate hooks so that
800                 all account entities can be located in an LDAP directory.
801                 </para>
802
803                 <para>
804 <indexterm><primary>PADL</primary></indexterm>
805 <indexterm><primary>nss_ldap</primary></indexterm>
806 <indexterm><primary>UID</primary></indexterm>
807 <indexterm><primary>LDAP</primary></indexterm>
808 <indexterm><primary>documentation</primary></indexterm>
809                 For many the weapon of choice is to use the PADL nss_ldap utility. This utility must
810                 be configured so that computer accounts can be resolved to a POSIX/UNIX account UID. That
811                 is fundamentally an LDAP design question.  The information provided on the Samba list and
812                 in the documentation is directed at providing working examples only. The design
813                 of an LDAP directory is a complex subject that is beyond the scope of this documentation.
814                 </para>
815
816         </sect2>
817
818 </sect1>
819
820 <sect1 id="acctmgmttools">
821 <title>Account Management Tools</title>
822
823 <para>
824 <indexterm><primary>pdbedit</primary></indexterm>
825 <indexterm><primary>machine accounts</primary></indexterm>
826 <indexterm><primary>management tools</primary></indexterm>
827 Samba provides two tools for management of user and machine accounts:
828 <command>smbpasswd</command> and <command>pdbedit</command>. 
829 </para>
830
831 <para>
832 <indexterm><primary>pdbedit</primary></indexterm>
833 <indexterm><primary>password aging</primary></indexterm>
834 <indexterm><primary>failed logins</primary></indexterm>
835 The <command>pdbedit</command> can be used to manage account policies in addition to
836 Samba user account information. The policy management capability is used to administer
837 domain default settings for password aging and management controls to handle failed login
838 attempts.
839 </para>
840
841 <para>
842 <indexterm><primary>smbpasswd</primary></indexterm>
843 <indexterm><primary>storage mechanism</primary></indexterm>
844 <indexterm><primary>SambaSAMAccount</primary></indexterm>
845 <indexterm><primary>net</primary></indexterm>
846 Some people are confused when reference is made to <literal>smbpasswd</literal> because the
847 name refers to a storage mechanism for SambaSAMAccount information, but it is also the name
848 of a utility tool. That tool is destined to eventually be replaced by new functionality that
849 is being added to the <command>net</command> toolset (see <link linkend="NetCommand">the Net Command</link>.
850 </para>
851
852         <sect2>
853         <title>The <command>smbpasswd</command> Tool</title>
854         
855                 <para>
856 <indexterm><primary>smbpasswd</primary></indexterm>
857 <indexterm><primary>passwd</primary></indexterm>
858 <indexterm><primary>yppasswd</primary></indexterm>
859 <indexterm><primary>passdb backend</primary></indexterm>
860 <indexterm><primary>storage methods</primary></indexterm>
861                 The <command>smbpasswd</command> utility is similar to the <command>passwd</command>
862                 and <command>yppasswd</command> programs. It maintains the two 32 byte password
863                 fields in the passdb backend. This utility operates independently of the actual
864                 account and password storage methods used (as specified by the <parameter>passdb
865                 backend</parameter> in the &smb.conf; file.
866                 </para>
867
868                 <para>
869 <indexterm><primary>smbpasswd</primary></indexterm>
870 <indexterm><primary>client-server mode</primary></indexterm>
871                 <command>smbpasswd</command> works in a client-server mode where it contacts the
872                 local smbd to change the user's password on its behalf. This has enormous benefits.
873                 </para>
874
875                 <para>
876 <indexterm><primary>smbpasswd</primary></indexterm>
877 <indexterm><primary>change passwords</primary></indexterm>
878                 <command>smbpasswd</command> has the capability to change passwords on Windows NT
879                 servers (this only works when the request is sent to the NT PDC if changing an NT
880                 domain user's password).
881                 </para>
882
883                 <para>
884                 <indexterm><primary>user management</primary></indexterm>
885                 <indexterm><primary>user account</primary><secondary>Adding/Deleting</secondary></indexterm>
886                 <command>smbpasswd</command> can be used to:
887                 </para>
888
889                 <itemizedlist>
890                         <listitem><para><emphasis>add</emphasis> user or machine accounts.</para></listitem>
891                         <listitem><para><emphasis>delete</emphasis> user or machine accounts.</para></listitem>
892                         <listitem><para><emphasis>enable</emphasis> user or machine accounts.</para></listitem>
893                         <listitem><para><emphasis>disable</emphasis> user or machine accounts.</para></listitem>
894                         <listitem><para><emphasis>set to NULL</emphasis> user passwords.</para></listitem>
895                         <listitem><para><emphasis>manage</emphasis> interdomain trust accounts.</para></listitem>
896                 </itemizedlist>
897                 
898                 <para>
899                 To run smbpasswd as a normal user, just type:
900                 </para>
901                 
902                 <para>
903 <screen>
904 &prompt;<userinput>smbpasswd</userinput>
905 <prompt>Old SMB password: </prompt><userinput><replaceable>secret</replaceable></userinput>
906 </screen>
907                 For <replaceable>secret</replaceable>, type the old value here or press return if
908                 there is no old password.
909 <screen>
910 <prompt>New SMB Password: </prompt><userinput><replaceable>new secret</replaceable></userinput>
911 <prompt>Repeat New SMB Password: </prompt><userinput><replaceable>new secret</replaceable></userinput>
912 </screen>
913                 </para>
914                 
915                 <para>
916                 If the old value does not match the current value stored for that user, or the two
917                 new values do not match each other, then the password will not be changed.
918                 </para>
919                 
920                 <para>
921 <indexterm><primary>SMB password</primary></indexterm>
922                 When invoked by an ordinary user, the command will allow only the user to change his or her own
923                 SMB password.
924                 </para>
925                 
926                 <para>
927 <indexterm><primary>smbpasswd</primary></indexterm>
928 <indexterm><primary>SMB password</primary></indexterm>
929                 When run by root, <command>smbpasswd</command> may take an optional argument specifying
930                 the username whose SMB password you wish to change. When run as root, <command>smbpasswd</command>
931                 does not prompt for or check the old password value, thus allowing root to set passwords 
932                 for users who have forgotten their passwords.
933                 </para>
934                 
935                 <para>
936 <indexterm><primary>smbpasswd</primary></indexterm>
937 <indexterm><primary>passwd</primary></indexterm>
938 <indexterm><primary>yppasswd</primary></indexterm>
939 <indexterm><primary>change capabilities</primary></indexterm>
940                 <command>smbpasswd</command> is designed to work in the way familiar to UNIX
941                 users who use the <command>passwd</command> or <command>yppasswd</command> commands.
942                 While designed for administrative use, this tool provides essential user-level
943                 password change capabilities.
944                 </para>
945
946                 <para>
947 <indexterm><primary>smbpasswd</primary></indexterm>
948                 For more details on using <command>smbpasswd</command>, refer to the man page (the
949                 definitive reference).
950                 </para>
951         </sect2>
952
953         <sect2 id="pdbeditthing">
954         <title>The <command>pdbedit</command> Tool</title>
955
956                 <para>
957                 <indexterm><primary>pdbedit</primary></indexterm>
958                 <indexterm><primary>User Management</primary></indexterm>
959                 <indexterm><primary>account policy</primary></indexterm>
960                 <indexterm><primary>User Accounts</primary><secondary>Adding/Deleting</secondary></indexterm>
961                 <command>pdbedit</command> is a tool that can be used only by root. It is used to
962                 manage the passdb backend, as well as domain-wide account policy settings. <command>pdbedit</command> 
963                 can be used to:
964                 </para>
965
966                 <itemizedlist>
967                         <listitem><para>add, remove, or modify user accounts.</para></listitem>
968                         <listitem><para>list user accounts.</para></listitem>
969                         <listitem><para>migrate user accounts.</para></listitem>
970                         <listitem><para>migrate group accounts.</para></listitem>
971                         <listitem><para>manage account policies.</para></listitem>
972                         <listitem><para>manage domain access policy settings.</para></listitem>
973                 </itemizedlist>
974
975                 <para>
976                 <indexterm><primary>Sarbanes-Oxley</primary></indexterm>
977                 Under the terms of the Sarbanes-Oxley Act of 2002, American businesses and organizations are mandated to
978                 implement a series of <literal>internal controls</literal> and procedures to communicate, store,
979                 and protect financial data. The Sarbanes-Oxley Act has far reaching implications in respect of:
980                 </para>
981
982                 <orderedlist>
983                         <listitem><para>Who has access to information systems that store financial data.</para></listitem>
984                         <listitem><para>How personal and financial information is treated among employees and business
985                                 partners.</para></listitem>
986                         <listitem><para>How security vulnerabilities are managed.</para></listitem>
987                         <listitem><para>Security and patch level maintenance for all information systems.</para></listitem>
988                         <listitem><para>How information systems changes are documented and tracked.</para></listitem>
989                         <listitem><para>How information access controls are implemented and managed.</para></listitem>
990                         <listitem><para>Auditability of all information systems in respect of change and security.</para></listitem>
991                         <listitem><para>Disciplinary procedures and controls to ensure privacy.</para></listitem>
992                 </orderedlist>
993
994                 <para>
995                 <indexterm><primary>accountability</primary></indexterm>
996                 <indexterm><primary>compliance</primary></indexterm>
997                 In short, the Sarbanes-Oxley Act of 2002 is an instrument that enforces accountability in respect of
998                 business related information systems so as to ensure the compliance of all information systems that
999                 are used to store personal information and particularly for financial records processing. Similar
1000                 accountabilities are being demanded around the world.
1001                 </para>
1002
1003                 <para>
1004                 <indexterm><primary>laws</primary></indexterm>
1005                 <indexterm><primary>regulations</primary></indexterm>
1006                 <indexterm><primary>pdbedit</primary></indexterm>
1007                 <indexterm><primary>access controls</primary></indexterm>
1008                 <indexterm><primary>manage accounts</primary></indexterm>
1009                 The need to be familiar with the Samba tools and facilities that permit information systems operation
1010                 in compliance with government laws and regulations is clear to all. The <command>pdbedit</command> is
1011                 currently the only Samba tool that provides the capacity to manage account and systems access controls
1012                 and policies. During the remaining life-cycle of the Samba-3 series it is possible the new tools may
1013                 be implemented to aid in this important area.
1014                 </para>
1015
1016                 <para>
1017                 Domain global policy controls available in Windows NT4 compared with Samba
1018                 is shown in <link linkend="policycontrols">NT4 Domain v's Samba Policy Controls</link>.
1019                 </para>
1020
1021                 <table id="policycontrols">
1022                 <title>NT4 Domain v's Samba Policy Controls</title>
1023             <tgroup cols="5">
1024                 <colspec align="left" colwidth="2*"/>
1025                 <colspec align="left" colwidth="2*"/>
1026                 <colspec align="center" colwidth="1*"/>
1027                 <colspec align="center" colwidth="1*"/>
1028                 <colspec align="center" colwidth="1*"/>
1029                 <thead>
1030                     <row>
1031                         <entry><para>NT4 policy Name</para></entry>
1032                         <entry><para>Samba Policy Name</para></entry>
1033                         <entry><para>NT4 Range</para></entry>
1034                         <entry><para>Samba Range</para></entry>
1035                         <entry><para>Samba Default</para></entry>
1036                     </row>
1037                 </thead>
1038                 <tbody>
1039                     <row>
1040                                         <entry><para>Maximum Password Age</para></entry>
1041                                         <entry><para>maximum password age</para></entry>
1042                                         <entry><para>0 - 999 (days)</para></entry>
1043                                         <entry><para>0 - 4294967295 (sec)</para></entry>
1044                                         <entry><para>4294967295</para></entry>
1045                     </row>
1046                     <row>
1047                                         <entry><para>Minimum Password Age</para></entry>
1048                                         <entry><para>minimum password age</para></entry>
1049                                         <entry><para>0 - 999 (days)</para></entry>
1050                                         <entry><para>0 - 4294967295 (sec)</para></entry>
1051                                         <entry><para>0</para></entry>
1052                     </row>
1053                     <row>
1054                                         <entry><para>Mimimum Password Length</para></entry>
1055                                         <entry><para>min password length</para></entry>
1056                                         <entry><para>1 - 14 (Chars)</para></entry>
1057                                         <entry><para>0 - 4294967295 (Chars)</para></entry>
1058                                         <entry><para>5</para></entry>
1059                     </row>
1060                     <row>
1061                                         <entry><para>Password Uniqueness</para></entry>
1062                                         <entry><para>password history</para></entry>
1063                                         <entry><para>0 - 23 (#)</para></entry>
1064                                         <entry><para>0 - 4294967295 (#)</para></entry>
1065                                         <entry><para>0</para></entry>
1066                     </row>
1067                     <row>
1068                                         <entry><para>Account Lockout - Reset count after</para></entry>
1069                                         <entry><para>reset count minutes</para></entry>
1070                                         <entry><para>1 - 99998 (min)</para></entry>
1071                                         <entry><para>0 - 4294967295 (min)</para></entry>
1072                                         <entry><para>30</para></entry>
1073                     </row>
1074                     <row>
1075                                         <entry><para>Lockout after bad logon attempts</para></entry>
1076                                         <entry><para>bad lockout attempt</para></entry>
1077                                         <entry><para>0 - 998 (#)</para></entry>
1078                                         <entry><para>0 - 4294967295 (#)</para></entry>
1079                                         <entry><para>0</para></entry>
1080                     </row>
1081                     <row>
1082                                         <entry><para>*** Not Known ***</para></entry>
1083                                         <entry><para>disconnect time</para></entry>
1084                                         <entry><para>TBA</para></entry>
1085                                         <entry><para>0 - 4294967295</para></entry>
1086                                         <entry><para>0</para></entry>
1087                     </row>
1088                     <row>
1089                                         <entry><para>Lockout Duration</para></entry>
1090                                         <entry><para>lockout duration</para></entry>
1091                                         <entry><para>1 - 99998 (min)</para></entry>
1092                                         <entry><para>0 - 4294967295 (min)</para></entry>
1093                                         <entry><para>30</para></entry>
1094                     </row>
1095                     <row>
1096                                         <entry><para>Users must log on in order to change password</para></entry>
1097                                         <entry><para>user must logon to change password</para></entry>
1098                                         <entry><para>0/1</para></entry>
1099                                         <entry><para>0 - 4294967295</para></entry>
1100                                         <entry><para>0</para></entry>
1101                     </row>
1102                     <row>
1103                                         <entry><para>*** Registry Setting ***</para></entry>
1104                                         <entry><para>refuse machine password change</para></entry>
1105                                         <entry><para>0/1</para></entry>
1106                                         <entry><para>0 - 4294967295</para></entry>
1107                                         <entry><para>0</para></entry>
1108                     </row>
1109                                 </tbody>
1110                         </tgroup>
1111                 </table>
1112
1113                 <para>
1114                 <indexterm><primary>pdbedit</primary></indexterm>
1115 <indexterm><primary>policy settings</primary></indexterm>
1116 <indexterm><primary>account security</primary></indexterm>
1117 <indexterm><primary>smbpasswd</primary></indexterm>
1118                 The <command>pdbedit</command> tool is the only one that can manage the account
1119                 security and policy settings. It is capable of all operations that smbpasswd can
1120                 do as well as a superset of them.
1121                 </para>
1122
1123                 <para>
1124                 <indexterm><primary>pdbedit</primary></indexterm>
1125 <indexterm><primary>account migration</primary></indexterm>
1126 <indexterm><primary>passdb backend</primary></indexterm>
1127                 One particularly important purpose of the <command>pdbedit</command> is to allow
1128                 the migration of account information from one passdb backend to another. See the
1129                 <link linkend="XMLpassdb">XML</link> password backend section of this chapter.
1130                 </para>
1131
1132                 <sect3>
1133                 <title>User Account Management</title>
1134
1135                 <para>
1136 <indexterm><primary>pdbedit</primary></indexterm>
1137 <indexterm><primary>smbpasswd</primary></indexterm>
1138 <indexterm><primary>system accounts</primary></indexterm>
1139 <indexterm><primary>user account</primary></indexterm>
1140 <indexterm><primary>domain user manager</primary></indexterm>
1141 <indexterm><primary>add user script</primary></indexterm>
1142 <indexterm><primary>interface scripts</primary></indexterm>
1143                 The <command>pdbedit</command> tool, like the <command>smbpasswd</command> tool, requires
1144                 that a POSIX user account already exists in the UNIX/Linux system accounts database (backend).
1145                 Neither tool will call out to the operating system to create a user account because this is
1146                 considered to be the responsibility of the system administrator. When the Windows NT4 domain
1147                 user manager is used to add an account, Samba will implement the <literal>add user script</literal>
1148                 (as well as the other interface scripts) to ensure that user, group and machine accounts are
1149                 correctly created and changed. The use of the <command>pdbedit</command> tool does not
1150                 make use of these interface scripts.
1151                 </para>
1152
1153                 <para>
1154 <indexterm><primary>pdbedit</primary></indexterm>
1155 <indexterm><primary>POSIX account</primary></indexterm>
1156                 Before attempting to use the <command>pdbedit</command> tool to manage user and machine
1157                 accounts, make certain that a system (POSIX) account has already been created.
1158                 </para>
1159
1160                 <sect4>
1161                 <title>Listing User and Machine Accounts</title>
1162
1163                 <para>
1164 <indexterm><primary>tdbsam</primary></indexterm>
1165 <indexterm><primary>password backend</primary></indexterm>
1166                 The following is an example of the user account information that is stored in
1167                 a tdbsam password backend. This listing was produced by running:
1168 <screen>
1169 &prompt;<userinput>pdbedit -Lv met</userinput>
1170 UNIX username:        met
1171 NT username:          met
1172 Account Flags:        [U          ]
1173 User SID:             S-1-5-21-1449123459-1407424037-3116680435-2004
1174 Primary Group SID:    S-1-5-21-1449123459-1407424037-3116680435-1201
1175 Full Name:            Melissa E Terpstra
1176 Home Directory:       \\frodo\met\Win9Profile
1177 HomeDir Drive:        H:
1178 Logon Script:         scripts\logon.bat
1179 Profile Path:         \\frodo\Profiles\met
1180 Domain:               &example.workgroup;
1181 Account desc:
1182 Workstations:         melbelle
1183 Munged dial:
1184 Logon time:           0
1185 Logoff time:          Mon, 18 Jan 2038 20:14:07 GMT
1186 Kickoff time:         Mon, 18 Jan 2038 20:14:07 GMT
1187 Password last set:    Sat, 14 Dec 2002 14:37:03 GMT
1188 Password can change:  Sat, 14 Dec 2002 14:37:03 GMT
1189 Password must change: Mon, 18 Jan 2038 20:14:07 GMT
1190 </screen>
1191                 </para>
1192
1193                 <para>
1194 <indexterm><primary>smbpasswd format</primary></indexterm>
1195                 Accounts can also be listed in the older <literal>smbpasswd</literal> format:
1196 <screen>
1197 &rootprompt;<userinput>pdbedit -Lw</userinput>
1198 root:0:84B0D8E14D158FF8417EAF50CFAC29C3:
1199      AF6DD3FD4E2EA8BDE1695A3F05EFBF52:[U          ]:LCT-42681AB8:
1200 jht:1000:6BBC4159020A52741486235A2333E4D2:
1201      CC099521AD554A3C3CF2556274DBCFBC:[U          ]:LCT-40D75B5B:
1202 rcg:1002:E95D4331A6F23AF8AAD3B435B51404EE:
1203      BB0F2C39B04CA6100F0E535DF8314B43:[U          ]:LCT-40D7C5A3:
1204 afw:1003:1AAFA7F9F6DC1DEAAAD3B435B51404EE:
1205      CE92C2F9471594CDC4E7860CA6BC62DB:[T          ]:LCT-40DA501F:
1206 met:1004:A2848CB7E076B435AAD3B435B51404EE:
1207      F25F5D3405085C555236B80B7B22C0D2:[U          ]:LCT-4244FAB8:
1208 aurora$:1005:060DE593EA638B8ACC4A19F14D2FF2BB:
1209      060DE593EA638B8ACC4A19F14D2FF2BB:[W          ]:LCT-4173E5CC:
1210 temptation$:1006:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:
1211      A96703C014E404E33D4049F706C45EE9:[W          ]:LCT-42BF0C57:
1212 vaioboss$:1001:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:
1213      88A30A095160072784C88F811E89F98A:[W          ]:LCT-41C3878D:
1214 frodo$:1008:15891DC6B843ECA41249940C814E316B:
1215      B68EADCCD18E17503D3DAD3E6B0B9A75:[W          ]:LCT-42B7979F:
1216 marvel$:1011:BF709959C3C94E0B3958B7B84A3BB6F3:
1217      C610EFE9A385A3E8AA46ADFD576E6881:[W          ]:LCT-40F07A4
1218 </screen>
1219 <indexterm><primary>login id</primary></indexterm>
1220 <indexterm><primary>UID</primary></indexterm>
1221 <indexterm><primary>LanManger password</primary></indexterm>
1222 <indexterm><primary>NT password</primary></indexterm>
1223 <indexterm><primary>Account Flags</primary></indexterm>
1224 <indexterm><primary>LCT</primary><see>last change time</see></indexterm>
1225                 The account information that was returned by this command in order from left to right 
1226                 consists of the following colon separated data:
1227                 </para>
1228
1229                 <itemizedlist>
1230                         <listitem><para>Login ID.</para></listitem>
1231                         <listitem><para>UNIX UID.</para></listitem>
1232                         <listitem>
1233                                 <para>Microsoft LanManager password hash (password converted to upper-case then hashed.</para>
1234                         </listitem>
1235                         <listitem><para>Microsoft NT password hash (hash of the case-preserved password).</para></listitem>
1236                         <listitem><para>Samba SAM Account Flags.</para></listitem>
1237                         <listitem><para>The LCT data (password last change time).</para></listitem>
1238                 </itemizedlist>
1239
1240                 <para>
1241 <indexterm><primary>Account Flags</primary></indexterm>
1242 <indexterm><primary>pdbedit</primary></indexterm>
1243                 The Account Flags parameters are documented in the <command>pdbedit</command> man page, and are
1244                 briefly documented in <link linkend="TOSHARG-acctflags">the Account Flags Management section</link>.
1245                 </para>
1246
1247                 <para>
1248 <indexterm><primary>last change time</primary></indexterm>
1249                 The LCT data consists of 8 hexadecimal characters representing the time since January 1, 1970, of
1250                 the time when the password was last changed.
1251                 </para>
1252
1253                 </sect4>
1254
1255                 <sect4>
1256                 <title>Adding User Accounts</title>
1257
1258                 <para>
1259 <indexterm><primary>pdbedit</primary></indexterm>
1260 <indexterm><primary>add a user account</primary></indexterm>
1261 <indexterm><primary>standalone server</primary></indexterm>
1262 <indexterm><primary>domain</primary></indexterm>
1263 <indexterm><primary>SambaSAMAccount</primary></indexterm>
1264                 The <command>pdbedit</command> can be used to add a user account to a standalone server
1265                 or to a domain. In the example shown here the account for the user <literal>vlaan</literal>
1266                 has been created before attempting to add the SambaSAMAccount.
1267 <screen>
1268 &rootprompt; pdbedit -a vlaan
1269 new password: secretpw
1270 retype new password: secretpw
1271 Unix username:        vlaan
1272 NT username:          vlaan
1273 Account Flags:        [U          ]
1274 User SID:             S-1-5-21-726309263-4128913605-1168186429-3014
1275 Primary Group SID:    S-1-5-21-726309263-4128913605-1168186429-513
1276 Full Name:            Victor Laan
1277 Home Directory:       \\frodo\vlaan
1278 HomeDir Drive:        H:
1279 Logon Script:         scripts\logon.bat
1280 Profile Path:         \\frodo\profiles\vlaan
1281 Domain:               &example.workgroup;
1282 Account desc:         Guest User
1283 Workstations:
1284 Munged dial:
1285 Logon time:           0
1286 Logoff time:          Mon, 18 Jan 2038 20:14:07 GMT
1287 Kickoff time:         Mon, 18 Jan 2038 20:14:07 GMT
1288 Password last set:    Wed, 29 Jun 2005 19:35:12 GMT
1289 Password can change:  Wed, 29 Jun 2005 19:35:12 GMT
1290 Password must change: Mon, 18 Jan 2038 20:14:07 GMT
1291 Last bad password   : 0
1292 Bad password count  : 0
1293 Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
1294 </screen>
1295                 </para>
1296
1297                 </sect4>
1298
1299                 <sect4>
1300                 <title>Deleting Accounts</title>
1301
1302                 <para>
1303 <indexterm><primary>account deleted</primary></indexterm>
1304 <indexterm><primary>SambaSAMAccount</primary></indexterm>
1305 <indexterm><primary>pdbedit</primary></indexterm>
1306 <indexterm><primary>passdb backend</primary></indexterm>
1307                 An account can be deleted from the SambaSAMAccount database
1308 <screen>
1309 &rootprompt; pdbedit -x vlaan
1310 </screen>
1311                 The account is removed without further screen output. The account is removed only from the
1312                 SambaSAMAccount (passdb backend) database, it is not removed from the UNIX account backend.
1313                 </para>
1314
1315                 <para>
1316 <indexterm><primary>delete user script</primary></indexterm>
1317 <indexterm><primary>pdbedit</primary></indexterm>
1318                 The use of the NT4 domain user manager to delete an account will trigger the <parameter>delete user
1319                 script</parameter>, but not the <command>pdbedit</command> tool.
1320                 </para>
1321
1322                 </sect4>
1323
1324                 <sect4>
1325                 <title>Changing User Accounts</title>
1326
1327                 <para>
1328 <indexterm><primary>pdbedit</primary></indexterm>
1329                 Refer to the <command>pdbedit</command> man page for a full synopsis of all operations
1330                 that are available with this tool.
1331                 </para>
1332
1333                 <para>
1334 <indexterm><primary>pdbedit</primary></indexterm>
1335                 An example of a simple change in the user account information is the change of the full name
1336                 information shown here:
1337 <screen>
1338 &rootprompt; pdbedit -r --fullname="Victor Aluicious Laan" vlaan
1339 ...
1340 Primary Group SID:    S-1-5-21-726309263-4128913605-1168186429-513
1341 Full Name:            Victor Aluicious Laan
1342 Home Directory:       \\frodo\vlaan
1343 ...
1344 </screen>
1345                 </para>
1346
1347                 <para>
1348 <indexterm><primary>grace time</primary></indexterm>
1349 <indexterm><primary>password expired</primary></indexterm>
1350 <indexterm><primary>expired password</primary></indexterm>
1351                 Let us assume for a moment that a user's password has expired and the user is unable to
1352                 change the password at this time. It may be necessary to give the user additional grace time
1353                 so that it is possible to continue to work with the account and the original password. This
1354                 demonstrates how the password expiration settings may be updated
1355 <screen>
1356 &rootprompt; pdbedit -Lv vlaan
1357 ...
1358 Password last set:    Sun, 09 Sep 2001 22:21:40 GMT
1359 Password can change:  Thu, 03 Jan 2002 15:08:35 GMT
1360 Password must change: Thu, 03 Jan 2002 15:08:35 GMT
1361 Last bad password   : Thu, 03 Jan 2002 15:08:35 GMT
1362 Bad password count  : 2
1363 ...
1364 </screen>
1365 <indexterm><primary>bad logon attempts</primary></indexterm>
1366 <indexterm><primary>lock the account</primary></indexterm>
1367                 The user has recorded 2 bad logon attempts and the next will lock the account, but the
1368                 password is also expired. Here is how this account can be reset:
1369 <screen>
1370 &rootprompt; pdbedit -z vlaan
1371 ...
1372 Password last set:    Sun, 09 Sep 2001 22:21:40 GMT
1373 Password can change:  Thu, 03 Jan 2002 15:08:35 GMT
1374 Password must change: Thu, 03 Jan 2002 15:08:35 GMT
1375 Last bad password   : 0
1376 Bad password count  : 0
1377 ...
1378 </screen>
1379                 The <literal>Password must change:</literal> parameter can be reset like this:
1380 <screen>
1381 &rootprompt; pdbedit --pwd-must-change-time=1200000000 vlaan
1382 ...
1383 Password last set:    Sun, 09 Sep 2001 22:21:40 GMT
1384 Password can change:  Thu, 03 Jan 2002 15:08:35 GMT
1385 Password must change: Thu, 10 Jan 2008 14:20:00 GMT
1386 ...
1387 </screen>
1388                 Another way to use this tools is to set the date like this:
1389 <screen>
1390 &rootprompt; pdbedit --pwd-must-change-time="2010-01-01" \
1391               --time-format="%Y-%m-%d" vlaan
1392 ...
1393 Password last set:    Sun, 09 Sep 2001 22:21:40 GMT
1394 Password can change:  Thu, 03 Jan 2002 15:08:35 GMT
1395 Password must change: Fri, 01 Jan 2010 00:00:00 GMT
1396 ...
1397 </screen>
1398 <indexterm><primary>strptime</primary></indexterm>
1399 <indexterm><primary>time format</primary></indexterm>
1400                 Refer to the strptime man page for specific time format information.
1401                 </para>
1402
1403                 <para>
1404 <indexterm><primary>pdbedit</primary></indexterm>
1405 <indexterm><primary>SambaSAMAccount</primary></indexterm>
1406                 Please refer to the pdbedit man page for further information relating to SambaSAMAccount
1407                 management.
1408                 </para>
1409
1410                 <sect5 id="TOSHARG-acctflags">
1411                 <title>Account Flags Management</title>
1412
1413                 <para>
1414 <indexterm><primary>Samba SAM account flags</primary></indexterm>
1415 <indexterm><primary>account control block</primary><see>ACB</see></indexterm>
1416 <indexterm><primary>account encode_bits</primary></indexterm>
1417 <indexterm><primary>account control flags</primary></indexterm>
1418                 The Samba SAM account flags are properly called the ACB (account control block) within
1419                 the Samba source code. In some parts of the Samba source code they are referred to as the 
1420                 account encode_bits, and also as the account control flags.
1421                 </para>
1422
1423                 <para>
1424 <indexterm><primary>pdbedit</primary></indexterm>
1425 <indexterm><primary>user account</primary></indexterm>
1426 <indexterm><primary>machine account</primary></indexterm>
1427 <indexterm><primary>trust account</primary></indexterm>
1428 <indexterm><primary>damaged data</primary></indexterm>
1429                 The manual adjustment of user, machine (workstation or server) or an inter-domain trust
1430                 account account flgas should not be necessary under normal conditions of use of Samba. On the other hand,
1431                 where this information becomes corrupted for some reason, the ability to correct the damaged data is certainly
1432                 useful. The tool of choice by which such correction can be affected is the <command>pdbedit</command> utility.
1433                 </para>
1434
1435                 <para>
1436 <indexterm><primary>account flags</primary></indexterm>
1437 <indexterm><primary>LDAP directory</primary></indexterm>
1438                 There have been a few requests for information regarding the account flags from developers
1439                 who are creating their own Samba management tools. An example of a need for information regarding
1440                 the proper management of the account flags is evident when developing scripts that will be used
1441                 to manage an LDAP directory.
1442                 </para>
1443
1444                 <para>
1445 <indexterm><primary>pdbedit</primary></indexterm>
1446 <indexterm><primary>account flag order</primary></indexterm>
1447                 The account flag field can contain up to 16 characters. Presently, only 11 are in use.
1448                 These are listed in <link linkend="accountflags">Samba SAM Account Control Block Flags</link>.
1449                 The order in which the flags are specified to the <command>pdbedit</command> command is not important.
1450                 In fact, they can be set without problem in any order in the SambaAcctFlags record in the LDAP directory.
1451                 </para>
1452
1453                 <table frame="all" id="accountflags">
1454                 <title>Samba SAM Account Control Block Flags</title>
1455         <tgroup cols="2" align="center">
1456             <thead>
1457             <row><entry align="center">Flag</entry><entry>Description</entry></row>
1458             </thead>
1459             <tbody>
1460             <row>
1461                                 <entry align="center">D</entry>
1462                                 <entry align="left">Account is disabled.</entry>
1463                         </row>
1464             <row>
1465                                 <entry align="center">H</entry>
1466                                 <entry align="left">A home directory is required.</entry>
1467                         </row>
1468             <row>
1469                                 <entry align="center">I</entry>
1470                                 <entry align="left">An inter-domain trust account.</entry>
1471                         </row>
1472             <row>
1473                                 <entry align="center">L</entry>
1474                                 <entry align="left">Account has been auto-locked.</entry>
1475                         </row>
1476             <row>
1477                                 <entry align="center">M</entry>
1478                                 <entry align="left">An MNS (Microsoft network service) logon account.</entry>
1479                         </row>
1480             <row>
1481                                 <entry align="center">N</entry>
1482                                 <entry align="left">Password not required.</entry>
1483                         </row>
1484             <row>
1485                                 <entry align="center">S</entry>
1486                                 <entry align="left">A server trust account.</entry>
1487                         </row>
1488             <row>
1489                                 <entry align="center">T</entry>
1490                                 <entry align="left">Temporary duplicate account entry.</entry>
1491                         </row>
1492             <row>
1493                                 <entry align="center">U</entry>
1494                                 <entry align="left">A normal user account.</entry>
1495                         </row>
1496             <row>
1497                                 <entry align="center">W</entry>
1498                                 <entry align="left">A workstation trust account.</entry>
1499                         </row>
1500             <row>
1501                                 <entry align="center">X</entry>
1502                                 <entry align="left">Password does not expire.</entry>
1503                         </row>
1504             </tbody>
1505         </tgroup>
1506         </table>
1507
1508                 <para>
1509 <indexterm><primary>pdbedit</primary></indexterm>
1510 <indexterm><primary>account control flags</primary></indexterm>
1511                 An example of use of the <command>pdbedit</command> utility to set the account control flags
1512                 is shown here:
1513 <screen>
1514 &rootprompt; pdbedit -r -c "[DLX]" jra
1515 Unix username:        jht
1516 NT username:          jht
1517 Account Flags:        [DHULX      ]
1518 User SID:             S-1-5-21-729263-4123605-1186429-3000
1519 Primary Group SID:    S-1-5-21-729263-4123605-1186429-513
1520 Full Name:            John H Terpstra,Utah Office
1521 Home Directory:       \\aurora\jht
1522 HomeDir Drive:        H:
1523 Logon Script:         scripts\logon.bat
1524 Profile Path:         \\aurora\profiles\jht
1525 Domain:               MIDEARTH
1526 Account desc:         BluntObject
1527 Workstations:
1528 Logon time:           0
1529 Logoff time:          Mon, 18 Jan 2038 20:14:07 GMT
1530 Kickoff time:         0
1531 Password last set:    Sun, 03 Jul 2005 23:19:18 GMT
1532 Password can change:  Sun, 03 Jul 2005 23:19:18 GMT
1533 Password must change: Mon, 18 Jan 2038 20:14:07 GMT
1534 Last bad password   : 0
1535 Bad password count  : 0
1536 Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
1537 </screen>
1538 <indexterm><primary>default settings</primary></indexterm>
1539         The flags can be reset to the default settings by executing:
1540 <screen>
1541 &rootprompt; pdbedit -r -c "[]" jra
1542 Unix username:        jht
1543 NT username:          jht
1544 Account Flags:        [U          ]
1545 User SID:             S-1-5-21-729263-4123605-1186429-3000
1546 Primary Group SID:    S-1-5-21-729263-4123605-1186429-513
1547 Full Name:            John H Terpstra,Utah Office
1548 Home Directory:       \\aurora\jht
1549 HomeDir Drive:        H:
1550 Logon Script:         scripts\logon.bat
1551 Profile Path:         \\aurora\profiles\jht
1552 Domain:               MIDEARTH
1553 Account desc:         BluntObject
1554 Workstations:
1555 Logon time:           0
1556 Logoff time:          Mon, 18 Jan 2038 20:14:07 GMT
1557 Kickoff time:         0
1558 Password last set:    Sun, 03 Jul 2005 23:19:18 GMT
1559 Password can change:  Sun, 03 Jul 2005 23:19:18 GMT
1560 Password must change: Mon, 18 Jan 2038 20:14:07 GMT
1561 Last bad password   : 0
1562 Bad password count  : 0
1563 Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
1564 </screen>
1565                 </para>
1566
1567                 </sect5>
1568
1569                 </sect4>
1570
1571                 <sect4>
1572                 <title>Domain Account Policy Managment</title>
1573
1574                 <para>
1575 <indexterm><primary>domain account access policies</primary></indexterm>
1576 <indexterm><primary>access policies</primary></indexterm>
1577                 To view the domain account access policies that may be configured execute:
1578 <screen>
1579 &rootprompt; pdbedit -P ?
1580 No account policy by that name
1581 Account policy names are :
1582 min password length
1583 password history
1584 user must logon to change password
1585 maximum password age
1586 minimum password age
1587 lockout duration
1588 reset count minutes
1589 bad lockout attempt
1590 disconnect time
1591 refuse machine password change
1592 </screen>
1593                 </para>
1594
1595                 <para>
1596                 Commands will be executed to establish controls for our domain as follows:
1597                 </para>
1598
1599                 <orderedlist>
1600                         <listitem><para>min password length = 8 characters.</para></listitem>
1601                         <listitem><para>password history = last 4 passwords.</para></listitem>
1602                         <listitem><para>maximum password age = 90 days.</para></listitem>
1603                         <listitem><para>minimum password age = 7 days.</para></listitem>
1604                         <listitem><para>bad lockout attempt = 8 bad logon attempts.</para></listitem>
1605                         <listitem><para>lockout duration = forever, account must be manually reenabled.</para></listitem>
1606                 </orderedlist>
1607
1608                 <para>
1609                 The following command execution will achieve these settings:
1610 <screen>
1611 &rootprompt; pdbedit -P "min password length" -C 8
1612 account policy value for min password length was 5
1613 account policy value for min password length is now 8
1614 &rootprompt; pdbedit -P "password history" -C 4
1615 account policy value for password history was 0
1616 account policy value for password history is now 4
1617 &rootprompt; pdbedit -P "maximum password age" -C 90
1618 account policy value for maximum password age was 4294967295
1619 account policy value for maximum password age is now 90
1620 &rootprompt; pdbedit -P "minimum password age" -C 7
1621 account policy value for minimum password age was 0
1622 account policy value for minimum password age is now 7
1623 &rootprompt; pdbedit -P "bad lockout attempt" -C 8
1624 account policy value for bad lockout attempt was 0
1625 account policy value for bad lockout attempt is now 8
1626 &rootprompt; pdbedit -P "lockout duration" -C -1
1627 account policy value for lockout duration was 30
1628 account policy value for lockout duration is now 4294967295
1629 </screen>
1630                 </para>
1631
1632 <note><para>
1633 To set the maximum (infinite) lockout time use the value of -1.
1634 </para></note>
1635
1636 <warning><para>
1637 Account policies must be set individually on each PDC and BDC. At this time (Samba 3.0.11 to Samba 3.0.14a)
1638 account policies are not replicated automatically. This may be fixed before Samba 3.0.20 ships or some
1639 time there after.
1640 </para></warning>
1641
1642                 </sect4>
1643
1644                 </sect3>
1645
1646                 <sect3>
1647                 <title>Account Migration</title>
1648
1649                 <para>
1650                 <indexterm><primary>pdbedit</primary></indexterm>
1651 <indexterm><primary>migrate accounts</primary></indexterm>
1652 <indexterm><primary>authentication</primary></indexterm>
1653                 The <command>pdbedit</command> tool allows migration of authentication (account)
1654                 databases from one backend to another. For example, to migrate accounts from an
1655                 old <filename>smbpasswd</filename> database to a <parameter>tdbsam</parameter>
1656                 backend:
1657                 </para>
1658
1659                 <procedure>
1660                         <step><para>
1661                         Set the <smbconfoption name="passdb backend">tdbsam, smbpasswd</smbconfoption>.
1662                         </para></step>
1663
1664                         <step><para>
1665 <indexterm><primary>pdbedit</primary></indexterm>
1666                         Execute:
1667 <screen>
1668 &rootprompt;<userinput>pdbedit -i smbpasswd -e tdbsam</userinput>
1669 </screen>
1670                         </para></step>
1671
1672                         <step><para>
1673 <indexterm><primary>smbpasswd</primary></indexterm>
1674                         Remove the <parameter>smbpasswd</parameter> from the passdb backend
1675                         configuration in &smb.conf;.
1676                         </para></step>
1677                 </procedure>
1678
1679         </sect3>
1680         </sect2>
1681 </sect1>
1682
1683 <sect1>
1684 <title>Password Backends</title>
1685
1686 <para>
1687 <indexterm><primary>account database</primary></indexterm>
1688 <indexterm><primary>SMB/CIFS server</primary></indexterm>
1689 Samba offers the greatest flexibility in backend account database design of any SMB/CIFS server
1690 technology available today. The flexibility is immediately obvious as one begins to explore this
1691 capability.
1692 </para>
1693
1694 <para>
1695 <indexterm><primary>multiple backends</primary></indexterm>
1696 <indexterm><primary>tdbsam databases</primary></indexterm>
1697 It is possible to specify not only multiple password backends, but even multiple
1698 backends of the same type. For example, to use two different <literal>tdbsam</literal> databases:
1699
1700 <smbconfblock>
1701 <smbconfoption name="passdb backend">tdbsam:/etc/samba/passdb.tdb tdbsam:/etc/samba/old-passdb.tdb</smbconfoption>
1702 </smbconfblock>
1703
1704 What is possible is not always sensible. Be careful to avoid complexity to the point that it
1705 may be said that the solution is <quote>too clever by half!</quote>
1706 </para>
1707
1708
1709         <sect2>
1710         <title>Plaintext</title>
1711
1712                 <para>
1713 <indexterm><primary>user database</primary></indexterm>
1714 <indexterm><primary>/etc/samba/smbpasswd</primary></indexterm>
1715 <indexterm><primary>/etc/smbpasswd</primary></indexterm>
1716 <indexterm><primary>password encryption</primary></indexterm>
1717 <indexterm><primary>/etc/passwd</primary></indexterm>
1718 <indexterm><primary>PAM</primary></indexterm>
1719                 Older versions of Samba retrieved user information from the UNIX user database 
1720                 and eventually some other fields from the file <filename>/etc/samba/smbpasswd</filename>
1721                 or <filename>/etc/smbpasswd</filename>. When password encryption is disabled, no 
1722                 SMB-specific data is stored at all. Instead, all operations are conducted via the way
1723                 that the Samba host OS will access its <filename>/etc/passwd</filename> database.
1724                 On most Linux systems, for example, all user and group resolution is done via PAM.
1725                 </para>
1726
1727         </sect2>
1728
1729         <sect2>
1730         <title>smbpasswd: Encrypted Password Database</title>
1731
1732                 <para>
1733                 <indexterm><primary>SAM backend</primary><secondary>smbpasswd</secondary></indexterm>
1734 <indexterm><primary>user account</primary></indexterm>
1735 <indexterm><primary>LM/NT password hashes</primary></indexterm>
1736 <indexterm><primary>smbpasswd</primary></indexterm>
1737                 Traditionally, when configuring <smbconfoption name="encrypt passwords">yes</smbconfoption>
1738                 in Samba's &smb.conf; file, user account information such as username, LM/NT password hashes,
1739                 password change times, and account flags have been stored in the <filename>smbpasswd(5)</filename>
1740                 file. There are several disadvantages to this approach for sites with large numbers of users
1741                 (counted in the thousands).
1742                 </para>
1743
1744                 <itemizedlist>
1745                 <listitem><para>
1746 <indexterm><primary>lookups</primary></indexterm>
1747                 The first problem is that all lookups must be performed sequentially. Given that
1748                 there are approximately two lookups per domain logon (one during intial logon validation
1749                 and one for a session connection setup, such as when mapping a network drive or printer), this
1750                 is a performance bottleneck for large sites. What is needed is an indexed approach
1751                 such as that used in databases.
1752                 </para></listitem>
1753
1754                 <listitem><para>
1755 <indexterm><primary>smbpasswd</primary></indexterm>
1756 <indexterm><primary>replicate</primary></indexterm>
1757 <indexterm><primary>rsync</primary></indexterm>
1758 <indexterm><primary>ssh</primary></indexterm>
1759 <indexterm><primary>custom scripts</primary></indexterm>
1760                 The second problem is that administrators who desire to replicate an smbpasswd file
1761                 to more than one Samba server are left to use external tools such as
1762                 <command>rsync(1)</command> and <command>ssh(1)</command> and write custom,
1763                 in-house scripts.
1764                 </para></listitem>
1765
1766                 <listitem><para>
1767 <indexterm><primary>smbpasswd</primary></indexterm>
1768 <indexterm><primary>home directory</primary></indexterm>
1769 <indexterm><primary>password expiration</primary></indexterm>
1770 <indexterm><primary>relative identifier</primary></indexterm>
1771 <indexterm><primary>relative identifier</primary><see>RID</see></indexterm>
1772                 Finally, the amount of information that is stored in an smbpasswd entry leaves
1773                 no room for additional attributes such as a home directory, password expiration time,
1774                 or even a relative identifier (RID).
1775                 </para></listitem>
1776                 </itemizedlist>
1777
1778                 <para>
1779 <indexterm><primary>user attributes</primary></indexterm>
1780 <indexterm><primary>smbd</primary></indexterm>
1781 <indexterm><primary>API</primary></indexterm>
1782 <indexterm><primary>samdb interface</primary></indexterm>
1783                 As a result of these deficiencies, a more robust means of storing user attributes
1784                 used by smbd was developed. The API that defines access to user accounts
1785                 is commonly referred to as the samdb interface (previously, this was called the passdb
1786                 API and is still so named in the Samba source code trees). 
1787                 </para>
1788
1789                 <para>
1790 <indexterm><primary>passdb backends</primary></indexterm>
1791 <indexterm><primary>smbpasswd plaintext database</primary></indexterm>
1792 <indexterm><primary>tdbsam</primary></indexterm>
1793 <indexterm><primary>ldapsam</primary></indexterm>
1794 <indexterm><primary>enterprise</primary></indexterm>
1795                 Samba provides an enhanced set of passdb backends that overcome the deficiencies
1796                 of the smbpasswd plaintext database. These are tdbsam and ldapsam.
1797                 Of these, ldapsam will be of most interest to large corporate or enterprise sites.
1798                 </para>
1799
1800         </sect2>
1801
1802         <sect2>
1803         <title>tdbsam</title>
1804
1805                 <para>
1806                 <indexterm><primary>SAM backend</primary><secondary>tdbsam</secondary></indexterm>
1807 <indexterm><primary>trivial database</primary><see>TDB</see></indexterm>
1808 <indexterm><primary>machine account</primary></indexterm>
1809                 Samba can store user and machine account data in a <quote>TDB</quote> (trivial database).
1810                 Using this backend does not require any additional configuration. This backend is
1811                 recommended for new installations that do not require LDAP.
1812                 </para>
1813
1814                 <para>
1815 <indexterm><primary>tdbsam</primary></indexterm>
1816 <indexterm><primary>PDC</primary></indexterm>
1817 <indexterm><primary>BDC</primary></indexterm>
1818 <indexterm><primary>scalability</primary></indexterm>
1819                 As a general guide, the Samba Team does not recommend using the tdbsam backend for sites
1820                 that have 250 or more users. Additionally, tdbsam is not capable of scaling for use
1821                 in sites that require PDB/BDC implementations that require replication of the account
1822                 database. Clearly, for reason of scalability, the use of ldapsam should be encouraged.
1823                 </para>
1824
1825                 <para>
1826 <indexterm><primary>250-user limit</primary></indexterm>
1827 <indexterm><primary>performance-based</primary></indexterm>
1828 <indexterm><primary>tdbsam</primary></indexterm>
1829                 The recommendation of a 250-user limit is purely based on the notion that this
1830                 would generally involve a site that has routed networks, possibly spread across
1831                 more than one physical location. The Samba Team has not at this time established
1832                 the performance-based scalability limits of the tdbsam architecture.
1833                 </para>
1834
1835                 <para>
1836 <indexterm><primary>4,500 user accounts</primary></indexterm>
1837 <indexterm><primary>passdb backend</primary></indexterm>
1838 <indexterm><primary>tdbsam</primary></indexterm>
1839 <indexterm><primary>SambaSAMAccount</primary></indexterm>
1840                 There are sites that have thousands of users and yet require only one server.
1841                 One site recently reported having 4,500 user accounts on one UNIX system and
1842                 reported excellent performance with the <literal>tdbsam</literal> passdb backend.
1843                 The limitation of where the <literal>tdbsam</literal> passdb backend can be used
1844                 is not one pertaining to a limitation in the TDB storage system, it is based
1845                 only on the need for a reliable distribution mechanism for the SambaSAMAccount
1846                 backend.
1847                 </para>
1848
1849         </sect2>
1850
1851         <sect2>
1852         <title>ldapsam</title>
1853
1854                 <para>
1855 <indexterm><primary>LDAP</primary></indexterm>
1856 <indexterm><primary>ldapsam</primary></indexterm>
1857                 <indexterm><primary>SAM backend</primary><secondary>ldapsam</secondary></indexterm>
1858                 There are a few points to stress that the ldapsam does not provide. The LDAP
1859                 support referred to in this documentation does not include:
1860                 </para>
1861
1862                 <itemizedlist>
1863                         <listitem><para>A means of retrieving user account information from
1864                         a Windows 200x Active Directory server.</para></listitem>
1865                         <listitem><para>A means of replacing /etc/passwd.</para></listitem>
1866                 </itemizedlist>
1867
1868                 <para>
1869 <indexterm><primary>LDAP</primary></indexterm>
1870 <indexterm><primary>NSS</primary></indexterm>
1871 <indexterm><primary>PAM</primary></indexterm>
1872 <indexterm><primary>LGPL</primary></indexterm>
1873                 The second item can be accomplished by using LDAP NSS and PAM modules. LGPL versions of these libraries can be
1874                 obtained from <ulink url="http://www.padl.com/">PADL Software</ulink>.  More information about the
1875                 configuration of these packages may be found in <ulink url="http://safari.oreilly.com/?XmlId=1-56592-491-6">
1876                 <emphasis>LDAP, System Administration</emphasis> by Gerald Carter, Chapter 6, Replacing NIS"</ulink>.
1877                 </para>
1878
1879                 <para>
1880 <indexterm><primary>LDAP directory</primary></indexterm>
1881 <indexterm><primary>smbpasswd</primary></indexterm>
1882 <indexterm><primary>directory server</primary></indexterm>
1883                 This document describes how to use an LDAP directory for storing Samba user
1884                 account information traditionally stored in the smbpasswd(5) file. It is
1885                 assumed that the reader already has a basic understanding of LDAP concepts
1886                 and has a working directory server already installed. For more information
1887                 on LDAP architectures and directories, please refer to the following sites:
1888                 </para>
1889
1890                 <itemizedlist>
1891                         <listitem><para><ulink url="http://www.openldap.org/">OpenLDAP</ulink></para></listitem>
1892                         <listitem><para><ulink url="http://www.sun.com/software/products/directory_srvr_ee/index.xml">
1893                                 Sun One Directory Server</ulink></para></listitem>
1894                         <listitem><para><ulink url="http://www.novell.com/products/edirectory/">Novell eDirectory</ulink></para></listitem>
1895                         <listitem><para><ulink url="http://www-306.ibm.com/software/tivoli/products/directory-server/">IBM
1896                                 Tivoli Directory Server</ulink></para></listitem>
1897                         <listitem><para><ulink url="http://www.redhat.com/software/rha/directory/">Red Hat Directory
1898                                 Server</ulink></para></listitem>
1899                         <listitem><para><ulink url="http://www.linuxsecurity.com/content/view/119229">Fedora Directory
1900                                 Server</ulink></para></listitem>
1901                 </itemizedlist>
1902
1903                 <para>
1904                 Two additional Samba resources that may prove to be helpful are:
1905                 </para>
1906
1907                 <itemizedlist>
1908                         <listitem><para>
1909 <indexterm><primary>Samba-PDC-LDAP-HOWTO</primary></indexterm>
1910                         The <ulink url="http://www.unav.es/cti/ldap-smb/ldap-smb-3-howto.html">Samba-PDC-LDAP-HOWTO</ulink>
1911                         maintained by Ignacio Coupeau.
1912                         </para></listitem>
1913
1914                         <listitem><para>
1915 <indexterm><primary>IDEALX</primary></indexterm>
1916 <indexterm><primary>NT migration scripts</primary></indexterm>
1917 <indexterm><primary>smbldap-tools</primary></indexterm>
1918                         The NT migration scripts from <ulink url="http://samba.idealx.org/">IDEALX</ulink> that are
1919                         geared to manage users and groups in such a Samba-LDAP domain controller configuration.
1920                         Idealx also produced the smbldap-tools and the Interactive Console Management tool.
1921                         </para></listitem>
1922                 </itemizedlist>
1923
1924                 <sect3>
1925                 <title>Supported LDAP Servers</title>
1926
1927                         <para>
1928 <indexterm><primary>LDAP</primary></indexterm>
1929 <indexterm><primary>ldapsam</primary></indexterm>
1930 <indexterm><primary>OpenLDAP</primary></indexterm>
1931 <indexterm><primary>Netscape's Directory Server</primary></indexterm>
1932                         The LDAP ldapsam code was developed and tested using the OpenLDAP 2.x server and
1933                         client libraries. The same code should work with Netscape's Directory Server and client SDK.
1934                         However, there are bound to be compile errors and bugs. These should not be hard to fix.
1935                         Please submit fixes via the process outlined in <link linkend="bugreport">Reporting Bugs</link>.
1936                         </para>
1937
1938                         <para>
1939                         Samba is capable of working with any standards-compliant LDAP server.
1940                         </para>
1941
1942                 </sect3>
1943
1944                 <sect3>
1945                 <title>Schema and Relationship to the RFC 2307 posixAccount</title>
1946
1947
1948                         <para>
1949                         Samba-3.0 includes the necessary schema file for OpenLDAP 2.x in the
1950                         <filename>examples/LDAP/samba.schema</filename> directory of the source code distribution
1951                         tarball. The schema entry for the sambaSamAccount ObjectClass is shown here:
1952 <programlisting>
1953 ObjectClass (1.3.6.1.4.1.7165.2.2.6 NAME 'sambaSamAccount' SUP top AUXILIARY
1954     DESC 'Samba-3.0 Auxiliary SAM Account'
1955     MUST ( uid $ sambaSID )
1956     MAY  ( cn $ sambaLMPassword $ sambaNTPassword $ sambaPwdLastSet $
1957           sambaLogonTime $ sambaLogoffTime $ sambaKickoffTime $
1958           sambaPwdCanChange $ sambaPwdMustChange $ sambaAcctFlags $
1959           displayName $ sambaHomePath $ sambaHomeDrive $ sambaLogonScript $
1960           sambaProfilePath $ description $ sambaUserWorkstations $
1961           sambaPrimaryGroupSID $ sambaDomainName ))
1962 </programlisting>
1963                         </para>
1964
1965                         <para>
1966 <indexterm><primary>samba.schema</primary></indexterm>
1967 <indexterm><primary>OpenLDAP</primary></indexterm>
1968 <indexterm><primary>OID</primary></indexterm>
1969                         The <filename>samba.schema</filename> file has been formatted for OpenLDAP 2.0/2.1.
1970                         The Samba Team owns the OID space used by the above schema and recommends its use.
1971                         If you translate the schema to be used with Netscape DS, please submit the modified
1972                         schema file as a patch to <ulink url="mailto:jerry@samba.org">jerry@samba.org</ulink>.
1973                         </para>
1974
1975                         <para>
1976 <indexterm><primary>smbpasswd</primary></indexterm>
1977 <indexterm><primary>/etc/passwd</primary></indexterm>
1978 <indexterm><primary>sambaSamAccount</primary></indexterm>
1979 <indexterm><primary>AUXILIARY</primary></indexterm>
1980 <indexterm><primary>ObjectClass</primary></indexterm>
1981 <indexterm><primary>LDAP</primary></indexterm>
1982 <indexterm><primary>RFC 2307.</primary></indexterm>
1983                         Just as the smbpasswd file is meant to store information that provides information
1984                         additional to  a user's <filename>/etc/passwd</filename> entry, so is the sambaSamAccount
1985                         object meant to supplement the UNIX user account information. A sambaSamAccount is an
1986                         <constant>AUXILIARY</constant> ObjectClass, so it can be used to augment existing
1987                         user account information in the LDAP directory, thus providing information needed
1988                         for Samba account handling. However, there are several fields (e.g., uid) that overlap
1989                         with the posixAccount ObjectClass outlined in RFC 2307. This is by design.
1990                         </para>
1991
1992                         <para>
1993 <indexterm><primary>account information</primary></indexterm>
1994 <indexterm><primary>sambaSamAccount</primary></indexterm>
1995 <indexterm><primary>posixAccount</primary></indexterm>
1996 <indexterm><primary>ObjectClasses</primary></indexterm>
1997 <indexterm><primary>smbd</primary></indexterm>
1998 <indexterm><primary>getpwnam</primary></indexterm>
1999 <indexterm><primary>LDAP</primary></indexterm>
2000 <indexterm><primary>NIS</primary></indexterm>
2001 <indexterm><primary>NSS</primary></indexterm>
2002                         In order to store all user account information (UNIX and Samba) in the directory,
2003                         it is necessary to use the sambaSamAccount and posixAccount ObjectClasses in
2004                         combination. However, <command>smbd</command> will still obtain the user's UNIX account
2005                         information via the standard C library calls, such as getpwnam().
2006                         This means that the Samba server must also have the LDAP NSS library installed
2007                         and functioning correctly. This division of information makes it possible to
2008                         store all Samba account information in LDAP, but still maintain UNIX account
2009                         information in NIS while the network is transitioning to a full LDAP infrastructure.
2010                         </para>
2011                 </sect3>
2012
2013                 <sect3>
2014                 <title>OpenLDAP Configuration</title>
2015
2016                 <para>
2017 <indexterm><primary>sambaSamAccount</primary></indexterm>
2018 <indexterm><primary>OpenLDAP</primary></indexterm>
2019 <indexterm><primary>slapd</primary></indexterm>
2020 <indexterm><primary>samba.schema</primary></indexterm>
2021                 To include support for the sambaSamAccount object in an OpenLDAP directory
2022                 server, first copy the samba.schema file to slapd's configuration directory.
2023                 The samba.schema file can be found in the directory <filename>examples/LDAP</filename>
2024                 in the Samba source distribution.
2025 <screen>
2026 &rootprompt;<userinput>cp samba.schema /etc/openldap/schema/</userinput>
2027 </screen>
2028                 </para>
2029
2030                 <para>
2031 <indexterm><primary>samba.schema</primary></indexterm>
2032 <indexterm><primary>slapd.conf</primary></indexterm>
2033 <indexterm><primary>sambaSamAccount</primary></indexterm>
2034 <indexterm><primary>cosine.schema</primary></indexterm>
2035 <indexterm><primary>uid</primary></indexterm>
2036 <indexterm><primary>inetorgperson.schema</primary></indexterm>
2037 <indexterm><primary>displayName</primary></indexterm>
2038 <indexterm><primary>attribute</primary></indexterm>
2039                 Next, include the <filename>samba.schema</filename> file in <filename>slapd.conf</filename>.
2040                 The sambaSamAccount object contains two attributes that depend on other schema
2041                 files. The <parameter>uid</parameter> attribute is defined in <filename>cosine.schema</filename> and
2042                 the <parameter>displayName</parameter> attribute is defined in the <filename>inetorgperson.schema</filename>
2043                 file. Both of these must be included before the <filename>samba.schema</filename> file.
2044 <programlisting>
2045 ## /etc/openldap/slapd.conf
2046
2047 ## schema files (core.schema is required by default)
2048 include            /etc/openldap/schema/core.schema
2049
2050 ## needed for sambaSamAccount
2051 include            /etc/openldap/schema/cosine.schema
2052 include            /etc/openldap/schema/inetorgperson.schema
2053 include            /etc/openldap/schema/nis.schema
2054 include            /etc/openldap/schema/samba.schema
2055 ....
2056 </programlisting>
2057                 </para>
2058
2059                 <para>
2060 <indexterm><primary>sambaSamAccount</primary></indexterm>
2061 <indexterm><primary>posixAccount</primary></indexterm>
2062 <indexterm><primary>posixGroup</primary></indexterm>
2063 <indexterm><primary>ObjectClasses</primary></indexterm>
2064                 It is recommended that you maintain some indices on some of the most useful attributes,
2065                 as in the following example, to speed up searches made on sambaSamAccount ObjectClasses
2066                 (and possibly posixAccount and posixGroup as well):
2067                 </para>
2068
2069 <para>
2070 <programlisting>
2071 # Indices to maintain
2072 ## required by OpenLDAP
2073 index objectclass             eq
2074
2075 index cn                      pres,sub,eq
2076 index sn                      pres,sub,eq
2077 ## required to support pdb_getsampwnam
2078 index uid                     pres,sub,eq
2079 ## required to support pdb_getsambapwrid()
2080 index displayName             pres,sub,eq
2081
2082 ## uncomment these if you are storing posixAccount and
2083 ## posixGroup entries in the directory as well
2084 ##index uidNumber               eq
2085 ##index gidNumber               eq
2086 ##index memberUid               eq
2087
2088 index   sambaSID              eq
2089 index   sambaPrimaryGroupSID  eq
2090 index   sambaDomainName       eq
2091 index   default               sub
2092 </programlisting>
2093 </para>
2094
2095                 <para>
2096                 Create the new index by executing:
2097 <screen>
2098 &rootprompt;./sbin/slapindex -f slapd.conf
2099 </screen>
2100                 </para>
2101
2102                 <para>
2103                 Remember to restart slapd after making these changes:
2104 <screen>
2105 &rootprompt;<userinput>/etc/init.d/slapd restart</userinput>
2106 </screen>
2107                 </para>
2108
2109                 </sect3>
2110
2111                 <sect3>
2112                 <title>Initialize the LDAP Database</title>
2113
2114                 <para>
2115 <indexterm><primary>LDAP database</primary></indexterm>
2116 <indexterm><primary>account containers</primary></indexterm>
2117 <indexterm><primary>LDIF file</primary></indexterm>
2118 <indexterm><primary>DNS</primary></indexterm>
2119                 Before you can add accounts to the LDAP database, you must create the account containers
2120                 that they will be stored in. The following LDIF file should be modified to match your
2121                 needs (DNS entries, and so on):
2122 <programlisting>
2123 # Organization for Samba Base
2124 dn: dc=quenya,dc=org
2125 objectclass: dcObject
2126 objectclass: organization
2127 dc: quenya
2128 o: Quenya Org Network
2129 description: The Samba-3 Network LDAP Example
2130
2131 # Organizational Role for Directory Management
2132 dn: cn=Manager,dc=quenya,dc=org
2133 objectclass: organizationalRole
2134 cn: Manager
2135 description: Directory Manager
2136
2137 # Setting up container for Users OU
2138 dn: ou=People,dc=quenya,dc=org
2139 objectclass: top
2140 objectclass: organizationalUnit
2141 ou: People
2142
2143 # Setting up admin handle for People OU
2144 dn: cn=admin,ou=People,dc=quenya,dc=org
2145 cn: admin
2146 objectclass: top
2147 objectclass: organizationalRole
2148 objectclass: simpleSecurityObject
2149 userPassword: {SSHA}c3ZM9tBaBo9autm1dL3waDS21+JSfQVz
2150
2151 # Setting up container for groups
2152 dn: ou=Groups,dc=quenya,dc=org
2153 objectclass: top
2154 objectclass: organizationalUnit
2155 ou: Groups
2156
2157 # Setting up admin handle for Groups OU
2158 dn: cn=admin,ou=Groups,dc=quenya,dc=org
2159 cn: admin
2160 objectclass: top
2161 objectclass: organizationalRole
2162 objectclass: simpleSecurityObject
2163 userPassword: {SSHA}c3ZM9tBaBo9autm1dL3waDS21+JSfQVz
2164
2165 # Setting up container for computers
2166 dn: ou=Computers,dc=quenya,dc=org
2167 objectclass: top
2168 objectclass: organizationalUnit
2169 ou: Computers
2170
2171 # Setting up admin handle for Computers OU
2172 dn: cn=admin,ou=Computers,dc=quenya,dc=org
2173 cn: admin
2174 objectclass: top
2175 objectclass: organizationalRole
2176 objectclass: simpleSecurityObject
2177 userPassword: {SSHA}c3ZM9tBaBo9autm1dL3waDS21+JSfQVz
2178 </programlisting>
2179                 </para>
2180
2181                 <para>
2182 <indexterm><primary>userPassword</primary></indexterm>
2183 <indexterm><primary>slappasswd</primary></indexterm>
2184                 The userPassword shown above should be generated using <command>slappasswd</command>.
2185                 </para>
2186
2187                 <para>
2188 <indexterm><primary>LDIF</primary></indexterm>
2189 <indexterm><primary>LDAP</primary></indexterm>
2190                 The following command will then load the contents of the LDIF file into the LDAP
2191                 database.
2192 <indexterm><primary>slapadd</primary></indexterm>
2193 <screen>
2194 &prompt;<userinput>slapadd -v -l initldap.dif</userinput>
2195 </screen>
2196                 </para>
2197
2198                 <para>
2199                 Do not forget to secure your LDAP server with an adequate access control list
2200                 as well as an admin password.
2201                 </para>
2202
2203                 <note><para>
2204 <indexterm><primary>secrets.tdb</primary></indexterm>
2205                 Before Samba can access the LDAP server, you need to store the LDAP admin password
2206                 in the Samba-3 <filename>secrets.tdb</filename> database by:
2207 <indexterm><primary>smbpasswd</primary></indexterm>
2208 <screen>
2209 &rootprompt;<userinput>smbpasswd -w <replaceable>secret</replaceable></userinput>
2210 </screen>
2211                 </para></note>
2212
2213                 </sect3>
2214
2215                 <sect3>
2216                 <title>Configuring Samba</title>
2217
2218                         <para>
2219 <indexterm><primary>LDAP</primary></indexterm>
2220 <indexterm><primary>smbd</primary></indexterm>
2221                         The following parameters are available in &smb.conf; only if your version of Samba was built with
2222                         LDAP support. Samba automatically builds with LDAP support if the LDAP libraries are found. The 
2223                         best method to verify that Samba was built with LDAP support is:
2224 <screen>
2225 &rootprompt; smbd -b | grep LDAP
2226    HAVE_LDAP_H
2227    HAVE_LDAP
2228    HAVE_LDAP_DOMAIN2HOSTLIST
2229    HAVE_LDAP_INIT
2230    HAVE_LDAP_INITIALIZE
2231    HAVE_LDAP_SET_REBIND_PROC
2232    HAVE_LIBLDAP
2233    LDAP_SET_REBIND_PROC_ARGS
2234 </screen>
2235                         If the build of the <command>smbd</command> command you are using does not produce output
2236                         that includes <literal>HAVE_LDAP_H</literal> it is necessary to discover why the LDAP headers
2237                         and libraries were not found during compilation.
2238                         </para>
2239
2240                         <para>LDAP-related smb.conf options include these:
2241                         <smbconfblock>
2242                         <smbconfoption name="passdb backend">ldapsam:url</smbconfoption>
2243                         <smbconfoption name="ldap admin dn"/>
2244                         <smbconfoption name="ldap delete dn"/>
2245                         <smbconfoption name="ldap filter"/>
2246                         <smbconfoption name="ldap group suffix"/>
2247                         <smbconfoption name="ldap idmap suffix"/>
2248                         <smbconfoption name="ldap machine suffix"/>
2249                         <smbconfoption name="ldap passwd sync"/>
2250                         <smbconfoption name="ldap ssl"/>
2251                         <smbconfoption name="ldap suffix"/>
2252                         <smbconfoption name="ldap user suffix"/>
2253                         <smbconfoption name="ldap replication sleep"/>
2254                         <smbconfoption name="ldap timeout"/>
2255                         <smbconfoption name="ldap page size"/>
2256                         </smbconfblock>
2257                         </para>
2258
2259                         <para>
2260                         These are described in the &smb.conf; man page and so are not repeated here. However, an example 
2261                         for use with an LDAP directory is shown in <link linkend="confldapex">the Configuration with LDAP.</link>
2262                         </para>
2263
2264 <example id="confldapex">
2265 <title>Configuration with LDAP</title>
2266 <smbconfblock>
2267 <smbconfsection name="[global]"/>
2268 <smbconfoption name="security">user</smbconfoption>
2269 <smbconfoption name="encrypt passwords">yes</smbconfoption>
2270 <smbconfoption name="netbios name">MORIA</smbconfoption>
2271 <smbconfoption name="workgroup">NOLDOR</smbconfoption>
2272
2273 <smbconfcomment>LDAP related parameters:</smbconfcomment>
2274
2275 <smbconfcomment>Define the DN used when binding to the LDAP servers.</smbconfcomment>
2276 <smbconfcomment>The password for this DN is not stored in smb.conf</smbconfcomment>
2277 <smbconfcomment>Set it using 'smbpasswd -w secret' to store the</smbconfcomment>
2278 <smbconfcomment>passphrase in the secrets.tdb file.</smbconfcomment>
2279 <smbconfcomment>If the "ldap admin dn" value changes, it must be reset.</smbconfcomment>
2280 <smbconfoption name="ldap admin dn">"cn=Manager,dc=quenya,dc=org"</smbconfoption>
2281
2282 <smbconfcomment>SSL directory connections can be configured by:</smbconfcomment>
2283 <smbconfcomment>('off', 'start tls', or 'on' (default))</smbconfcomment>
2284 <smbconfoption name="ldap ssl">start tls</smbconfoption>
2285
2286 <smbconfcomment>syntax: passdb backend = ldapsam:ldap://server-name[:port]</smbconfcomment>
2287 <smbconfoption name="passdb backend">ldapsam:ldap://frodo.quenya.org</smbconfoption>
2288
2289 <smbconfcomment>smbpasswd -x delete the entire dn-entry</smbconfcomment>
2290 <smbconfoption name="ldap delete dn">no</smbconfoption>
2291
2292 <smbconfcomment>The machine and user suffix are added to the base suffix</smbconfcomment>
2293 <smbconfcomment>wrote WITHOUT quotes. NULL suffixes by default</smbconfcomment>
2294 <smbconfoption name="ldap user suffix">ou=People</smbconfoption>
2295 <smbconfoption name="ldap group suffix">ou=Groups</smbconfoption>
2296 <smbconfoption name="ldap machine suffix">ou=Computers</smbconfoption>
2297
2298 <smbconfcomment>Trust UNIX account information in LDAP</smbconfcomment>
2299 <smbconfcomment> (see the smb.conf man page for details)</smbconfcomment>
2300
2301 <smbconfcomment>Specify the base DN to use when searching the directory</smbconfcomment>
2302 <smbconfoption name="ldap suffix">dc=quenya,dc=org</smbconfoption>
2303 </smbconfblock>
2304 </example>
2305
2306                 </sect3>
2307
2308                 <sect3>
2309                 <title>Accounts and Groups Management</title>
2310
2311                         <para>
2312                         <indexterm><primary>User Management</primary></indexterm>
2313                         <indexterm><primary>User Accounts</primary><secondary>Adding/Deleting</secondary></indexterm>
2314                         Because user accounts are managed through the sambaSamAccount ObjectClass, you should
2315                         modify your existing administration tools to deal with sambaSamAccount attributes.
2316                         </para>
2317
2318                         <para>
2319 <indexterm><primary>sambaSamAccount</primary></indexterm>
2320 <indexterm><primary>/etc/openldap/sldap.conf</primary></indexterm>
2321 <indexterm><primary>NSS</primary></indexterm>
2322                         Machine accounts are managed with the sambaSamAccount ObjectClass, just
2323                         like user accounts. However, it is up to you to store those accounts
2324                         in a different tree of your LDAP namespace. You should use
2325                         <quote>ou=Groups,dc=quenya,dc=org</quote> to store groups and
2326                         <quote>ou=People,dc=quenya,dc=org</quote> to store users. Just configure your
2327                         NSS and PAM accordingly (usually, in the <filename>/etc/openldap/sldap.conf</filename>
2328                         configuration file).
2329                         </para>
2330
2331                         <para>
2332 <indexterm><primary>POSIX</primary></indexterm>
2333 <indexterm><primary>posixGroup</primary></indexterm>
2334 <indexterm><primary>Domain Groups</primary></indexterm>
2335 <indexterm><primary>ADS</primary></indexterm>
2336                         In Samba-3, the group management system is based on POSIX
2337                         groups. This means that Samba makes use of the posixGroup ObjectClass.
2338                         For now, there is no NT-like group system management (global and local
2339                         groups). Samba-3 knows only about <constant>Domain Groups</constant>
2340                         and, unlike MS Windows 2000 and Active Directory, Samba-3 does not
2341                         support nested groups. 
2342                         </para>
2343
2344                 </sect3>
2345
2346                 <sect3>
2347                 <title>Security and sambaSamAccount</title>
2348
2349
2350                         <para>
2351 <indexterm><primary>sambaSAMAccount</primary></indexterm>
2352                         There are two important points to remember when discussing the security
2353                         of sambaSAMAccount entries in the directory.
2354                         </para>
2355
2356                         <itemizedlist>
2357                                 <listitem><para><emphasis>Never</emphasis> retrieve the SambaLMPassword or
2358 <indexterm><primary>SambaNTPassword</primary></indexterm>
2359                                 SambaNTPassword attribute values over an unencrypted LDAP session.</para></listitem>
2360                                 <listitem><para><emphasis>Never</emphasis> allow non-admin users to
2361                                 view the SambaLMPassword or SambaNTPassword attribute values.</para></listitem>
2362                         </itemizedlist>
2363
2364                         <para>
2365 <indexterm><primary>clear-text</primary></indexterm>
2366 <indexterm><primary>impersonate</primary></indexterm>
2367 <indexterm><primary>LM/NT password hashes</primary></indexterm>
2368                         These password hashes are clear-text equivalents and can be used to impersonate
2369                         the user without deriving the original clear-text strings. For more information
2370                         on the details of LM/NT password hashes, refer to <link linkend="passdb">the
2371                         Account Information Database section</link>.
2372                         </para>
2373
2374                         <para>
2375 <indexterm><primary>encrypted session</primary></indexterm>
2376 <indexterm><primary>StartTLS</primary></indexterm>
2377 <indexterm><primary>LDAPS</primary></indexterm>
2378 <indexterm><primary>secure communications</primary></indexterm>
2379                         To remedy the first security issue, the <smbconfoption name="ldap ssl"/> &smb.conf;
2380                         parameter defaults to require an encrypted session (<smbconfoption name="ldap
2381                         ssl">on</smbconfoption>) using the default port of <constant>636</constant> when
2382                         contacting the directory server. When using an OpenLDAP server, it
2383                         is possible to use the StartTLS LDAP extended operation in the place of LDAPS.
2384                         In either case, you are strongly encouraged to use secure communications protocols
2385                         (so do not set <smbconfoption name="ldap ssl">off</smbconfoption>).
2386                         </para>
2387
2388                         <para>
2389 <indexterm><primary>LDAPS</primary></indexterm>
2390 <indexterm><primary>StartTLS</primary></indexterm>
2391 <indexterm><primary>LDAPv3</primary></indexterm>
2392                         Note that the LDAPS protocol is deprecated in favor of the LDAPv3 StartTLS
2393                         extended operation. However, the OpenLDAP library still provides support for
2394                         the older method of securing communication between clients and servers.
2395                         </para>
2396
2397                         <para>
2398 <indexterm><primary>harvesting password hashes</primary></indexterm>
2399 <indexterm><primary>ACL</primary></indexterm>
2400 <indexterm><primary>slapd.conf</primary></indexterm>
2401                         The second security precaution is to prevent non-administrative users from
2402                         harvesting password hashes from the directory. This can be done using the
2403                         following ACL in <filename>slapd.conf</filename>:
2404                         </para>
2405
2406 <para>
2407 <programlisting>
2408 ## allow the "ldap admin dn" access, but deny everyone else
2409 access to attrs=SambaLMPassword,SambaNTPassword
2410      by dn="cn=Samba Admin,ou=People,dc=quenya,dc=org" write
2411      by * none
2412 </programlisting>
2413 </para>
2414
2415                 </sect3>
2416
2417                 <sect3>
2418                 <title>LDAP Special Attributes for sambaSamAccounts</title>
2419
2420                         <para> The sambaSamAccount ObjectClass is composed of the attributes shown in next tables: <link
2421                         linkend="attribobjclPartA">Part A</link>, and <link linkend="attribobjclPartB">Part B</link>. 
2422                         </para>
2423
2424                         <table frame="all" id="attribobjclPartA">
2425                                 <title>Attributes in the sambaSamAccount ObjectClass (LDAP), Part A</title>
2426                         <tgroup cols="2" align="justify">
2427                                         <colspec align="left"/>
2428                                         <colspec align="justify" colwidth="1*"/>
2429                         <tbody>
2430                                 <row><entry><constant>sambaLMPassword</constant></entry><entry>The LanMan password 16-byte hash stored as a character
2431                                                 representation of a hexadecimal string.</entry></row>
2432                                 <row><entry><constant>sambaNTPassword</constant></entry><entry>The NT password 16-byte hash stored as a character
2433                                                 representation of a hexadecimal string.</entry></row>
2434                                 <row><entry><constant>sambaPwdLastSet</constant></entry><entry>The integer time in seconds since 1970 when the
2435                                                 <constant>sambaLMPassword</constant> and <constant>sambaNTPassword</constant> attributes were last set.
2436                                 </entry></row>
2437
2438                                 <row><entry><constant>sambaAcctFlags</constant></entry><entry>String of 11 characters surrounded by square brackets [ ]
2439                                                 representing account flags such as U (user), W (workstation), X (no password expiration),
2440                                                 I (domain trust account), H (home dir required), S (server trust account),
2441                                                 and D (disabled).</entry></row>
2442
2443                                 <row><entry><constant>sambaLogonTime</constant></entry><entry>Integer value currently unused.</entry></row>
2444
2445                                 <row><entry><constant>sambaLogoffTime</constant></entry><entry>Integer value currently unused.</entry></row>
2446
2447                                 <row><entry><constant>sambaKickoffTime</constant></entry><entry>Specifies the time (UNIX time format) when the user
2448                                 will be locked down and cannot login any longer. If this attribute is omitted, then the account will never expire.
2449                                 Using this attribute together with shadowExpire of the shadowAccount ObjectClass will enable accounts to        
2450                                 expire completely on an exact date.</entry></row>
2451
2452                                 <row><entry><constant>sambaPwdCanChange</constant></entry><entry>Specifies the time (UNIX time format)
2453                                 after which the user is allowed to change his password. If this attribute is not set, the user will be free
2454                                 to change his password whenever he wants.</entry></row> 
2455
2456                                 <row><entry><constant>sambaPwdMustChange</constant></entry><entry>Specifies the time (UNIX time format) when the user is
2457                                 forced to change his password. If this value is set to 0, the user will have to change his password at first login.
2458                                 If this attribute is not set, then the password will never expire.</entry></row>
2459
2460                                 <row><entry><constant>sambaHomeDrive</constant></entry><entry>Specifies the drive letter to which to map the
2461                                 UNC path specified by sambaHomePath. The drive letter must be specified in the form <quote>X:</quote>
2462                                 where X is the letter of the drive to map. Refer to the <quote>logon drive</quote> parameter in the
2463                                 smb.conf(5) man page for more information.</entry></row>
2464
2465                                 <row><entry><constant>sambaLogonScript</constant></entry><entry>The sambaLogonScript property specifies the path of
2466                                 the user's logon script, .CMD, .EXE, or .BAT file. The string can be null. The path
2467                                 is relative to the netlogon share. Refer to the <smbconfoption name="logon script"/> parameter in the
2468                                 &smb.conf; man page for more information.</entry></row>
2469
2470                                 <row><entry><constant>sambaProfilePath</constant></entry><entry>Specifies a path to the user's profile.
2471                                 This value can be a null string, a local absolute path, or a UNC path. Refer to the
2472                                 <smbconfoption name="logon path"/> parameter in the &smb.conf; man page for more information.</entry></row>
2473
2474                                 <row><entry><constant>sambaHomePath</constant></entry><entry>The sambaHomePath property specifies the path of
2475                                 the home directory for the user. The string can be null. If sambaHomeDrive is set and specifies
2476                                 a drive letter, sambaHomePath should be a UNC path. The path must be a network
2477                                 UNC path of the form <filename>\\server\share\directory</filename>. This value can be a null string.
2478                                 Refer to the <command>logon home</command> parameter in the &smb.conf; man page for more information.
2479                                 </entry></row>
2480                         </tbody>
2481                         </tgroup></table>
2482
2483
2484                         <table frame="all" id="attribobjclPartB">
2485                                 <title>Attributes in the sambaSamAccount ObjectClass (LDAP), Part B</title>
2486                         <tgroup cols="2" align="justify">
2487                                         <colspec align="left"/>
2488                                         <colspec align="justify" colwidth="1*"/>
2489                         <tbody>
2490                                 <row><entry><constant>sambaUserWorkstations</constant></entry><entry>Here you can give a comma-separated list of machines
2491                                 on which the user is allowed to login. You may observe problems when you try to connect to a Samba domain member.
2492                                 Because domain members are not in this list, the domain controllers will reject them. Where this attribute is omitted,
2493                                 the default implies no restrictions.
2494                                 </entry></row>
2495
2496                                 <row><entry><constant>sambaSID</constant></entry><entry>The security identifier(SID) of the user.
2497                                 The Windows equivalent of UNIX UIDs.</entry></row>
2498
2499                                 <row><entry><constant>sambaPrimaryGroupSID</constant></entry><entry>The security identifier (SID) of the primary group
2500                                 of the user.</entry></row>
2501
2502                                 <row><entry><constant>sambaDomainName</constant></entry><entry>Domain the user is part of.</entry></row>
2503                         </tbody>
2504                         </tgroup></table>
2505
2506
2507                         <para>
2508 <indexterm><primary>PDC</primary></indexterm>
2509 <indexterm><primary>sambaSamAccount</primary></indexterm>
2510                         The majority of these parameters are only used when Samba is acting as a PDC of
2511                         a domain (refer to <link linkend="samba-pdc">Domain Control</link>, for details on
2512                         how to configure Samba as a PDC). The following four attributes
2513                         are only stored with the sambaSamAccount entry if the values are non-default values:
2514                         </para>
2515
2516                         <itemizedlist>
2517 <indexterm><primary>sambaHomePath</primary></indexterm>
2518 <indexterm><primary>sambaLogonScript</primary></indexterm>
2519 <indexterm><primary>sambaProfilePath</primary></indexterm>
2520 <indexterm><primary>sambaHomeDrive</primary></indexterm>
2521                                 <listitem><para>sambaHomePath</para></listitem>
2522                                 <listitem><para>sambaLogonScript</para></listitem>
2523                                 <listitem><para>sambaProfilePath</para></listitem>
2524                                 <listitem><para>sambaHomeDrive</para></listitem>
2525                         </itemizedlist>
2526
2527                         <para>
2528 <indexterm><primary>sambaSamAccount</primary></indexterm>
2529 <indexterm><primary>PDC</primary></indexterm>
2530 <indexterm><primary>smbHome</primary></indexterm>
2531                         These attributes are only stored with the sambaSamAccount entry if
2532                         the values are non-default values. For example, assume MORIA has now been
2533                         configured as a PDC and that <smbconfoption name="logon home">\\%L\%u</smbconfoption> was defined in
2534                         its &smb.conf; file. When a user named <quote>becky</quote> logs on to the domain,
2535                         the <smbconfoption name="logon home"/> string is expanded to \\MORIA\becky.
2536                         If the smbHome attribute exists in the entry <quote>uid=becky,ou=People,dc=samba,dc=org</quote>,
2537                         this value is used. However, if this attribute does not exist, then the value
2538                         of the <smbconfoption name="logon home"/> parameter is used in its place. Samba
2539                         will only write the attribute value to the directory entry if the value is
2540                         something other than the default (e.g., <filename>\\MOBY\becky</filename>).
2541                         </para>
2542
2543                 </sect3>
2544
2545                 <sect3>
2546                 <title>Example LDIF Entries for a sambaSamAccount</title>
2547
2548                         <para>
2549                         The following is a working LDIF that demonstrates the use of the SambaSamAccount ObjectClass:
2550 <programlisting>
2551 dn: uid=guest2, ou=People,dc=quenya,dc=org
2552 sambaLMPassword: 878D8014606CDA29677A44EFA1353FC7
2553 sambaPwdMustChange: 2147483647
2554 sambaPrimaryGroupSID: S-1-5-21-2447931902-1787058256-3961074038-513
2555 sambaNTPassword: 552902031BEDE9EFAAD3B435B51404EE
2556 sambaPwdLastSet: 1010179124
2557 sambaLogonTime: 0
2558 objectClass: sambaSamAccount
2559 uid: guest2
2560 sambaKickoffTime: 2147483647
2561 sambaAcctFlags: [UX         ]
2562 sambaLogoffTime: 2147483647
2563 sambaSID: S-1-5-21-2447931902-1787058256-3961074038-5006
2564 sambaPwdCanChange: 0
2565 </programlisting>
2566                         </para>
2567
2568                         <para>
2569                         The following is an LDIF entry for using both the sambaSamAccount and
2570                         posixAccount ObjectClasses:
2571 <programlisting>
2572 dn: uid=gcarter, ou=People,dc=quenya,dc=org
2573 sambaLogonTime: 0
2574 displayName: Gerald Carter
2575 sambaLMPassword: 552902031BEDE9EFAAD3B435B51404EE
2576 sambaPrimaryGroupSID: S-1-5-21-2447931902-1787058256-3961074038-1201
2577 objectClass: posixAccount
2578 objectClass: sambaSamAccount
2579 sambaAcctFlags: [UX         ]
2580 userPassword: {crypt}BpM2ej8Rkzogo
2581 uid: gcarter
2582 uidNumber: 9000
2583 cn: Gerald Carter
2584 loginShell: /bin/bash
2585 logoffTime: 2147483647
2586 gidNumber: 100
2587 sambaKickoffTime: 2147483647
2588 sambaPwdLastSet: 1010179230
2589 sambaSID: S-1-5-21-2447931902-1787058256-3961074038-5004
2590 homeDirectory: /home/moria/gcarter
2591 sambaPwdCanChange: 0
2592 sambaPwdMustChange: 2147483647
2593 sambaNTPassword: 878D8014606CDA29677A44EFA1353FC7
2594 </programlisting>
2595                 </para>
2596
2597                 </sect3>
2598
2599                 <sect3>
2600                 <title>Password Synchronization</title>
2601
2602                 <para>
2603                 Samba-3 and later can update the non-Samba (LDAP) password stored with an account. When
2604                 using pam_ldap, this allows changing both UNIX and Windows passwords at once.
2605                 </para>
2606
2607                 <para>The <smbconfoption name="ldap passwd sync"/> options can have the  values shown in
2608                 <link linkend="ldappwsync">Possible <emphasis>ldap passwd sync</emphasis> Values</link>.</para>
2609
2610                 <table frame="all" id="ldappwsync">
2611                 <title>Possible <parameter>ldap passwd sync</parameter> Values</title>
2612                 <tgroup cols="2">
2613                         <colspec align="left" colwidth="1*"/>
2614                         <colspec align="justify" colwidth="4*"/>
2615                 <thead>
2616                         <row><entry align="left">Value</entry><entry align="center">Description</entry></row>
2617                 </thead>
2618                 <tbody>
2619                 <row><entry>yes</entry><entry><para>When the user changes his password, update
2620                                <constant>SambaNTPassword</constant>, <constant>SambaLMPassword</constant>,
2621                                and the <constant>password</constant> fields.</para></entry></row>
2622
2623                 <row><entry>no</entry><entry><para>Only update <constant>SambaNTPassword</constant> and
2624                                         <constant>SambaLMPassword</constant>.</para></entry></row>
2625
2626                 <row><entry>only</entry><entry><para>Only update the LDAP password and let the LDAP server
2627                         worry about the other fields.  This option is only available on some LDAP servers and
2628                         only when the LDAP server supports LDAP_EXOP_X_MODIFY_PASSWD.</para></entry></row>
2629                 </tbody>
2630                 </tgroup>
2631                 </table>
2632
2633
2634                 <para>More information can be found in the &smb.conf; man page.</para>
2635
2636                 </sect3>
2637
2638                 <sect3>
2639                 <title>Using OpenLDAP Overlay for Password Syncronization</title>
2640
2641                 <para>
2642                 Howard Chu has written a special overlay called <command>smbk5pwd</command>. This tool  modifies the
2643                 <literal>SambaNTPassword</literal>, <literal>SambaLMPassword</literal> and <literal>Heimdal</literal>
2644                 hashes in an OpenLDAP entry when an LDAP_EXOP_X_MODIFY_PASSWD operation is performed.
2645                 </para>
2646
2647                 <para>
2648                 The overlay is shipped with OpenLDAP-2.3 and can be found in the
2649                 <filename>contrib/slapd-modules/smbk5pwd</filename> subdirectory. This module can also be used with
2650                 OpenLDAP-2.2.
2651                 </para>
2652
2653                 </sect3>
2654
2655         </sect2>
2656
2657 </sect1>
2658
2659 <sect1>
2660 <title>Common Errors</title>
2661
2662         <sect2>
2663                 <title>Users Cannot Logon</title>
2664
2665                 <para><quote>I've installed Samba, but now I can't log on with my UNIX account! </quote></para>
2666
2667                 <para>Make sure your user has been added to the current Samba <smbconfoption name="passdb backend"/>. 
2668                 Read the <link linkend="acctmgmttools">Account Management Tools,</link> for details.</para>
2669
2670         </sect2>
2671
2672         <sect2>
2673         <title>Users Being Added to the Wrong Backend Database</title>
2674
2675         <para>
2676         A few complaints have been received from users who just moved to Samba-3. The following
2677         &smb.conf; file entries were causing problems: new accounts were being added to the old
2678         smbpasswd file, not to the tdbsam passdb.tdb file:
2679         </para>
2680
2681         <para>
2682         <smbconfblock>
2683         <smbconfsection name="[global]"/>
2684         <member>...</member>
2685         <smbconfoption name="passdb backend">smbpasswd, tdbsam</smbconfoption>
2686         <member>...</member>
2687         </smbconfblock>
2688         </para>
2689
2690         <para>
2691         Samba will add new accounts to the first entry in the <emphasis>passdb backend</emphasis>
2692         parameter entry. If you want to update to the tdbsam, then change the entry to:
2693         </para>
2694
2695         <para>
2696 <smbconfblock>
2697 [globals]
2698 ...
2699 <smbconfoption name="passdb backend">tdbsam, smbpasswd</smbconfoption>
2700 ...
2701 </smbconfblock>
2702         </para>
2703
2704         </sect2>
2705
2706         <sect2>
2707         <title>Configuration of <parameter>auth methods</parameter></title>
2708
2709         <para>
2710         When explicitly setting an <smbconfoption name="auth methods"/> parameter,
2711         <parameter>guest</parameter> must be specified as the first entry on the line &smbmdash;
2712         for example, <smbconfoption name="auth methods">guest sam</smbconfoption>.
2713         </para>
2714
2715         </sect2>
2716
2717 </sect1>
2718
2719 </chapter>