Regenerate docs
[nivanova/samba-autobuild/.git] / docs / htmldocs / passdb.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >User information database</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
9 REL="HOME"
10 TITLE="SAMBA Project Documentation"
11 HREF="samba-howto-collection.html"><LINK
12 REL="UP"
13 TITLE="General installation"
14 HREF="introduction.html"><LINK
15 REL="PREVIOUS"
16 TITLE="Quick Cross Subnet Browsing / Cross Workgroup Browsing guide"
17 HREF="browsing-quick.html"><LINK
18 REL="NEXT"
19 TITLE="Type of installation"
20 HREF="type.html"></HEAD
21 ><BODY
22 CLASS="CHAPTER"
23 BGCOLOR="#FFFFFF"
24 TEXT="#000000"
25 LINK="#0000FF"
26 VLINK="#840084"
27 ALINK="#0000FF"
28 ><DIV
29 CLASS="NAVHEADER"
30 ><TABLE
31 SUMMARY="Header navigation table"
32 WIDTH="100%"
33 BORDER="0"
34 CELLPADDING="0"
35 CELLSPACING="0"
36 ><TR
37 ><TH
38 COLSPAN="3"
39 ALIGN="center"
40 >SAMBA Project Documentation</TH
41 ></TR
42 ><TR
43 ><TD
44 WIDTH="10%"
45 ALIGN="left"
46 VALIGN="bottom"
47 ><A
48 HREF="browsing-quick.html"
49 ACCESSKEY="P"
50 >Prev</A
51 ></TD
52 ><TD
53 WIDTH="80%"
54 ALIGN="center"
55 VALIGN="bottom"
56 ></TD
57 ><TD
58 WIDTH="10%"
59 ALIGN="right"
60 VALIGN="bottom"
61 ><A
62 HREF="type.html"
63 ACCESSKEY="N"
64 >Next</A
65 ></TD
66 ></TR
67 ></TABLE
68 ><HR
69 ALIGN="LEFT"
70 WIDTH="100%"></DIV
71 ><DIV
72 CLASS="CHAPTER"
73 ><H1
74 ><A
75 NAME="PASSDB"
76 ></A
77 >Chapter 4. User information database</H1
78 ><DIV
79 CLASS="TOC"
80 ><DL
81 ><DT
82 ><B
83 >Table of Contents</B
84 ></DT
85 ><DT
86 >4.1. <A
87 HREF="passdb.html#AEN469"
88 >Introduction</A
89 ></DT
90 ><DT
91 >4.2. <A
92 HREF="passdb.html#AEN476"
93 >Important Notes About Security</A
94 ></DT
95 ><DD
96 ><DL
97 ><DT
98 >4.2.1. <A
99 HREF="passdb.html#AEN502"
100 >Advantages of SMB Encryption</A
101 ></DT
102 ><DT
103 >4.2.2. <A
104 HREF="passdb.html#AEN508"
105 >Advantages of non-encrypted passwords</A
106 ></DT
107 ></DL
108 ></DD
109 ><DT
110 >4.3. <A
111 HREF="passdb.html#AEN514"
112 >The smbpasswd Command</A
113 ></DT
114 ><DT
115 >4.4. <A
116 HREF="passdb.html#AEN545"
117 >Plain text</A
118 ></DT
119 ><DT
120 >4.5. <A
121 HREF="passdb.html#AEN550"
122 >TDB</A
123 ></DT
124 ><DT
125 >4.6. <A
126 HREF="passdb.html#AEN553"
127 >LDAP</A
128 ></DT
129 ><DD
130 ><DL
131 ><DT
132 >4.6.1. <A
133 HREF="passdb.html#AEN555"
134 >Introduction</A
135 ></DT
136 ><DT
137 >4.6.2. <A
138 HREF="passdb.html#AEN575"
139 >Introduction</A
140 ></DT
141 ><DT
142 >4.6.3. <A
143 HREF="passdb.html#AEN599"
144 >Supported LDAP Servers</A
145 ></DT
146 ><DT
147 >4.6.4. <A
148 HREF="passdb.html#AEN604"
149 >Schema and Relationship to the RFC 2307 posixAccount</A
150 ></DT
151 ><DT
152 >4.6.5. <A
153 HREF="passdb.html#AEN616"
154 >Configuring Samba with LDAP</A
155 ></DT
156 ><DD
157 ><DL
158 ><DT
159 >4.6.5.1. <A
160 HREF="passdb.html#AEN618"
161 >OpenLDAP configuration</A
162 ></DT
163 ><DT
164 >4.6.5.2. <A
165 HREF="passdb.html#AEN635"
166 >Configuring Samba</A
167 ></DT
168 ></DL
169 ></DD
170 ><DT
171 >4.6.6. <A
172 HREF="passdb.html#AEN663"
173 >Accounts and Groups management</A
174 ></DT
175 ><DT
176 >4.6.7. <A
177 HREF="passdb.html#AEN668"
178 >Security and sambaAccount</A
179 ></DT
180 ><DT
181 >4.6.8. <A
182 HREF="passdb.html#AEN688"
183 >LDAP specials attributes for sambaAccounts</A
184 ></DT
185 ><DT
186 >4.6.9. <A
187 HREF="passdb.html#AEN758"
188 >Example LDIF Entries for a sambaAccount</A
189 ></DT
190 ></DL
191 ></DD
192 ><DT
193 >4.7. <A
194 HREF="passdb.html#AEN766"
195 >MySQL</A
196 ></DT
197 ><DD
198 ><DL
199 ><DT
200 >4.7.1. <A
201 HREF="passdb.html#AEN768"
202 >Creating the database</A
203 ></DT
204 ><DT
205 >4.7.2. <A
206 HREF="passdb.html#AEN778"
207 >Configuring</A
208 ></DT
209 ><DT
210 >4.7.3. <A
211 HREF="passdb.html#AEN795"
212 >Using plaintext passwords or encrypted password</A
213 ></DT
214 ><DT
215 >4.7.4. <A
216 HREF="passdb.html#AEN800"
217 >Getting non-column data from the table</A
218 ></DT
219 ></DL
220 ></DD
221 ><DT
222 >4.8. <A
223 HREF="passdb.html#AEN808"
224 >XML</A
225 ></DT
226 ></DL
227 ></DIV
228 ><DIV
229 CLASS="SECT1"
230 ><H1
231 CLASS="SECT1"
232 ><A
233 NAME="AEN469"
234 >4.1. Introduction</A
235 ></H1
236 ><P
237 >Old windows clients send plain text passwords over the wire. 
238         Samba can check these passwords by crypting them and comparing them 
239         to the hash stored in the unix user database.
240         </P
241 ><P
242 >       Newer windows clients send encrypted passwords (so-called 
243         Lanman and NT hashes) over 
244         the wire, instead of plain text passwords. The newest clients 
245         will only send encrypted passwords and refuse to send plain text 
246         passwords, unless their registry is tweaked.
247         </P
248 ><P
249 >These passwords can't be converted to unix style encrypted 
250         passwords. Because of that you can't use the standard unix 
251         user database, and you have to store the Lanman and NT hashes 
252         somewhere else. </P
253 ><P
254 >Next to a differently encrypted passwords, 
255         windows also stores certain data for each user 
256         that is not stored in a unix user database, e.g. 
257         workstations the user may logon from, the location where his/her 
258         profile is stored, etc.
259         Samba retrieves and stores this information using a "passdb backend".
260         Commonly
261         available backends are LDAP, plain text file, MySQL and nisplus.
262         For more information, see the documentation about the 
263         <B
264 CLASS="COMMAND"
265 >passdb backend = </B
266 > parameter.
267         </P
268 ></DIV
269 ><DIV
270 CLASS="SECT1"
271 ><H1
272 CLASS="SECT1"
273 ><A
274 NAME="AEN476"
275 >4.2. Important Notes About Security</A
276 ></H1
277 ><P
278 >The unix and SMB password encryption techniques seem similar 
279         on the surface. This similarity is, however, only skin deep. The unix 
280         scheme typically sends clear text passwords over the network when 
281         logging in. This is bad. The SMB encryption scheme never sends the 
282         cleartext password over the network but it does store the 16 byte 
283         hashed values on disk. This is also bad. Why? Because the 16 byte hashed 
284         values are a "password equivalent". You cannot derive the user's 
285         password from them, but they could potentially be used in a modified 
286         client to gain access to a server. This would require considerable 
287         technical knowledge on behalf of the attacker but is perfectly possible. 
288         You should thus treat the data stored in whatever 
289         passdb backend you use (smbpasswd file, ldap, mysql) as though it contained the 
290         cleartext passwords of all your users. Its contents must be kept 
291         secret, and the file should be protected accordingly.</P
292 ><P
293 >Ideally we would like a password scheme which neither requires 
294         plain text passwords on the net or on disk. Unfortunately this 
295         is not available as Samba is stuck with being compatible with 
296         other SMB systems (WinNT, WfWg, Win95 etc). </P
297 ><DIV
298 CLASS="WARNING"
299 ><P
300 ></P
301 ><TABLE
302 CLASS="WARNING"
303 WIDTH="100%"
304 BORDER="0"
305 ><TR
306 ><TD
307 WIDTH="25"
308 ALIGN="CENTER"
309 VALIGN="TOP"
310 ><IMG
311 SRC="/usr/share/sgml/docbook/stylesheet/dsssl/modular/images/warning.gif"
312 HSPACE="5"
313 ALT="Warning"></TD
314 ><TD
315 ALIGN="LEFT"
316 VALIGN="TOP"
317 ><P
318 >Note that Windows NT 4.0 Service pack 3 changed the 
319                 default for permissible authentication so that plaintext 
320                 passwords are <SPAN
321 CLASS="emphasis"
322 ><I
323 CLASS="EMPHASIS"
324 >never</I
325 ></SPAN
326 > sent over the wire. 
327                 The solution to this is either to switch to encrypted passwords 
328                 with Samba or edit the Windows NT registry to re-enable plaintext 
329                 passwords. See the document WinNT.txt for details on how to do 
330                 this.</P
331 ><P
332 >Other Microsoft operating systems which also exhibit 
333                 this behavior includes</P
334 ><P
335 > These versions of MS Windows do not support full domain
336                 security protocols, although they may log onto a domain environment.
337                 Of these Only MS Windows XP Home does NOT support domain logons.</P
338 ><P
339 ></P
340 ><TABLE
341 BORDER="0"
342 ><TBODY
343 ><TR
344 ><TD
345 >MS DOS Network client 3.0 with 
346                         the basic network redirector installed</TD
347 ></TR
348 ><TR
349 ><TD
350 >Windows 95 with the network redirector 
351                         update installed</TD
352 ></TR
353 ><TR
354 ><TD
355 >Windows 98 [se]</TD
356 ></TR
357 ><TR
358 ><TD
359 >Windows Me</TD
360 ></TR
361 ><TR
362 ><TD
363 >Windows XP Home</TD
364 ></TR
365 ></TBODY
366 ></TABLE
367 ><P
368 ></P
369 ><P
370 > The following versions of MS Windows fully support domain
371                 security protocols.</P
372 ><P
373 ></P
374 ><TABLE
375 BORDER="0"
376 ><TBODY
377 ><TR
378 ><TD
379 >Windows NT 3.5x</TD
380 ></TR
381 ><TR
382 ><TD
383 >Windows NT 4.0</TD
384 ></TR
385 ><TR
386 ><TD
387 >Windows 2000 Professional</TD
388 ></TR
389 ><TR
390 ><TD
391 >Windows 200x Server/Advanced Server</TD
392 ></TR
393 ><TR
394 ><TD
395 >Windows XP Professional</TD
396 ></TR
397 ></TBODY
398 ></TABLE
399 ><P
400 ></P
401 ></TD
402 ></TR
403 ></TABLE
404 ></DIV
405 ><DIV
406 CLASS="NOTE"
407 ><P
408 ></P
409 ><TABLE
410 CLASS="NOTE"
411 WIDTH="100%"
412 BORDER="0"
413 ><TR
414 ><TD
415 WIDTH="25"
416 ALIGN="CENTER"
417 VALIGN="TOP"
418 ><IMG
419 SRC="/usr/share/sgml/docbook/stylesheet/dsssl/modular/images/note.gif"
420 HSPACE="5"
421 ALT="Note"></TD
422 ><TD
423 ALIGN="LEFT"
424 VALIGN="TOP"
425 ><P
426 >All current release of 
427         Microsoft SMB/CIFS clients support authentication via the
428         SMB Challenge/Response mechanism described here.  Enabling
429         clear text authentication does not disable the ability
430         of the client to participate in encrypted authentication.</P
431 ></TD
432 ></TR
433 ></TABLE
434 ></DIV
435 ><P
436 >MS Windows clients will cache the encrypted password alone.
437         Even when plain text passwords are re-enabled, through the appropriate
438         registry change, the plain text password is NEVER cached. This means that
439         in the event that a network connections should become disconnected (broken)
440         only the cached (encrypted) password will be sent to the resource server
441         to affect a auto-reconnect. If the resource server does not support encrypted
442         passwords the auto-reconnect will fail. <SPAN
443 CLASS="emphasis"
444 ><I
445 CLASS="EMPHASIS"
446 >USE OF ENCRYPTED PASSWORDS
447         IS STRONGLY ADVISED.</I
448 ></SPAN
449 ></P
450 ><DIV
451 CLASS="SECT2"
452 ><H2
453 CLASS="SECT2"
454 ><A
455 NAME="AEN502"
456 >4.2.1. Advantages of SMB Encryption</A
457 ></H2
458 ><P
459 ></P
460 ><TABLE
461 BORDER="0"
462 ><TBODY
463 ><TR
464 ><TD
465 >Plain text passwords are not passed across 
466                         the network. Someone using a network sniffer cannot just 
467                         record passwords going to the SMB server.</TD
468 ></TR
469 ><TR
470 ><TD
471 >WinNT doesn't like talking to a server 
472                         that SM not support encrypted passwords. It will refuse 
473                         to browse the server if the server is also in user level 
474                         security mode. It will insist on prompting the user for the 
475                         password on each connection, which is very annoying. The
476                         only things you can do to stop this is to use SMB encryption.
477                         </TD
478 ></TR
479 ><TR
480 ><TD
481 >Encrypted password support allows automatic share
482                         (resource) reconnects.</TD
483 ></TR
484 ></TBODY
485 ></TABLE
486 ><P
487 ></P
488 ></DIV
489 ><DIV
490 CLASS="SECT2"
491 ><H2
492 CLASS="SECT2"
493 ><A
494 NAME="AEN508"
495 >4.2.2. Advantages of non-encrypted passwords</A
496 ></H2
497 ><P
498 ></P
499 ><TABLE
500 BORDER="0"
501 ><TBODY
502 ><TR
503 ><TD
504 >Plain text passwords are not kept 
505                         on disk, and are NOT cached in memory. </TD
506 ></TR
507 ><TR
508 ><TD
509 >Uses same password file as other unix 
510                         services such as login and ftp</TD
511 ></TR
512 ><TR
513 ><TD
514 >Use of other services (such as telnet and ftp) which
515                         send plain text passwords over the net, so sending them for SMB
516                         isn't such a big deal.</TD
517 ></TR
518 ></TBODY
519 ></TABLE
520 ><P
521 ></P
522 ></DIV
523 ></DIV
524 ><DIV
525 CLASS="SECT1"
526 ><H1
527 CLASS="SECT1"
528 ><A
529 NAME="AEN514"
530 >4.3. The smbpasswd Command</A
531 ></H1
532 ><P
533 >The smbpasswd utility is a utility similar to the 
534         <B
535 CLASS="COMMAND"
536 >passwd</B
537 > or <B
538 CLASS="COMMAND"
539 >yppasswd</B
540 > programs.
541         It maintains the two 32 byte password fields in the passdb backend. </P
542 ><P
543 ><B
544 CLASS="COMMAND"
545 >smbpasswd</B
546 > works in a client-server mode 
547         where it contacts the local smbd to change the user's password on its 
548         behalf. This has enormous benefits - as follows.</P
549 ><P
550 ><B
551 CLASS="COMMAND"
552 >smbpasswd</B
553 > has the capability 
554         to change passwords on Windows NT servers (this only works when 
555         the request is sent to the NT Primary Domain Controller if you 
556         are changing an NT Domain user's password).</P
557 ><P
558 >To run smbpasswd as a normal user just type :</P
559 ><P
560 ><SAMP
561 CLASS="PROMPT"
562 >$ </SAMP
563 ><KBD
564 CLASS="USERINPUT"
565 >smbpasswd</KBD
566 ></P
567 ><P
568 ><SAMP
569 CLASS="PROMPT"
570 >Old SMB password: </SAMP
571 ><KBD
572 CLASS="USERINPUT"
573 >&#60;type old value here - 
574         or hit return if there was no old password&#62;</KBD
575 ></P
576 ><P
577 ><SAMP
578 CLASS="PROMPT"
579 >New SMB Password: </SAMP
580 ><KBD
581 CLASS="USERINPUT"
582 >&#60;type new value&#62;
583         </KBD
584 ></P
585 ><P
586 ><SAMP
587 CLASS="PROMPT"
588 >Repeat New SMB Password: </SAMP
589 ><KBD
590 CLASS="USERINPUT"
591 >&#60;re-type new value
592         </KBD
593 ></P
594 ><P
595 >If the old value does not match the current value stored for 
596         that user, or the two new values do not match each other, then the 
597         password will not be changed.</P
598 ><P
599 >If invoked by an ordinary user it will only allow the user 
600         to change his or her own Samba password.</P
601 ><P
602 >If run by the root user smbpasswd may take an optional 
603         argument, specifying the user name whose SMB password you wish to 
604         change.  Note that when run as root smbpasswd does not prompt for 
605         or check the old password value, thus allowing root to set passwords 
606         for users who have forgotten their passwords.</P
607 ><P
608 ><B
609 CLASS="COMMAND"
610 >smbpasswd</B
611 > is designed to work in the same way 
612         and be familiar to UNIX users who use the <B
613 CLASS="COMMAND"
614 >passwd</B
615 > or 
616         <B
617 CLASS="COMMAND"
618 >yppasswd</B
619 > commands.</P
620 ><P
621 >For more details on using <B
622 CLASS="COMMAND"
623 >smbpasswd</B
624 > refer 
625         to the man page which will always be the definitive reference.</P
626 ></DIV
627 ><DIV
628 CLASS="SECT1"
629 ><H1
630 CLASS="SECT1"
631 ><A
632 NAME="AEN545"
633 >4.4. Plain text</A
634 ></H1
635 ><P
636 >Older versions of samba retrieved user information from the unix user database 
637 and eventually some other fields from the file <TT
638 CLASS="FILENAME"
639 >/etc/samba/smbpasswd</TT
640 >
641 or <TT
642 CLASS="FILENAME"
643 >/etc/smbpasswd</TT
644 >. When password encryption is disabled, no 
645 data is stored at all.</P
646 ></DIV
647 ><DIV
648 CLASS="SECT1"
649 ><H1
650 CLASS="SECT1"
651 ><A
652 NAME="AEN550"
653 >4.5. TDB</A
654 ></H1
655 ><P
656 >Samba can also store the user data in a "TDB" (Trivial Database). Using this backend 
657 doesn't require any additional configuration. This backend is recommended for new installations who 
658 don't require LDAP.</P
659 ></DIV
660 ><DIV
661 CLASS="SECT1"
662 ><H1
663 CLASS="SECT1"
664 ><A
665 NAME="AEN553"
666 >4.6. LDAP</A
667 ></H1
668 ><DIV
669 CLASS="SECT2"
670 ><H2
671 CLASS="SECT2"
672 ><A
673 NAME="AEN555"
674 >4.6.1. Introduction</A
675 ></H2
676 ><P
677 >This document describes how to use an LDAP directory for storing Samba user
678 account information traditionally stored in the smbpasswd(5) file.  It is
679 assumed that the reader already has a basic understanding of LDAP concepts
680 and has a working directory server already installed.  For more information
681 on LDAP architectures and Directories, please refer to the following sites.</P
682 ><P
683 ></P
684 ><UL
685 ><LI
686 ><P
687 >OpenLDAP - <A
688 HREF="http://www.openldap.org/"
689 TARGET="_top"
690 >http://www.openldap.org/</A
691 ></P
692 ></LI
693 ><LI
694 ><P
695 >iPlanet Directory Server - <A
696 HREF="http://iplanet.netscape.com/directory"
697 TARGET="_top"
698 >http://iplanet.netscape.com/directory</A
699 ></P
700 ></LI
701 ></UL
702 ><P
703 >Note that <A
704 HREF="http://www.ora.com/"
705 TARGET="_top"
706 >O'Reilly Publishing</A
707 > is working on
708 a guide to LDAP for System Administrators which has a planned release date of
709 early summer, 2002.</P
710 ><P
711 >Two additional Samba resources which may prove to be helpful are</P
712 ><P
713 ></P
714 ><UL
715 ><LI
716 ><P
717 >The <A
718 HREF="http://www.unav.es/cti/ldap-smb/ldap-smb-3-howto.html"
719 TARGET="_top"
720 >Samba-PDC-LDAP-HOWTO</A
721 >
722         maintained by Ignacio Coupeau.</P
723 ></LI
724 ><LI
725 ><P
726 >The NT migration scripts from <A
727 HREF="http://samba.idealx.org/"
728 TARGET="_top"
729 >IDEALX</A
730 > that are
731         geared to manage users and group in such a Samba-LDAP Domain Controller configuration.
732         </P
733 ></LI
734 ></UL
735 ></DIV
736 ><DIV
737 CLASS="SECT2"
738 ><H2
739 CLASS="SECT2"
740 ><A
741 NAME="AEN575"
742 >4.6.2. Introduction</A
743 ></H2
744 ><P
745 >Traditionally, when configuring <A
746 HREF="smb.conf.5.html#ENCRYPTPASSWORDS"
747 TARGET="_top"
748 >"encrypt
749 passwords = yes"</A
750 > in Samba's <TT
751 CLASS="FILENAME"
752 >smb.conf</TT
753 > file, user account
754 information such as username, LM/NT password hashes, password change times, and account
755 flags have been stored in the <TT
756 CLASS="FILENAME"
757 >smbpasswd(5)</TT
758 > file.  There are several
759 disadvantages to this approach for sites with very large numbers of users (counted
760 in the thousands).</P
761 ><P
762 ></P
763 ><UL
764 ><LI
765 ><P
766 >The first is that all lookups must be performed sequentially.  Given that
767 there are approximately two lookups per domain logon (one for a normal
768 session connection such as when mapping a network drive or printer), this
769 is a performance bottleneck for lareg sites.  What is needed is an indexed approach
770 such as is used in databases.</P
771 ></LI
772 ><LI
773 ><P
774 >The second problem is that administrators who desired to replicate a
775 smbpasswd file to more than one Samba server were left to use external
776 tools such as <B
777 CLASS="COMMAND"
778 >rsync(1)</B
779 > and <B
780 CLASS="COMMAND"
781 >ssh(1)</B
782 >
783 and wrote custom, in-house scripts.</P
784 ></LI
785 ><LI
786 ><P
787 >And finally, the amount of information which is stored in an
788 smbpasswd entry leaves no room for additional attributes such as
789 a home directory, password expiration time, or even a Relative
790 Identified (RID).</P
791 ></LI
792 ></UL
793 ><P
794 >As a result of these defeciencies, a more robust means of storing user attributes
795 used by smbd was developed.  The API which defines access to user accounts
796 is commonly referred to as the samdb interface (previously this was called the passdb
797 API, and is still so named in the CVS trees). </P
798 ><P
799 >There are a few points to stress about what the ldapsam
800 does not provide.  The LDAP support referred to in the this documentation does not
801 include:</P
802 ><P
803 ></P
804 ><UL
805 ><LI
806 ><P
807 >A means of retrieving user account information from
808         an Windows 2000 Active Directory server.</P
809 ></LI
810 ><LI
811 ><P
812 >A means of replacing /etc/passwd.</P
813 ></LI
814 ></UL
815 ><P
816 >The second item can be accomplished by using LDAP NSS and PAM modules.  LGPL
817 versions of these libraries can be obtained from PADL Software
818 (<A
819 HREF="http://www.padl.com/"
820 TARGET="_top"
821 >http://www.padl.com/</A
822 >).  However,
823 the details of configuring these packages are beyond the scope of this document.</P
824 ></DIV
825 ><DIV
826 CLASS="SECT2"
827 ><H2
828 CLASS="SECT2"
829 ><A
830 NAME="AEN599"
831 >4.6.3. Supported LDAP Servers</A
832 ></H2
833 ><P
834 >The LDAP samdb code in 2.2.3 (and later) has been developed and tested
835 using the OpenLDAP 2.0 server and client libraries. 
836 The same code should be able to work with Netscape's Directory Server
837 and client SDK. However, due to lack of testing so far, there are bound
838 to be compile errors and bugs.  These should not be hard to fix.
839 If you are so inclined, please be sure to forward all patches to
840 <A
841 HREF="mailto:samba-patches@samba.org"
842 TARGET="_top"
843 >samba-patches@samba.org</A
844 > and
845 <A
846 HREF="mailto:jerry@samba.org"
847 TARGET="_top"
848 >jerry@samba.org</A
849 >.</P
850 ></DIV
851 ><DIV
852 CLASS="SECT2"
853 ><H2
854 CLASS="SECT2"
855 ><A
856 NAME="AEN604"
857 >4.6.4. Schema and Relationship to the RFC 2307 posixAccount</A
858 ></H2
859 ><P
860 >Samba 3.0 includes the necessary schema file for OpenLDAP 2.0 in
861 <TT
862 CLASS="FILENAME"
863 >examples/LDAP/samba.schema</TT
864 >.  The sambaAccount objectclass is given here:</P
865 ><P
866 ><PRE
867 CLASS="PROGRAMLISTING"
868 >objectclass ( 1.3.1.5.1.4.1.7165.2.2.2 NAME 'sambaAccount' SUP top STRUCTURAL
869      DESC 'Samba Account'
870      MUST ( uid $ rid )
871      MAY  ( cn $ lmPassword $ ntPassword $ pwdLastSet $ logonTime $
872             logoffTime $ kickoffTime $ pwdCanChange $ pwdMustChange $ acctFlags $
873             displayName $ smbHome $ homeDrive $ scriptPath $ profilePath $
874             description $ userWorkstations $ primaryGroupID $ domain ))</PRE
875 ></P
876 ><P
877 >The samba.schema file has been formatted for OpenLDAP 2.0.  The OID's are
878 owned by the Samba Team and as such is legal to be openly published.
879 If you translate the schema to be used with Netscape DS, please
880 submit the modified schema file as a patch to <A
881 HREF="mailto:jerry@samba.org"
882 TARGET="_top"
883 >jerry@samba.org</A
884 ></P
885 ><P
886 >Just as the smbpasswd file is mean to store information which supplements a
887 user's <TT
888 CLASS="FILENAME"
889 >/etc/passwd</TT
890 > entry, so is the sambaAccount object
891 meant to supplement the UNIX user account information.  A sambaAccount is a
892 <CODE
893 CLASS="CONSTANT"
894 >STRUCTURAL</CODE
895 > objectclass so it can be stored individually
896 in the directory.  However, there are several fields (e.g. uid) which overlap
897 with the posixAccount objectclass outlined in RFC2307.  This is by design.</P
898 ><P
899 >In order to store all user account information (UNIX and Samba) in the directory,
900 it is necessary to use the sambaAccount and posixAccount objectclasses in
901 combination.  However, smbd will still obtain the user's UNIX account
902 information via the standard C library calls (e.g. getpwnam(), et. al.).
903 This means that the Samba server must also have the LDAP NSS library installed
904 and functioning correctly.  This division of information makes it possible to
905 store all Samba account information in LDAP, but still maintain UNIX account
906 information in NIS while the network is transitioning to a full LDAP infrastructure.</P
907 ></DIV
908 ><DIV
909 CLASS="SECT2"
910 ><H2
911 CLASS="SECT2"
912 ><A
913 NAME="AEN616"
914 >4.6.5. Configuring Samba with LDAP</A
915 ></H2
916 ><DIV
917 CLASS="SECT3"
918 ><H3
919 CLASS="SECT3"
920 ><A
921 NAME="AEN618"
922 >4.6.5.1. OpenLDAP configuration</A
923 ></H3
924 ><P
925 >To include support for the sambaAccount object in an OpenLDAP directory
926 server, first copy the samba.schema file to slapd's configuration directory.</P
927 ><P
928 ><SAMP
929 CLASS="PROMPT"
930 >root# </SAMP
931 ><KBD
932 CLASS="USERINPUT"
933 >cp samba.schema /etc/openldap/schema/</KBD
934 ></P
935 ><P
936 >Next, include the <TT
937 CLASS="FILENAME"
938 >samba.schema</TT
939 > file in <TT
940 CLASS="FILENAME"
941 >slapd.conf</TT
942 >.
943 The sambaAccount object contains two attributes which depend upon other schema
944 files.  The 'uid' attribute is defined in <TT
945 CLASS="FILENAME"
946 >cosine.schema</TT
947 > and
948 the 'displayName' attribute is defined in the <TT
949 CLASS="FILENAME"
950 >inetorgperson.schema</TT
951 >
952 file.  Both of these must be included before the <TT
953 CLASS="FILENAME"
954 >samba.schema</TT
955 > file.</P
956 ><P
957 ><PRE
958 CLASS="PROGRAMLISTING"
959 >## /etc/openldap/slapd.conf
960
961 ## schema files (core.schema is required by default)
962 include            /etc/openldap/schema/core.schema
963
964 ## needed for sambaAccount
965 include            /etc/openldap/schema/cosine.schema
966 include            /etc/openldap/schema/inetorgperson.schema
967 include            /etc/openldap/schema/samba.schema
968 include            /etc/openldap/schema/nis.schema
969
970 ....</PRE
971 ></P
972 ><P
973 >It is recommended that you maintain some indices on some of the most usefull attributes,
974 like in the following example, to speed up searches made on sambaAccount objectclasses
975 (and possibly posixAccount and posixGroup as well).</P
976 ><P
977 ><PRE
978 CLASS="PROGRAMLISTING"
979 ># Indices to maintain
980 ## required by OpenLDAP 2.0
981 index objectclass   eq
982
983 ## support pb_getsampwnam()
984 index uid           pres,eq
985 ## support pdb_getsambapwrid()
986 index rid           eq
987
988 ## uncomment these if you are storing posixAccount and
989 ## posixGroup entries in the directory as well
990 ##index uidNumber     eq
991 ##index gidNumber     eq
992 ##index cn            eq
993 ##index memberUid     eq</PRE
994 ></P
995 ></DIV
996 ><DIV
997 CLASS="SECT3"
998 ><H3
999 CLASS="SECT3"
1000 ><A
1001 NAME="AEN635"
1002 >4.6.5.2. Configuring Samba</A
1003 ></H3
1004 ><P
1005 >The following parameters are available in smb.conf only with <VAR
1006 CLASS="PARAMETER"
1007 >--with-ldapsam</VAR
1008 >
1009 was included with compiling Samba.</P
1010 ><P
1011 ></P
1012 ><UL
1013 ><LI
1014 ><P
1015 ><A
1016 HREF="smb.conf.5.html#LDAPSSL"
1017 TARGET="_top"
1018 >ldap ssl</A
1019 ></P
1020 ></LI
1021 ><LI
1022 ><P
1023 ><A
1024 HREF="smb.conf.5.html#LDAPSERVER"
1025 TARGET="_top"
1026 >ldap server</A
1027 ></P
1028 ></LI
1029 ><LI
1030 ><P
1031 ><A
1032 HREF="smb.conf.5.html#LDAPADMINDN"
1033 TARGET="_top"
1034 >ldap admin dn</A
1035 ></P
1036 ></LI
1037 ><LI
1038 ><P
1039 ><A
1040 HREF="smb.conf.5.html#LDAPSUFFIX"
1041 TARGET="_top"
1042 >ldap suffix</A
1043 ></P
1044 ></LI
1045 ><LI
1046 ><P
1047 ><A
1048 HREF="smb.conf.5.html#LDAPFILTER"
1049 TARGET="_top"
1050 >ldap filter</A
1051 ></P
1052 ></LI
1053 ><LI
1054 ><P
1055 ><A
1056 HREF="smb.conf.5.html#LDAPPORT"
1057 TARGET="_top"
1058 >ldap port</A
1059 ></P
1060 ></LI
1061 ></UL
1062 ><P
1063 >These are described in the <A
1064 HREF="smb.conf.5.html"
1065 TARGET="_top"
1066 >smb.conf(5)</A
1067 > man
1068 page and so will not be repeated here.  However, a sample smb.conf file for
1069 use with an LDAP directory could appear as</P
1070 ><P
1071 ><PRE
1072 CLASS="PROGRAMLISTING"
1073 >## /usr/local/samba/lib/smb.conf
1074 [global]
1075      security = user
1076      encrypt passwords = yes
1077
1078      netbios name = TASHTEGO
1079      workgroup = NARNIA
1080
1081      # ldap related parameters
1082
1083      # define the DN to use when binding to the directory servers
1084      # The password for this DN is not stored in smb.conf.  Rather it
1085      # must be set by using 'smbpasswd -w <VAR
1086 CLASS="REPLACEABLE"
1087 >secretpw</VAR
1088 >' to store the
1089      # passphrase in the secrets.tdb file.  If the "ldap admin dn" values
1090      # changes, this password will need to be reset.
1091      ldap admin dn = "cn=Samba Manager,ou=people,dc=samba,dc=org"
1092
1093      #  specify the LDAP server's hostname (defaults to locahost)
1094      ldap server = ahab.samba.org
1095
1096      # Define the SSL option when connecting to the directory
1097      # ('off', 'start tls', or 'on' (default))
1098      ldap ssl = start tls
1099
1100      # define the port to use in the LDAP session (defaults to 636 when
1101      # "ldap ssl = on")
1102      ldap port = 389
1103
1104      # specify the base DN to use when searching the directory
1105      ldap suffix = "ou=people,dc=samba,dc=org"
1106
1107      # generally the default ldap search filter is ok
1108      # ldap filter = "(&#38;(uid=%u)(objectclass=sambaAccount))"</PRE
1109 ></P
1110 ></DIV
1111 ></DIV
1112 ><DIV
1113 CLASS="SECT2"
1114 ><H2
1115 CLASS="SECT2"
1116 ><A
1117 NAME="AEN663"
1118 >4.6.6. Accounts and Groups management</A
1119 ></H2
1120 ><P
1121 >As users accounts are managed thru the sambaAccount objectclass, you should
1122 modify you existing administration tools to deal with sambaAccount attributes.</P
1123 ><P
1124 >Machines accounts are managed with the sambaAccount objectclass, just
1125 like users accounts. However, it's up to you to stored thoses accounts
1126 in a different tree of you LDAP namespace: you should use
1127 "ou=Groups,dc=plainjoe,dc=org" to store groups and
1128 "ou=People,dc=plainjoe,dc=org" to store users. Just configure your
1129 NSS and PAM accordingly (usually, in the /etc/ldap.conf configuration
1130 file).</P
1131 ><P
1132 >In Samba release 3.0, the group management system is based on posix
1133 groups. This means that Samba make usage of the posixGroup objectclass.
1134 For now, there is no NT-like group system management (global and local
1135 groups).</P
1136 ></DIV
1137 ><DIV
1138 CLASS="SECT2"
1139 ><H2
1140 CLASS="SECT2"
1141 ><A
1142 NAME="AEN668"
1143 >4.6.7. Security and sambaAccount</A
1144 ></H2
1145 ><P
1146 >There are two important points to remember when discussing the security
1147 of sambaAccount entries in the directory.</P
1148 ><P
1149 ></P
1150 ><UL
1151 ><LI
1152 ><P
1153 ><SPAN
1154 CLASS="emphasis"
1155 ><I
1156 CLASS="EMPHASIS"
1157 >Never</I
1158 ></SPAN
1159 > retrieve the lmPassword or
1160         ntPassword attribute values over an unencrypted LDAP session.</P
1161 ></LI
1162 ><LI
1163 ><P
1164 ><SPAN
1165 CLASS="emphasis"
1166 ><I
1167 CLASS="EMPHASIS"
1168 >Never</I
1169 ></SPAN
1170 > allow non-admin users to
1171         view the lmPassword or ntPassword attribute values.</P
1172 ></LI
1173 ></UL
1174 ><P
1175 >These password hashes are clear text equivalents and can be used to impersonate
1176 the user without deriving the original clear text strings.  For more information
1177 on the details of LM/NT password hashes, refer to the <A
1178 HREF="passdb.html"
1179 >User Database</A
1180 > of the Samba-HOWTO-Collection.</P
1181 ><P
1182 >To remedy the first security issue, the "ldap ssl" smb.conf parameter defaults
1183 to require an encrypted session (<B
1184 CLASS="COMMAND"
1185 >ldap ssl = on</B
1186 >) using
1187 the default port of 636
1188 when contacting the directory server.  When using an OpenLDAP 2.0 server, it
1189 is possible to use the use the StartTLS LDAP extended  operation in the place of
1190 LDAPS.  In either case, you are strongly discouraged to disable this security
1191 (<B
1192 CLASS="COMMAND"
1193 >ldap ssl = off</B
1194 >).</P
1195 ><P
1196 >Note that the LDAPS protocol is deprecated in favor of the LDAPv3 StartTLS
1197 extended operation.  However, the OpenLDAP library still provides support for
1198 the older method of securing communication between clients and servers.</P
1199 ><P
1200 >The second security precaution is to prevent non-administrative users from
1201 harvesting password hashes from the directory.  This can be done using the
1202 following ACL in <TT
1203 CLASS="FILENAME"
1204 >slapd.conf</TT
1205 >:</P
1206 ><P
1207 ><PRE
1208 CLASS="PROGRAMLISTING"
1209 >## allow the "ldap admin dn" access, but deny everyone else
1210 access to attrs=lmPassword,ntPassword
1211      by dn="cn=Samba Admin,ou=people,dc=plainjoe,dc=org" write
1212      by * none</PRE
1213 ></P
1214 ></DIV
1215 ><DIV
1216 CLASS="SECT2"
1217 ><H2
1218 CLASS="SECT2"
1219 ><A
1220 NAME="AEN688"
1221 >4.6.8. LDAP specials attributes for sambaAccounts</A
1222 ></H2
1223 ><P
1224 >The sambaAccount objectclass is composed of the following attributes:</P
1225 ><P
1226 ></P
1227 ><UL
1228 ><LI
1229 ><P
1230 ><CODE
1231 CLASS="CONSTANT"
1232 >lmPassword</CODE
1233 >: the LANMAN password 16-byte hash stored as a character
1234         representation of a hexidecimal string.</P
1235 ></LI
1236 ><LI
1237 ><P
1238 ><CODE
1239 CLASS="CONSTANT"
1240 >ntPassword</CODE
1241 >: the NT password hash 16-byte stored as a character
1242         representation of a hexidecimal string.</P
1243 ></LI
1244 ><LI
1245 ><P
1246 ><CODE
1247 CLASS="CONSTANT"
1248 >pwdLastSet</CODE
1249 >: The integer time in seconds since 1970 when the
1250         <CODE
1251 CLASS="CONSTANT"
1252 >lmPassword</CODE
1253 > and <CODE
1254 CLASS="CONSTANT"
1255 >ntPassword</CODE
1256 > attributes were last set.
1257         </P
1258 ></LI
1259 ><LI
1260 ><P
1261 ><CODE
1262 CLASS="CONSTANT"
1263 >acctFlags</CODE
1264 >: string of 11 characters surrounded by square brackets []
1265         representing account flags such as U (user), W(workstation), X(no password expiration), and
1266         D(disabled).</P
1267 ></LI
1268 ><LI
1269 ><P
1270 ><CODE
1271 CLASS="CONSTANT"
1272 >logonTime</CODE
1273 >: Integer value currently unused</P
1274 ></LI
1275 ><LI
1276 ><P
1277 ><CODE
1278 CLASS="CONSTANT"
1279 >logoffTime</CODE
1280 >: Integer value currently unused</P
1281 ></LI
1282 ><LI
1283 ><P
1284 ><CODE
1285 CLASS="CONSTANT"
1286 >kickoffTime</CODE
1287 >: Integer value currently unused</P
1288 ></LI
1289 ><LI
1290 ><P
1291 ><CODE
1292 CLASS="CONSTANT"
1293 >pwdCanChange</CODE
1294 >: Integer value currently unused</P
1295 ></LI
1296 ><LI
1297 ><P
1298 ><CODE
1299 CLASS="CONSTANT"
1300 >pwdMustChange</CODE
1301 >: Integer value currently unused</P
1302 ></LI
1303 ><LI
1304 ><P
1305 ><CODE
1306 CLASS="CONSTANT"
1307 >homeDrive</CODE
1308 >: specifies the drive letter to which to map the
1309         UNC path specified by homeDirectory. The drive letter must be specified in the form "X:"
1310         where X is the letter of the drive to map. Refer to the "logon drive" parameter in the
1311         smb.conf(5) man page for more information.</P
1312 ></LI
1313 ><LI
1314 ><P
1315 ><CODE
1316 CLASS="CONSTANT"
1317 >scriptPath</CODE
1318 >: The scriptPath property specifies the path of
1319         the user's logon script, .CMD, .EXE, or .BAT file. The string can be null. The path
1320         is relative to the netlogon share.  Refer to the "logon script" parameter in the
1321         smb.conf(5) man page for more information.</P
1322 ></LI
1323 ><LI
1324 ><P
1325 ><CODE
1326 CLASS="CONSTANT"
1327 >profilePath</CODE
1328 >: specifies a path to the user's profile.
1329         This value can be a null string, a local absolute path, or a UNC path.  Refer to the
1330         "logon path" parameter in the smb.conf(5) man page for more information.</P
1331 ></LI
1332 ><LI
1333 ><P
1334 ><CODE
1335 CLASS="CONSTANT"
1336 >smbHome</CODE
1337 >: The homeDirectory property specifies the path of
1338         the home directory for the user. The string can be null. If homeDrive is set and specifies
1339         a drive letter, homeDirectory should be a UNC path. The path must be a network
1340         UNC path of the form \\server\share\directory. This value can be a null string.
1341         Refer to the "logon home" parameter in the smb.conf(5) man page for more information.
1342         </P
1343 ></LI
1344 ><LI
1345 ><P
1346 ><CODE
1347 CLASS="CONSTANT"
1348 >userWorkstation</CODE
1349 >: character string value currently unused.
1350         </P
1351 ></LI
1352 ><LI
1353 ><P
1354 ><CODE
1355 CLASS="CONSTANT"
1356 >rid</CODE
1357 >: the integer representation of the user's relative identifier
1358         (RID).</P
1359 ></LI
1360 ><LI
1361 ><P
1362 ><CODE
1363 CLASS="CONSTANT"
1364 >primaryGroupID</CODE
1365 >: the relative identifier (RID) of the primary group
1366         of the user.</P
1367 ></LI
1368 ></UL
1369 ><P
1370 >The majority of these parameters are only used when Samba is acting as a PDC of
1371 a domain (refer to the <A
1372 HREF="Samba-PDC-HOWTO.html"
1373 TARGET="_top"
1374 >Samba-PDC-HOWTO</A
1375 > for details on
1376 how to configure Samba as a Primary Domain Controller). The following four attributes
1377 are only stored with the sambaAccount entry if the values are non-default values:</P
1378 ><P
1379 ></P
1380 ><UL
1381 ><LI
1382 ><P
1383 >smbHome</P
1384 ></LI
1385 ><LI
1386 ><P
1387 >scriptPath</P
1388 ></LI
1389 ><LI
1390 ><P
1391 >logonPath</P
1392 ></LI
1393 ><LI
1394 ><P
1395 >homeDrive</P
1396 ></LI
1397 ></UL
1398 ><P
1399 >These attributes are only stored with the sambaAccount entry if
1400 the values are non-default values.  For example, assume TASHTEGO has now been
1401 configured as a PDC and that <B
1402 CLASS="COMMAND"
1403 >logon home = \\%L\%u</B
1404 > was defined in
1405 its <TT
1406 CLASS="FILENAME"
1407 >smb.conf</TT
1408 > file. When a user named "becky" logons to the domain,
1409 the <VAR
1410 CLASS="PARAMETER"
1411 >logon home</VAR
1412 > string is expanded to \\TASHTEGO\becky.
1413 If the smbHome attribute exists in the entry "uid=becky,ou=people,dc=samba,dc=org",
1414 this value is used.  However, if this attribute does not exist, then the value
1415 of the <VAR
1416 CLASS="PARAMETER"
1417 >logon home</VAR
1418 > parameter is used in its place.  Samba
1419 will only write the attribute value to the directory entry is the value is
1420 something other than the default (e.g. \\MOBY\becky).</P
1421 ></DIV
1422 ><DIV
1423 CLASS="SECT2"
1424 ><H2
1425 CLASS="SECT2"
1426 ><A
1427 NAME="AEN758"
1428 >4.6.9. Example LDIF Entries for a sambaAccount</A
1429 ></H2
1430 ><P
1431 >The following is a working LDIF with the inclusion of the posixAccount objectclass:</P
1432 ><P
1433 ><PRE
1434 CLASS="PROGRAMLISTING"
1435 >dn: uid=guest2, ou=people,dc=plainjoe,dc=org
1436 ntPassword: 878D8014606CDA29677A44EFA1353FC7
1437 pwdMustChange: 2147483647
1438 primaryGroupID: 1201
1439 lmPassword: 552902031BEDE9EFAAD3B435B51404EE
1440 pwdLastSet: 1010179124
1441 logonTime: 0
1442 objectClass: sambaAccount
1443 uid: guest2
1444 kickoffTime: 2147483647
1445 acctFlags: [UX         ]
1446 logoffTime: 2147483647
1447 rid: 19006
1448 pwdCanChange: 0</PRE
1449 ></P
1450 ><P
1451 >The following is an LDIF entry for using both the sambaAccount and
1452 posixAccount objectclasses:</P
1453 ><P
1454 ><PRE
1455 CLASS="PROGRAMLISTING"
1456 >dn: uid=gcarter, ou=people,dc=plainjoe,dc=org
1457 logonTime: 0
1458 displayName: Gerald Carter
1459 lmPassword: 552902031BEDE9EFAAD3B435B51404EE
1460 primaryGroupID: 1201
1461 objectClass: posixAccount
1462 objectClass: sambaAccount
1463 acctFlags: [UX         ]
1464 userPassword: {crypt}BpM2ej8Rkzogo
1465 uid: gcarter
1466 uidNumber: 9000
1467 cn: Gerald Carter
1468 loginShell: /bin/bash
1469 logoffTime: 2147483647
1470 gidNumber: 100
1471 kickoffTime: 2147483647
1472 pwdLastSet: 1010179230
1473 rid: 19000
1474 homeDirectory: /home/tashtego/gcarter
1475 pwdCanChange: 0
1476 pwdMustChange: 2147483647
1477 ntPassword: 878D8014606CDA29677A44EFA1353FC7</PRE
1478 ></P
1479 ></DIV
1480 ></DIV
1481 ><DIV
1482 CLASS="SECT1"
1483 ><H1
1484 CLASS="SECT1"
1485 ><A
1486 NAME="AEN766"
1487 >4.7. MySQL</A
1488 ></H1
1489 ><DIV
1490 CLASS="SECT2"
1491 ><H2
1492 CLASS="SECT2"
1493 ><A
1494 NAME="AEN768"
1495 >4.7.1. Creating the database</A
1496 ></H2
1497 ><P
1498 >You either can set up your own table and specify the field names to pdb_mysql (see below
1499 for the column names) or use the default table. The file <TT
1500 CLASS="FILENAME"
1501 >examples/pdb/mysql/mysql.dump</TT
1502
1503 contains the correct queries to create the required tables. Use the command :
1504
1505 <B
1506 CLASS="COMMAND"
1507 >mysql -u<VAR
1508 CLASS="REPLACEABLE"
1509 >username</VAR
1510 > -h<VAR
1511 CLASS="REPLACEABLE"
1512 >hostname</VAR
1513 > -p<VAR
1514 CLASS="REPLACEABLE"
1515 >password</VAR
1516 > <VAR
1517 CLASS="REPLACEABLE"
1518 >databasename</VAR
1519 > &#60; <TT
1520 CLASS="FILENAME"
1521 >/path/to/samba/examples/pdb/mysql/mysql.dump</TT
1522 ></B
1523 >&#13;</P
1524 ></DIV
1525 ><DIV
1526 CLASS="SECT2"
1527 ><H2
1528 CLASS="SECT2"
1529 ><A
1530 NAME="AEN778"
1531 >4.7.2. Configuring</A
1532 ></H2
1533 ><P
1534 >This plugin lacks some good documentation, but here is some short info:</P
1535 ><P
1536 >Add a the following to the <B
1537 CLASS="COMMAND"
1538 >passdb backend</B
1539 > variable in your <TT
1540 CLASS="FILENAME"
1541 >smb.conf</TT
1542 >:
1543 <PRE
1544 CLASS="PROGRAMLISTING"
1545 >passdb backend = [other-plugins] mysql:identifier [other-plugins]</PRE
1546 ></P
1547 ><P
1548 >The identifier can be any string you like, as long as it doesn't collide with 
1549 the identifiers of other plugins or other instances of pdb_mysql. If you 
1550 specify multiple pdb_mysql.so entries in 'passdb backend', you also need to 
1551 use different identifiers!</P
1552 ><P
1553 >Additional options can be given thru the smb.conf file in the [global] section.</P
1554 ><P
1555 ><PRE
1556 CLASS="PROGRAMLISTING"
1557 >identifier:mysql host                     - host name, defaults to 'localhost'
1558 identifier:mysql password
1559 identifier:mysql user                     - defaults to 'samba'
1560 identifier:mysql database                 - defaults to 'samba'
1561 identifier:mysql port                     - defaults to 3306
1562 identifier:table                          - Name of the table containing users</PRE
1563 ></P
1564 ><DIV
1565 CLASS="WARNING"
1566 ><P
1567 ></P
1568 ><TABLE
1569 CLASS="WARNING"
1570 WIDTH="100%"
1571 BORDER="0"
1572 ><TR
1573 ><TD
1574 WIDTH="25"
1575 ALIGN="CENTER"
1576 VALIGN="TOP"
1577 ><IMG
1578 SRC="/usr/share/sgml/docbook/stylesheet/dsssl/modular/images/warning.gif"
1579 HSPACE="5"
1580 ALT="Warning"></TD
1581 ><TD
1582 ALIGN="LEFT"
1583 VALIGN="TOP"
1584 ><P
1585 >Since the password for the mysql user is stored in the 
1586 smb.conf file, you should make the the smb.conf file 
1587 readable only to the user that runs samba. This is considered a security 
1588 bug and will be fixed soon.</P
1589 ></TD
1590 ></TR
1591 ></TABLE
1592 ></DIV
1593 ><P
1594 >Names of the columns in this table(I've added column types those columns should have first):</P
1595 ><P
1596 ><PRE
1597 CLASS="PROGRAMLISTING"
1598 >identifier:logon time column             - int(9)
1599 identifier:logoff time column            - int(9)
1600 identifier:kickoff time column           - int(9)
1601 identifier:pass last set time column     - int(9)
1602 identifier:pass can change time column   - int(9)
1603 identifier:pass must change time column  - int(9)
1604 identifier:username column               - varchar(255) - unix username
1605 identifier:domain column                 - varchar(255) - NT domain user is part of
1606 identifier:nt username column            - varchar(255) - NT username
1607 identifier:fullname column            - varchar(255) - Full name of user
1608 identifier:home dir column               - varchar(255) - Unix homedir path
1609 identifier:dir drive column              - varchar(2) - Directory drive path (eg: 'H:')
1610 identifier:logon script column           - varchar(255) - Batch file to run on client side when logging on
1611 identifier:profile path column           - varchar(255) - Path of profile
1612 identifier:acct desc column              - varchar(255) - Some ASCII NT user data
1613 identifier:workstations column           - varchar(255) - Workstations user can logon to (or NULL for all)
1614 identifier:unknown string column         - varchar(255) - unknown string
1615 identifier:munged dial column            - varchar(255) - ?
1616 identifier:uid column                    - int(9) - Unix user ID (uid)
1617 identifier:gid column                    - int(9) - Unix user group (gid)
1618 identifier:user sid column               - varchar(255) - NT user SID
1619 identifier:group sid column              - varchar(255) - NT group ID
1620 identifier:lanman pass column            - varchar(255) - encrypted lanman password
1621 identifier:nt pass column                - varchar(255) - encrypted nt passwd
1622 identifier:plain pass column             - varchar(255) - plaintext password
1623 identifier:acct control column           - int(9) - nt user data
1624 identifier:unknown 3 column              - int(9) - unknown
1625 identifier:logon divs column             - int(9) - ?
1626 identifier:hours len column              - int(9) - ?
1627 identifier:unknown 5 column              - int(9) - unknown
1628 identifier:unknown 6 column              - int(9) - unknown</PRE
1629 ></P
1630 ><P
1631 >Eventually, you can put a colon (:) after the name of each column, which 
1632 should specify the column to update when updating the table. You can also
1633 specify nothing behind the colon - then the data from the field will not be 
1634 updated. </P
1635 ></DIV
1636 ><DIV
1637 CLASS="SECT2"
1638 ><H2
1639 CLASS="SECT2"
1640 ><A
1641 NAME="AEN795"
1642 >4.7.3. Using plaintext passwords or encrypted password</A
1643 ></H2
1644 ><P
1645 >I strongly discourage the use of plaintext passwords, however, you can use them:</P
1646 ><P
1647 >If you would like to use plaintext passwords, set 'identifier:lanman pass column' and 'identifier:nt pass column' to 'NULL' (without the quotes) and 'identifier:plain pass column' to the name of the column containing the plaintext passwords. </P
1648 ><P
1649 >If you use encrypted passwords, set the 'identifier:plain pass column' to 'NULL' (without the quotes). This is the default.</P
1650 ></DIV
1651 ><DIV
1652 CLASS="SECT2"
1653 ><H2
1654 CLASS="SECT2"
1655 ><A
1656 NAME="AEN800"
1657 >4.7.4. Getting non-column data from the table</A
1658 ></H2
1659 ><P
1660 >It is possible to have not all data in the database and making some 'constant'.</P
1661 ><P
1662 >For example, you can set 'identifier:fullname column' to : 
1663 <B
1664 CLASS="COMMAND"
1665 >CONCAT(First_name,' ',Sur_name)</B
1666 ></P
1667 ><P
1668 >Or, set 'identifier:workstations column' to :
1669 <B
1670 CLASS="COMMAND"
1671 >NULL</B
1672 ></P
1673 ><P
1674 >See the MySQL documentation for more language constructs.</P
1675 ></DIV
1676 ></DIV
1677 ><DIV
1678 CLASS="SECT1"
1679 ><H1
1680 CLASS="SECT1"
1681 ><A
1682 NAME="AEN808"
1683 >4.8. XML</A
1684 ></H1
1685 ><P
1686 >This module requires libxml2 to be installed.</P
1687 ><P
1688 >The usage of pdb_xml is pretty straightforward. To export data, use:
1689
1690 <KBD
1691 CLASS="USERINPUT"
1692 >pdbedit -e xml:filename</KBD
1693 >
1694
1695 (where filename is the name of the file to put the data in)</P
1696 ><P
1697 >To import data, use:
1698 <KBD
1699 CLASS="USERINPUT"
1700 >pdbedit -i xml:filename -e current-pdb</KBD
1701 >
1702
1703 Where filename is the name to read the data from and current-pdb to put it in.</P
1704 ></DIV
1705 ></DIV
1706 ><DIV
1707 CLASS="NAVFOOTER"
1708 ><HR
1709 ALIGN="LEFT"
1710 WIDTH="100%"><TABLE
1711 SUMMARY="Footer navigation table"
1712 WIDTH="100%"
1713 BORDER="0"
1714 CELLPADDING="0"
1715 CELLSPACING="0"
1716 ><TR
1717 ><TD
1718 WIDTH="33%"
1719 ALIGN="left"
1720 VALIGN="top"
1721 ><A
1722 HREF="browsing-quick.html"
1723 ACCESSKEY="P"
1724 >Prev</A
1725 ></TD
1726 ><TD
1727 WIDTH="34%"
1728 ALIGN="center"
1729 VALIGN="top"
1730 ><A
1731 HREF="samba-howto-collection.html"
1732 ACCESSKEY="H"
1733 >Home</A
1734 ></TD
1735 ><TD
1736 WIDTH="33%"
1737 ALIGN="right"
1738 VALIGN="top"
1739 ><A
1740 HREF="type.html"
1741 ACCESSKEY="N"
1742 >Next</A
1743 ></TD
1744 ></TR
1745 ><TR
1746 ><TD
1747 WIDTH="33%"
1748 ALIGN="left"
1749 VALIGN="top"
1750 >Quick Cross Subnet Browsing / Cross Workgroup Browsing guide</TD
1751 ><TD
1752 WIDTH="34%"
1753 ALIGN="center"
1754 VALIGN="top"
1755 ><A
1756 HREF="introduction.html"
1757 ACCESSKEY="U"
1758 >Up</A
1759 ></TD
1760 ><TD
1761 WIDTH="33%"
1762 ALIGN="right"
1763 VALIGN="top"
1764 >Type of installation</TD
1765 ></TR
1766 ></TABLE
1767 ></DIV
1768 ></BODY
1769 ></HTML
1770 >