Match Samba 2.2, and make ACB_NORMAL the default ACB value.
[Samba.git] / docs / docbook / projdoc / passdb.xml
blob1e0fcc6e2bfa848e228ccd35e6b40e6169cbb714
1 <chapter id="passdb">
2 <chapterinfo>
3         &author.jelmer;
4         &author.jht;
5         &author.jerry;
6         &author.jeremy;
7         <author>&person.gd;<contrib>LDAP updates</contrib></author>
8         <author>
9                 <firstname>Olivier (lem)</firstname><surname>Lemaire</surname>
10                 <affiliation>
11                         <orgname>IDEALX</orgname>
12                         <address><email>olem@IDEALX.org</email></address>
13                 </affiliation>
14         </author>
15         
16         <pubdate>May 24, 2003</pubdate>
17 </chapterinfo>
18 <title>Account Information Databases</title>
20 <para>
21 Samba-3 implements a new capability to work concurrently with multiple account backends.
22 The possible new combinations of password backends allows Samba-3 a degree of flexibility
23 and scalability that previously could be achieved only with MS Windows Active Directory.
24 This chapter describes the new functionality and how to get the most out of it.
25 </para>
27 <para>
28 In the development of Samba-3, a number of requests were received to provide the
29 ability to migrate MS Windows NT4 SAM accounts to Samba-3 without the need to provide
30 matching UNIX/Linux accounts. We called this the <emphasis>Non-UNIX Accounts (NUA)</emphasis>
31 capability. The intent was that an administrator could decide to use the <emphasis>tdbsam</emphasis>
32 backend and by simply specifying <smbconfoption><name>passdb backend</name><value>tdbsam_nua</value></smbconfoption>,
33 this would allow Samba-3 to implement a solution that did not use UNIX accounts per se. Late
34 in the development cycle, the team doing this work hit upon some obstacles that prevents this
35 solution from being used. Given the delays with the Samba-3 release, a decision was made to not
36 deliver this functionality until a better method of recognizing NT Group SIDs from NT User
37 SIDs could be found. This feature may return during the life cycle for the Samba-3 series.
38 </para>
40 <note><para>
41 Samba-3 does not support Non-UNIX Account (NUA) operation for user accounts.
42 Samba-3 does support NUA operation for machine accounts.
43 </para></note>
45 <sect1>
46 <title>Features and Benefits</title>
48 <para>
49 Samba-3 provides for complete backward compatibility with Samba-2.2.x functionality
50 as follows:
51 <indexterm><primary>SAM backend</primary><secondary>smbpasswd</secondary></indexterm>
52 <indexterm><primary>SAM backend</primary><secondary>ldapsam_compat</secondary></indexterm>
53 <indexterm><primary>encrypted passwords</primary></indexterm>
54 </para>
56 <?latex \newpage ?>
58 <sect2>
59         <title>Backward Compatibility Backends</title>
61 <variablelist>
62         <varlistentry><term>Plain Text</term>
63                 <listitem>
64                         <para>
65                         This option uses nothing but the UNIX/Linux <filename>/etc/passwd</filename>
66                         style backend. On systems that have Pluggable Authentication Modules (PAM)
67                         support, all PAM modules are supported. The behavior is just as it was with
68                         Samba-2.2.x, and the protocol limitations imposed by MS Windows clients
69                         apply likewise. Please refer to <link linkend="passdbtech"/> for more information
70                         regarding the limitations of Plain Text password usage.
71                         </para>
72                 </listitem>
73         </varlistentry>
75         <varlistentry><term>smbpasswd</term>
76                 <listitem>
77                         <para>
78                         This option allows continued use of the <filename>smbpasswd</filename>
79                         file that maintains a plain ASCII (text) layout that includes the MS Windows
80                         LanMan and NT encrypted passwords as well as a field that stores some
81                         account information. This form of password backend does not store any of
82                         the MS Windows NT/200x SAM (Security Account Manager) information required to
83                         provide the extended controls that are needed for more comprehensive 
84                         interoperation with MS Windows NT4/200x servers.
85                         </para>
87                         <para>
88                         This backend should be used only for backward compatibility with older
89                         versions of Samba. It may be deprecated in future releases.
90                         </para>
91                 </listitem>
92         </varlistentry>
94         <varlistentry><term>ldapsam_compat (Samba-2.2 LDAP Compatibility)</term>
95                 <listitem>
96                         <para>
97                         There is a password backend option that allows continued operation with
98                         an existing OpenLDAP backend that uses the Samba-2.2.x LDAP schema extension.
99                         This option is provided primarily as a migration tool, although there is
100                         no reason to force migration at this time. This tool will eventually
101                         be deprecated.
102                         </para>
103                 </listitem>
104         </varlistentry>
105 </variablelist>
107 </sect2>
109 <para>
110 Samba-3 introduces a number of new password backend capabilities.
111 <indexterm><primary>SAM backend</primary><secondary>tdbsam</secondary></indexterm>
112 <indexterm><primary>SAM backend</primary><secondary>ldapsam</secondary></indexterm>
113 <indexterm><primary>SAM backend</primary><secondary>mysqlsam</secondary></indexterm>
114 <indexterm><primary>SAM backend</primary><secondary>xmlsam</secondary></indexterm>
115 </para>
117 <sect2>
118 <title>New Backends</title>
120 <variablelist>
121         <varlistentry><term>tdbsam</term>
122                 <listitem>
123                         <para>
124                         This backend provides a rich database backend for local servers. This
125                         backend is not suitable for multiple Domain Controllers (i.e., PDC + one
126                         or more BDC) installations.
127                         </para>
129                         <para>
130                         The <emphasis>tdbsam</emphasis> password backend stores the old <emphasis>
131                         smbpasswd</emphasis> information plus the extended MS Windows NT / 200x
132                         SAM information into a binary format TDB (trivial database) file.
133                         The inclusion of the extended information makes it possible for Samba-3
134                         to implement the same account and system access controls that are possible
135                         with MS Windows NT4/200x-based systems.
136                         </para>
138                         <para>
139                         The inclusion of the <emphasis>tdbsam</emphasis> capability is a direct
140                         response to user requests to allow simple site operation without the overhead
141                         of the complexities of running OpenLDAP. It is recommended to use this only
142                         for sites that have fewer than 250 users. For larger sites or implementations,
143                         the use of OpenLDAP or of Active Directory integration is strongly recommended.
144                         </para>
145                 </listitem>
146         </varlistentry>
148         <varlistentry><term>ldapsam</term>
149                 <listitem>
150                         <para>
151                         This provides a rich directory backend for distributed account installation.    
152                         </para>
154                         <para>
155                         Samba-3 has a new and extended LDAP implementation that requires configuration
156                         of OpenLDAP with a new format Samba schema. The new format schema file is
157                         included in the <filename class="directory">examples/LDAP</filename> directory of the Samba distribution.
158                         </para>
160                         <para>
161                         The new LDAP implementation significantly expands the control abilities that
162                         were possible with prior versions of Samba. It is now possible to specify
163                         <quote>per user</quote> profile settings, home directories, account access controls, and
164                         much more. Corporate sites will see that the Samba Team has listened to their
165                         requests both for capability and to allow greater scalability.
166                         </para>
167                 </listitem>
168         </varlistentry>
170         <varlistentry><term>mysqlsam (MySQL based backend)</term>
171                 <listitem>
172                         <para>
173                         It is expected that the MySQL-based SAM will be very popular in some corners.
174                         This database backend will be of considerable interest to sites that want to
175                         leverage existing MySQL technology.
176                         </para>
177                 </listitem>
178         </varlistentry>
180         <varlistentry><term>xmlsam (XML based datafile)</term>
181                 <listitem>
182                         <para>
183 <indexterm><primary>pdbedit</primary></indexterm>
184                         Allows the account and password data to be stored in an XML format
185                         data file. This backend cannot be used for normal operation, it can only 
186                         be used in conjunction with <command>pdbedit</command>'s pdb2pdb 
187                         functionality. The DTD that is used might be subject to changes in the future.
188                         </para>
190                         <para>
191                         The <parameter>xmlsam</parameter> option can be useful for account migration between database
192                         backends or backups. Use of this tool will allow the data to be edited before migration
193                         into another backend format.
194                         </para>
195                 </listitem>
196         </varlistentry>
198 </variablelist>
200 </sect2>
202 </sect1>
204 <sect1 id="passdbtech">
205         <title>Technical Information</title>
207         <para>
208         Old Windows clients send plain text passwords over the wire. Samba can check these
209         passwords by encrypting them and comparing them to the hash stored in the UNIX user database.
210         </para>
212         <para>
213 <indexterm><primary>encrypted passwords</primary></indexterm>   
214         Newer Windows clients send encrypted passwords (so-called Lanman and NT hashes) over 
215         the wire, instead of plain text passwords. The newest clients will send only encrypted
216         passwords and refuse to send plain text passwords, unless their registry is tweaked.
217         </para>
219         <para>
220         These passwords can't be converted to UNIX-style encrypted passwords. Because of that,
221         you can't use the standard UNIX user database, and you have to store the Lanman and NT
222         hashes somewhere else.
223         </para>
224         
225         <para>
226         In addition to differently encrypted passwords, Windows also stores certain data for each
227         user that is not stored in a UNIX user database. For example, workstations the user may logon from,
228         the location where the user's profile is stored, and so on. Samba retrieves and stores this
229         information using a <smbconfoption><name>passdb backend</name></smbconfoption>. Commonly available backends are LDAP, plain text
230         file, and MySQL. For more information, see the man page for &smb.conf; regarding the 
231         <smbconfoption><name>passdb backend</name></smbconfoption> parameter.
232         </para>
235         <image scale="50" id="idmap-sid2uid"><imagedescription>IDMAP: Resolution of SIDs to UIDs.</imagedescription><imagefile>idmap-sid2uid</imagefile></image>
237         <para>
238 <indexterm><primary>SID</primary></indexterm>
239         The resolution of SIDs to UIDs is fundamental to correct operation of Samba. In both cases shown, if winbindd is not running, or cannot
240         be contacted, then only local SID/UID resolution is possible. See <link linkend="idmap-sid2uid"/> and
241         <link linkend="idmap-uid2sid"/>.
242         </para>
244         <image scale="50" id="idmap-uid2sid"><imagedescription>IDMAP: Resolution of UIDs to SIDs.</imagedescription><imagefile>idmap-uid2sid</imagefile></image>
246         <sect2>
247         <title>Important Notes About Security</title>
248                 
249                 <para>
250                 The UNIX and SMB password encryption techniques seem similar on the surface. This
251                 similarity is, however, only skin deep. The UNIX scheme typically sends cleartext
252                 passwords over the network when logging in. This is bad. The SMB encryption scheme
253                 never sends the cleartext password over the network but it does store the 16 byte 
254                 hashed values on disk. This is also bad. Why? Because the 16 byte hashed values
255                 are a <quote>password equivalent.</quote> You cannot derive the user's password from them, but
256                 they could potentially be used in a modified client to gain access to a server.
257                 This would require considerable technical knowledge on behalf of the attacker but
258                 is perfectly possible. You should thus treat the datastored in whatever passdb
259                 backend you use (smbpasswd file, LDAP, MYSQL) as though it contained the cleartext
260                 passwords of all your users. Its contents must be kept secret and the file should
261                 be protected accordingly.
262                 </para>
263                 
264                 <para>
265                 Ideally, we would like a password scheme that involves neither plain text passwords
266                 on the network nor on disk. Unfortunately, this is not available as Samba is stuck with
267                 having to be compatible with other SMB systems (Windows NT, Windows for Workgroups, Windows 9x/Me).
268                 </para>
270                 <para>
271                 Windows NT 4.0 Service Pack 3 changed the default setting so plaintext passwords
272                 are disabled from being sent over the wire. This mandates either the use of encrypted
273                 password support or editing the Windows NT registry to re-enable plaintext passwords.
274                 </para>
275                 
276                 <para>
277                 The following versions of Microsoft Windows do not support full domain security protocols,
278                 although they may log onto a domain environment:
279                 </para>
281                 <itemizedlist>
282                         <listitem>MS DOS Network client 3.0 with the basic network redirector installed.</listitem>
283                         <listitem>Windows 95 with the network redirector update installed.</listitem>
284                         <listitem>Windows 98 [Second Edition].</listitem>
285                         <listitem>Windows Me.</listitem>
286                 </itemizedlist>
288                 <note>
289                 <para>
290                 MS Windows XP Home does not have facilities to become a Domain Member and it cannot participate in domain logons.
291                 </para>
292                 </note>
294                 <para>
295                 The following versions of MS Windows fully support domain security protocols.
296                 </para>
298                 <itemizedlist>
299                         <listitem>Windows NT 3.5x.</listitem>
300                         <listitem>Windows NT 4.0.</listitem>
301                         <listitem>Windows 2000 Professional.</listitem>
302                         <listitem>Windows 200x Server/Advanced Server.</listitem>
303                         <listitem>Windows XP Professional.</listitem>
304                 </itemizedlist>
305                         
306                 <para>
307                 All current releases of Microsoft SMB/CIFS clients support authentication via the
308                 SMB Challenge/Response mechanism described here. Enabling cleartext authentication
309                 does not disable the ability of the client to participate in encrypted authentication.
310                 Instead, it allows the client to negotiate either plain text or encrypted password
311                 handling.
312                 </para>
314                 <para>
315                 MS Windows clients will cache the encrypted password alone. Where plain text passwords
316                 are re-enabled through the appropriate registry change, the plain text password is never
317                 cached. This means that in the event that a network connections should become disconnected
318                 (broken), only the cached (encrypted) password will be sent to the resource server to
319                 effect an auto-reconnect. If the resource server does not support encrypted passwords the
320                 auto-reconnect will fail. Use of encrypted passwords is strongly advised.
321                 </para>
323                 <sect3>
324                 <title>Advantages of Encrypted Passwords</title>
326                         <itemizedlist>
327                                 <listitem><para>Plaintext passwords are not passed across 
328                                 the network. Someone using a network sniffer cannot just 
329                                 record passwords going to the SMB server.</para></listitem>
331                                 <listitem><para>Plaintext passwords are not stored anywhere in
332                                 memory or on disk.</para></listitem>
333                          
334                                 <listitem><para>Windows NT does not like talking to a server 
335                                 that does not support encrypted passwords. It will refuse 
336                                 to browse the server if the server is also in User Level 
337                                 security mode. It will insist on prompting the user for the 
338                                 password on each connection, which is very annoying. The
339                                 only things you can do to stop this is to use SMB encryption.
340                                 </para></listitem>
342                                 <listitem><para>Encrypted password support allows automatic share
343                                 (resource) reconnects.</para></listitem>
345                                 <listitem><para>Encrypted passwords are essential for PDC/BDC
346                                 operation.</para></listitem>
347                         </itemizedlist>
348                 </sect3>
351                 <sect3>
352                 <title>Advantages of Non-Encrypted Passwords</title>
354                         <itemizedlist>
355                                 <listitem><para>Plaintext passwords are not kept 
356                                 on disk, and are not cached in memory. </para></listitem>
357                                 
358                                 <listitem><para>Uses same password file as other UNIX 
359                                 services such as Login and FTP.</para></listitem>
360                                 
361                                 <listitem><para>Use of other services (such as Telnet and FTP) that
362                                 send plain text passwords over the network, so sending them for SMB
363                                 is not such a big deal.</para></listitem>
364                         </itemizedlist>
365                 </sect3>
366         </sect2>
368         <sect2>
369         <title>Mapping User Identifiers between MS Windows and UNIX</title>
371         <para>
372         Every operation in UNIX/Linux requires a user identifier (UID), just as in
373         MS Windows NT4/200x this requires a Security Identifier (SID). Samba provides
374         two means for mapping an MS Windows user to a UNIX/Linux UID.
375         </para>
377         <para>
378         First, all Samba SAM (Security Account Manager database) accounts require
379         a UNIX/Linux UID that the account will map to. As users are added to the account
380         information database, Samba will call the <smbconfoption><name>add user script</name></smbconfoption>
381         interface to add the account to the Samba host OS. In essence all accounts in
382         the local SAM require a local user account.
383         </para>
385         <para>
386         The second way to effect Windows SID to UNIX UID mapping is via the
387         <emphasis>idmap uid</emphasis> and <emphasis>idmap gid</emphasis> parameters in &smb.conf;.
388         Please refer to the man page for information about these parameters.
389         These parameters are essential when mapping users from a remote SAM server.
390         </para>
392         </sect2>
394         <sect2 id="idmapbackend">
395         <title>Mapping Common UIDs/GIDs on Distributed Machines</title>
397         <para>
398         Samba-3 has a special facility that makes it possible to maintain identical UIDs and GIDs
399         on all servers in a distributed network. A distributed network is one where there exists
400         a PDC, one or more BDCs and/or one or more Domain Member servers. Why is this important?
401         This is important if files are being shared over more than one protocol (e.g., NFS) and where
402         users are copying files across UNIX/Linux systems using tools such as <command>rsync</command>.
403         </para>
405         <para>
406         The special facility is enabled using a parameter called <parameter>idmap backend</parameter>.
407         The default setting for this parameter is an empty string. Technically it is possible to use
408         an LDAP based idmap backend for UIDs and GIDs, but it makes most sense when this is done for
409         network configurations that also use LDAP for the SAM backend. A sample use is shown in
410         <link linkend="idmapbackendexample"/>.
411         </para>
413         <para>
414 <indexterm><primary>SAM backend</primary><secondary>ldapsam</secondary></indexterm>
415 <smbconfexample id="idmapbackendexample">
416 <title>Example configuration with the LDAP idmap backend</title>
417 <indexterm><primary>SAM backend</primary><secondary>xmlsam</secondary></indexterm>
418 <smbconfsection>[global]</smbconfsection>
419 <smbconfoption><name>idmap backend</name><value>ldapsam:ldap://ldap-server.quenya.org:636</value></smbconfoption>
420 <smbcomment>Alternately, this could be specified as:</smbcomment>
421 <smbconfoption><name>idmap backend</name><value>ldapsam:ldaps://ldap-server.quenya.org</value></smbconfoption>
422 </smbconfexample>
423         </para>
425         <para>
426         A network administrator who wants to make significant use of LDAP backends will sooner or later be
427         exposed to the excellent work done by PADL Software. PADL <ulink url="http://www.padl.com"/> have
428         produced and released to open source an array of tools that might be of interest. These tools include:
429         </para>
431         <itemizedlist>
432                 <listitem>
433                 <para>
434                 <emphasis>nss_ldap:</emphasis> An LDAP Name Service Switch module to provide native
435                 name service support for AIX, Linux, Solaris, and other operating systems. This tool
436                 can be used for centralized storage and retrieval of UIDs/GIDs.
437                 </para>
438                 </listitem>
440                 <listitem>
441                 <para>
442                 <emphasis>pam_ldap:</emphasis> A PAM module that provides LDAP integration for UNIX/Linux
443                 system access authentication.
444                 </para>
445                 </listitem>
446                 <listitem>
447                 <para>
448                 <emphasis>idmap_ad:</emphasis> An IDMAP backend that supports the Microsoft Services for
449                 UNIX RFC 2307 schema available from their web
450                 <ulink url="http://www.padl.com/download/xad_oss_plugins.tar.gz">site</ulink>.
451                 </para>
452                 </listitem>
453         </itemizedlist>
456         </sect2>
457 </sect1>
459 <sect1 id="acctmgmttools">
460 <title>Account Management Tools</title>
462 <para>
463 <indexterm><primary>pdbedit</primary></indexterm>
464 Samba provides two tools for management of user and machine accounts. These tools are
465 called <command>smbpasswd</command> and <command>pdbedit</command>. A third tool is under
466 development but is not expected to ship in time for Samba-3.0.0. The new tool will be a TCL/TK
467 GUI tool that looks much like the MS Windows NT4 Domain User Manager. Hopefully this will
468 be announced in time for the Samba-3.0.1 release.
469 </para>
470         <sect2>
471         <title>The <emphasis>smbpasswd</emphasis> Command</title>
472         
473                 <para>
474                 The smbpasswd utility is similar to the <command>passwd</command>
475                 or <command>yppasswd</command> programs. It maintains the two 32 byte password
476                 fields in the passdb backend.
477                 </para>
479                 <para>
480                 <command>smbpasswd</command> works in a client-server mode where it contacts the
481                 local smbd to change the user's password on its behalf. This has enormous benefits.
482                 </para>
484                 <para>
485                 <command>smbpasswd</command> has the capability to change passwords on Windows NT
486                 servers (this only works when the request is sent to the NT Primary Domain Controller
487                 if changing an NT Domain user's password).
488                 </para>
490                 <para>
491                 <command>smbpasswd</command> can be used to:
492 <indexterm><primary>User Management</primary></indexterm>
493 <indexterm><primary>User Accounts</primary><secondary>Adding/Deleting</secondary></indexterm>
494                 
495                 </para>
497                 <itemizedlist>
498                         <listitem><emphasis>add</emphasis> user or machine accounts.</listitem>
499                         <listitem><emphasis>delete</emphasis> user or machine accounts.</listitem>
500                         <listitem><emphasis>enable</emphasis> user or machine accounts.</listitem>
501                         <listitem><emphasis>disable</emphasis> user or machine accounts.</listitem>
502                         <listitem><emphasis>set to NULL</emphasis> user passwords.</listitem>
503                         <listitem><emphasis>manage interdomain trust accounts.</emphasis></listitem>
504                 </itemizedlist>
505                 
506                 <para>
507                 To run smbpasswd as a normal user just type:
508                 </para>
509                 
510                 <para>
511 <screen>
512 &prompt;<userinput>smbpasswd</userinput>
513 <prompt>Old SMB password: </prompt><userinput><replaceable>secret</replaceable></userinput>
514 </screen>
515                 For <replaceable>secret</replaceable>, type old value here or press return if
516                 there is no old password.
517 <screen>
518 <prompt>New SMB Password: </prompt><userinput><replaceable>new secret</replaceable></userinput>
519 <prompt>Repeat New SMB Password: </prompt><userinput><replaceable>new secret</replaceable></userinput>
520 </screen>
521                 </para>
522                 
523                 <para>
524                 If the old value does not match the current value stored for that user, or the two
525                 new values do not match each other, then the password will not be changed.
526                 </para>
527                 
528                 <para>
529                 When invoked by an ordinary user, the command will only allow the user to change his or her own
530                 SMB password.
531                 </para>
532                 
533                 <para>
534                 When run by root, <command>smbpasswd</command> may take an optional argument specifying
535                 the user name whose SMB password you wish to change. When run as root, <command>smbpasswd</command>
536                 does not prompt for or check the old password value, thus allowing root to set passwords 
537                 for users who have forgotten their passwords.
538                 </para>
539                 
540                 <para>
541                 <command>smbpasswd</command> is designed to work in the way familiar to UNIX
542                 users who use the <command>passwd</command> or <command>yppasswd</command> commands.
543                 While designed for administrative use, this tool provides essential User Level
544                 password change capabilities.
545                 </para>
547                 <para>
548                 For more details on using <command>smbpasswd</command>, refer to the man page (the
549                 definitive reference).
550                 </para>
551         </sect2>
553         <sect2 id="pdbeditthing">
554         <title>The <emphasis>pdbedit</emphasis> Command</title>
556                 <para>
557 <indexterm><primary>pdbedit</primary></indexterm>
558                 <command>pdbedit</command> is a tool that can be used only by root. It is used to
559                 manage the passdb backend. <command>pdbedit</command> can be used to:
560 <indexterm><primary>User Management</primary></indexterm>
561 <indexterm><primary>User Accounts</primary><secondary>Adding/Deleting</secondary></indexterm>
563                 </para>
565                 <itemizedlist>
566                         <listitem>add, remove or modify user accounts.</listitem>
567                         <listitem>list user accounts.</listitem>
568                         <listitem>migrate user accounts.</listitem>
569                 </itemizedlist>
571                 <para>
572 <indexterm><primary>pdbedit</primary></indexterm>
573                 The <command>pdbedit</command> tool is the only one that can manage the account
574                 security and policy settings. It is capable of all operations that smbpasswd can
575                 do as well as a super set of them.
576                 </para>
578                 <para>
579 <indexterm><primary>pdbedit</primary></indexterm>
580                 One particularly important purpose of the <command>pdbedit</command> is to allow
581                 the migration of account information from one passdb backend to another. See the
582                 <link linkend="XMLpassdb">XML</link> password backend section of this chapter.
583                 </para>
585                 <para>
586                 The following is an example of the user account information that is stored in
587                 a tdbsam password backend. This listing was produced by running:
588                 </para>
590 <screen>
591 &prompt;<userinput>pdbedit -Lv met</userinput>
592 UNIX username:        met
593 NT username:
594 Account Flags:        [UX         ]
595 User SID:             S-1-5-21-1449123459-1407424037-3116680435-2004
596 Primary Group SID:    S-1-5-21-1449123459-1407424037-3116680435-1201
597 Full Name:            Melissa E Terpstra
598 Home Directory:       \\frodo\met\Win9Profile
599 HomeDir Drive:        H:
600 Logon Script:         scripts\logon.bat
601 Profile Path:         \\frodo\Profiles\met
602 Domain:               &example.workgroup;
603 Account desc:
604 Workstations:         melbelle
605 Munged dial:
606 Logon time:           0
607 Logoff time:          Mon, 18 Jan 2038 20:14:07 GMT
608 Kickoff time:         Mon, 18 Jan 2038 20:14:07 GMT
609 Password last set:    Sat, 14 Dec 2002 14:37:03 GMT
610 Password can change:  Sat, 14 Dec 2002 14:37:03 GMT
611 Password must change: Mon, 18 Jan 2038 20:14:07 GMT
612 </screen>
614                 <para>
615 <indexterm><primary>pdbedit</primary></indexterm>
616                 The <command>pdbedit</command> tool allows migration of authentication (account)
617                 databases from one backend to another. For example: To migrate accounts from an
618                 old <filename>smbpasswd</filename> database to a <parameter>tdbsam</parameter>
619                 backend:
620                 </para>
622                 <procedure>
623                         <step><para>
624                         Set the <smbconfoption><name>passdb backend</name><value>tdbsam, smbpasswd</value></smbconfoption>.
625                         </para></step>
627                         <step><para>
628                         Execute:
629 <screen>
630 &rootprompt;<userinput>pdbedit -i smbpassed -e tdbsam</userinput>
631 </screen>
632                         </para></step>
634                         <step><para>
635                         Now remove the <parameter>smbpasswd</parameter> from the passdb backend
636                         configuration in &smb.conf;.
637                         </para></step>
638                 </procedure>
640         </sect2>
641 </sect1>
643 <sect1>
644 <title>Password Backends</title>
646 <para>
647 Samba offers the greatest flexibility in backend account database design of any SMB/CIFS server
648 technology available today. The flexibility is immediately obvious as one begins to explore this
649 capability.
650 </para>
652 <para>
653 It is possible to specify not only multiple different password backends, but even multiple
654 backends of the same type. For example, to use two different tdbsam databases:
655 </para>
657 <para>
658 <smbconfblock>
659         <smbconfoption><name>passdb backend</name><value>tdbsam:/etc/samba/passdb.tdb \</value></smbconfoption>
660         <member><parameter>tdbsam:/etc/samba/old-passdb.tdb</parameter></member>
661 </smbconfblock>
662 </para>
665         <sect2>
666         <title>Plaintext</title>
668                 <para>
669                 Older versions of Samba retrieved user information from the UNIX user database 
670                 and eventually some other fields from the file <filename>/etc/samba/smbpasswd</filename>
671                 or <filename>/etc/smbpasswd</filename>. When password encryption is disabled, no 
672                 SMB specific data is stored at all. Instead all operations are conducted via the way
673                 that the Samba host OS will access its <filename>/etc/passwd</filename> database.
674                 Linux systems For example, all operations are done via PAM.
675                 </para>
677         </sect2>
679         <sect2>
680         <title>smbpasswd &smbmdash; Encrypted Password Database</title>
682                 <para>
683 <indexterm><primary>SAM backend</primary><secondary>smbpasswd</secondary></indexterm>
684                 Traditionally, when configuring <smbconfoption><name>encrypt passwords</name><value>yes</value></smbconfoption> in Samba's &smb.conf; file, user account
685                 information such as username, LM/NT password hashes, password change times, and account
686                 flags have been stored in the <filename>smbpasswd(5)</filename> file. There are several
687                 disadvantages to this approach for sites with large numbers of users (counted
688                 in the thousands).
689                 </para>
691                 <itemizedlist>
692                 <listitem><para>
693                 The first problem is that all lookups must be performed sequentially. Given that
694                 there are approximately two lookups per domain logon (one for a normal
695                 session connection such as when mapping a network drive or printer), this
696                 is a performance bottleneck for large sites. What is needed is an indexed approach
697                 such as used in databases.
698                 </para></listitem>
700                 <listitem><para>
701                 The second problem is that administrators who desire to replicate a smbpasswd file
702                 to more than one Samba server were left to use external tools such as
703                 <command>rsync(1)</command> and <command>ssh(1)</command> and wrote custom,
704                 in-house scripts.
705                 </para></listitem>
707                 <listitem><para>
708                 Finally, the amount of information that is stored in an smbpasswd entry leaves
709                 no room for additional attributes such as a home directory, password expiration time,
710                 or even a Relative Identifier (RID).
711                 </para></listitem>
712                 </itemizedlist>
714                 <para>
715                 As a result of these deficiencies, a more robust means of storing user attributes
716                 used by smbd was developed. The API which defines access to user accounts
717                 is commonly referred to as the samdb interface (previously this was called the passdb
718                 API, and is still so named in the Samba CVS trees). 
719                 </para>
721                 <para>
722                 Samba provides an enhanced set of passdb backends that overcome the deficiencies
723                 of the smbpasswd plain text database. These are tdbsam, ldapsam and xmlsam.
724                 Of these, ldapsam will be of most interest to large corporate or enterprise sites.
725                 </para>
727         </sect2>
729         <sect2>
730         <title>tdbsam</title>
732         <para>
733 <indexterm><primary>SAM backend</primary><secondary>tdbsam</secondary></indexterm>
734                 Samba can store user and machine account data in a <quote>TDB</quote> (Trivial Database).
735                 Using this backend does not require any additional configuration. This backend is
736                 recommended for new installations that do not require LDAP.
737                 </para>
739                 <para>
740                 As a general guide, the Samba Team does not recommend using the tdbsam backend for sites
741                 that have 250 or more users. Additionally, tdbsam is not capable of scaling for use
742                 in sites that require PDB/BDC implementations that require replication of the account
743                 database. Clearly, for reason of scalability, the use of ldapsam should be encouraged.
744                 </para>
746                 <para>
747                 The recommendation of a 250 user limit is purely based on the notion that this
748                 would generally involve a site that has routed networks, possibly spread across
749                 more than one physical location. The Samba Team has not at this time established
750                 the performance based scalability limits of the tdbsam architecture.
751                 </para>
753         </sect2>
755         <sect2>
756         <title>ldapsam</title>
758                 <para>
759 <indexterm><primary>SAM backend</primary><secondary>ldapsam</secondary></indexterm>
760                 There are a few points to stress that the ldapsam does not provide. The LDAP
761                 support referred to in this documentation does not include:
762                 </para>
764                 <itemizedlist>
765                         <listitem><para>A means of retrieving user account information from
766                         an Windows 200x Active Directory server.</para></listitem>
767                         <listitem><para>A means of replacing /etc/passwd.</para></listitem>
768                 </itemizedlist>
770                 <para>
771                 The second item can be accomplished by using LDAP NSS and PAM modules. LGPL
772                 versions of these libraries can be obtained from 
773                 <ulink url="http://www.padl.com/">PADL Software</ulink>.
774                 More information about the configuration of these packages may be found at
775                 <ulink url="http://safari.oreilly.com/?XmlId=1-56592-491-6">
776                 <emphasis>LDAP, System Administration</emphasis>; Gerald Carter by O'Reilly; Chapter 6: Replacing NIS."</ulink>
777                 </para>
779                 <para>
780                 This document describes how to use an LDAP directory for storing Samba user
781                 account information traditionally stored in the smbpasswd(5) file. It is
782                 assumed that the reader already has a basic understanding of LDAP concepts
783                 and has a working directory server already installed. For more information
784                 on LDAP architectures and directories, please refer to the following sites:
785                 </para>
787                 <itemizedlist>
788                         <listitem><para><ulink url="http://www.openldap.org/">OpenLDAP</ulink></para></listitem>
789                         <listitem><para><ulink url="http://iplanet.netscape.com/directory">Sun iPlanet Directory Server</ulink></para></listitem>
790                 </itemizedlist>
792                 <para>
793                 Two additional Samba resources which may prove to be helpful are:
794                 </para>
796                 <itemizedlist>
797                         <listitem><para>The <ulink url="http://www.unav.es/cti/ldap-smb/ldap-smb-3-howto.html">Samba-PDC-LDAP-HOWTO</ulink>
798                         maintained by Ignacio Coupeau.</para></listitem>
800                         <listitem><para>The NT migration scripts from <ulink url="http://samba.idealx.org/">IDEALX</ulink> that are
801                         geared to manage users and group in such a Samba-LDAP Domain Controller configuration.
802                         </para></listitem>
803                 </itemizedlist>
805                 <sect3>
806                 <title>Supported LDAP Servers</title>
808                         <para>
809                         The LDAP ldapsam code has been developed and tested using the OpenLDAP 2.0 and 2.1 server and
810                         client libraries. The same code should work with Netscape's Directory Server and client SDK.
811                         However, there are bound to be compile errors and bugs. These should not be hard to fix.
812                         Please submit fixes via the process outlined in <link linkend="bugreport"/>.
813                         </para>
815                 </sect3>
817                 <sect3>
818                 <title>Schema and Relationship to the RFC 2307 posixAccount</title>
821                         <para>
822                         Samba-3.0 includes the necessary schema file for OpenLDAP 2.0 in
823                         <filename>examples/LDAP/samba.schema</filename>. The sambaSamAccount objectclass is given here:
824                         </para>
826 <para>
827 <programlisting>
828 objectclass (1.3.6.1.4.1.7165.2.2.6 NAME 'sambaSamAccount' SUP top AUXILIARY
829     DESC 'Samba-3.0 Auxiliary SAM Account'
830     MUST ( uid $ sambaSID )
831     MAY  ( cn $ sambaLMPassword $ sambaNTPassword $ sambaPwdLastSet $
832           sambaLogonTime $ sambaLogoffTime $ sambaKickoffTime $
833           sambaPwdCanChange $ sambaPwdMustChange $ sambaAcctFlags $
834           displayName $ sambaHomePath $ sambaHomeDrive $ sambaLogonScript $
835           sambaProfilePath $ description $ sambaUserWorkstations $
836           sambaPrimaryGroupSID $ sambaDomainName ))
837 </programlisting>
838 </para>
840                         <para>
841                         The <filename>samba.schema</filename> file has been formatted for OpenLDAP 2.0/2.1.
842                         The Samba Team owns the OID space used by the above schema and recommends its use.
843                         If you translate the schema to be used with Netscape DS, please submit the modified
844                         schema file as a patch to <ulink url="mailto:jerry@samba.org">jerry@samba.org</ulink>.
845                         </para>
847                         <para>
848                         Just as the smbpasswd file is meant to store information that provides information additional to  a
849                         user's <filename>/etc/passwd</filename> entry, so is the sambaSamAccount object
850                         meant to supplement the UNIX user account information. A sambaSamAccount is a
851                         <constant>AUXILIARY</constant> objectclass so it can be used to augment existing
852                         user account information in the LDAP directory, thus providing information needed
853                         for Samba account handling. However, there are several fields (e.g., uid) that overlap
854                         with the posixAccount objectclass outlined in RFC2307. This is by design.
855                         </para>
857                         <!--olem: we should perhaps have a note about shadowAccounts too as many
858                         systems use them, isn'it ? -->
860                         <para>
861                         In order to store all user account information (UNIX and Samba) in the directory,
862                         it is necessary to use the sambaSamAccount and posixAccount objectclasses in
863                         combination. However, smbd will still obtain the user's UNIX account
864                         information via the standard C library calls (e.g., getpwnam(), et al).
865                         This means that the Samba server must also have the LDAP NSS library installed
866                         and functioning correctly. This division of information makes it possible to
867                         store all Samba account information in LDAP, but still maintain UNIX account
868                         information in NIS while the network is transitioning to a full LDAP infrastructure.
869                         </para>
870                 </sect3>
872                 <sect3>
873                 <title>OpenLDAP Configuration</title>
875                         <para>
876                         To include support for the sambaSamAccount object in an OpenLDAP directory
877                         server, first copy the samba.schema file to slapd's configuration directory.
878                         The samba.schema file can be found in the directory <filename>examples/LDAP</filename>
879                         in the Samba source distribution.
880                         </para>
882 <para>
883 <screen>
884 &rootprompt;<userinput>cp samba.schema /etc/openldap/schema/</userinput>
885 </screen>
886 </para>
888                         <para>
889                         Next, include the <filename>samba.schema</filename> file in <filename>slapd.conf</filename>.
890                         The sambaSamAccount object contains two attributes that depend on other schema
891                         files. The <parameter>uid</parameter> attribute is defined in <filename>cosine.schema</filename> and
892                         the <parameter>displayName</parameter> attribute is defined in the <filename>inetorgperson.schema</filename>
893                         file. Both of these must be included before the <filename>samba.schema</filename> file.
894                         </para>
896 <para>
897 <programlisting>
898 ## /etc/openldap/slapd.conf
900 ## schema files (core.schema is required by default)
901 include            /etc/openldap/schema/core.schema
903 ## needed for sambaSamAccount
904 include            /etc/openldap/schema/cosine.schema
905 include            /etc/openldap/schema/inetorgperson.schema
906 include            /etc/openldap/schema/samba.schema
907 include            /etc/openldap/schema/nis.schema
908 ....
909 </programlisting>
910 </para>
912                 <para>
913                 It is recommended that you maintain some indices on some of the most useful attributes,
914                 as in the following example, to speed up searches made on sambaSamAccount objectclasses
915                 (and possibly posixAccount and posixGroup as well):
916                 </para>
918 <para>
919 <programlisting>
920 # Indices to maintain
921 ## required by OpenLDAP
922 index objectclass             eq
924 index cn                      pres,sub,eq
925 index sn                      pres,sub,eq
926 ## required to support pdb_getsampwnam
927 index uid                     pres,sub,eq
928 ## required to support pdb_getsambapwrid()
929 index displayName             pres,sub,eq
931 ## uncomment these if you are storing posixAccount and
932 ## posixGroup entries in the directory as well
933 ##index uidNumber               eq
934 ##index gidNumber               eq
935 ##index memberUid               eq
937 index   sambaSID              eq
938 index   sambaPrimaryGroupSID  eq
939 index   sambaDomainName       eq
940 index   default               sub
941 </programlisting>
942 </para>
944                 <para>
945                 Create the new index by executing:
946                 </para>
948 <para>
949 <screen>
950 &rootprompt;./sbin/slapindex -f slapd.conf
951 </screen>
952 </para>
954                 <para>
955                 Remember to restart slapd after making these changes:
956                 </para>
958 <para>
959 <screen>
960 &rootprompt;<userinput>/etc/init.d/slapd restart</userinput>
961 </screen>
962 </para>
964                 </sect3>
966                 <sect3>
967                 <title>Initialize the LDAP Database</title>
969                 <para>
970                 Before you can add accounts to the LDAP database you must create the account containers
971                 that they will be stored in. The following LDIF file should be modified to match your
972                 needs (DNS entries, and so on):
973                 </para>
974                 
975 <para>
976 <programlisting>
977 # Organization for Samba Base
978 dn: dc=quenya,dc=org
979 objectclass: dcObject
980 objectclass: organization
981 dc: quenya
982 o: Quenya Org Network
983 description: The Samba-3 Network LDAP Example
985 # Organizational Role for Directory Management
986 dn: cn=Manager,dc=quenya,dc=org
987 objectclass: organizationalRole
988 cn: Manager
989 description: Directory Manager
991 # Setting up container for users
992 dn: ou=People,dc=quenya,dc=org
993 objectclass: top
994 objectclass: organizationalUnit
995 ou: People
997 # Setting up admin handle for People OU
998 dn: cn=admin,ou=People,dc=quenya,dc=org
999 cn: admin
1000 objectclass: top
1001 objectclass: organizationalRole
1002 objectclass: simpleSecurityObject
1003 userPassword: {SSHA}c3ZM9tBaBo9autm1dL3waDS21+JSfQVz
1005 # Setting up container for groups
1006 dn: ou=Groups,dc=quenya,dc=org
1007 objectclass: top
1008 objectclass: organizationalUnit
1009 ou: People
1011 # Setting up admin handle for Groups OU
1012 dn: cn=admin,ou=Groups,dc=quenya,dc=org
1013 cn: admin
1014 objectclass: top
1015 objectclass: organizationalRole
1016 objectclass: simpleSecurityObject
1017 userPassword: {SSHA}c3ZM9tBaBo9autm1dL3waDS21+JSfQVz
1019 # Setting up container for computers
1020 dn: ou=Computers,dc=quenya,dc=org
1021 objectclass: top
1022 objectclass: organizationalUnit
1023 ou: People
1025 # Setting up admin handle for Computers OU
1026 dn: cn=admin,ou=Computers,dc=quenya,dc=org
1027 cn: admin
1028 objectclass: top
1029 objectclass: organizationalRole
1030 objectclass: simpleSecurityObject
1031 userPassword: {SSHA}c3ZM9tBaBo9autm1dL3waDS21+JSfQVz
1032 </programlisting>
1033 </para>
1035                 <para>
1036                 The userPassword shown above should be generated using <command>slappasswd</command>.
1037                 </para>
1039                 <para>
1040                 The following command will then load the contents of the LDIF file into the LDAP
1041                 database.
1042                 </para>
1044 <para>
1045 <screen>
1046 &prompt;<userinput>slapadd -v -l initldap.dif</userinput>
1047 </screen>
1048 </para>
1050                 <para>
1051                 Do not forget to secure your LDAP server with an adequate access control list
1052                 as well as an admin password.
1053                 </para>
1055                 <note>
1056                 <para>
1057                 Before Samba can access the LDAP server you need to store the LDAP admin password
1058                 into the Samba-3 <filename>secrets.tdb</filename> database by:
1059 <screen>
1060 &rootprompt;<userinput>smbpasswd -w <replaceable>secret</replaceable></userinput>
1061 </screen>
1062                 </para>
1063                 </note>
1065                 </sect3>
1067                 <sect3>
1068                 <title>Configuring Samba</title>
1070                         <para>
1071                         The following parameters are available in smb.conf only if your
1072                         version of Samba was built with LDAP support. Samba automatically builds with LDAP support if the
1073                         LDAP libraries are found.
1074                         </para>
1076                         <para>LDAP related smb.conf options: 
1077                         <smbconfoption><name>passdb backend</name><value>ldapsam:url</value></smbconfoption>,
1078                         <smbconfoption><name>ldap admin dn</name></smbconfoption>,
1079                         <smbconfoption><name>ldap delete dn</name></smbconfoption>,
1080                         <smbconfoption><name>ldap filter</name></smbconfoption>,
1081                         <smbconfoption><name>ldap group suffix</name></smbconfoption>,
1082                         <smbconfoption><name>ldap idmap suffix</name></smbconfoption>,
1083                         <smbconfoption><name>ldap machine suffix</name></smbconfoption>,
1084                         <smbconfoption><name>ldap passwd sync</name></smbconfoption>,
1085                         <smbconfoption><name>ldap ssl</name></smbconfoption>,
1086                         <smbconfoption><name>ldap suffix</name></smbconfoption>,
1087                         <smbconfoption><name>ldap user suffix</name></smbconfoption>,
1088                 </para>
1090                         <para>
1091                         These are described in the &smb.conf; man
1092                         page and so will not be repeated here. However, a sample &smb.conf; file for
1093                         use with an LDAP directory could appear as shown in <link linkend="confldapex"/>.
1094                         </para>
1096 <para>
1097 <smbconfexample id="confldapex">
1098 <title>Configuration with LDAP</title>
1099 <smbconfsection>[global]</smbconfsection>
1100 <smbconfoption><name>security</name><value>user</value></smbconfoption>
1101 <smbconfoption><name>encrypt passwords</name><value>yes</value></smbconfoption>
1102 <smbconfoption><name>netbios name</name><value>MORIA</value></smbconfoption>
1103 <smbconfoption><name>workgroup</name><value>NOLDOR</value></smbconfoption>
1105 <smbconfcomment>ldap related parameters</smbconfcomment>
1107 <smbconfcomment>define the DN to use when binding to the directory servers</smbconfcomment>
1108 <smbconfcomment>The password for this DN is not stored in smb.conf. Rather it</smbconfcomment>
1109 <smbconfcomment>must be set by using 'smbpasswd -w <replaceable>secretpw</replaceable>' to store the</smbconfcomment>
1110 <smbconfcomment>passphrase in the secrets.tdb file. If the "ldap admin dn" values</smbconfcomment>
1111 <smbconfcomment>change, this password will need to be reset.</smbconfcomment>
1112 <smbconfoption><name>ldap admin dn</name><value>"cn=Manager,ou=People,dc=quenya,dc=org"</value></smbconfoption>
1114 <smbconfcomment>Define the SSL option when connecting to the directory</smbconfcomment>
1115 <smbconfcomment>('off', 'start tls', or 'on' (default))</smbconfcomment>
1116 <smbconfoption><name>ldap ssl</name><value>start tls</value></smbconfoption>
1118 <smbconfcomment>syntax: passdb backend = ldapsam:ldap://server-name[:port]</smbconfcomment>
1119 <smbconfoption><name>passdb backend</name><value>ldapsam:ldap://frodo.quenya.org</value></smbconfoption>
1121 <smbconfcomment>smbpasswd -x delete the entire dn-entry</smbconfcomment>
1122 <smbconfoption><name>ldap delete dn</name><value>no</value></smbconfoption>
1124 <smbconfcomment>the machine and user suffix added to the base suffix</smbconfcomment>
1125 <smbconfcomment>wrote WITHOUT quotes. NULL suffixes by default</smbconfcomment>
1126 <smbconfoption><name>ldap user suffix</name><value>ou=People</value></smbconfoption>
1127 <smbconfoption><name>ldap group suffix</name><value>ou=Groups</value></smbconfoption>
1128 <smbconfoption><name>ldap machine suffix</name><value>ou=Computers</value></smbconfoption>
1130 <smbconfcomment>Trust UNIX account information in LDAP</smbconfcomment>
1131 <smbconfcomment> (see the smb.conf manpage for details)</smbconfcomment>
1133 <smbconfcomment> specify the base DN to use when searching the directory</smbconfcomment>
1134 <smbconfoption><name>ldap suffix</name><value>ou=People,dc=quenya,dc=org</value></smbconfoption>
1136 <smbconfcomment> generally the default ldap search filter is ok</smbconfcomment>
1137 <smbconfoption><name>ldap filter</name><value>(&amp;(uid=%u)(objectclass=sambaSamAccount))</value></smbconfoption>
1138 </smbconfexample>
1139 </para>
1141                 </sect3>
1143                 <sect3>
1144                 <title>Accounts and Groups Management</title>
1146                         <para>
1147 <indexterm><primary>User Management</primary></indexterm>
1148 <indexterm><primary>User Accounts</primary><secondary>Adding/Deleting</secondary></indexterm>
1150                         As user accounts are managed through the sambaSamAccount objectclass, you should
1151                         modify your existing administration tools to deal with sambaSamAccount attributes.
1152                         </para>
1154                         <para>
1155                         Machine accounts are managed with the sambaSamAccount objectclass, just
1156                         like users accounts. However, it is up to you to store those accounts
1157                         in a different tree of your LDAP namespace. You should use
1158                         <quote>ou=Groups,dc=quenya,dc=org</quote> to store groups and
1159                         <quote>ou=People,dc=quenya,dc=org</quote> to store users. Just configure your
1160                         NSS and PAM accordingly (usually, in the <filename>/etc/openldap/sldap.conf</filename>
1161                         configuration file).
1162                         </para>
1164                         <para>
1165                         In Samba-3, the group management system is based on POSIX
1166                         groups. This means that Samba makes use of the posixGroup objectclass.
1167                         For now, there is no NT-like group system management (global and local
1168                         groups). Samba-3 knows only about <constant>Domain Groups</constant>
1169                         and, unlike MS Windows 2000 and Active Directory, Samba-3 does not
1170                         support nested groups. 
1171                         </para>
1173                 </sect3>
1175                 <sect3>
1176                 <title>Security and sambaSamAccount</title>
1179                         <para>
1180                         There are two important points to remember when discussing the security
1181                         of sambaSamAccount entries in the directory.
1182                         </para>
1184                         <itemizedlist>
1185                                 <listitem><para><emphasis>Never</emphasis> retrieve the lmPassword or
1186                                 ntPassword attribute values over an unencrypted LDAP session.</para></listitem>
1187                                 <listitem><para><emphasis>Never</emphasis> allow non-admin users to
1188                                 view the lmPassword or ntPassword attribute values.</para></listitem>
1189                         </itemizedlist>
1191                         <para>
1192                         These password hashes are cleartext equivalents and can be used to impersonate
1193                         the user without deriving the original cleartext strings. For more information
1194                         on the details of LM/NT password hashes, refer to the
1195                         <link linkend="passdb">Account Information Database</link> section of this chapter.
1196                         </para>
1198                         <para>
1199                         To remedy the first security issue, the <smbconfoption><name>ldap ssl</name></smbconfoption> &smb.conf; parameter defaults
1200                         to require an encrypted session (<smbconfoption><name>ldap ssl</name><value>on</value></smbconfoption>) using
1201                         the default port of <constant>636</constant>
1202                         when contacting the directory server. When using an OpenLDAP server, it
1203                         is possible to use the use the StartTLS LDAP extended  operation in the place of
1204                         LDAPS. In either case, you are strongly discouraged to disable this security
1205                         (<smbconfoption><name>ldap ssl</name><value>off</value></smbconfoption>).
1206                         </para>
1208                         <para>
1209                         Note that the LDAPS protocol is deprecated in favor of the LDAPv3 StartTLS
1210                         extended operation. However, the OpenLDAP library still provides support for
1211                         the older method of securing communication between clients and servers.
1212                         </para>
1214                         <para>
1215                         The second security precaution is to prevent non-administrative users from
1216                         harvesting password hashes from the directory. This can be done using the
1217                         following ACL in <filename>slapd.conf</filename>:
1218                         </para>
1220 <para>
1221 <programlisting>
1222 ## allow the "ldap admin dn" access, but deny everyone else
1223 access to attrs=lmPassword,ntPassword
1224      by dn="cn=Samba Admin,ou=People,dc=quenya,dc=org" write
1225      by * none
1226 </programlisting>
1227 </para>
1229                 </sect3>
1231                 <sect3>
1232                 <title>LDAP Special Attributes for sambaSamAccounts</title>
1234                         <para>
1235                         The sambaSamAccount objectclass is composed of the attributes shown in <link linkend="attribobjclPartA"/>, and <link linkend="attribobjclPartB"/>.
1236                         </para>
1238                         <para>
1239                         <table frame="all" id="attribobjclPartA">
1240                                 <title>Attributes in the sambaSamAccount objectclass (LDAP) &smbmdash; Part A</title>
1241                         <tgroup cols="2" align="justify">
1242                                         <colspec align="left"/>
1243                                         <colspec align="justify" colwidth="1*"/>
1244                         <tbody>
1245                                 <row><entry><constant>sambaLMPassword</constant></entry><entry>The LANMAN password 16-byte hash stored as a character
1246                                                 representation of a hexadecimal string.</entry></row>
1247                                 <row><entry><constant>sambaNTPassword</constant></entry><entry>The NT password hash 16-byte stored as a character
1248                                                 representation of a hexadecimal string.</entry></row>
1249                                 <row><entry><constant>sambaPwdLastSet</constant></entry><entry>The integer time in seconds since 1970 when the
1250                                                 <constant>sambaLMPassword</constant> and <constant>sambaNTPassword</constant> attributes were last set.
1251                                 </entry></row>
1253                                 <row><entry><constant>sambaAcctFlags</constant></entry><entry>String of 11 characters surrounded by square brackets []
1254                                                 representing account flags such as U (user), W (workstation), X (no password expiration),
1255                                                 I (Domain trust account), H (Home dir required), S (Server trust account),
1256                                                 and D (disabled).</entry></row>
1258                                 <row><entry><constant>sambaLogonTime</constant></entry><entry>Integer value currently unused</entry></row>
1260                                 <row><entry><constant>sambaLogoffTime</constant></entry><entry>Integer value currently unused</entry></row>
1262                                 <row><entry><constant>sambaKickoffTime</constant></entry><entry>Specifies the time (UNIX time format) when the user
1263                                 will be locked down and cannot login any longer. If this attribute is ommited, then the account will never expire.
1264                                 If you use this attribute together with `shadowExpire' of the `shadowAccount' objectClass, will enable accounts to      
1265                                 expire completly on an exact date.</entry></row>
1267                                 <row><entry><constant>sambaPwdCanChange</constant></entry><entry>Specifies the time (UNIX time format) from which on the user is allowed to
1268                                 change his password. If attribute is not set, the user will be free to change his password whenever he wants.</entry></row>
1270                                 <row><entry><constant>sambaPwdMustChange</constant></entry><entry>Specifies the time (UNIX time format) since when the user is
1271                                 forced to change his password. If this value is set to `0', the user will have to change his password at first login.
1272                                 If this attribute is not set, then the password will never expire.</entry></row>
1274                                 <row><entry><constant>sambaHomeDrive</constant></entry><entry>Specifies the drive letter to which to map the
1275                                 UNC path specified by sambaHomePath. The drive letter must be specified in the form <quote>X:</quote>
1276                                 where X is the letter of the drive to map. Refer to the <quote>logon drive</quote> parameter in the
1277                                 smb.conf(5) man page for more information.</entry></row>
1279                                 <row><entry><constant>sambaLogonScript</constant></entry><entry>The sambaLogonScript property specifies the path of
1280                                 the user's logon script, .CMD, .EXE, or .BAT file. The string can be null. The path
1281                                 is relative to the netlogon share. Refer to the <smbconfoption><name>logon script</name></smbconfoption> parameter in the
1282                                 &smb.conf; man page for more information.</entry></row>
1284                                 <row><entry><constant>sambaProfilePath</constant></entry><entry>Specifies a path to the user's profile.
1285                                 This value can be a null string, a local absolute path, or a UNC path. Refer to the
1286                                 <smbconfoption><name>logon path</name></smbconfoption> parameter in the &smb.conf; man page for more information.</entry></row>
1288                                 <row><entry><constant>sambaHomePath</constant></entry><entry>The sambaHomePath property specifies the path of
1289                                 the home directory for the user. The string can be null. If sambaHomeDrive is set and specifies
1290                                 a drive letter, sambaHomePath should be a UNC path. The path must be a network
1291                                 UNC path of the form <filename>\\server\share\directory</filename>. This value can be a null string.
1292                                 Refer to the <command>logon home</command> parameter in the &smb.conf; man page for more information.
1293                                 </entry></row>
1294                         </tbody>
1295                         </tgroup></table>
1296                         </para>
1297                         <para>
1298                         <table frame="all" id="attribobjclPartB">
1299                                 <title>Attributes in the sambaSamAccount objectclass (LDAP) &smbmdash; Part B</title>
1300                         <tgroup cols="2" align="justify">
1301                                         <colspec align="left"/>
1302                                         <colspec align="justify" colwidth="1*"/>
1303                         <tbody>
1304                                 <row><entry><constant>sambaUserWorkstations</constant></entry><entry>Here you can give a comma-seperated list of machines
1305                                 on which the user is allowed to login. You may observe problems when you try to connect to an Samba Domain Member.
1306                                 Bacause Domain Members are not in this list, the Domain Controllers will reject them. Where this attribute is ommited,
1307                                 the default implies no restrictions.
1308                                 </entry></row>
1310                                 <row><entry><constant>sambaSID</constant></entry><entry>The security identifier(SID) of the user.
1311                                 The Windows equivalent of UNIX UIDs.</entry></row>
1313                                 <row><entry><constant>sambaPrimaryGroupSID</constant></entry><entry>The Security IDentifier (SID) of the primary group
1314                                 of the user.</entry></row>
1316                                 <row><entry><constant>sambaDomainName</constant></entry><entry>Domain the user is part of.</entry></row>
1317                         </tbody>
1318                         </tgroup></table>
1319                         </para>
1321                         <para>
1322                         The majority of these parameters are only used when Samba is acting as a PDC of
1323                         a domain (refer to <link linkend="samba-pdc"/>, for details on
1324                         how to configure Samba as a Primary Domain Controller). The following four attributes
1325                         are only stored with the sambaSamAccount entry if the values are non-default values:
1326                         </para>
1328                         <itemizedlist>
1329                                 <listitem>sambaHomePath</listitem>
1330                                 <listitem>sambaLogonScript</listitem>
1331                                 <listitem>sambaProfilePath</listitem>
1332                                 <listitem>sambaHomeDrive</listitem>
1333                         </itemizedlist>
1335                         <para>
1336                         These attributes are only stored with the sambaSamAccount entry if
1337                         the values are non-default values. For example, assume MORIA has now been
1338                         configured as a PDC and that <smbconfoption><name>logon home</name><value>\\%L\%u</value></smbconfoption> was defined in
1339                         its &smb.conf; file. When a user named <quote>becky</quote> logons to the domain,
1340                         the <smbconfoption><name>logon home</name></smbconfoption> string is expanded to \\MORIA\becky.
1341                         If the smbHome attribute exists in the entry <quote>uid=becky,ou=People,dc=samba,dc=org</quote>,
1342                         this value is used. However, if this attribute does not exist, then the value
1343                         of the <smbconfoption><name>logon home</name></smbconfoption> parameter is used in its place. Samba
1344                         will only write the attribute value to the directory entry if the value is
1345                         something other than the default (e.g., <filename>\\MOBY\becky</filename>).
1346                         </para>
1348                 </sect3>
1350                 <sect3>
1351                 <title>Example LDIF Entries for a sambaSamAccount</title>
1353                         <para>
1354                         The following is a working LDIF that demonstrates the use of the SambaSamAccount objectclass:
1355                         </para>
1357         <para>
1358         <programlisting>
1359         dn: uid=guest2, ou=People,dc=quenya,dc=org
1360         sambaLMPassword: 878D8014606CDA29677A44EFA1353FC7
1361         sambaPwdMustChange: 2147483647
1362         sambaPrimaryGroupSID: S-1-5-21-2447931902-1787058256-3961074038-513
1363         sambaNTPassword: 552902031BEDE9EFAAD3B435B51404EE
1364         sambaPwdLastSet: 1010179124
1365         sambaLogonTime: 0
1366         objectClass: sambaSamAccount
1367         uid: guest2
1368         sambaKickoffTime: 2147483647
1369         sambaAcctFlags: [UX         ]
1370         sambaLogoffTime: 2147483647
1371         sambaSID: S-1-5-21-2447931902-1787058256-3961074038-5006
1372         sambaPwdCanChange: 0
1373         </programlisting>
1374         </para>
1376                         <para>
1377                         The following is an LDIF entry for using both the sambaSamAccount and
1378                         posixAccount objectclasses:
1379                         </para>
1381         <para>
1382         <programlisting>
1383         dn: uid=gcarter, ou=People,dc=quenya,dc=org
1384         sambaLogonTime: 0
1385         displayName: Gerald Carter
1386         sambaLMPassword: 552902031BEDE9EFAAD3B435B51404EE
1387         sambaPrimaryGroupSID: S-1-5-21-2447931902-1787058256-3961074038-1201
1388         objectClass: posixAccount
1389         objectClass: sambaSamAccount
1390         sambaAcctFlags: [UX         ]
1391         userPassword: {crypt}BpM2ej8Rkzogo
1392         uid: gcarter
1393         uidNumber: 9000
1394         cn: Gerald Carter
1395         loginShell: /bin/bash
1396         logoffTime: 2147483647
1397         gidNumber: 100
1398         sambaKickoffTime: 2147483647
1399         sambaPwdLastSet: 1010179230
1400         sambaSID: S-1-5-21-2447931902-1787058256-3961074038-5004
1401         homeDirectory: /home/moria/gcarter
1402         sambaPwdCanChange: 0
1403         sambaPwdMustChange: 2147483647
1404         sambaNTPassword: 878D8014606CDA29677A44EFA1353FC7
1405 </programlisting>
1406         </para>
1408                 </sect3>
1410                 <sect3>
1411                 <title>Password Synchronization</title>
1413                 <para>
1414                 Samba-3 and later can update the non-samba (LDAP) password stored with an account. When
1415                 using pam_ldap, this allows changing both UNIX and Windows passwords at once.
1416                 </para>
1418                 <para>The <smbconfoption><name>ldap passwd sync</name></smbconfoption> options can have the  values shown in
1419                 <link linkend="ldappwsync"/>.</para>
1421                 <table iframe="all" id="ldappwsync">
1422                         <title>Possible <emphasis>ldap passwd sync</emphasis> values</title>
1423                 <tgroup cols="2">
1424                         <colspec align="left" width="1*"/>
1425                         <colspec align="justify" width="4*"/>
1426                 <thead>
1427                         <row><entry align="left">Value</entry><entry align="center">Description</entry></row>
1428                 </thead>
1429                 <tbody>
1430                 <row><entry>yes</entry><entry><para>When the user changes his password, update
1431                                <constant>ntPassword</constant>, <constant>lmPassword</constant>
1432                                and the <constant>password</constant> fields.</para></entry></row>
1434                 <row><entry>no</entry><entry><para>Only update <constant>ntPassword</constant> and <constant>lmPassword</constant>.</para></entry></row>
1436                 <row><entry>only</entry><entry><para>Only update the LDAP password and let the LDAP server worry about the other fields.
1437                         This option is only available on some LDAP servers. Only when the LDAP server
1438                         supports LDAP_EXOP_X_MODIFY_PASSWD.</para></entry></row>
1439                 </tbody>
1440                 </tgroup>
1441                 </table>
1444                 <para>More information can be found in the &smb.conf; manpage.</para>
1446                 </sect3>
1448         </sect2>
1450         <sect2>
1451         <title>MySQL</title>
1453         <para>
1454 <indexterm><primary>SAM backend</primary><secondary>mysqlsam</secondary></indexterm>
1455         Every so often someone will come along with a great new idea. Storing user accounts in a
1456         SQL backend is one of them. Those who want to do this are in the best position to know what the
1457         specific benefits are to them. This may sound like a cop-out, but in truth we cannot attempt
1458         to document every little detail why certain things of marginal utility to the bulk of
1459         Samba users might make sense to the rest. In any case, the following instructions should help
1460         the determined SQL user to implement a working system.
1461         </para>
1463                 <sect3>
1464                 <title>Creating the Database</title>
1466                         <para>
1467                         You can set up your own table and specify the field names to pdb_mysql (see below
1468                         for the column names) or use the default table. The file <filename>examples/pdb/mysql/mysql.dump</filename> 
1469                         contains the correct queries to create the required tables. Use the command:
1471 <screen>
1472 &prompt;<userinput>mysql -u<replaceable>username</replaceable> -h<replaceable>hostname</replaceable> -p<replaceable>password</replaceable> \
1473         <replaceable>databasename</replaceable> &lt; <filename>/path/to/samba/examples/pdb/mysql/mysql.dump</filename></userinput>
1474 </screen>
1475                         </para>
1476                 </sect3>
1478                 <sect3>
1479                 <title>Configuring</title>
1481                         <para>This plugin lacks some good documentation, but here is some brief infoormation. Add the following to the
1482                         <smbconfoption><name>passdb backend</name></smbconfoption> variable in your &smb.conf;:
1483 <smbconfblock>
1484 <smbconfoption><name>passdb backend</name><value>[other-plugins] mysql:identifier [other-plugins]</value></smbconfoption>
1485 </smbconfblock>
1486                         </para>
1488                         <para>The identifier can be any string you like, as long as it does not collide with 
1489                         the identifiers of other plugins or other instances of pdb_mysql. If you 
1490                         specify multiple pdb_mysql.so entries in <smbconfoption><name>passdb backend</name></smbconfoption>, you also need to 
1491                         use different identifiers.
1492                         </para>
1494                         <para>
1495                         Additional options can be given through the &smb.conf; file in the <smbconfsection>[global]</smbconfsection> section.
1496                         Refer to <link linkend="mysqlpbe"/>.
1497                         </para>
1499                         <table frame="all" id="mysqlpbe">
1500                                 <title>Basic smb.conf options for MySQL passdb backend</title>
1501                                 <tgroup cols="2">
1502                                         <colspec align="left"/>
1503                                         <colspec align="justify" colwidth="1*"/>
1504                                 <thead>
1505                                         <row><entry>Field</entry><entry>Contents</entry></row>
1506                                 </thead>
1507                                 <tbody>
1508                                         <row><entry>mysql host</entry><entry>Host name, defaults to `localhost'</entry></row>
1509                                         <row><entry>mysql password</entry><entry></entry></row>
1510                                         <row><entry>mysql user</entry><entry>Defaults to `samba'</entry></row>
1511                                         <row><entry>mysql database</entry><entry>Defaults to `samba'</entry></row>
1512                                         <row><entry>mysql port</entry><entry>Defaults to 3306</entry></row>
1513                                         <row><entry>table</entry><entry>Name of the table containing the users</entry></row>
1514                                 </tbody>
1515                                 </tgroup>
1516                         </table>
1518                         <warning>
1519                         <para>
1520                         Since the password for the MySQL user is stored in the &smb.conf; file, you should make the &smb.conf; file 
1521                         readable only to the user who runs Samba. This is considered a security bug and will soon be fixed.
1522                         </para>
1523                         </warning>
1525                         <para>Names of the columns are given in <link linkend="moremysqlpdbe"/>. The default column names can be found in the example table dump.
1526                          </para>
1528                 <para>
1529                         <table frame="all" id="moremysqlpdbe">
1530                                 <title>MySQL field names for MySQL passdb backend</title>
1531                                 <tgroup cols="3" align="justify">
1532                                         <colspec align="left"/>
1533                                         <colspec align="left"/>
1534                                         <colspec align="justify" colwidth="1*"/>
1535                         <thead>         
1536                                 <row><entry>Field</entry><entry>Type</entry><entry>Contents</entry></row>
1537                         </thead>
1538                         <tbody>
1539                                 <row><entry>logon time column</entry><entry>int(9)</entry><entry>UNIX time stamp of last logon of user</entry></row>
1540                                 <row><entry>logoff time column</entry><entry>int(9)</entry><entry>UNIX time stamp of last logoff of user</entry></row>
1541                                 <row><entry>kickoff time column</entry><entry>int(9)</entry><entry>UNIX time stamp of moment user should be kicked off workstation (not enforced)</entry></row>
1542                                 <row><entry>pass last set time column</entry><entry>int(9)</entry><entry>UNIX time stamp of moment password was last set</entry></row>
1543                                 <row><entry>pass can change time column</entry><entry>int(9)</entry><entry>UNIX time stamp of moment from which password can be changed</entry></row>
1544                                 <row><entry>pass must change time column</entry><entry>int(9)</entry><entry>UNIX time stamp of moment on which password must be changed</entry></row>
1545                                 <row><entry>username column</entry><entry>varchar(255)</entry><entry>UNIX username</entry></row>
1546                                 <row><entry>domain column</entry><entry>varchar(255)</entry><entry>NT domain user belongs to</entry></row>
1547                                 <row><entry>nt username column</entry><entry>varchar(255)</entry><entry>NT username</entry></row>
1548                                 <row><entry>fullname column</entry><entry>varchar(255)</entry><entry>Full name of user</entry></row>
1549                                 <row><entry>home dir column</entry><entry>varchar(255)</entry><entry>UNIX homedir path</entry></row>
1550                                 <row><entry>dir drive column</entry><entry>varchar(2)</entry><entry>Directory drive path (e.g., <quote>H:</quote>)</entry></row>
1551                                 <row><entry>logon script column</entry><entry>varchar(255)</entry><entry>Batch file to run on client side when logging on</entry></row>
1552                                 <row><entry>profile path column</entry><entry>varchar(255)</entry><entry>Path of profile</entry></row>
1553                                 <row><entry>acct desc column</entry><entry>varchar(255)</entry><entry>Some ASCII NT user data</entry></row>
1554                                 <row><entry>workstations column</entry><entry>varchar(255)</entry><entry>Workstations user can logon to (or NULL for all)</entry></row>
1555                                 <row><entry>unknown string column</entry><entry>varchar(255)</entry><entry>Unknown string</entry></row>
1556                                 <row><entry>munged dial column</entry><entry>varchar(255)</entry><entry>Unknown</entry></row>
1557                                 <row><entry>user sid column</entry><entry>varchar(255)</entry><entry>NT user SID</entry></row>
1558                                 <row><entry>group sid column</entry><entry>varchar(255)</entry><entry>NT group SID</entry></row>
1559                                 <row><entry>lanman pass column</entry><entry>varchar(255)</entry><entry>Encrypted lanman password</entry></row>
1560                                 <row><entry>nt pass column</entry><entry>varchar(255)</entry><entry>Encrypted nt passwd</entry></row>
1561                                 <row><entry>plain pass column</entry><entry>varchar(255)</entry><entry>Plaintext password</entry></row>
1562                                 <row><entry>acct ctrl column</entry><entry>int(9)</entry><entry>NT user data</entry></row>
1563                                 <row><entry>unknown 3 column</entry><entry>int(9)</entry><entry>Unknown</entry></row>
1564                                 <row><entry>logon divs column</entry><entry>int(9)</entry><entry>Unknown</entry></row>
1565                                 <row><entry>hours len column</entry><entry>int(9)</entry><entry>Unknown</entry></row>
1566                                 <row><entry>bad password count column</entry><entry>int(5)</entry><entry>Number of failed password tries before disabling an account</entry></row>
1567                                 <row><entry>logon count column</entry><entry>int(5)</entry><entry>Number of logon attempts</entry></row>
1568                                 <row><entry>unknown 6 column</entry><entry>int(9)</entry><entry>Unknown</entry></row>
1569                         </tbody></tgroup>
1570                 </table>
1571                 </para>
1573                         <para>
1574                         You can put a colon (:) after the name of each column, which 
1575                         should specify the column to update when updating the table. You can also
1576                         specify nothing behind the colon. Then the field data will not be updated. Setting a column name to <parameter>NULL</parameter> means the field should not be used.
1577                         </para>
1579                         <para>An example configuration can be found in <link linkend="mysqlsam"/>.
1580                         </para>
1582                         <smbconfexample id="mysqlsam">
1583                                 <title>Example configuration for the MySQL passdb backend</title>
1584                         <smbconfsection>[global]</smbconfsection>
1585                         <smbconfoption><name>passdb backend</name><value>mysql:foo</value></smbconfoption>
1586                         <smbconfoption><name>foo:mysql user</name><value>samba</value></smbconfoption>
1587                         <smbconfoption><name>foo:mysql password</name><value>abmas</value></smbconfoption>
1588                         <smbconfoption><name>foo:mysql database</name><value>samba</value></smbconfoption>
1589                         <smbconfcomment>domain name is static and can't be changed</smbconfcomment>
1590                         <smbconfoption><name>foo:domain column</name><value>'MYWORKGROUP':</value></smbconfoption>
1591                         <smbconfcomment>The fullname column comes from several other columns</smbconfcomment>
1592                         <smbconfoption><name>foo:fullname column</name><value>CONCAT(firstname,' ',surname):</value></smbconfoption>
1593                         <smbconfcomment>Samba should never write to the password columns</smbconfcomment>
1594                         <smbconfoption><name>foo:lanman pass column</name><value>lm_pass:</value></smbconfoption>
1595                         <smbconfoption><name>foo:nt pass column</name><value>nt_pass:</value></smbconfoption>
1596                         <smbconfcomment>The unknown 3 column is not stored</smbconfcomment>
1597                         <smbconfoption><name>foo:unknown 3 column</name><value>NULL</value></smbconfoption>
1598                         </smbconfexample>
1599                 </sect3>
1601                 <sect3>
1602                 <title>Using Plaintext Passwords or Encrypted Password</title>
1604                         <para>
1605 <indexterm><primary>encrypted passwords</primary></indexterm>
1606                         I strongly discourage the use of plaintext passwords, however, you can use them.
1607                         </para>
1609                         <para>
1610                         If you would like to use plaintext passwords, set
1611                         `identifier:lanman pass column' and `identifier:nt pass column' to
1612                         `NULL' (without the quotes) and `identifier:plain pass column' to the
1613                         name of the column containing the plaintext passwords. 
1614                         </para>
1616                         <para>
1617                         If you use encrypted passwords, set the 'identifier:plain pass
1618                         column' to 'NULL' (without the quotes). This is the default.
1619                         </para>
1621                 </sect3>
1623                 <sect3>
1624                 <title>Getting Non-Column Data from the Table</title>
1626                         <para>
1627                         It is possible to have not all data in the database by making some `constant'.
1628                         </para>
1630                         <para>
1631                         For example, you can set `identifier:fullname column' to
1632                         something like <?latex \linebreak ?><command>CONCAT(Firstname,' ',Surname)</command>
1633                         </para>
1635                         <para>
1636                         Or, set `identifier:workstations column' to:
1637                         <command>NULL</command></para>
1639                         <para>See the MySQL documentation for more language constructs.</para>
1641                 </sect3>
1642         </sect2>
1644         <sect2 id="XMLpassdb">
1645         <title>XML</title>
1647         <para>
1648 <indexterm><primary>SAM backend</primary><secondary>xmlsam</secondary></indexterm>
1649                 This module requires libxml2 to be installed.</para>
1651                 <para>The usage of pdb_xml is fairly straightforward. To export data, use:
1652                 </para>
1654                 <para>
1655 <indexterm><primary>pdbedit</primary></indexterm>
1656                         <prompt>$ </prompt> <userinput>pdbedit -e xml:filename</userinput>
1657                 </para>
1659                 <para>
1660                 (where filename is the name of the file to put the data in)
1661                 </para>
1663                 <para>
1664                 To import data, use:
1665                 <prompt>$ </prompt> <userinput>pdbedit -i xml:filename</userinput>
1666                 </para>
1667         </sect2>
1668 </sect1>
1670 <sect1>
1671 <title>Common Errors</title>
1673         <sect2>
1674                 <title>Users Cannot Logon</title>
1676                 <para><quote>I've installed Samba, but now I can't log on with my UNIX account! </quote></para>
1678                 <para>Make sure your user has been added to the current Samba <smbconfoption><name>passdb backend</name></smbconfoption>. Read the section <link linkend="acctmgmttools"/> for details.</para>
1680         </sect2>
1682         <sect2>
1683         <title>Users Being Added to the Wrong Backend Database</title>
1685         <para>
1686         A few complaints have been received from users that just moved to Samba-3. The following
1687         &smb.conf; file entries were causing problems, new accounts were being added to the old
1688         smbpasswd file, not to the tdbsam passdb.tdb file:
1689         </para>
1691         <para>
1692         <smbconfblock>
1693         <smbconfsection>[global]</smbconfsection>
1694         <member>...</member>
1695         <smbconfoption><name>passdb backend</name><value>smbpasswd, tdbsam</value></smbconfoption>
1696         <member>...</member>
1697         </smbconfblock>
1698         </para>
1700         <para>
1701         Samba will add new accounts to the first entry in the <emphasis>passdb backend</emphasis>
1702         parameter entry. If you want to update to the tdbsam, then change the entry to:
1703         </para>
1705         <para>
1706 <smbconfblock>
1707 [globals]
1709 <smbconfoption><name>passdb backend</name><value>tdbsam, smbpasswd</value></smbconfoption>
1711 </smbconfblock>
1712         </para>
1714         </sect2>
1716         <sect2>
1717         <title>Configuration of <parameter>auth methods</parameter></title>
1719         <para>
1720         When explicitly setting an <smbconfoption><name>auth methods</name></smbconfoption> parameter,
1721         <parameter>guest</parameter> must be specified as the first entry on the line,
1722         for example, <smbconfoption><name>auth methods</name><value>guest sam</value></smbconfoption>.
1723         </para>
1725         <para>
1726         This is the exact opposite of the requirement for the <smbconfoption><name>passdb backend</name></smbconfoption>
1727         option, where it must be the <emphasis>LAST</emphasis> parameter on the line.
1728         </para>
1730         </sect2>
1732 </sect1>
1734 </chapter>