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

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

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