source: vendor/3.6.23/docs-xml/Samba3-HOWTO/TOSHARG-Passdb.xml

Last change on this file was 414, checked in by Herwig Bauernfeind, 15 years ago

Samba 3.5.0: Initial import

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