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