This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.
[sfrench/samba-autobuild/.git] / docs / htmldocs / Samba-HOWTO-Collection.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >SAMBA Project Documentation</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.77"></HEAD
9 ><BODY
10 CLASS="BOOK"
11 BGCOLOR="#FFFFFF"
12 TEXT="#000000"
13 LINK="#0000FF"
14 VLINK="#840084"
15 ALINK="#0000FF"
16 ><DIV
17 CLASS="BOOK"
18 ><A
19 NAME="SAMBA-PROJECT-DOCUMENTATION"
20 ></A
21 ><DIV
22 CLASS="TITLEPAGE"
23 ><H1
24 CLASS="TITLE"
25 ><A
26 NAME="SAMBA-PROJECT-DOCUMENTATION"
27 ></A
28 >SAMBA Project Documentation</H1
29 ><H3
30 CLASS="AUTHOR"
31 ><A
32 NAME="AEN4"
33 ></A
34 >SAMBA Team</H3
35 ><HR></DIV
36 ><HR><H1
37 ><A
38 NAME="AEN8"
39 ></A
40 >Abstract</H1
41 ><P
42 ><SPAN
43 CLASS="emphasis"
44 ><I
45 CLASS="EMPHASIS"
46 >Last Update</I
47 ></SPAN
48 > : Thu Aug 15 12:48:45 CDT 2002</P
49 ><P
50 >This book is a collection of HOWTOs added to Samba documentation over the years.
51 I try to ensure that all are current, but sometimes the is a larger job
52 than one person can maintain.  The most recent version of this document
53 can be found at <A
54 HREF="http://www.samba.org/"
55 TARGET="_top"
56 >http://www.samba.org/</A
57 >
58 on the "Documentation" page.  Please send updates to <A
59 HREF="mailto:jerry@samba.org"
60 TARGET="_top"
61 >jerry@samba.org</A
62 >.</P
63 ><P
64 >This documentation is distributed under the GNU General Public License (GPL) 
65 version 2.  A copy of the license is included with the Samba source
66 distribution.  A copy can be found on-line at <A
67 HREF="http://www.fsf.org/licenses/gpl.txt"
68 TARGET="_top"
69 >http://www.fsf.org/licenses/gpl.txt</A
70 ></P
71 ><P
72 >Cheers, jerry</P
73 ><DIV
74 CLASS="TOC"
75 ><DL
76 ><DT
77 ><B
78 >Table of Contents</B
79 ></DT
80 ><DT
81 >1. <A
82 HREF="#INSTALL"
83 >How to Install and Test SAMBA</A
84 ></DT
85 ><DD
86 ><DL
87 ><DT
88 >1.1. <A
89 HREF="#AEN20"
90 >Step 0: Read the man pages</A
91 ></DT
92 ><DT
93 >1.2. <A
94 HREF="#AEN28"
95 >Step 1: Building the Binaries</A
96 ></DT
97 ><DT
98 >1.3. <A
99 HREF="#AEN56"
100 >Step 2: The all important step</A
101 ></DT
102 ><DT
103 >1.4. <A
104 HREF="#AEN60"
105 >Step 3: Create the smb configuration file.</A
106 ></DT
107 ><DT
108 >1.5. <A
109 HREF="#AEN74"
110 >Step 4: Test your config file with 
111         <B
112 CLASS="COMMAND"
113 >testparm</B
114 ></A
115 ></DT
116 ><DT
117 >1.6. <A
118 HREF="#AEN80"
119 >Step 5: Starting the smbd and nmbd</A
120 ></DT
121 ><DD
122 ><DL
123 ><DT
124 >1.6.1. <A
125 HREF="#AEN90"
126 >Step 5a: Starting from inetd.conf</A
127 ></DT
128 ><DT
129 >1.6.2. <A
130 HREF="#AEN119"
131 >Step 5b. Alternative: starting it as a daemon</A
132 ></DT
133 ></DL
134 ></DD
135 ><DT
136 >1.7. <A
137 HREF="#AEN135"
138 >Step 6: Try listing the shares available on your 
139         server</A
140 ></DT
141 ><DT
142 >1.8. <A
143 HREF="#AEN144"
144 >Step 7: Try connecting with the unix client</A
145 ></DT
146 ><DT
147 >1.9. <A
148 HREF="#AEN160"
149 >Step 8: Try connecting from a DOS, WfWg, Win9x, WinNT, 
150         Win2k, OS/2, etc... client</A
151 ></DT
152 ><DT
153 >1.10. <A
154 HREF="#AEN174"
155 >What If Things Don't Work?</A
156 ></DT
157 ><DD
158 ><DL
159 ><DT
160 >1.10.1. <A
161 HREF="#AEN179"
162 >Diagnosing Problems</A
163 ></DT
164 ><DT
165 >1.10.2. <A
166 HREF="#AEN183"
167 >Scope IDs</A
168 ></DT
169 ><DT
170 >1.10.3. <A
171 HREF="#AEN186"
172 >Choosing the Protocol Level</A
173 ></DT
174 ><DT
175 >1.10.4. <A
176 HREF="#AEN195"
177 >Printing from UNIX to a Client PC</A
178 ></DT
179 ><DT
180 >1.10.5. <A
181 HREF="#AEN200"
182 >Locking</A
183 ></DT
184 ><DT
185 >1.10.6. <A
186 HREF="#AEN209"
187 >Mapping Usernames</A
188 ></DT
189 ></DL
190 ></DD
191 ></DL
192 ></DD
193 ><DT
194 >2. <A
195 HREF="#DIAGNOSIS"
196 >Diagnosing your samba server</A
197 ></DT
198 ><DD
199 ><DL
200 ><DT
201 >2.1. <A
202 HREF="#AEN223"
203 >Introduction</A
204 ></DT
205 ><DT
206 >2.2. <A
207 HREF="#AEN228"
208 >Assumptions</A
209 ></DT
210 ><DT
211 >2.3. <A
212 HREF="#AEN238"
213 >Tests</A
214 ></DT
215 ><DD
216 ><DL
217 ><DT
218 >2.3.1. <A
219 HREF="#AEN240"
220 >Test 1</A
221 ></DT
222 ><DT
223 >2.3.2. <A
224 HREF="#AEN246"
225 >Test 2</A
226 ></DT
227 ><DT
228 >2.3.3. <A
229 HREF="#AEN252"
230 >Test 3</A
231 ></DT
232 ><DT
233 >2.3.4. <A
234 HREF="#AEN267"
235 >Test 4</A
236 ></DT
237 ><DT
238 >2.3.5. <A
239 HREF="#AEN272"
240 >Test 5</A
241 ></DT
242 ><DT
243 >2.3.6. <A
244 HREF="#AEN278"
245 >Test 6</A
246 ></DT
247 ><DT
248 >2.3.7. <A
249 HREF="#AEN286"
250 >Test 7</A
251 ></DT
252 ><DT
253 >2.3.8. <A
254 HREF="#AEN312"
255 >Test 8</A
256 ></DT
257 ><DT
258 >2.3.9. <A
259 HREF="#AEN329"
260 >Test 9</A
261 ></DT
262 ><DT
263 >2.3.10. <A
264 HREF="#AEN337"
265 >Test 10</A
266 ></DT
267 ><DT
268 >2.3.11. <A
269 HREF="#AEN343"
270 >Test 11</A
271 ></DT
272 ></DL
273 ></DD
274 ><DT
275 >2.4. <A
276 HREF="#AEN348"
277 >Still having troubles?</A
278 ></DT
279 ></DL
280 ></DD
281 ><DT
282 >3. <A
283 HREF="#INTEGRATE-MS-NETWORKS"
284 >Integrating MS Windows networks with Samba</A
285 ></DT
286 ><DD
287 ><DL
288 ><DT
289 >3.1. <A
290 HREF="#AEN365"
291 >Agenda</A
292 ></DT
293 ><DT
294 >3.2. <A
295 HREF="#AEN387"
296 >Name Resolution in a pure Unix/Linux world</A
297 ></DT
298 ><DD
299 ><DL
300 ><DT
301 >3.2.1. <A
302 HREF="#AEN403"
303 ><TT
304 CLASS="FILENAME"
305 >/etc/hosts</TT
306 ></A
307 ></DT
308 ><DT
309 >3.2.2. <A
310 HREF="#AEN419"
311 ><TT
312 CLASS="FILENAME"
313 >/etc/resolv.conf</TT
314 ></A
315 ></DT
316 ><DT
317 >3.2.3. <A
318 HREF="#AEN430"
319 ><TT
320 CLASS="FILENAME"
321 >/etc/host.conf</TT
322 ></A
323 ></DT
324 ><DT
325 >3.2.4. <A
326 HREF="#AEN438"
327 ><TT
328 CLASS="FILENAME"
329 >/etc/nsswitch.conf</TT
330 ></A
331 ></DT
332 ></DL
333 ></DD
334 ><DT
335 >3.3. <A
336 HREF="#AEN450"
337 >Name resolution as used within MS Windows networking</A
338 ></DT
339 ><DD
340 ><DL
341 ><DT
342 >3.3.1. <A
343 HREF="#AEN462"
344 >The NetBIOS Name Cache</A
345 ></DT
346 ><DT
347 >3.3.2. <A
348 HREF="#AEN467"
349 >The LMHOSTS file</A
350 ></DT
351 ><DT
352 >3.3.3. <A
353 HREF="#AEN475"
354 >HOSTS file</A
355 ></DT
356 ><DT
357 >3.3.4. <A
358 HREF="#AEN480"
359 >DNS Lookup</A
360 ></DT
361 ><DT
362 >3.3.5. <A
363 HREF="#AEN483"
364 >WINS Lookup</A
365 ></DT
366 ></DL
367 ></DD
368 ><DT
369 >3.4. <A
370 HREF="#AEN495"
371 >How browsing functions and how to deploy stable and 
372 dependable browsing using Samba</A
373 ></DT
374 ><DT
375 >3.5. <A
376 HREF="#AEN505"
377 >MS Windows security options and how to configure 
378 Samba for seemless integration</A
379 ></DT
380 ><DD
381 ><DL
382 ><DT
383 >3.5.1. <A
384 HREF="#AEN533"
385 >Use MS Windows NT as an authentication server</A
386 ></DT
387 ><DT
388 >3.5.2. <A
389 HREF="#AEN541"
390 >Make Samba a member of an MS Windows NT security domain</A
391 ></DT
392 ><DT
393 >3.5.3. <A
394 HREF="#AEN558"
395 >Configure Samba as an authentication server</A
396 ></DT
397 ></DL
398 ></DD
399 ><DT
400 >3.6. <A
401 HREF="#AEN575"
402 >Conclusions</A
403 ></DT
404 ></DL
405 ></DD
406 ><DT
407 >4. <A
408 HREF="#PAM"
409 >Configuring PAM for distributed but centrally 
410 managed authentication</A
411 ></DT
412 ><DD
413 ><DL
414 ><DT
415 >4.1. <A
416 HREF="#AEN596"
417 >Samba and PAM</A
418 ></DT
419 ><DT
420 >4.2. <A
421 HREF="#AEN640"
422 >Distributed Authentication</A
423 ></DT
424 ><DT
425 >4.3. <A
426 HREF="#AEN647"
427 >PAM Configuration in smb.conf</A
428 ></DT
429 ></DL
430 ></DD
431 ><DT
432 >5. <A
433 HREF="#MSDFS"
434 >Hosting a Microsoft Distributed File System tree on Samba</A
435 ></DT
436 ><DD
437 ><DL
438 ><DT
439 >5.1. <A
440 HREF="#AEN667"
441 >Instructions</A
442 ></DT
443 ><DD
444 ><DL
445 ><DT
446 >5.1.1. <A
447 HREF="#AEN702"
448 >Notes</A
449 ></DT
450 ></DL
451 ></DD
452 ></DL
453 ></DD
454 ><DT
455 >6. <A
456 HREF="#UNIX-PERMISSIONS"
457 >UNIX Permission Bits and Windows NT Access Control Lists</A
458 ></DT
459 ><DD
460 ><DL
461 ><DT
462 >6.1. <A
463 HREF="#AEN722"
464 >Viewing and changing UNIX permissions using the NT 
465         security dialogs</A
466 ></DT
467 ><DT
468 >6.2. <A
469 HREF="#AEN731"
470 >How to view file security on a Samba share</A
471 ></DT
472 ><DT
473 >6.3. <A
474 HREF="#AEN742"
475 >Viewing file ownership</A
476 ></DT
477 ><DT
478 >6.4. <A
479 HREF="#AEN762"
480 >Viewing file or directory permissions</A
481 ></DT
482 ><DD
483 ><DL
484 ><DT
485 >6.4.1. <A
486 HREF="#AEN777"
487 >File Permissions</A
488 ></DT
489 ><DT
490 >6.4.2. <A
491 HREF="#AEN791"
492 >Directory Permissions</A
493 ></DT
494 ></DL
495 ></DD
496 ><DT
497 >6.5. <A
498 HREF="#AEN798"
499 >Modifying file or directory permissions</A
500 ></DT
501 ><DT
502 >6.6. <A
503 HREF="#AEN820"
504 >Interaction with the standard Samba create mask 
505         parameters</A
506 ></DT
507 ><DT
508 >6.7. <A
509 HREF="#AEN884"
510 >Interaction with the standard Samba file attribute 
511         mapping</A
512 ></DT
513 ></DL
514 ></DD
515 ><DT
516 >7. <A
517 HREF="#PRINTING"
518 >Printing Support in Samba 2.2.x</A
519 ></DT
520 ><DD
521 ><DL
522 ><DT
523 >7.1. <A
524 HREF="#AEN905"
525 >Introduction</A
526 ></DT
527 ><DT
528 >7.2. <A
529 HREF="#AEN927"
530 >Configuration</A
531 ></DT
532 ><DD
533 ><DL
534 ><DT
535 >7.2.1. <A
536 HREF="#AEN938"
537 >Creating [print$]</A
538 ></DT
539 ><DT
540 >7.2.2. <A
541 HREF="#AEN973"
542 >Setting Drivers for Existing Printers</A
543 ></DT
544 ><DT
545 >7.2.3. <A
546 HREF="#AEN990"
547 >Support a large number of printers</A
548 ></DT
549 ><DT
550 >7.2.4. <A
551 HREF="#AEN1001"
552 >Adding New Printers via the Windows NT APW</A
553 ></DT
554 ><DT
555 >7.2.5. <A
556 HREF="#AEN1031"
557 >Samba and Printer Ports</A
558 ></DT
559 ></DL
560 ></DD
561 ><DT
562 >7.3. <A
563 HREF="#AEN1039"
564 >The Imprints Toolset</A
565 ></DT
566 ><DD
567 ><DL
568 ><DT
569 >7.3.1. <A
570 HREF="#AEN1043"
571 >What is Imprints?</A
572 ></DT
573 ><DT
574 >7.3.2. <A
575 HREF="#AEN1053"
576 >Creating Printer Driver Packages</A
577 ></DT
578 ><DT
579 >7.3.3. <A
580 HREF="#AEN1056"
581 >The Imprints server</A
582 ></DT
583 ><DT
584 >7.3.4. <A
585 HREF="#AEN1060"
586 >The Installation Client</A
587 ></DT
588 ></DL
589 ></DD
590 ><DT
591 >7.4. <A
592 HREF="#AEN1082"
593 ><A
594 NAME="MIGRATION"
595 ></A
596 >Migration to from Samba 2.0.x to 2.2.x</A
597 ></DT
598 ></DL
599 ></DD
600 ><DT
601 >8. <A
602 HREF="#PRINTINGDEBUG"
603 >Debugging Printing Problems</A
604 ></DT
605 ><DD
606 ><DL
607 ><DT
608 >8.1. <A
609 HREF="#AEN1128"
610 >Introduction</A
611 ></DT
612 ><DT
613 >8.2. <A
614 HREF="#AEN1144"
615 >Debugging printer problems</A
616 ></DT
617 ><DT
618 >8.3. <A
619 HREF="#AEN1153"
620 >What printers do I have?</A
621 ></DT
622 ><DT
623 >8.4. <A
624 HREF="#AEN1161"
625 >Setting up printcap and print servers</A
626 ></DT
627 ><DT
628 >8.5. <A
629 HREF="#AEN1189"
630 >Job sent, no output</A
631 ></DT
632 ><DT
633 >8.6. <A
634 HREF="#AEN1200"
635 >Job sent, strange output</A
636 ></DT
637 ><DT
638 >8.7. <A
639 HREF="#AEN1212"
640 >Raw PostScript printed</A
641 ></DT
642 ><DT
643 >8.8. <A
644 HREF="#AEN1215"
645 >Advanced Printing</A
646 ></DT
647 ><DT
648 >8.9. <A
649 HREF="#AEN1218"
650 >Real debugging</A
651 ></DT
652 ></DL
653 ></DD
654 ><DT
655 >9. <A
656 HREF="#SECURITYLEVELS"
657 >Security levels</A
658 ></DT
659 ><DD
660 ><DL
661 ><DT
662 >9.1. <A
663 HREF="#AEN1231"
664 >Introduction</A
665 ></DT
666 ><DT
667 >9.2. <A
668 HREF="#AEN1242"
669 >More complete description of security levels</A
670 ></DT
671 ></DL
672 ></DD
673 ><DT
674 >10. <A
675 HREF="#DOMAIN-SECURITY"
676 >security = domain in Samba 2.x</A
677 ></DT
678 ><DD
679 ><DL
680 ><DT
681 >10.1. <A
682 HREF="#AEN1275"
683 >Joining an NT Domain with Samba 2.2</A
684 ></DT
685 ><DT
686 >10.2. <A
687 HREF="#AEN1339"
688 >Samba and Windows 2000 Domains</A
689 ></DT
690 ><DT
691 >10.3. <A
692 HREF="#AEN1344"
693 >Why is this better than security = server?</A
694 ></DT
695 ></DL
696 ></DD
697 ><DT
698 >11. <A
699 HREF="#WINBIND"
700 >Unified Logons between Windows NT and UNIX using Winbind</A
701 ></DT
702 ><DD
703 ><DL
704 ><DT
705 >11.1. <A
706 HREF="#AEN1397"
707 >Abstract</A
708 ></DT
709 ><DT
710 >11.2. <A
711 HREF="#AEN1401"
712 >Introduction</A
713 ></DT
714 ><DT
715 >11.3. <A
716 HREF="#AEN1414"
717 >What Winbind Provides</A
718 ></DT
719 ><DD
720 ><DL
721 ><DT
722 >11.3.1. <A
723 HREF="#AEN1421"
724 >Target Uses</A
725 ></DT
726 ></DL
727 ></DD
728 ><DT
729 >11.4. <A
730 HREF="#AEN1425"
731 >How Winbind Works</A
732 ></DT
733 ><DD
734 ><DL
735 ><DT
736 >11.4.1. <A
737 HREF="#AEN1430"
738 >Microsoft Remote Procedure Calls</A
739 ></DT
740 ><DT
741 >11.4.2. <A
742 HREF="#AEN1434"
743 >Name Service Switch</A
744 ></DT
745 ><DT
746 >11.4.3. <A
747 HREF="#AEN1450"
748 >Pluggable Authentication Modules</A
749 ></DT
750 ><DT
751 >11.4.4. <A
752 HREF="#AEN1458"
753 >User and Group ID Allocation</A
754 ></DT
755 ><DT
756 >11.4.5. <A
757 HREF="#AEN1462"
758 >Result Caching</A
759 ></DT
760 ></DL
761 ></DD
762 ><DT
763 >11.5. <A
764 HREF="#AEN1465"
765 >Installation and Configuration</A
766 ></DT
767 ><DD
768 ><DL
769 ><DT
770 >11.5.1. <A
771 HREF="#AEN1472"
772 >Introduction</A
773 ></DT
774 ><DT
775 >11.5.2. <A
776 HREF="#AEN1485"
777 >Requirements</A
778 ></DT
779 ><DT
780 >11.5.3. <A
781 HREF="#AEN1499"
782 >Testing Things Out</A
783 ></DT
784 ></DL
785 ></DD
786 ><DT
787 >11.6. <A
788 HREF="#AEN1714"
789 >Limitations</A
790 ></DT
791 ><DT
792 >11.7. <A
793 HREF="#AEN1724"
794 >Conclusion</A
795 ></DT
796 ></DL
797 ></DD
798 ><DT
799 >12. <A
800 HREF="#SAMBA-PDC"
801 >How to Configure Samba 2.2 as a Primary Domain Controller</A
802 ></DT
803 ><DD
804 ><DL
805 ><DT
806 >12.1. <A
807 HREF="#AEN1744"
808 >Prerequisite Reading</A
809 ></DT
810 ><DT
811 >12.2. <A
812 HREF="#AEN1750"
813 >Background</A
814 ></DT
815 ><DT
816 >12.3. <A
817 HREF="#AEN1789"
818 >Configuring the Samba Domain Controller</A
819 ></DT
820 ><DT
821 >12.4. <A
822 HREF="#AEN1832"
823 >Creating Machine Trust Accounts and Joining Clients to the
824 Domain</A
825 ></DT
826 ><DD
827 ><DL
828 ><DT
829 >12.4.1. <A
830 HREF="#AEN1851"
831 >Manual Creation of Machine Trust Accounts</A
832 ></DT
833 ><DT
834 >12.4.2. <A
835 HREF="#AEN1886"
836 >"On-the-Fly" Creation of Machine Trust Accounts</A
837 ></DT
838 ><DT
839 >12.4.3. <A
840 HREF="#AEN1895"
841 >Joining the Client to the Domain</A
842 ></DT
843 ></DL
844 ></DD
845 ><DT
846 >12.5. <A
847 HREF="#AEN1910"
848 >Common Problems and Errors</A
849 ></DT
850 ><DT
851 >12.6. <A
852 HREF="#AEN1958"
853 >System Policies and Profiles</A
854 ></DT
855 ><DT
856 >12.7. <A
857 HREF="#AEN2002"
858 >What other help can I get?</A
859 ></DT
860 ><DT
861 >12.8. <A
862 HREF="#AEN2116"
863 >Domain Control for Windows 9x/ME</A
864 ></DT
865 ><DD
866 ><DL
867 ><DT
868 >12.8.1. <A
869 HREF="#AEN2142"
870 >Configuration Instructions:    Network Logons</A
871 ></DT
872 ><DT
873 >12.8.2. <A
874 HREF="#AEN2161"
875 >Configuration Instructions:    Setting up Roaming User Profiles</A
876 ></DT
877 ></DL
878 ></DD
879 ><DT
880 >12.9. <A
881 HREF="#AEN2254"
882 >DOMAIN_CONTROL.txt : Windows NT Domain Control &#38; Samba</A
883 ></DT
884 ></DL
885 ></DD
886 ><DT
887 >13. <A
888 HREF="#SAMBA-BDC"
889 >How to Act as a Backup Domain Controller in a Purely Samba Controlled Domain</A
890 ></DT
891 ><DD
892 ><DL
893 ><DT
894 >13.1. <A
895 HREF="#AEN2290"
896 >Prerequisite Reading</A
897 ></DT
898 ><DT
899 >13.2. <A
900 HREF="#AEN2294"
901 >Background</A
902 ></DT
903 ><DT
904 >13.3. <A
905 HREF="#AEN2302"
906 >What qualifies a Domain Controller on the network?</A
907 ></DT
908 ><DD
909 ><DL
910 ><DT
911 >13.3.1. <A
912 HREF="#AEN2305"
913 >How does a Workstation find its domain controller?</A
914 ></DT
915 ><DT
916 >13.3.2. <A
917 HREF="#AEN2308"
918 >When is the PDC needed?</A
919 ></DT
920 ></DL
921 ></DD
922 ><DT
923 >13.4. <A
924 HREF="#AEN2311"
925 >Can Samba be a Backup Domain Controller?</A
926 ></DT
927 ><DT
928 >13.5. <A
929 HREF="#AEN2315"
930 >How do I set up a Samba BDC?</A
931 ></DT
932 ><DD
933 ><DL
934 ><DT
935 >13.5.1. <A
936 HREF="#AEN2332"
937 >How do I replicate the smbpasswd file?</A
938 ></DT
939 ></DL
940 ></DD
941 ></DL
942 ></DD
943 ><DT
944 >14. <A
945 HREF="#SAMBA-LDAP-HOWTO"
946 >Storing Samba's User/Machine Account information in an LDAP Directory</A
947 ></DT
948 ><DD
949 ><DL
950 ><DT
951 >14.1. <A
952 HREF="#AEN2353"
953 >Purpose</A
954 ></DT
955 ><DT
956 >14.2. <A
957 HREF="#AEN2373"
958 >Introduction</A
959 ></DT
960 ><DT
961 >14.3. <A
962 HREF="#AEN2402"
963 >Supported LDAP Servers</A
964 ></DT
965 ><DT
966 >14.4. <A
967 HREF="#AEN2407"
968 >Schema and Relationship to the RFC 2307 posixAccount</A
969 ></DT
970 ><DT
971 >14.5. <A
972 HREF="#AEN2419"
973 >Configuring Samba with LDAP</A
974 ></DT
975 ><DD
976 ><DL
977 ><DT
978 >14.5.1. <A
979 HREF="#AEN2421"
980 >OpenLDAP configuration</A
981 ></DT
982 ><DT
983 >14.5.2. <A
984 HREF="#AEN2438"
985 >Configuring Samba</A
986 ></DT
987 ></DL
988 ></DD
989 ><DT
990 >14.6. <A
991 HREF="#AEN2466"
992 >Accounts and Groups management</A
993 ></DT
994 ><DT
995 >14.7. <A
996 HREF="#AEN2471"
997 >Security and sambaAccount</A
998 ></DT
999 ><DT
1000 >14.8. <A
1001 HREF="#AEN2491"
1002 >LDAP specials attributes for sambaAccounts</A
1003 ></DT
1004 ><DT
1005 >14.9. <A
1006 HREF="#AEN2561"
1007 >Example LDIF Entries for a sambaAccount</A
1008 ></DT
1009 ><DT
1010 >14.10. <A
1011 HREF="#AEN2569"
1012 >Comments</A
1013 ></DT
1014 ></DL
1015 ></DD
1016 ><DT
1017 >15. <A
1018 HREF="#ADS"
1019 >Using samba 3.0 with ActiveDirectory support</A
1020 ></DT
1021 ><DD
1022 ><DL
1023 ><DT
1024 >15.1. <A
1025 HREF="#AEN2587"
1026 >Installing the required packages for Debian</A
1027 ></DT
1028 ><DT
1029 >15.2. <A
1030 HREF="#AEN2593"
1031 >Installing the required packages for RedHat</A
1032 ></DT
1033 ><DT
1034 >15.3. <A
1035 HREF="#AEN2602"
1036 >Compile Samba</A
1037 ></DT
1038 ><DT
1039 >15.4. <A
1040 HREF="#AEN2614"
1041 >Setup your /etc/krb5.conf</A
1042 ></DT
1043 ><DT
1044 >15.5. <A
1045 HREF="#AEN2624"
1046 >Create the computer account</A
1047 ></DT
1048 ><DD
1049 ><DL
1050 ><DT
1051 >15.5.1. <A
1052 HREF="#AEN2628"
1053 >Possible errors</A
1054 ></DT
1055 ></DL
1056 ></DD
1057 ><DT
1058 >15.6. <A
1059 HREF="#AEN2640"
1060 >Test your server setup</A
1061 ></DT
1062 ><DT
1063 >15.7. <A
1064 HREF="#AEN2645"
1065 >Testing with smbclient</A
1066 ></DT
1067 ><DT
1068 >15.8. <A
1069 HREF="#AEN2648"
1070 >Notes</A
1071 ></DT
1072 ></DL
1073 ></DD
1074 ><DT
1075 >16. <A
1076 HREF="#IMPROVED-BROWSING"
1077 >Improved browsing in samba</A
1078 ></DT
1079 ><DD
1080 ><DL
1081 ><DT
1082 >16.1. <A
1083 HREF="#AEN2659"
1084 >Overview of browsing</A
1085 ></DT
1086 ><DT
1087 >16.2. <A
1088 HREF="#AEN2663"
1089 >Browsing support in samba</A
1090 ></DT
1091 ><DT
1092 >16.3. <A
1093 HREF="#AEN2672"
1094 >Problem resolution</A
1095 ></DT
1096 ><DT
1097 >16.4. <A
1098 HREF="#AEN2679"
1099 >Browsing across subnets</A
1100 ></DT
1101 ><DD
1102 ><DL
1103 ><DT
1104 >16.4.1. <A
1105 HREF="#AEN2684"
1106 >How does cross subnet browsing work ?</A
1107 ></DT
1108 ></DL
1109 ></DD
1110 ><DT
1111 >16.5. <A
1112 HREF="#AEN2719"
1113 >Setting up a WINS server</A
1114 ></DT
1115 ><DT
1116 >16.6. <A
1117 HREF="#AEN2738"
1118 >Setting up Browsing in a WORKGROUP</A
1119 ></DT
1120 ><DT
1121 >16.7. <A
1122 HREF="#AEN2756"
1123 >Setting up Browsing in a DOMAIN</A
1124 ></DT
1125 ><DT
1126 >16.8. <A
1127 HREF="#AEN2766"
1128 >Forcing samba to be the master</A
1129 ></DT
1130 ><DT
1131 >16.9. <A
1132 HREF="#AEN2775"
1133 >Making samba the domain master</A
1134 ></DT
1135 ><DT
1136 >16.10. <A
1137 HREF="#AEN2793"
1138 >Note about broadcast addresses</A
1139 ></DT
1140 ><DT
1141 >16.11. <A
1142 HREF="#AEN2796"
1143 >Multiple interfaces</A
1144 ></DT
1145 ></DL
1146 ></DD
1147 ><DT
1148 >17. <A
1149 HREF="#SPEED"
1150 >Samba performance issues</A
1151 ></DT
1152 ><DD
1153 ><DL
1154 ><DT
1155 >17.1. <A
1156 HREF="#AEN2814"
1157 >Comparisons</A
1158 ></DT
1159 ><DT
1160 >17.2. <A
1161 HREF="#AEN2820"
1162 >Oplocks</A
1163 ></DT
1164 ><DD
1165 ><DL
1166 ><DT
1167 >17.2.1. <A
1168 HREF="#AEN2822"
1169 >Overview</A
1170 ></DT
1171 ><DT
1172 >17.2.2. <A
1173 HREF="#AEN2830"
1174 >Level2 Oplocks</A
1175 ></DT
1176 ><DT
1177 >17.2.3. <A
1178 HREF="#AEN2836"
1179 >Old 'fake oplocks' option - deprecated</A
1180 ></DT
1181 ></DL
1182 ></DD
1183 ><DT
1184 >17.3. <A
1185 HREF="#AEN2840"
1186 >Socket options</A
1187 ></DT
1188 ><DT
1189 >17.4. <A
1190 HREF="#AEN2847"
1191 >Read size</A
1192 ></DT
1193 ><DT
1194 >17.5. <A
1195 HREF="#AEN2852"
1196 >Max xmit</A
1197 ></DT
1198 ><DT
1199 >17.6. <A
1200 HREF="#AEN2857"
1201 >Locking</A
1202 ></DT
1203 ><DT
1204 >17.7. <A
1205 HREF="#AEN2861"
1206 >Share modes</A
1207 ></DT
1208 ><DT
1209 >17.8. <A
1210 HREF="#AEN2866"
1211 >Log level</A
1212 ></DT
1213 ><DT
1214 >17.9. <A
1215 HREF="#AEN2869"
1216 >Wide lines</A
1217 ></DT
1218 ><DT
1219 >17.10. <A
1220 HREF="#AEN2872"
1221 >Read raw</A
1222 ></DT
1223 ><DT
1224 >17.11. <A
1225 HREF="#AEN2877"
1226 >Write raw</A
1227 ></DT
1228 ><DT
1229 >17.12. <A
1230 HREF="#AEN2881"
1231 >Read prediction</A
1232 ></DT
1233 ><DT
1234 >17.13. <A
1235 HREF="#AEN2888"
1236 >Memory mapping</A
1237 ></DT
1238 ><DT
1239 >17.14. <A
1240 HREF="#AEN2893"
1241 >Slow Clients</A
1242 ></DT
1243 ><DT
1244 >17.15. <A
1245 HREF="#AEN2897"
1246 >Slow Logins</A
1247 ></DT
1248 ><DT
1249 >17.16. <A
1250 HREF="#AEN2900"
1251 >Client tuning</A
1252 ></DT
1253 ><DT
1254 >17.17. <A
1255 HREF="#AEN2932"
1256 >My Results</A
1257 ></DT
1258 ></DL
1259 ></DD
1260 ><DT
1261 >18. <A
1262 HREF="#OTHER-CLIENTS"
1263 >Samba and other CIFS clients</A
1264 ></DT
1265 ><DD
1266 ><DL
1267 ><DT
1268 >18.1. <A
1269 HREF="#AEN2953"
1270 >Macintosh clients?</A
1271 ></DT
1272 ><DT
1273 >18.2. <A
1274 HREF="#AEN2962"
1275 >OS2 Client</A
1276 ></DT
1277 ><DD
1278 ><DL
1279 ><DT
1280 >18.2.1. <A
1281 HREF="#AEN2964"
1282 >How can I configure OS/2 Warp Connect or 
1283                 OS/2 Warp 4 as a client for Samba?</A
1284 ></DT
1285 ><DT
1286 >18.2.2. <A
1287 HREF="#AEN2979"
1288 >How can I configure OS/2 Warp 3 (not Connect), 
1289                 OS/2 1.2, 1.3 or 2.x for Samba?</A
1290 ></DT
1291 ><DT
1292 >18.2.3. <A
1293 HREF="#AEN2988"
1294 >Are there any other issues when OS/2 (any version) 
1295                 is used as a client?</A
1296 ></DT
1297 ><DT
1298 >18.2.4. <A
1299 HREF="#AEN2992"
1300 >How do I get printer driver download working 
1301                 for OS/2 clients?</A
1302 ></DT
1303 ></DL
1304 ></DD
1305 ><DT
1306 >18.3. <A
1307 HREF="#AEN3002"
1308 >Windows for Workgroups</A
1309 ></DT
1310 ><DD
1311 ><DL
1312 ><DT
1313 >18.3.1. <A
1314 HREF="#AEN3004"
1315 >Use latest TCP/IP stack from Microsoft</A
1316 ></DT
1317 ><DT
1318 >18.3.2. <A
1319 HREF="#AEN3009"
1320 >Delete .pwl files after password change</A
1321 ></DT
1322 ><DT
1323 >18.3.3. <A
1324 HREF="#AEN3014"
1325 >Configure WfW password handling</A
1326 ></DT
1327 ><DT
1328 >18.3.4. <A
1329 HREF="#AEN3018"
1330 >Case handling of passwords</A
1331 ></DT
1332 ></DL
1333 ></DD
1334 ><DT
1335 >18.4. <A
1336 HREF="#AEN3023"
1337 >Windows '95/'98</A
1338 ></DT
1339 ><DT
1340 >18.5. <A
1341 HREF="#AEN3039"
1342 >Windows 2000 Service Pack 2</A
1343 ></DT
1344 ></DL
1345 ></DD
1346 ><DT
1347 >19. <A
1348 HREF="#CVS-ACCESS"
1349 >HOWTO Access Samba source code via CVS</A
1350 ></DT
1351 ><DD
1352 ><DL
1353 ><DT
1354 >19.1. <A
1355 HREF="#AEN3063"
1356 >Introduction</A
1357 ></DT
1358 ><DT
1359 >19.2. <A
1360 HREF="#AEN3068"
1361 >CVS Access to samba.org</A
1362 ></DT
1363 ><DD
1364 ><DL
1365 ><DT
1366 >19.2.1. <A
1367 HREF="#AEN3071"
1368 >Access via CVSweb</A
1369 ></DT
1370 ><DT
1371 >19.2.2. <A
1372 HREF="#AEN3076"
1373 >Access via cvs</A
1374 ></DT
1375 ></DL
1376 ></DD
1377 ></DL
1378 ></DD
1379 ><DT
1380 >20. <A
1381 HREF="#BUGREPORT"
1382 >Reporting Bugs</A
1383 ></DT
1384 ><DD
1385 ><DL
1386 ><DT
1387 >20.1. <A
1388 HREF="#AEN3111"
1389 >Introduction</A
1390 ></DT
1391 ><DT
1392 >20.2. <A
1393 HREF="#AEN3118"
1394 >General info</A
1395 ></DT
1396 ><DT
1397 >20.3. <A
1398 HREF="#AEN3124"
1399 >Debug levels</A
1400 ></DT
1401 ><DT
1402 >20.4. <A
1403 HREF="#AEN3141"
1404 >Internal errors</A
1405 ></DT
1406 ><DT
1407 >20.5. <A
1408 HREF="#AEN3151"
1409 >Attaching to a running process</A
1410 ></DT
1411 ><DT
1412 >20.6. <A
1413 HREF="#AEN3154"
1414 >Patches</A
1415 ></DT
1416 ></DL
1417 ></DD
1418 ><DT
1419 >21. <A
1420 HREF="#GROUPMAPPING"
1421 >Group mapping HOWTO</A
1422 ></DT
1423 ><DT
1424 >22. <A
1425 HREF="#PORTABILITY"
1426 >Portability</A
1427 ></DT
1428 ><DD
1429 ><DL
1430 ><DT
1431 >22.1. <A
1432 HREF="#AEN3201"
1433 >HPUX</A
1434 ></DT
1435 ><DT
1436 >22.2. <A
1437 HREF="#AEN3206"
1438 >SCO Unix</A
1439 ></DT
1440 ><DT
1441 >22.3. <A
1442 HREF="#AEN3210"
1443 >DNIX</A
1444 ></DT
1445 ></DL
1446 ></DD
1447 ></DL
1448 ></DIV
1449 ><DIV
1450 CLASS="CHAPTER"
1451 ><HR><H1
1452 ><A
1453 NAME="INSTALL"
1454 ></A
1455 >Chapter 1. How to Install and Test SAMBA</H1
1456 ><DIV
1457 CLASS="SECT1"
1458 ><H2
1459 CLASS="SECT1"
1460 ><A
1461 NAME="AEN20"
1462 ></A
1463 >1.1. Step 0: Read the man pages</H2
1464 ><P
1465 >The man pages distributed with SAMBA contain 
1466         lots of useful info that will help to get you started. 
1467         If you don't know how to read man pages then try 
1468         something like:</P
1469 ><P
1470 ><TT
1471 CLASS="PROMPT"
1472 >$ </TT
1473 ><TT
1474 CLASS="USERINPUT"
1475 ><B
1476 >nroff -man smbd.8 | more
1477         </B
1478 ></TT
1479 ></P
1480 ><P
1481 >Other sources of information are pointed to 
1482         by the Samba web site,<A
1483 HREF="http://www.samba.org/"
1484 TARGET="_top"
1485 >       http://www.samba.org</A
1486 ></P
1487 ></DIV
1488 ><DIV
1489 CLASS="SECT1"
1490 ><HR><H2
1491 CLASS="SECT1"
1492 ><A
1493 NAME="AEN28"
1494 ></A
1495 >1.2. Step 1: Building the Binaries</H2
1496 ><P
1497 >To do this, first run the program <B
1498 CLASS="COMMAND"
1499 >./configure
1500         </B
1501 > in the source directory. This should automatically 
1502         configure Samba for your operating system. If you have unusual 
1503         needs then you may wish to run</P
1504 ><P
1505 ><TT
1506 CLASS="PROMPT"
1507 >root# </TT
1508 ><TT
1509 CLASS="USERINPUT"
1510 ><B
1511 >./configure --help
1512         </B
1513 ></TT
1514 ></P
1515 ><P
1516 >first to see what special options you can enable.
1517         Then executing</P
1518 ><P
1519 ><TT
1520 CLASS="PROMPT"
1521 >root# </TT
1522 ><TT
1523 CLASS="USERINPUT"
1524 ><B
1525 >make</B
1526 ></TT
1527 ></P
1528 ><P
1529 >will create the binaries. Once it's successfully 
1530         compiled you can use </P
1531 ><P
1532 ><TT
1533 CLASS="PROMPT"
1534 >root# </TT
1535 ><TT
1536 CLASS="USERINPUT"
1537 ><B
1538 >make install</B
1539 ></TT
1540 ></P
1541 ><P
1542 >to install the binaries and manual pages. You can 
1543         separately install the binaries and/or man pages using</P
1544 ><P
1545 ><TT
1546 CLASS="PROMPT"
1547 >root# </TT
1548 ><TT
1549 CLASS="USERINPUT"
1550 ><B
1551 >make installbin
1552         </B
1553 ></TT
1554 ></P
1555 ><P
1556 >and</P
1557 ><P
1558 ><TT
1559 CLASS="PROMPT"
1560 >root# </TT
1561 ><TT
1562 CLASS="USERINPUT"
1563 ><B
1564 >make installman
1565         </B
1566 ></TT
1567 ></P
1568 ><P
1569 >Note that if you are upgrading for a previous version 
1570         of Samba you might like to know that the old versions of 
1571         the binaries will be renamed with a ".old" extension. You 
1572         can go back to the previous version with</P
1573 ><P
1574 ><TT
1575 CLASS="PROMPT"
1576 >root# </TT
1577 ><TT
1578 CLASS="USERINPUT"
1579 ><B
1580 >make revert
1581         </B
1582 ></TT
1583 ></P
1584 ><P
1585 >if you find this version a disaster!</P
1586 ></DIV
1587 ><DIV
1588 CLASS="SECT1"
1589 ><HR><H2
1590 CLASS="SECT1"
1591 ><A
1592 NAME="AEN56"
1593 ></A
1594 >1.3. Step 2: The all important step</H2
1595 ><P
1596 >At this stage you must fetch yourself a 
1597         coffee or other drink you find stimulating. Getting the rest 
1598         of the install right can sometimes be tricky, so you will 
1599         probably need it.</P
1600 ><P
1601 >If you have installed samba before then you can skip 
1602         this step.</P
1603 ></DIV
1604 ><DIV
1605 CLASS="SECT1"
1606 ><HR><H2
1607 CLASS="SECT1"
1608 ><A
1609 NAME="AEN60"
1610 ></A
1611 >1.4. Step 3: Create the smb configuration file.</H2
1612 ><P
1613 >There are sample configuration files in the examples 
1614         subdirectory in the distribution. I suggest you read them 
1615         carefully so you can see how the options go together in 
1616         practice. See the man page for all the options.</P
1617 ><P
1618 >The simplest useful configuration file would be 
1619         something like this:</P
1620 ><P
1621 ><PRE
1622 CLASS="PROGRAMLISTING"
1623 >       [global]
1624            workgroup = MYGROUP
1625
1626            [homes]
1627               guest ok = no
1628               read only = no
1629         </PRE
1630 ></P
1631 ><P
1632 >which would allow connections by anyone with an 
1633         account on the server, using either their login name or 
1634         "homes" as the service name. (Note that I also set the 
1635         workgroup that Samba is part of. See BROWSING.txt for details)</P
1636 ><P
1637 >Note that <B
1638 CLASS="COMMAND"
1639 >make install</B
1640 > will not install 
1641         a <TT
1642 CLASS="FILENAME"
1643 >smb.conf</TT
1644 > file. You need to create it 
1645         yourself. </P
1646 ><P
1647 >Make sure you put the smb.conf file in the same place 
1648         you specified in the<TT
1649 CLASS="FILENAME"
1650 >Makefile</TT
1651 > (the default is to 
1652         look for it in <TT
1653 CLASS="FILENAME"
1654 >/usr/local/samba/lib/</TT
1655 >).</P
1656 ><P
1657 >For more information about security settings for the 
1658         [homes] share please refer to the document UNIX_SECURITY.txt.</P
1659 ></DIV
1660 ><DIV
1661 CLASS="SECT1"
1662 ><HR><H2
1663 CLASS="SECT1"
1664 ><A
1665 NAME="AEN74"
1666 ></A
1667 >1.5. Step 4: Test your config file with 
1668         <B
1669 CLASS="COMMAND"
1670 >testparm</B
1671 ></H2
1672 ><P
1673 >It's important that you test the validity of your
1674         <TT
1675 CLASS="FILENAME"
1676 >smb.conf</TT
1677 > file using the testparm program. 
1678         If testparm runs OK then it will list the loaded services. If 
1679         not it will give an error message.</P
1680 ><P
1681 >Make sure it runs OK and that the services look 
1682         reasonable before proceeding. </P
1683 ></DIV
1684 ><DIV
1685 CLASS="SECT1"
1686 ><HR><H2
1687 CLASS="SECT1"
1688 ><A
1689 NAME="AEN80"
1690 ></A
1691 >1.6. Step 5: Starting the smbd and nmbd</H2
1692 ><P
1693 >You must choose to start smbd and nmbd either
1694         as daemons or from <B
1695 CLASS="COMMAND"
1696 >inetd</B
1697 >. Don't try
1698         to do both!  Either you can put them in <TT
1699 CLASS="FILENAME"
1700 >       inetd.conf</TT
1701 > and have them started on demand
1702         by <B
1703 CLASS="COMMAND"
1704 >inetd</B
1705 >, or you can start them as
1706         daemons either from the command line or in <TT
1707 CLASS="FILENAME"
1708 >       /etc/rc.local</TT
1709 >. See the man pages for details
1710         on the command line options. Take particular care to read
1711         the bit about what user you need to be in order to start
1712         Samba.  In many cases you must be root.</P
1713 ><P
1714 >The main advantage of starting <B
1715 CLASS="COMMAND"
1716 >smbd</B
1717 >
1718         and <B
1719 CLASS="COMMAND"
1720 >nmbd</B
1721 > using the recommended daemon method
1722         is that they will respond slightly more quickly to an initial connection
1723         request.</P
1724 ><DIV
1725 CLASS="SECT2"
1726 ><HR><H3
1727 CLASS="SECT2"
1728 ><A
1729 NAME="AEN90"
1730 ></A
1731 >1.6.1. Step 5a: Starting from inetd.conf</H3
1732 ><P
1733 >NOTE; The following will be different if 
1734                 you use NIS or NIS+ to distributed services maps.</P
1735 ><P
1736 >Look at your <TT
1737 CLASS="FILENAME"
1738 >/etc/services</TT
1739 >. 
1740                 What is defined at port 139/tcp. If nothing is defined 
1741                 then add a line like this:</P
1742 ><P
1743 ><TT
1744 CLASS="USERINPUT"
1745 ><B
1746 >netbios-ssn     139/tcp</B
1747 ></TT
1748 ></P
1749 ><P
1750 >similarly for 137/udp you should have an entry like:</P
1751 ><P
1752 ><TT
1753 CLASS="USERINPUT"
1754 ><B
1755 >netbios-ns     137/udp</B
1756 ></TT
1757 ></P
1758 ><P
1759 >Next edit your <TT
1760 CLASS="FILENAME"
1761 >/etc/inetd.conf</TT
1762
1763                 and add two lines something like this:</P
1764 ><P
1765 ><PRE
1766 CLASS="PROGRAMLISTING"
1767 >               netbios-ssn stream tcp nowait root /usr/local/samba/bin/smbd smbd 
1768                 netbios-ns dgram udp wait root /usr/local/samba/bin/nmbd nmbd 
1769                 </PRE
1770 ></P
1771 ><P
1772 >The exact syntax of <TT
1773 CLASS="FILENAME"
1774 >/etc/inetd.conf</TT
1775
1776                 varies between unixes. Look at the other entries in inetd.conf 
1777                 for a guide.</P
1778 ><P
1779 >NOTE: Some unixes already have entries like netbios_ns 
1780                 (note the underscore) in <TT
1781 CLASS="FILENAME"
1782 >/etc/services</TT
1783 >. 
1784                 You must either edit <TT
1785 CLASS="FILENAME"
1786 >/etc/services</TT
1787 > or
1788                 <TT
1789 CLASS="FILENAME"
1790 >/etc/inetd.conf</TT
1791 > to make them consistent.</P
1792 ><P
1793 >NOTE: On many systems you may need to use the 
1794                 "interfaces" option in smb.conf to specify the IP address 
1795                 and netmask of your interfaces. Run <B
1796 CLASS="COMMAND"
1797 >ifconfig</B
1798
1799                 as root if you don't know what the broadcast is for your
1800                 net. <B
1801 CLASS="COMMAND"
1802 >nmbd</B
1803 > tries to determine it at run 
1804                 time, but fails on some unixes. See the section on "testing nmbd" 
1805                 for a method of finding if you need to do this.</P
1806 ><P
1807 >!!!WARNING!!! Many unixes only accept around 5 
1808                 parameters on the command line in <TT
1809 CLASS="FILENAME"
1810 >inetd.conf</TT
1811 >. 
1812                 This means you shouldn't use spaces between the options and 
1813                 arguments, or you should use a script, and start the script 
1814                 from <B
1815 CLASS="COMMAND"
1816 >inetd</B
1817 >.</P
1818 ><P
1819 >Restart <B
1820 CLASS="COMMAND"
1821 >inetd</B
1822 >, perhaps just send 
1823                 it a HUP. If you have installed an earlier version of <B
1824 CLASS="COMMAND"
1825 >               nmbd</B
1826 > then you may need to kill nmbd as well.</P
1827 ></DIV
1828 ><DIV
1829 CLASS="SECT2"
1830 ><HR><H3
1831 CLASS="SECT2"
1832 ><A
1833 NAME="AEN119"
1834 ></A
1835 >1.6.2. Step 5b. Alternative: starting it as a daemon</H3
1836 ><P
1837 >To start the server as a daemon you should create 
1838                 a script something like this one, perhaps calling 
1839                 it <TT
1840 CLASS="FILENAME"
1841 >startsmb</TT
1842 >.</P
1843 ><P
1844 ><PRE
1845 CLASS="PROGRAMLISTING"
1846 >               #!/bin/sh
1847                 /usr/local/samba/bin/smbd -D 
1848                 /usr/local/samba/bin/nmbd -D 
1849                 </PRE
1850 ></P
1851 ><P
1852 >then make it executable with <B
1853 CLASS="COMMAND"
1854 >chmod 
1855                 +x startsmb</B
1856 ></P
1857 ><P
1858 >You can then run <B
1859 CLASS="COMMAND"
1860 >startsmb</B
1861 > by 
1862                 hand or execute it from <TT
1863 CLASS="FILENAME"
1864 >/etc/rc.local</TT
1865 >
1866                 </P
1867 ><P
1868 >To kill it send a kill signal to the processes 
1869                 <B
1870 CLASS="COMMAND"
1871 >nmbd</B
1872 > and <B
1873 CLASS="COMMAND"
1874 >smbd</B
1875 >.</P
1876 ><P
1877 >NOTE: If you use the SVR4 style init system then 
1878                 you may like to look at the <TT
1879 CLASS="FILENAME"
1880 >examples/svr4-startup</TT
1881 >
1882                 script to make Samba fit into that system.</P
1883 ></DIV
1884 ></DIV
1885 ><DIV
1886 CLASS="SECT1"
1887 ><HR><H2
1888 CLASS="SECT1"
1889 ><A
1890 NAME="AEN135"
1891 ></A
1892 >1.7. Step 6: Try listing the shares available on your 
1893         server</H2
1894 ><P
1895 ><TT
1896 CLASS="PROMPT"
1897 >$ </TT
1898 ><TT
1899 CLASS="USERINPUT"
1900 ><B
1901 >smbclient -L 
1902         <TT
1903 CLASS="REPLACEABLE"
1904 ><I
1905 >yourhostname</I
1906 ></TT
1907 ></B
1908 ></TT
1909 ></P
1910 ><P
1911 >You should get back a list of shares available on 
1912         your server. If you don't then something is incorrectly setup. 
1913         Note that this method can also be used to see what shares 
1914         are available on other LanManager clients (such as WfWg).</P
1915 ><P
1916 >If you choose user level security then you may find 
1917         that Samba requests a password before it will list the shares. 
1918         See the <B
1919 CLASS="COMMAND"
1920 >smbclient</B
1921 > man page for details. (you 
1922         can force it to list the shares without a password by
1923         adding the option -U% to the command line. This will not work 
1924         with non-Samba servers)</P
1925 ></DIV
1926 ><DIV
1927 CLASS="SECT1"
1928 ><HR><H2
1929 CLASS="SECT1"
1930 ><A
1931 NAME="AEN144"
1932 ></A
1933 >1.8. Step 7: Try connecting with the unix client</H2
1934 ><P
1935 ><TT
1936 CLASS="PROMPT"
1937 >$ </TT
1938 ><TT
1939 CLASS="USERINPUT"
1940 ><B
1941 >smbclient <TT
1942 CLASS="REPLACEABLE"
1943 ><I
1944 >       //yourhostname/aservice</I
1945 ></TT
1946 ></B
1947 ></TT
1948 ></P
1949 ><P
1950 >Typically the <TT
1951 CLASS="REPLACEABLE"
1952 ><I
1953 >yourhostname</I
1954 ></TT
1955
1956         would be the name of the host where you installed <B
1957 CLASS="COMMAND"
1958 >       smbd</B
1959 >. The <TT
1960 CLASS="REPLACEABLE"
1961 ><I
1962 >aservice</I
1963 ></TT
1964 > is 
1965         any service you have defined in the <TT
1966 CLASS="FILENAME"
1967 >smb.conf</TT
1968
1969         file. Try your user name if you just have a [homes] section
1970         in <TT
1971 CLASS="FILENAME"
1972 >smb.conf</TT
1973 >.</P
1974 ><P
1975 >For example if your unix host is bambi and your login 
1976         name is fred you would type:</P
1977 ><P
1978 ><TT
1979 CLASS="PROMPT"
1980 >$ </TT
1981 ><TT
1982 CLASS="USERINPUT"
1983 ><B
1984 >smbclient //bambi/fred
1985         </B
1986 ></TT
1987 ></P
1988 ></DIV
1989 ><DIV
1990 CLASS="SECT1"
1991 ><HR><H2
1992 CLASS="SECT1"
1993 ><A
1994 NAME="AEN160"
1995 ></A
1996 >1.9. Step 8: Try connecting from a DOS, WfWg, Win9x, WinNT, 
1997         Win2k, OS/2, etc... client</H2
1998 ><P
1999 >Try mounting disks. eg:</P
2000 ><P
2001 ><TT
2002 CLASS="PROMPT"
2003 >C:\WINDOWS\&#62; </TT
2004 ><TT
2005 CLASS="USERINPUT"
2006 ><B
2007 >net use d: \\servername\service
2008         </B
2009 ></TT
2010 ></P
2011 ><P
2012 >Try printing. eg:</P
2013 ><P
2014 ><TT
2015 CLASS="PROMPT"
2016 >C:\WINDOWS\&#62; </TT
2017 ><TT
2018 CLASS="USERINPUT"
2019 ><B
2020 >net use lpt1:
2021         \\servername\spoolservice</B
2022 ></TT
2023 ></P
2024 ><P
2025 ><TT
2026 CLASS="PROMPT"
2027 >C:\WINDOWS\&#62; </TT
2028 ><TT
2029 CLASS="USERINPUT"
2030 ><B
2031 >print filename
2032         </B
2033 ></TT
2034 ></P
2035 ><P
2036 >Celebrate, or send me a bug report!</P
2037 ></DIV
2038 ><DIV
2039 CLASS="SECT1"
2040 ><HR><H2
2041 CLASS="SECT1"
2042 ><A
2043 NAME="AEN174"
2044 ></A
2045 >1.10. What If Things Don't Work?</H2
2046 ><P
2047 >If nothing works and you start to think "who wrote 
2048         this pile of trash" then I suggest you do step 2 again (and 
2049         again) till you calm down.</P
2050 ><P
2051 >Then you might read the file DIAGNOSIS.txt and the 
2052         FAQ. If you are still stuck then try the mailing list or 
2053         newsgroup (look in the README for details). Samba has been 
2054         successfully installed at thousands of sites worldwide, so maybe 
2055         someone else has hit your problem and has overcome it. You could 
2056         also use the WWW site to scan back issues of the samba-digest.</P
2057 ><P
2058 >When you fix the problem PLEASE send me some updates to the
2059         documentation (or source code) so that the next person will find it
2060         easier. </P
2061 ><DIV
2062 CLASS="SECT2"
2063 ><HR><H3
2064 CLASS="SECT2"
2065 ><A
2066 NAME="AEN179"
2067 ></A
2068 >1.10.1. Diagnosing Problems</H3
2069 ><P
2070 >If you have installation problems then go to 
2071                 <TT
2072 CLASS="FILENAME"
2073 >DIAGNOSIS.txt</TT
2074 > to try to find the 
2075                 problem.</P
2076 ></DIV
2077 ><DIV
2078 CLASS="SECT2"
2079 ><HR><H3
2080 CLASS="SECT2"
2081 ><A
2082 NAME="AEN183"
2083 ></A
2084 >1.10.2. Scope IDs</H3
2085 ><P
2086 >By default Samba uses a blank scope ID. This means 
2087                 all your windows boxes must also have a blank scope ID. 
2088                 If you really want to use a non-blank scope ID then you will 
2089                 need to use the 'netbios scope' smb.conf option.
2090                 All your PCs will need to have the same setting for 
2091                 this to work. I do not recommend scope IDs.</P
2092 ></DIV
2093 ><DIV
2094 CLASS="SECT2"
2095 ><HR><H3
2096 CLASS="SECT2"
2097 ><A
2098 NAME="AEN186"
2099 ></A
2100 >1.10.3. Choosing the Protocol Level</H3
2101 ><P
2102 >The SMB protocol has many dialects. Currently 
2103                 Samba supports 5, called CORE, COREPLUS, LANMAN1, 
2104                 LANMAN2 and NT1.</P
2105 ><P
2106 >You can choose what maximum protocol to support 
2107                 in the <TT
2108 CLASS="FILENAME"
2109 >smb.conf</TT
2110 > file. The default is 
2111                 NT1 and that is the best for the vast majority of sites.</P
2112 ><P
2113 >In older versions of Samba you may have found it 
2114                 necessary to use COREPLUS. The limitations that led to 
2115                 this have mostly been fixed. It is now less likely that you 
2116                 will want to use less than LANMAN1. The only remaining advantage 
2117                 of COREPLUS is that for some obscure reason WfWg preserves 
2118                 the case of passwords in this protocol, whereas under LANMAN1, 
2119                 LANMAN2 or NT1 it uppercases all passwords before sending them,
2120                 forcing you to use the "password level=" option in some cases.</P
2121 ><P
2122 >The main advantage of LANMAN2 and NT1 is support for 
2123                 long filenames with some clients (eg: smbclient, Windows NT 
2124                 or Win95). </P
2125 ><P
2126 >See the smb.conf(5) manual page for more details.</P
2127 ><P
2128 >Note: To support print queue reporting you may find 
2129                 that you have to use TCP/IP as the default protocol under 
2130                 WfWg. For some reason if you leave Netbeui as the default 
2131                 it may break the print queue reporting on some systems. 
2132                 It is presumably a WfWg bug.</P
2133 ></DIV
2134 ><DIV
2135 CLASS="SECT2"
2136 ><HR><H3
2137 CLASS="SECT2"
2138 ><A
2139 NAME="AEN195"
2140 ></A
2141 >1.10.4. Printing from UNIX to a Client PC</H3
2142 ><P
2143 >To use a printer that is available via a smb-based 
2144                 server from a unix host with LPR you will need to compile the 
2145                 smbclient program. You then need to install the script 
2146                 "smbprint". Read the instruction in smbprint for more details.
2147                 </P
2148 ><P
2149 >There is also a SYSV style script that does much 
2150                 the same thing called smbprint.sysv. It contains instructions.</P
2151 ><P
2152 >See the CUPS manual for information about setting up 
2153                 printing from a unix host with CUPS to a smb-based server. </P
2154 ></DIV
2155 ><DIV
2156 CLASS="SECT2"
2157 ><HR><H3
2158 CLASS="SECT2"
2159 ><A
2160 NAME="AEN200"
2161 ></A
2162 >1.10.5. Locking</H3
2163 ><P
2164 >One area which sometimes causes trouble is locking.</P
2165 ><P
2166 >There are two types of locking which need to be 
2167                 performed by a SMB server. The first is "record locking" 
2168                 which allows a client to lock a range of bytes in a open file. 
2169                 The second is the "deny modes" that are specified when a file 
2170                 is open.</P
2171 ><P
2172 >Record locking semantics under Unix is very
2173                 different from record locking under Windows. Versions
2174                 of Samba before 2.2 have tried to use the native
2175                 fcntl() unix system call to implement proper record
2176                 locking between different Samba clients. This can not
2177                 be fully correct due to several reasons. The simplest
2178                 is the fact that a Windows client is allowed to lock a
2179                 byte range up to 2^32 or 2^64, depending on the client
2180                 OS. The unix locking only supports byte ranges up to
2181                 2^31. So it is not possible to correctly satisfy a
2182                 lock request above 2^31. There are many more
2183                 differences, too many to be listed here.</P
2184 ><P
2185 >Samba 2.2 and above implements record locking
2186                 completely independent of the underlying unix
2187                 system. If a byte range lock that the client requests
2188                 happens to fall into the range 0-2^31, Samba hands
2189                 this request down to the Unix system. All other locks
2190                 can not be seen by unix anyway.</P
2191 ><P
2192 >Strictly a SMB server should check for locks before 
2193                 every read and write call on a file. Unfortunately with the 
2194                 way fcntl() works this can be slow and may overstress the 
2195                 rpc.lockd. It is also almost always unnecessary as clients 
2196                 are supposed to independently make locking calls before reads 
2197                 and writes anyway if locking is important to them. By default 
2198                 Samba only makes locking calls when explicitly asked
2199                 to by a client, but if you set "strict locking = yes" then it will
2200                 make lock checking calls on every read and write. </P
2201 ><P
2202 >You can also disable by range locking completely 
2203                 using "locking = no". This is useful for those shares that 
2204                 don't support locking or don't need it (such as cdroms). In 
2205                 this case Samba fakes the return codes of locking calls to 
2206                 tell clients that everything is OK.</P
2207 ><P
2208 >The second class of locking is the "deny modes". These 
2209                 are set by an application when it opens a file to determine 
2210                 what types of access should be allowed simultaneously with 
2211                 its open. A client may ask for DENY_NONE, DENY_READ, DENY_WRITE 
2212                 or DENY_ALL. There are also special compatibility modes called 
2213                 DENY_FCB and  DENY_DOS.</P
2214 ></DIV
2215 ><DIV
2216 CLASS="SECT2"
2217 ><HR><H3
2218 CLASS="SECT2"
2219 ><A
2220 NAME="AEN209"
2221 ></A
2222 >1.10.6. Mapping Usernames</H3
2223 ><P
2224 >If you have different usernames on the PCs and 
2225                 the unix server then take a look at the "username map" option. 
2226                 See the smb.conf man page for details.</P
2227 ></DIV
2228 ></DIV
2229 ></DIV
2230 ><DIV
2231 CLASS="CHAPTER"
2232 ><HR><H1
2233 ><A
2234 NAME="DIAGNOSIS"
2235 ></A
2236 >Chapter 2. Diagnosing your samba server</H1
2237 ><DIV
2238 CLASS="SECT1"
2239 ><H2
2240 CLASS="SECT1"
2241 ><A
2242 NAME="AEN223"
2243 ></A
2244 >2.1. Introduction</H2
2245 ><P
2246 >This file contains a list of tests you can perform to validate your
2247 Samba server. It also tells you what the likely cause of the problem
2248 is if it fails any one of these steps. If it passes all these tests
2249 then it is probably working fine.</P
2250 ><P
2251 >You should do ALL the tests, in the order shown. I have tried to
2252 carefully choose them so later tests only use capabilities verified in
2253 the earlier tests.</P
2254 ><P
2255 >If you send me an email saying "it doesn't work" and you have not
2256 followed this test procedure then you should not be surprised if I
2257 ignore your email.</P
2258 ></DIV
2259 ><DIV
2260 CLASS="SECT1"
2261 ><HR><H2
2262 CLASS="SECT1"
2263 ><A
2264 NAME="AEN228"
2265 ></A
2266 >2.2. Assumptions</H2
2267 ><P
2268 >In all of the tests I assume you have a Samba server called BIGSERVER
2269 and a PC called ACLIENT both in workgroup TESTGROUP. I also assume the
2270 PC is running windows for workgroups with a recent copy of the
2271 microsoft tcp/ip stack. Alternatively, your PC may be running Windows
2272 95 or Windows NT (Workstation or Server).</P
2273 ><P
2274 >The procedure is similar for other types of clients.</P
2275 ><P
2276 >I also assume you know the name of an available share in your
2277 smb.conf. I will assume this share is called "tmp". You can add a
2278 "tmp" share like by adding the following to smb.conf:</P
2279 ><P
2280 ><PRE
2281 CLASS="PROGRAMLISTING"
2282 >&#13;[tmp]
2283  comment = temporary files 
2284  path = /tmp
2285  read only = yes&#13;</PRE
2286 ></P
2287 ><P
2288 >THESE TESTS ASSUME VERSION 2.0.6 OR LATER OF THE SAMBA SUITE. SOME
2289 COMMANDS SHOWN DID NOT EXIST IN EARLIER VERSIONS</P
2290 ><P
2291 >Please pay attention to the error messages you receive. If any error message
2292 reports that your server is being unfriendly you should first check that you
2293 IP name resolution is correctly set up. eg: Make sure your /etc/resolv.conf
2294 file points to name servers that really do exist.</P
2295 ><P
2296 >Also, if you do not have DNS server access for name resolution please check
2297 that the settings for your smb.conf file results in "dns proxy = no". The
2298 best way to check this is with "testparm smb.conf"</P
2299 ></DIV
2300 ><DIV
2301 CLASS="SECT1"
2302 ><HR><H2
2303 CLASS="SECT1"
2304 ><A
2305 NAME="AEN238"
2306 ></A
2307 >2.3. Tests</H2
2308 ><DIV
2309 CLASS="SECT2"
2310 ><H3
2311 CLASS="SECT2"
2312 ><A
2313 NAME="AEN240"
2314 ></A
2315 >2.3.1. Test 1</H3
2316 ><P
2317 >In the directory in which you store your smb.conf file, run the command
2318 "testparm smb.conf". If it reports any errors then your smb.conf
2319 configuration file is faulty.</P
2320 ><P
2321 >Note:  Your smb.conf file may be located in: <TT
2322 CLASS="FILENAME"
2323 >/etc</TT
2324 >
2325         Or in:   <TT
2326 CLASS="FILENAME"
2327 >/usr/local/samba/lib</TT
2328 ></P
2329 ></DIV
2330 ><DIV
2331 CLASS="SECT2"
2332 ><HR><H3
2333 CLASS="SECT2"
2334 ><A
2335 NAME="AEN246"
2336 ></A
2337 >2.3.2. Test 2</H3
2338 ><P
2339 >Run the command "ping BIGSERVER" from the PC and "ping ACLIENT" from
2340 the unix box. If you don't get a valid response then your TCP/IP
2341 software is not correctly installed. </P
2342 ><P
2343 >Note that you will need to start a "dos prompt" window on the PC to
2344 run ping.</P
2345 ><P
2346 >If you get a message saying "host not found" or similar then your DNS
2347 software or /etc/hosts file is not correctly setup. It is possible to
2348 run samba without DNS entries for the server and client, but I assume
2349 you do have correct entries for the remainder of these tests. </P
2350 ><P
2351 >Another reason why ping might fail is if your host is running firewall 
2352 software. You will need to relax the rules to let in the workstation
2353 in question, perhaps by allowing access from another subnet (on Linux
2354 this is done via the ipfwadm program.)</P
2355 ></DIV
2356 ><DIV
2357 CLASS="SECT2"
2358 ><HR><H3
2359 CLASS="SECT2"
2360 ><A
2361 NAME="AEN252"
2362 ></A
2363 >2.3.3. Test 3</H3
2364 ><P
2365 >Run the command "smbclient -L BIGSERVER" on the unix box. You
2366 should get a list of available shares back. </P
2367 ><P
2368 >If you get a error message containing the string "Bad password" then
2369 you probably have either an incorrect "hosts allow", "hosts deny" or
2370 "valid users" line in your smb.conf, or your guest account is not
2371 valid. Check what your guest account is using "testparm" and
2372 temporarily remove any "hosts allow", "hosts deny", "valid users" or
2373 "invalid users" lines.</P
2374 ><P
2375 >If you get a "connection refused" response then the smbd server may
2376 not be running. If you installed it in inetd.conf then you probably edited
2377 that file incorrectly. If you installed it as a daemon then check that
2378 it is running, and check that the netbios-ssn port is in a LISTEN
2379 state using "netstat -a".</P
2380 ><P
2381 >If you get a "session request failed" then the server refused the
2382 connection. If it says "Your server software is being unfriendly" then
2383 its probably because you have invalid command line parameters to smbd,
2384 or a similar fatal problem with the initial startup of smbd. Also
2385 check your config file (smb.conf) for syntax errors with "testparm"
2386 and that the various directories where samba keeps its log and lock
2387 files exist.</P
2388 ><P
2389 >There are a number of reasons for which smbd may refuse or decline
2390 a session request. The most common of these involve one or more of
2391 the following smb.conf file entries:</P
2392 ><P
2393 ><PRE
2394 CLASS="PROGRAMLISTING"
2395 >       hosts deny = ALL
2396         hosts allow = xxx.xxx.xxx.xxx/yy
2397         bind interfaces only = Yes</PRE
2398 ></P
2399 ><P
2400 >In the above, no allowance has been made for any session requests that
2401 will automatically translate to the loopback adaptor address 127.0.0.1.
2402 To solve this problem change these lines to:</P
2403 ><P
2404 ><PRE
2405 CLASS="PROGRAMLISTING"
2406 >       hosts deny = ALL
2407         hosts allow = xxx.xxx.xxx.xxx/yy 127.</PRE
2408 ></P
2409 ><P
2410 >Do NOT use the "bind interfaces only" parameter where you may wish to
2411 use the samba password change facility, or where smbclient may need to
2412 access local service for name resolution or for local resource
2413 connections. (Note: the "bind interfaces only" parameter deficiency
2414 where it will not allow connections to the loopback address will be
2415 fixed soon).</P
2416 ><P
2417 >Another common cause of these two errors is having something already running 
2418 on port 139, such as Samba (ie: smbd is running from inetd already) or
2419 something like Digital's Pathworks. Check your inetd.conf file before trying
2420 to start smbd as a daemon, it can avoid a lot of frustration!</P
2421 ><P
2422 >And yet another possible cause for failure of TEST 3 is when the subnet mask
2423 and / or broadcast address settings are incorrect. Please check that the
2424 network interface IP Address / Broadcast Address / Subnet Mask settings are
2425 correct and that Samba has correctly noted these in the log.nmb file.</P
2426 ></DIV
2427 ><DIV
2428 CLASS="SECT2"
2429 ><HR><H3
2430 CLASS="SECT2"
2431 ><A
2432 NAME="AEN267"
2433 ></A
2434 >2.3.4. Test 4</H3
2435 ><P
2436 >Run the command "nmblookup -B BIGSERVER __SAMBA__". You should get the
2437 IP address of your Samba server back.</P
2438 ><P
2439 >If you don't then nmbd is incorrectly installed. Check your inetd.conf
2440 if you run it from there, or that the daemon is running and listening
2441 to udp port 137.</P
2442 ><P
2443 >One common problem is that many inetd implementations can't take many
2444 parameters on the command line. If this is the case then create a
2445 one-line script that contains the right parameters and run that from
2446 inetd.</P
2447 ></DIV
2448 ><DIV
2449 CLASS="SECT2"
2450 ><HR><H3
2451 CLASS="SECT2"
2452 ><A
2453 NAME="AEN272"
2454 ></A
2455 >2.3.5. Test 5</H3
2456 ><P
2457 >run the command <B
2458 CLASS="COMMAND"
2459 >nmblookup -B ACLIENT '*'</B
2460 ></P
2461 ><P
2462 >You should get the PCs IP address back. If you don't then the client
2463 software on the PC isn't installed correctly, or isn't started, or you
2464 got the name of the PC wrong. </P
2465 ><P
2466 >If ACLIENT doesn't resolve via DNS then use the IP address of the
2467 client in the above test.</P
2468 ></DIV
2469 ><DIV
2470 CLASS="SECT2"
2471 ><HR><H3
2472 CLASS="SECT2"
2473 ><A
2474 NAME="AEN278"
2475 ></A
2476 >2.3.6. Test 6</H3
2477 ><P
2478 >Run the command <B
2479 CLASS="COMMAND"
2480 >nmblookup -d 2 '*'</B
2481 ></P
2482 ><P
2483 >This time we are trying the same as the previous test but are trying
2484 it via a broadcast to the default broadcast address. A number of
2485 Netbios/TCPIP hosts on the network should respond, although Samba may
2486 not catch all of the responses in the short time it listens. You
2487 should see "got a positive name query response" messages from several
2488 hosts.</P
2489 ><P
2490 >If this doesn't give a similar result to the previous test then
2491 nmblookup isn't correctly getting your broadcast address through its
2492 automatic mechanism. In this case you should experiment use the
2493 "interfaces" option in smb.conf to manually configure your IP
2494 address, broadcast and netmask. </P
2495 ><P
2496 >If your PC and server aren't on the same subnet then you will need to
2497 use the -B option to set the broadcast address to the that of the PCs
2498 subnet.</P
2499 ><P
2500 >This test will probably fail if your subnet mask and broadcast address are
2501 not correct. (Refer to TEST 3 notes above).</P
2502 ></DIV
2503 ><DIV
2504 CLASS="SECT2"
2505 ><HR><H3
2506 CLASS="SECT2"
2507 ><A
2508 NAME="AEN286"
2509 ></A
2510 >2.3.7. Test 7</H3
2511 ><P
2512 >Run the command <B
2513 CLASS="COMMAND"
2514 >smbclient //BIGSERVER/TMP</B
2515 >. You should 
2516 then be prompted for a password. You should use the password of the account
2517 you are logged into the unix box with. If you want to test with
2518 another account then add the -U &gt;accountname&lt; option to the end of
2519 the command line.  eg: 
2520 <B
2521 CLASS="COMMAND"
2522 >smbclient //bigserver/tmp -Ujohndoe</B
2523 ></P
2524 ><P
2525 >Note: It is possible to specify the password along with the username
2526 as follows:
2527 <B
2528 CLASS="COMMAND"
2529 >smbclient //bigserver/tmp -Ujohndoe%secret</B
2530 ></P
2531 ><P
2532 >Once you enter the password you should get the "smb&#62;" prompt. If you
2533 don't then look at the error message. If it says "invalid network
2534 name" then the service "tmp" is not correctly setup in your smb.conf.</P
2535 ><P
2536 >If it says "bad password" then the likely causes are:</P
2537 ><P
2538 ></P
2539 ><OL
2540 TYPE="1"
2541 ><LI
2542 ><P
2543 >       you have shadow passords (or some other password system) but didn't
2544         compile in support for them in smbd
2545         </P
2546 ></LI
2547 ><LI
2548 ><P
2549 >       your "valid users" configuration is incorrect
2550         </P
2551 ></LI
2552 ><LI
2553 ><P
2554 >       you have a mixed case password and you haven't enabled the "password
2555         level" option at a high enough level
2556         </P
2557 ></LI
2558 ><LI
2559 ><P
2560 >       the "path =" line in smb.conf is incorrect. Check it with testparm
2561         </P
2562 ></LI
2563 ><LI
2564 ><P
2565 >       you enabled password encryption but didn't create the SMB encrypted
2566         password file
2567         </P
2568 ></LI
2569 ></OL
2570 ><P
2571 >Once connected you should be able to use the commands 
2572 <B
2573 CLASS="COMMAND"
2574 >dir</B
2575 > <B
2576 CLASS="COMMAND"
2577 >get</B
2578 > <B
2579 CLASS="COMMAND"
2580 >put</B
2581 > etc. 
2582 Type <B
2583 CLASS="COMMAND"
2584 >help &gt;command&lt;</B
2585 > for instructions. You should
2586 especially check that the amount of free disk space shown is correct
2587 when you type <B
2588 CLASS="COMMAND"
2589 >dir</B
2590 >.</P
2591 ></DIV
2592 ><DIV
2593 CLASS="SECT2"
2594 ><HR><H3
2595 CLASS="SECT2"
2596 ><A
2597 NAME="AEN312"
2598 ></A
2599 >2.3.8. Test 8</H3
2600 ><P
2601 >On the PC type the command <B
2602 CLASS="COMMAND"
2603 >net view \\BIGSERVER</B
2604 >. You will 
2605 need to do this from within a "dos prompt" window. You should get back a 
2606 list of available shares on the server.</P
2607 ><P
2608 >If you get a "network name not found" or similar error then netbios
2609 name resolution is not working. This is usually caused by a problem in
2610 nmbd. To overcome it you could do one of the following (you only need
2611 to choose one of them):</P
2612 ><P
2613 ></P
2614 ><OL
2615 TYPE="1"
2616 ><LI
2617 ><P
2618 >       fixup the nmbd installation</P
2619 ></LI
2620 ><LI
2621 ><P
2622 >       add the IP address of BIGSERVER to the "wins server" box in the
2623         advanced tcp/ip setup on the PC.</P
2624 ></LI
2625 ><LI
2626 ><P
2627 >       enable windows name resolution via DNS in the advanced section of
2628         the tcp/ip setup</P
2629 ></LI
2630 ><LI
2631 ><P
2632 >       add BIGSERVER to your lmhosts file on the PC.</P
2633 ></LI
2634 ></OL
2635 ><P
2636 >If you get a "invalid network name" or "bad password error" then the
2637 same fixes apply as they did for the "smbclient -L" test above. In
2638 particular, make sure your "hosts allow" line is correct (see the man
2639 pages)</P
2640 ><P
2641 >Also, do not overlook that fact that when the workstation requests the
2642 connection to the samba server it will attempt to connect using the 
2643 name with which you logged onto your Windows machine. You need to make
2644 sure that an account exists on your Samba server with that exact same
2645 name and password.</P
2646 ><P
2647 >If you get "specified computer is not receiving requests" or similar
2648 it probably means that the host is not contactable via tcp services.
2649 Check to see if the host is running tcp wrappers, and if so add an entry in
2650 the hosts.allow file for your client (or subnet, etc.)</P
2651 ></DIV
2652 ><DIV
2653 CLASS="SECT2"
2654 ><HR><H3
2655 CLASS="SECT2"
2656 ><A
2657 NAME="AEN329"
2658 ></A
2659 >2.3.9. Test 9</H3
2660 ><P
2661 >Run the command <B
2662 CLASS="COMMAND"
2663 >net use x: \\BIGSERVER\TMP</B
2664 >. You should 
2665 be prompted for a password then you should get a "command completed 
2666 successfully" message. If not then your PC software is incorrectly 
2667 installed or your smb.conf is incorrect. make sure your "hosts allow" 
2668 and other config lines in smb.conf are correct.</P
2669 ><P
2670 >It's also possible that the server can't work out what user name to
2671 connect you as. To see if this is the problem add the line "user =
2672 USERNAME" to the [tmp] section of smb.conf where "USERNAME" is the
2673 username corresponding to the password you typed. If you find this
2674 fixes things you may need the username mapping option. </P
2675 ><P
2676 >It might also be the case that your client only sends encrypted passwords 
2677 and you have <B
2678 CLASS="COMMAND"
2679 >encrypt passwords = no</B
2680 > in <TT
2681 CLASS="FILENAME"
2682 >smb.conf</TT
2683 >.
2684 Turn it back on to fix.</P
2685 ></DIV
2686 ><DIV
2687 CLASS="SECT2"
2688 ><HR><H3
2689 CLASS="SECT2"
2690 ><A
2691 NAME="AEN337"
2692 ></A
2693 >2.3.10. Test 10</H3
2694 ><P
2695 >Run the command <B
2696 CLASS="COMMAND"
2697 >nmblookup -M TESTGROUP</B
2698 > where 
2699 TESTGROUP is the name of the workgroup that your Samba server and 
2700 Windows PCs belong to. You should get back the IP address of the 
2701 master browser for that workgroup.</P
2702 ><P
2703 >If you don't then the election process has failed. Wait a minute to
2704 see if it is just being slow then try again. If it still fails after
2705 that then look at the browsing options you have set in smb.conf. Make
2706 sure you have <B
2707 CLASS="COMMAND"
2708 >preferred master = yes</B
2709 > to ensure that 
2710 an election is held at startup.</P
2711 ></DIV
2712 ><DIV
2713 CLASS="SECT2"
2714 ><HR><H3
2715 CLASS="SECT2"
2716 ><A
2717 NAME="AEN343"
2718 ></A
2719 >2.3.11. Test 11</H3
2720 ><P
2721 >From file manager try to browse the server. Your samba server should
2722 appear in the browse list of your local workgroup (or the one you
2723 specified in smb.conf). You should be able to double click on the name
2724 of the server and get a list of shares. If you get a "invalid
2725 password" error when you do then you are probably running WinNT and it
2726 is refusing to browse a server that has no encrypted password
2727 capability and is in user level security mode. In this case either set
2728 <B
2729 CLASS="COMMAND"
2730 >security = server</B
2731 > AND 
2732 <B
2733 CLASS="COMMAND"
2734 >password server = Windows_NT_Machine</B
2735 > in your
2736 smb.conf file, or enable encrypted passwords AFTER compiling in support
2737 for encrypted passwords (refer to the Makefile).</P
2738 ></DIV
2739 ></DIV
2740 ><DIV
2741 CLASS="SECT1"
2742 ><HR><H2
2743 CLASS="SECT1"
2744 ><A
2745 NAME="AEN348"
2746 ></A
2747 >2.4. Still having troubles?</H2
2748 ><P
2749 >Try the mailing list or newsgroup, or use the ethereal utility to
2750 sniff the problem. The official samba mailing list can be reached at
2751 <A
2752 HREF="mailto:samba@samba.org"
2753 TARGET="_top"
2754 >samba@samba.org</A
2755 >. To find 
2756 out more about samba and how to subscribe to the mailing list check 
2757 out the samba web page at 
2758 <A
2759 HREF="http://samba.org/samba"
2760 TARGET="_top"
2761 >http://samba.org/samba</A
2762 ></P
2763 ><P
2764 >Also look at the other docs in the Samba package!</P
2765 ></DIV
2766 ></DIV
2767 ><DIV
2768 CLASS="CHAPTER"
2769 ><HR><H1
2770 ><A
2771 NAME="INTEGRATE-MS-NETWORKS"
2772 ></A
2773 >Chapter 3. Integrating MS Windows networks with Samba</H1
2774 ><DIV
2775 CLASS="SECT1"
2776 ><H2
2777 CLASS="SECT1"
2778 ><A
2779 NAME="AEN365"
2780 ></A
2781 >3.1. Agenda</H2
2782 ><P
2783 >To identify the key functional mechanisms of MS Windows networking 
2784 to enable the deployment of Samba as a means of extending and/or 
2785 replacing MS Windows NT/2000 technology.</P
2786 ><P
2787 >We will examine:</P
2788 ><P
2789 ></P
2790 ><OL
2791 TYPE="1"
2792 ><LI
2793 ><P
2794 >Name resolution in a pure Unix/Linux TCP/IP 
2795         environment
2796         </P
2797 ></LI
2798 ><LI
2799 ><P
2800 >Name resolution as used within MS Windows 
2801         networking
2802         </P
2803 ></LI
2804 ><LI
2805 ><P
2806 >How browsing functions and how to deploy stable 
2807         and dependable browsing using Samba
2808         </P
2809 ></LI
2810 ><LI
2811 ><P
2812 >MS Windows security options and how to 
2813         configure Samba for seemless integration
2814         </P
2815 ></LI
2816 ><LI
2817 ><P
2818 >Configuration of Samba as:</P
2819 ><P
2820 ></P
2821 ><OL
2822 TYPE="a"
2823 ><LI
2824 ><P
2825 >A stand-alone server</P
2826 ></LI
2827 ><LI
2828 ><P
2829 >An MS Windows NT 3.x/4.0 security domain member
2830                 </P
2831 ></LI
2832 ><LI
2833 ><P
2834 >An alternative to an MS Windows NT 3.x/4.0 Domain Controller
2835                 </P
2836 ></LI
2837 ></OL
2838 ></LI
2839 ></OL
2840 ></DIV
2841 ><DIV
2842 CLASS="SECT1"
2843 ><HR><H2
2844 CLASS="SECT1"
2845 ><A
2846 NAME="AEN387"
2847 ></A
2848 >3.2. Name Resolution in a pure Unix/Linux world</H2
2849 ><P
2850 >The key configuration files covered in this section are:</P
2851 ><P
2852 ></P
2853 ><UL
2854 ><LI
2855 ><P
2856 ><TT
2857 CLASS="FILENAME"
2858 >/etc/hosts</TT
2859 ></P
2860 ></LI
2861 ><LI
2862 ><P
2863 ><TT
2864 CLASS="FILENAME"
2865 >/etc/resolv.conf</TT
2866 ></P
2867 ></LI
2868 ><LI
2869 ><P
2870 ><TT
2871 CLASS="FILENAME"
2872 >/etc/host.conf</TT
2873 ></P
2874 ></LI
2875 ><LI
2876 ><P
2877 ><TT
2878 CLASS="FILENAME"
2879 >/etc/nsswitch.conf</TT
2880 ></P
2881 ></LI
2882 ></UL
2883 ><DIV
2884 CLASS="SECT2"
2885 ><HR><H3
2886 CLASS="SECT2"
2887 ><A
2888 NAME="AEN403"
2889 ></A
2890 >3.2.1. <TT
2891 CLASS="FILENAME"
2892 >/etc/hosts</TT
2893 ></H3
2894 ><P
2895 >Contains a static list of IP Addresses and names.
2896 eg:</P
2897 ><P
2898 ><PRE
2899 CLASS="PROGRAMLISTING"
2900 >       127.0.0.1       localhost localhost.localdomain
2901         192.168.1.1     bigbox.caldera.com      bigbox  alias4box</PRE
2902 ></P
2903 ><P
2904 >The purpose of <TT
2905 CLASS="FILENAME"
2906 >/etc/hosts</TT
2907 > is to provide a 
2908 name resolution mechanism so that uses do not need to remember 
2909 IP addresses.</P
2910 ><P
2911 >Network packets that are sent over the physical network transport 
2912 layer communicate not via IP addresses but rather using the Media 
2913 Access Control address, or MAC address. IP Addresses are currently 
2914 32 bits in length and are typically presented as four (4) decimal 
2915 numbers that are separated by a dot (or period). eg: 168.192.1.1</P
2916 ><P
2917 >MAC Addresses use 48 bits (or 6 bytes) and are typically represented 
2918 as two digit hexadecimal numbers separated by colons. eg: 
2919 40:8e:0a:12:34:56</P
2920 ><P
2921 >Every network interfrace must have an MAC address. Associated with 
2922 a MAC address there may be one or more IP addresses. There is NO 
2923 relationship between an IP address and a MAC address, all such assignments 
2924 are arbitary or discretionary in nature. At the most basic level all 
2925 network communications takes place using MAC addressing. Since MAC 
2926 addresses must be globally unique, and generally remains fixed for 
2927 any particular interface, the assignment of an IP address makes sense 
2928 from a network management perspective. More than one IP address can 
2929 be assigned per MAC address. One address must be the primary IP address, 
2930 this is the address that will be returned in the ARP reply.</P
2931 ><P
2932 >When a user or a process wants to communicate with another machine 
2933 the protocol implementation ensures that the "machine name" or "host 
2934 name" is resolved to an IP address in a manner that is controlled 
2935 by the TCP/IP configuration control files. The file 
2936 <TT
2937 CLASS="FILENAME"
2938 >/etc/hosts</TT
2939 > is one such file.</P
2940 ><P
2941 >When the IP address of the destination interface has been 
2942 determined a protocol called ARP/RARP is used to identify 
2943 the MAC address of the target interface. ARP stands for Address 
2944 Resolution Protocol, and is a broadcast oriented method that 
2945 uses UDP (User Datagram Protocol) to send a request to all 
2946 interfaces on the local network segment using the all 1's MAC 
2947 address. Network interfaces are programmed to respond to two 
2948 MAC addresses only; their own unique address and the address 
2949 ff:ff:ff:ff:ff:ff. The reply packet from an ARP request will 
2950 contain the MAC address and the primary IP address for each 
2951 interface.</P
2952 ><P
2953 >The <TT
2954 CLASS="FILENAME"
2955 >/etc/hosts</TT
2956 > file is foundational to all 
2957 Unix/Linux TCP/IP installations and as a minumum will contain 
2958 the localhost and local network interface IP addresses and the 
2959 primary names by which they are known within the local machine. 
2960 This file helps to prime the pump so that a basic level of name 
2961 resolution can exist before any other method of name resolution 
2962 becomes available.</P
2963 ></DIV
2964 ><DIV
2965 CLASS="SECT2"
2966 ><HR><H3
2967 CLASS="SECT2"
2968 ><A
2969 NAME="AEN419"
2970 ></A
2971 >3.2.2. <TT
2972 CLASS="FILENAME"
2973 >/etc/resolv.conf</TT
2974 ></H3
2975 ><P
2976 >This file tells the name resolution libraries:</P
2977 ><P
2978 ></P
2979 ><UL
2980 ><LI
2981 ><P
2982 >The name of the domain to which the machine 
2983         belongs
2984         </P
2985 ></LI
2986 ><LI
2987 ><P
2988 >The name(s) of any domains that should be 
2989         automatically searched when trying to resolve unqualified 
2990         host names to their IP address
2991         </P
2992 ></LI
2993 ><LI
2994 ><P
2995 >The name or IP address of available Domain 
2996         Name Servers that may be asked to perform name to address 
2997         translation lookups
2998         </P
2999 ></LI
3000 ></UL
3001 ></DIV
3002 ><DIV
3003 CLASS="SECT2"
3004 ><HR><H3
3005 CLASS="SECT2"
3006 ><A
3007 NAME="AEN430"
3008 ></A
3009 >3.2.3. <TT
3010 CLASS="FILENAME"
3011 >/etc/host.conf</TT
3012 ></H3
3013 ><P
3014 ><TT
3015 CLASS="FILENAME"
3016 >/etc/host.conf</TT
3017 > is the primary means by 
3018 which the setting in /etc/resolv.conf may be affected. It is a 
3019 critical configuration file.  This file controls the order by 
3020 which name resolution may procede. The typical structure is:</P
3021 ><P
3022 ><PRE
3023 CLASS="PROGRAMLISTING"
3024 >       order hosts,bind
3025         multi on</PRE
3026 ></P
3027 ><P
3028 >then both addresses should be returned. Please refer to the 
3029 man page for host.conf for further details.</P
3030 ></DIV
3031 ><DIV
3032 CLASS="SECT2"
3033 ><HR><H3
3034 CLASS="SECT2"
3035 ><A
3036 NAME="AEN438"
3037 ></A
3038 >3.2.4. <TT
3039 CLASS="FILENAME"
3040 >/etc/nsswitch.conf</TT
3041 ></H3
3042 ><P
3043 >This file controls the actual name resolution targets. The 
3044 file typically has resolver object specifications as follows:</P
3045 ><P
3046 ><PRE
3047 CLASS="PROGRAMLISTING"
3048 >       # /etc/nsswitch.conf
3049         #
3050         # Name Service Switch configuration file.
3051         #
3052
3053         passwd:         compat
3054         # Alternative entries for password authentication are:
3055         # passwd:       compat files nis ldap winbind
3056         shadow:         compat
3057         group:          compat
3058
3059         hosts:          files nis dns
3060         # Alternative entries for host name resolution are:
3061         # hosts:        files dns nis nis+ hesoid db compat ldap wins
3062         networks:       nis files dns
3063
3064         ethers:         nis files
3065         protocols:      nis files
3066         rpc:            nis files
3067         services:       nis files</PRE
3068 ></P
3069 ><P
3070 >Of course, each of these mechanisms requires that the appropriate 
3071 facilities and/or services are correctly configured.</P
3072 ><P
3073 >It should be noted that unless a network request/message must be 
3074 sent, TCP/IP networks are silent. All TCP/IP communications assumes a 
3075 principal of speaking only when necessary.</P
3076 ><P
3077 >Samba version 2.2.0 will add Linux support for extensions to 
3078 the name service switch infrastructure so that linux clients will 
3079 be able to obtain resolution of MS Windows NetBIOS names to IP 
3080 Addresses. To gain this functionality Samba needs to be compiled 
3081 with appropriate arguments to the make command (ie: <B
3082 CLASS="COMMAND"
3083 >make 
3084 nsswitch/libnss_wins.so</B
3085 >). The resulting library should 
3086 then be installed in the <TT
3087 CLASS="FILENAME"
3088 >/lib</TT
3089 > directory and 
3090 the "wins" parameter needs to be added to the "hosts:" line in 
3091 the <TT
3092 CLASS="FILENAME"
3093 >/etc/nsswitch.conf</TT
3094 > file. At this point it 
3095 will be possible to ping any MS Windows machine by it's NetBIOS 
3096 machine name, so long as that machine is within the workgroup to 
3097 which both the samba machine and the MS Windows machine belong.</P
3098 ></DIV
3099 ></DIV
3100 ><DIV
3101 CLASS="SECT1"
3102 ><HR><H2
3103 CLASS="SECT1"
3104 ><A
3105 NAME="AEN450"
3106 ></A
3107 >3.3. Name resolution as used within MS Windows networking</H2
3108 ><P
3109 >MS Windows networking is predicated about the name each machine 
3110 is given. This name is known variously (and inconsistently) as 
3111 the "computer name", "machine name", "networking name", "netbios name", 
3112 "SMB name". All terms mean the same thing with the exception of 
3113 "netbios name" which can apply also to the name of the workgroup or the 
3114 domain name. The terms "workgroup" and "domain" are really just a 
3115 simply name with which the machine is associated. All NetBIOS names 
3116 are exactly 16 characters in length. The 16th character is reserved. 
3117 It is used to store a one byte value that indicates service level 
3118 information for the NetBIOS name that is registered. A NetBIOS machine 
3119 name is therefore registered for each service type that is provided by 
3120 the client/server.</P
3121 ><P
3122 >The following are typical NetBIOS name/service type registrations:</P
3123 ><P
3124 ><PRE
3125 CLASS="PROGRAMLISTING"
3126 >       Unique NetBIOS Names:
3127                 MACHINENAME&#60;00&#62; = Server Service is running on MACHINENAME
3128                 MACHINENAME&#60;03&#62; = Generic Machine Name (NetBIOS name)
3129                 MACHINENAME&#60;20&#62; = LanMan Server service is running on MACHINENAME
3130                 WORKGROUP&#60;1b&#62; = Domain Master Browser
3131
3132         Group Names:
3133                 WORKGROUP&#60;03&#62; = Generic Name registered by all members of WORKGROUP
3134                 WORKGROUP&#60;1c&#62; = Domain Controllers / Netlogon Servers
3135                 WORKGROUP&#60;1d&#62; = Local Master Browsers
3136                 WORKGROUP&#60;1e&#62; = Internet Name Resolvers</PRE
3137 ></P
3138 ><P
3139 >It should be noted that all NetBIOS machines register their own 
3140 names as per the above. This is in vast contrast to TCP/IP 
3141 installations where traditionally the system administrator will 
3142 determine in the /etc/hosts or in the DNS database what names 
3143 are associated with each IP address.</P
3144 ><P
3145 >One further point of clarification should be noted, the <TT
3146 CLASS="FILENAME"
3147 >/etc/hosts</TT
3148
3149 file and the DNS records do not provide the NetBIOS name type information 
3150 that MS Windows clients depend on to locate the type of service that may 
3151 be needed. An example of this is what happens when an MS Windows client 
3152 wants to locate a domain logon server. It find this service and the IP 
3153 address of a server that provides it by performing a lookup (via a 
3154 NetBIOS broadcast) for enumeration of all machines that have 
3155 registered the name type *&#60;1c&#62;. A logon request is then sent to each 
3156 IP address that is returned in the enumerated list of IP addresses. Which 
3157 ever machine first replies then ends up providing the logon services.</P
3158 ><P
3159 >The name "workgroup" or "domain" really can be confusing since these 
3160 have the added significance of indicating what is the security 
3161 architecture of the MS Windows network. The term "workgroup" indicates 
3162 that the primary nature of the network environment is that of a 
3163 peer-to-peer design. In a WORKGROUP all machines are responsible for 
3164 their own security, and generally such security is limited to use of 
3165 just a password (known as SHARE MODE security). In most situations 
3166 with peer-to-peer networking the users who control their own machines 
3167 will simply opt to have no security at all. It is possible to have 
3168 USER MODE security in a WORKGROUP environment, thus requiring use 
3169 of a user name and a matching password.</P
3170 ><P
3171 >MS Windows networking is thus predetermined to use machine names 
3172 for all local and remote machine message passing. The protocol used is 
3173 called Server Message Block (SMB) and this is implemented using 
3174 the NetBIOS protocol (Network Basic Input Output System). NetBIOS can 
3175 be encapsulated using LLC (Logical Link Control) protocol - in which case 
3176 the resulting protocol is called NetBEUI (Network Basic Extended User 
3177 Interface). NetBIOS can also be run over IPX (Internetworking Packet 
3178 Exchange) protocol as used by Novell NetWare, and it can be run 
3179 over TCP/IP protocols - in which case the resulting protocol is called 
3180 NBT or NetBT, the NetBIOS over TCP/IP.</P
3181 ><P
3182 >MS Windows machines use a complex array of name resolution mechanisms. 
3183 Since we are primarily concerned with TCP/IP this demonstration is 
3184 limited to this area.</P
3185 ><DIV
3186 CLASS="SECT2"
3187 ><HR><H3
3188 CLASS="SECT2"
3189 ><A
3190 NAME="AEN462"
3191 ></A
3192 >3.3.1. The NetBIOS Name Cache</H3
3193 ><P
3194 >All MS Windows machines employ an in memory buffer in which is 
3195 stored the NetBIOS names and IP addresses for all external 
3196 machines that that machine has communicated with over the 
3197 past 10-15 minutes. It is more efficient to obtain an IP address 
3198 for a machine from the local cache than it is to go through all the 
3199 configured name resolution mechanisms.</P
3200 ><P
3201 >If a machine whose name is in the local name cache has been shut 
3202 down before the name had been expired and flushed from the cache, then 
3203 an attempt to exchange a message with that machine will be subject 
3204 to time-out delays. i.e.: Its name is in the cache, so a name resolution 
3205 lookup will succeed, but the machine can not respond. This can be 
3206 frustrating for users - but it is a characteristic of the protocol.</P
3207 ><P
3208 >The MS Windows utility that allows examination of the NetBIOS 
3209 name cache is called "nbtstat". The Samba equivalent of this 
3210 is called "nmblookup".</P
3211 ></DIV
3212 ><DIV
3213 CLASS="SECT2"
3214 ><HR><H3
3215 CLASS="SECT2"
3216 ><A
3217 NAME="AEN467"
3218 ></A
3219 >3.3.2. The LMHOSTS file</H3
3220 ><P
3221 >This file is usually located in MS Windows NT 4.0 or 
3222 2000 in <TT
3223 CLASS="FILENAME"
3224 >C:\WINNT\SYSTEM32\DRIVERS\ETC</TT
3225 > and contains 
3226 the IP Address and the machine name in matched pairs. The 
3227 <TT
3228 CLASS="FILENAME"
3229 >LMHOSTS</TT
3230 > file performs NetBIOS name 
3231 to IP address mapping oriented.</P
3232 ><P
3233 >It typically looks like:</P
3234 ><P
3235 ><PRE
3236 CLASS="PROGRAMLISTING"
3237 >       # Copyright (c) 1998 Microsoft Corp.
3238         #
3239         # This is a sample LMHOSTS file used by the Microsoft Wins Client (NetBIOS
3240         # over TCP/IP) stack for Windows98
3241         #
3242         # This file contains the mappings of IP addresses to NT computernames
3243         # (NetBIOS) names.  Each entry should be kept on an individual line.
3244         # The IP address should be placed in the first column followed by the
3245         # corresponding computername. The address and the comptername
3246         # should be separated by at least one space or tab. The "#" character
3247         # is generally used to denote the start of a comment (see the exceptions
3248         # below).
3249         #
3250         # This file is compatible with Microsoft LAN Manager 2.x TCP/IP lmhosts
3251         # files and offers the following extensions:
3252         #
3253         #      #PRE
3254         #      #DOM:&lt;domain&gt;
3255         #      #INCLUDE &lt;filename&gt;
3256         #      #BEGIN_ALTERNATE
3257         #      #END_ALTERNATE
3258         #      \0xnn (non-printing character support)
3259         #
3260         # Following any entry in the file with the characters "#PRE" will cause
3261         # the entry to be preloaded into the name cache. By default, entries are
3262         # not preloaded, but are parsed only after dynamic name resolution fails.
3263         #
3264         # Following an entry with the "#DOM:&lt;domain&gt;" tag will associate the
3265         # entry with the domain specified by &lt;domain&gt;. This affects how the
3266         # browser and logon services behave in TCP/IP environments. To preload
3267         # the host name associated with #DOM entry, it is necessary to also add a
3268         # #PRE to the line. The &lt;domain&gt; is always preloaded although it will not
3269         # be shown when the name cache is viewed.
3270         #
3271         # Specifying "#INCLUDE &lt;filename&gt;" will force the RFC NetBIOS (NBT)
3272         # software to seek the specified &lt;filename&gt; and parse it as if it were
3273         # local. &lt;filename&gt; is generally a UNC-based name, allowing a
3274         # centralized lmhosts file to be maintained on a server.
3275         # It is ALWAYS necessary to provide a mapping for the IP address of the
3276         # server prior to the #INCLUDE. This mapping must use the #PRE directive.
3277         # In addtion the share "public" in the example below must be in the
3278         # LanManServer list of "NullSessionShares" in order for client machines to
3279         # be able to read the lmhosts file successfully. This key is under
3280         # \machine\system\currentcontrolset\services\lanmanserver\parameters\nullsessionshares
3281         # in the registry. Simply add "public" to the list found there.
3282         #
3283         # The #BEGIN_ and #END_ALTERNATE keywords allow multiple #INCLUDE
3284         # statements to be grouped together. Any single successful include
3285         # will cause the group to succeed.
3286         #
3287         # Finally, non-printing characters can be embedded in mappings by
3288         # first surrounding the NetBIOS name in quotations, then using the
3289         # \0xnn notation to specify a hex value for a non-printing character.
3290         #
3291         # The following example illustrates all of these extensions:
3292         #
3293         # 102.54.94.97     rhino         #PRE #DOM:networking  #net group's DC
3294         # 102.54.94.102    "appname  \0x14"                    #special app server
3295         # 102.54.94.123    popular            #PRE             #source server
3296         # 102.54.94.117    localsrv           #PRE             #needed for the include
3297         #
3298         # #BEGIN_ALTERNATE
3299         # #INCLUDE \\localsrv\public\lmhosts
3300         # #INCLUDE \\rhino\public\lmhosts
3301         # #END_ALTERNATE
3302         #
3303         # In the above example, the "appname" server contains a special
3304         # character in its name, the "popular" and "localsrv" server names are
3305         # preloaded, and the "rhino" server name is specified so it can be used
3306         # to later #INCLUDE a centrally maintained lmhosts file if the "localsrv"
3307         # system is unavailable.
3308         #
3309         # Note that the whole file is parsed including comments on each lookup,
3310         # so keeping the number of comments to a minimum will improve performance.
3311         # Therefore it is not advisable to simply add lmhosts file entries onto the
3312         # end of this file.</PRE
3313 ></P
3314 ></DIV
3315 ><DIV
3316 CLASS="SECT2"
3317 ><HR><H3
3318 CLASS="SECT2"
3319 ><A
3320 NAME="AEN475"
3321 ></A
3322 >3.3.3. HOSTS file</H3
3323 ><P
3324 >This file is usually located in MS Windows NT 4.0 or 2000 in 
3325 <TT
3326 CLASS="FILENAME"
3327 >C:\WINNT\SYSTEM32\DRIVERS\ETC</TT
3328 > and contains 
3329 the IP Address and the IP hostname in matched pairs. It can be 
3330 used by the name resolution infrastructure in MS Windows, depending 
3331 on how the TCP/IP environment is configured. This file is in 
3332 every way the equivalent of the Unix/Linux <TT
3333 CLASS="FILENAME"
3334 >/etc/hosts</TT
3335 > file.</P
3336 ></DIV
3337 ><DIV
3338 CLASS="SECT2"
3339 ><HR><H3
3340 CLASS="SECT2"
3341 ><A
3342 NAME="AEN480"
3343 ></A
3344 >3.3.4. DNS Lookup</H3
3345 ><P
3346 >This capability is configured in the TCP/IP setup area in the network 
3347 configuration facility. If enabled an elaborate name resolution sequence 
3348 is followed the precise nature of which isdependant on what the NetBIOS 
3349 Node Type parameter is configured to. A Node Type of 0 means use 
3350 NetBIOS broadcast (over UDP broadcast) is first used if the name 
3351 that is the subject of a name lookup is not found in the NetBIOS name 
3352 cache. If that fails then DNS, HOSTS and LMHOSTS are checked. If set to 
3353 Node Type 8, then a NetBIOS Unicast (over UDP Unicast) is sent to the 
3354 WINS Server to obtain a lookup before DNS, HOSTS, LMHOSTS, or broadcast 
3355 lookup is used.</P
3356 ></DIV
3357 ><DIV
3358 CLASS="SECT2"
3359 ><HR><H3
3360 CLASS="SECT2"
3361 ><A
3362 NAME="AEN483"
3363 ></A
3364 >3.3.5. WINS Lookup</H3
3365 ><P
3366 >A WINS (Windows Internet Name Server) service is the equivaent of the 
3367 rfc1001/1002 specified NBNS (NetBIOS Name Server). A WINS server stores 
3368 the names and IP addresses that are registered by a Windows client 
3369 if the TCP/IP setup has been given at least one WINS Server IP Address.</P
3370 ><P
3371 >To configure Samba to be a WINS server the following parameter needs 
3372 to be added to the <TT
3373 CLASS="FILENAME"
3374 >smb.conf</TT
3375 > file:</P
3376 ><P
3377 ><PRE
3378 CLASS="PROGRAMLISTING"
3379 >       wins support = Yes</PRE
3380 ></P
3381 ><P
3382 >To configure Samba to use a WINS server the following parameters are 
3383 needed in the smb.conf file:</P
3384 ><P
3385 ><PRE
3386 CLASS="PROGRAMLISTING"
3387 >       wins support = No
3388         wins server = xxx.xxx.xxx.xxx</PRE
3389 ></P
3390 ><P
3391 >where <TT
3392 CLASS="REPLACEABLE"
3393 ><I
3394 >xxx.xxx.xxx.xxx</I
3395 ></TT
3396 > is the IP address 
3397 of the WINS server.</P
3398 ></DIV
3399 ></DIV
3400 ><DIV
3401 CLASS="SECT1"
3402 ><HR><H2
3403 CLASS="SECT1"
3404 ><A
3405 NAME="AEN495"
3406 ></A
3407 >3.4. How browsing functions and how to deploy stable and 
3408 dependable browsing using Samba</H2
3409 ><P
3410 >As stated above, MS Windows machines register their NetBIOS names 
3411 (i.e.: the machine name for each service type in operation) on start 
3412 up. Also, as stated above, the exact method by which this name registration 
3413 takes place is determined by whether or not the MS Windows client/server 
3414 has been given a WINS server address, whether or not LMHOSTS lookup 
3415 is enabled, or if DNS for NetBIOS name resolution is enabled, etc.</P
3416 ><P
3417 >In the case where there is no WINS server all name registrations as 
3418 well as name lookups are done by UDP broadcast. This isolates name 
3419 resolution to the local subnet, unless LMHOSTS is used to list all 
3420 names and IP addresses. In such situations Samba provides a means by 
3421 which the samba server name may be forcibly injected into the browse 
3422 list of a remote MS Windows network (using the "remote announce" parameter).</P
3423 ><P
3424 >Where a WINS server is used, the MS Windows client will use UDP 
3425 unicast to register with the WINS server. Such packets can be routed 
3426 and thus WINS allows name resolution to function across routed networks.</P
3427 ><P
3428 >During the startup process an election will take place to create a 
3429 local master browser if one does not already exist. On each NetBIOS network 
3430 one machine will be elected to function as the domain master browser. This 
3431 domain browsing has nothing to do with MS security domain control. 
3432 Instead, the domain master browser serves the role of contacting each local 
3433 master browser (found by asking WINS or from LMHOSTS) and exchanging browse 
3434 list contents. This way every master browser will eventually obtain a complete 
3435 list of all machines that are on the network. Every 11-15 minutes an election 
3436 is held to determine which machine will be the master browser. By the nature of 
3437 the election criteria used, the machine with the highest uptime, or the 
3438 most senior protocol version, or other criteria, will win the election 
3439 as domain master browser.</P
3440 ><P
3441 >Clients wishing to browse the network make use of this list, but also depend 
3442 on the availability of correct name resolution to the respective IP 
3443 address/addresses. </P
3444 ><P
3445 >Any configuration that breaks name resolution and/or browsing intrinsics 
3446 will annoy users because they will have to put up with protracted 
3447 inability to use the network services.</P
3448 ><P
3449 >Samba supports a feature that allows forced synchonisation 
3450 of browse lists across routed networks using the "remote 
3451 browse sync" parameter in the smb.conf file. This causes Samba 
3452 to contact the local master browser on a remote network and 
3453 to request browse list synchronisation. This effectively bridges 
3454 two networks that are separated by routers. The two remote 
3455 networks may use either broadcast based name resolution or WINS 
3456 based name resolution, but it should be noted that the "remote 
3457 browse sync" parameter provides browse list synchronisation - and 
3458 that is distinct from name to address resolution, in other 
3459 words, for cross subnet browsing to function correctly it is 
3460 essential that a name to address resolution mechanism be provided. 
3461 This mechanism could be via DNS, <TT
3462 CLASS="FILENAME"
3463 >/etc/hosts</TT
3464 >, 
3465 and so on.</P
3466 ></DIV
3467 ><DIV
3468 CLASS="SECT1"
3469 ><HR><H2
3470 CLASS="SECT1"
3471 ><A
3472 NAME="AEN505"
3473 ></A
3474 >3.5. MS Windows security options and how to configure 
3475 Samba for seemless integration</H2
3476 ><P
3477 >MS Windows clients may use encrypted passwords as part of a 
3478 challenege/response authentication model (a.k.a. NTLMv1) or 
3479 alone, or clear text strings for simple password based 
3480 authentication. It should be realized that with the SMB 
3481 protocol the password is passed over the network either 
3482 in plain text or encrypted, but not both in the same 
3483 authentication requets.</P
3484 ><P
3485 >When encrypted passwords are used a password that has been 
3486 entered by the user is encrypted in two ways:</P
3487 ><P
3488 ></P
3489 ><UL
3490 ><LI
3491 ><P
3492 >An MD4 hash of the UNICODE of the password
3493         string.  This is known as the NT hash.
3494         </P
3495 ></LI
3496 ><LI
3497 ><P
3498 >The password is converted to upper case,
3499         and then padded or trucated to 14 bytes.  This string is 
3500         then appended with 5 bytes of NULL characters and split to
3501         form two 56 bit DES keys to encrypt a "magic" 8 byte value.
3502         The resulting 16 bytes for the LanMan hash.
3503         </P
3504 ></LI
3505 ></UL
3506 ><P
3507 >You should refer to the <A
3508 HREF="ENCRYPTION.html"
3509 TARGET="_top"
3510 >Password Encryption</A
3511 > chapter in this HOWTO collection
3512 for more details on the inner workings</P
3513 ><P
3514 >MS Windows 95 pre-service pack 1, MS Windows NT versions 3.x 
3515 and version 4.0 pre-service pack 3 will use either mode of 
3516 password authentication. All versions of MS Windows that follow 
3517 these versions no longer support plain text passwords by default.</P
3518 ><P
3519 >MS Windows clients have a habit of dropping network mappings that 
3520 have been idle for 10 minutes or longer. When the user attempts to 
3521 use the mapped drive connection that has been dropped, the client
3522 re-establishes the connection using 
3523 a cached copy of the password.</P
3524 ><P
3525 >When Microsoft changed the default password mode, they dropped support for 
3526 caching of the plain text password. This means that when the registry 
3527 parameter is changed to re-enable use of plain text passwords it appears to 
3528 work, but when a dropped mapping attempts to revalidate it will fail if 
3529 the remote authentication server does not support encrypted passwords. 
3530 This means that it is definitely not a good idea to re-enable plain text 
3531 password support in such clients.</P
3532 ><P
3533 >The following parameters can be used to work around the 
3534 issue of Windows 9x client upper casing usernames and
3535 password before transmitting them to the SMB server
3536 when using clear text authentication.</P
3537 ><P
3538 ><PRE
3539 CLASS="PROGRAMLISTING"
3540 >       <A
3541 HREF="smb.conf.5.html#PASSWORDLEVEL"
3542 TARGET="_top"
3543 >passsword level</A
3544 > = <TT
3545 CLASS="REPLACEABLE"
3546 ><I
3547 >integer</I
3548 ></TT
3549 >
3550         <A
3551 HREF="smb.conf.5.html#USERNAMELEVEL"
3552 TARGET="_top"
3553 >username level</A
3554 > = <TT
3555 CLASS="REPLACEABLE"
3556 ><I
3557 >integer</I
3558 ></TT
3559 ></PRE
3560 ></P
3561 ><P
3562 >By default Samba will lower case the username before attempting
3563 to lookup the user in the database of local system accounts.
3564 Because UNIX usernames conventionally only contain lower case
3565 character, the <TT
3566 CLASS="PARAMETER"
3567 ><I
3568 >username level</I
3569 ></TT
3570 > parameter
3571 is rarely even needed.</P
3572 ><P
3573 >However, password on UNIX systems often make use of mixed case
3574 characters.  This means that in order for a user on a Windows 9x
3575 client to connect to a Samba server using clear text authentication,
3576 the <TT
3577 CLASS="PARAMETER"
3578 ><I
3579 >password level</I
3580 ></TT
3581 > must be set to the maximum
3582 number of upper case letter which <SPAN
3583 CLASS="emphasis"
3584 ><I
3585 CLASS="EMPHASIS"
3586 >could</I
3587 ></SPAN
3588 > appear
3589 is a password.  Note that is the server OS uses the traditional
3590 DES version of crypt(), then a <TT
3591 CLASS="PARAMETER"
3592 ><I
3593 >password level</I
3594 ></TT
3595 >
3596 of 8 will result in case insensitive passwords as seen from Windows
3597 users.  This will also result in longer login times as Samba
3598 hash to compute the permutations of the password string and 
3599 try them one by one until a match is located (or all combinations fail).</P
3600 ><P
3601 >The best option to adopt is to enable support for encrypted passwords 
3602 where ever Samba is used. There are three configuration possibilities 
3603 for support of encrypted passwords:</P
3604 ><DIV
3605 CLASS="SECT2"
3606 ><HR><H3
3607 CLASS="SECT2"
3608 ><A
3609 NAME="AEN533"
3610 ></A
3611 >3.5.1. Use MS Windows NT as an authentication server</H3
3612 ><P
3613 >This method involves the additions of the following parameters 
3614 in the smb.conf file:</P
3615 ><P
3616 ><PRE
3617 CLASS="PROGRAMLISTING"
3618 >       encrypt passwords = Yes
3619         security = server
3620         password server = "NetBIOS_name_of_PDC"</PRE
3621 ></P
3622 ><P
3623 >There are two ways of identifying whether or not a username and 
3624 password pair was valid or not. One uses the reply information provided 
3625 as part of the authentication messaging process, the other uses 
3626 just and error code.</P
3627 ><P
3628 >The down-side of this mode of configuration is the fact that 
3629 for security reasons Samba will send the password server a bogus 
3630 username and a bogus password and if the remote server fails to 
3631 reject the username and password pair then an alternative mode 
3632 of identification of validation is used. Where a site uses password 
3633 lock out after a certain number of failed authentication attempts 
3634 this will result in user lockouts.</P
3635 ><P
3636 >Use of this mode of authentication does require there to be 
3637 a standard Unix account for the user, this account can be blocked 
3638 to prevent logons by other than MS Windows clients.</P
3639 ></DIV
3640 ><DIV
3641 CLASS="SECT2"
3642 ><HR><H3
3643 CLASS="SECT2"
3644 ><A
3645 NAME="AEN541"
3646 ></A
3647 >3.5.2. Make Samba a member of an MS Windows NT security domain</H3
3648 ><P
3649 >This method involves additon of the following paramters in the smb.conf file:</P
3650 ><P
3651 ><PRE
3652 CLASS="PROGRAMLISTING"
3653 >       encrypt passwords = Yes
3654         security = domain
3655         workgroup = "name of NT domain"
3656         password server = *</PRE
3657 ></P
3658 ><P
3659 >The use of the "*" argument to "password server" will cause samba 
3660 to locate the domain controller in a way analogous to the way 
3661 this is done within MS Windows NT.</P
3662 ><P
3663 >In order for this method to work the Samba server needs to join the 
3664 MS Windows NT security domain. This is done as follows:</P
3665 ><P
3666 ></P
3667 ><UL
3668 ><LI
3669 ><P
3670 >On the MS Windows NT domain controller using 
3671         the Server Manager add a machine account for the Samba server.
3672         </P
3673 ></LI
3674 ><LI
3675 ><P
3676 >Next, on the Linux system execute: 
3677         <B
3678 CLASS="COMMAND"
3679 >smbpasswd -r PDC_NAME -j DOMAIN_NAME</B
3680 >
3681         </P
3682 ></LI
3683 ></UL
3684 ><P
3685 >Use of this mode of authentication does require there to be 
3686 a standard Unix account for the user in order to assign
3687 a uid once the account has been authenticated by the remote
3688 Windows DC.  This account can be blocked to prevent logons by 
3689 other than MS Windows clients by things such as setting an invalid
3690 shell in the <TT
3691 CLASS="FILENAME"
3692 >/etc/passwd</TT
3693 > entry.</P
3694 ><P
3695 >An alternative to assigning UIDs to Windows users on a 
3696 Samba member server is presented in the <A
3697 HREF="winbind.html"
3698 TARGET="_top"
3699 >Winbind Overview</A
3700 > chapter in
3701 this HOWTO collection.</P
3702 ></DIV
3703 ><DIV
3704 CLASS="SECT2"
3705 ><HR><H3
3706 CLASS="SECT2"
3707 ><A
3708 NAME="AEN558"
3709 ></A
3710 >3.5.3. Configure Samba as an authentication server</H3
3711 ><P
3712 >This mode of authentication demands that there be on the 
3713 Unix/Linux system both a Unix style account as well as an 
3714 smbpasswd entry for the user. The Unix system account can be 
3715 locked if required as only the encrypted password will be 
3716 used for SMB client authentication.</P
3717 ><P
3718 >This method involves addition of the following parameters to 
3719 the smb.conf file:</P
3720 ><P
3721 ><PRE
3722 CLASS="PROGRAMLISTING"
3723 >## please refer to the Samba PDC HOWTO chapter later in 
3724 ## this collection for more details
3725 [global]
3726         encrypt passwords = Yes
3727         security = user
3728         domain logons = Yes
3729         ; an OS level of 33 or more is recommended
3730         os level = 33
3731
3732 [NETLOGON]
3733         path = /somewhare/in/file/system
3734         read only = yes</PRE
3735 ></P
3736 ><P
3737 >in order for this method to work a Unix system account needs 
3738 to be created for each user, as well as for each MS Windows NT/2000 
3739 machine. The following structure is required.</P
3740 ><DIV
3741 CLASS="SECT3"
3742 ><HR><H4
3743 CLASS="SECT3"
3744 ><A
3745 NAME="AEN565"
3746 ></A
3747 >3.5.3.1. Users</H4
3748 ><P
3749 >A user account that may provide a home directory should be 
3750 created. The following Linux system commands are typical of 
3751 the procedure for creating an account.</P
3752 ><P
3753 ><PRE
3754 CLASS="PROGRAMLISTING"
3755 >       # useradd -s /bin/bash -d /home/"userid" -m "userid"
3756         # passwd "userid"
3757           Enter Password: &lt;pw&gt;
3758           
3759         # smbpasswd -a "userid"
3760           Enter Password: &lt;pw&gt;</PRE
3761 ></P
3762 ></DIV
3763 ><DIV
3764 CLASS="SECT3"
3765 ><HR><H4
3766 CLASS="SECT3"
3767 ><A
3768 NAME="AEN570"
3769 ></A
3770 >3.5.3.2. MS Windows NT Machine Accounts</H4
3771 ><P
3772 >These are required only when Samba is used as a domain 
3773 controller.  Refer to the Samba-PDC-HOWTO for more details.</P
3774 ><P
3775 ><PRE
3776 CLASS="PROGRAMLISTING"
3777 >       # useradd -s /bin/false -d /dev/null "machine_name"\$
3778         # passwd -l "machine_name"\$
3779         # smbpasswd -a -m "machine_name"</PRE
3780 ></P
3781 ></DIV
3782 ></DIV
3783 ></DIV
3784 ><DIV
3785 CLASS="SECT1"
3786 ><HR><H2
3787 CLASS="SECT1"
3788 ><A
3789 NAME="AEN575"
3790 ></A
3791 >3.6. Conclusions</H2
3792 ><P
3793 >Samba provides a flexible means to operate as...</P
3794 ><P
3795 ></P
3796 ><UL
3797 ><LI
3798 ><P
3799 >A Stand-alone server - No special action is needed 
3800         other than to create user accounts. Stand-alone servers do NOT 
3801         provide network logon services, meaning that machines that use this 
3802         server do NOT perform a domain logon but instead make use only of 
3803         the MS Windows logon which is local to the MS Windows 
3804         workstation/server.
3805         </P
3806 ></LI
3807 ><LI
3808 ><P
3809 >An MS Windows NT 3.x/4.0 security domain member.
3810         </P
3811 ></LI
3812 ><LI
3813 ><P
3814 >An alternative to an MS Windows NT 3.x/4.0 
3815         Domain Controller.
3816         </P
3817 ></LI
3818 ></UL
3819 ></DIV
3820 ></DIV
3821 ><DIV
3822 CLASS="CHAPTER"
3823 ><HR><H1
3824 ><A
3825 NAME="PAM"
3826 ></A
3827 >Chapter 4. Configuring PAM for distributed but centrally 
3828 managed authentication</H1
3829 ><DIV
3830 CLASS="SECT1"
3831 ><H2
3832 CLASS="SECT1"
3833 ><A
3834 NAME="AEN596"
3835 ></A
3836 >4.1. Samba and PAM</H2
3837 ><P
3838 >A number of Unix systems (eg: Sun Solaris), as well as the 
3839 xxxxBSD family and Linux, now utilize the Pluggable Authentication 
3840 Modules (PAM) facility to provide all authentication, 
3841 authorization and resource control services. Prior to the 
3842 introduction of PAM, a decision to use an alternative to 
3843 the system password database (<TT
3844 CLASS="FILENAME"
3845 >/etc/passwd</TT
3846 >) 
3847 would require the provision of alternatives for all programs that provide 
3848 security services. Such a choice would involve provision of 
3849 alternatives to such programs as: <B
3850 CLASS="COMMAND"
3851 >login</B
3852 >, 
3853 <B
3854 CLASS="COMMAND"
3855 >passwd</B
3856 >, <B
3857 CLASS="COMMAND"
3858 >chown</B
3859 >, etc.</P
3860 ><P
3861 >PAM provides a mechanism that disconnects these security programs 
3862 from the underlying authentication/authorization infrastructure.
3863 PAM is configured either through one file <TT
3864 CLASS="FILENAME"
3865 >/etc/pam.conf</TT
3866 > (Solaris), 
3867 or by editing individual files that are located in <TT
3868 CLASS="FILENAME"
3869 >/etc/pam.d</TT
3870 >.</P
3871 ><P
3872 >The following is an example <TT
3873 CLASS="FILENAME"
3874 >/etc/pam.d/login</TT
3875 > configuration file. 
3876 This example had all options been uncommented is probably not usable 
3877 as it stacks many conditions before allowing successful completion 
3878 of the login process. Essentially all conditions can be disabled 
3879 by commenting them out except the calls to <TT
3880 CLASS="FILENAME"
3881 >pam_pwdb.so</TT
3882 >.</P
3883 ><P
3884 ><PRE
3885 CLASS="PROGRAMLISTING"
3886 >#%PAM-1.0
3887 # The PAM configuration file for the `login' service
3888 #
3889 auth            required        pam_securetty.so
3890 auth            required        pam_nologin.so
3891 # auth          required        pam_dialup.so
3892 # auth          optional        pam_mail.so
3893 auth            required        pam_pwdb.so shadow md5
3894 # account       requisite       pam_time.so
3895 account         required        pam_pwdb.so
3896 session         required        pam_pwdb.so
3897 # session       optional        pam_lastlog.so
3898 # password      required        pam_cracklib.so retry=3
3899 password        required        pam_pwdb.so shadow md5</PRE
3900 ></P
3901 ><P
3902 >PAM allows use of replacable modules. Those available on a 
3903 sample system include:</P
3904 ><P
3905 ><PRE
3906 CLASS="PROGRAMLISTING"
3907 >$ /bin/ls /lib/security
3908 pam_access.so    pam_ftp.so          pam_limits.so     
3909 pam_ncp_auth.so  pam_rhosts_auth.so  pam_stress.so     
3910 pam_cracklib.so  pam_group.so        pam_listfile.so   
3911 pam_nologin.so   pam_rootok.so       pam_tally.so      
3912 pam_deny.so      pam_issue.so        pam_mail.so       
3913 pam_permit.so    pam_securetty.so    pam_time.so       
3914 pam_dialup.so    pam_lastlog.so      pam_mkhomedir.so  
3915 pam_pwdb.so      pam_shells.so       pam_unix.so       
3916 pam_env.so       pam_ldap.so         pam_motd.so       
3917 pam_radius.so    pam_smbpass.so      pam_unix_acct.so  
3918 pam_wheel.so     pam_unix_auth.so    pam_unix_passwd.so
3919 pam_userdb.so    pam_warn.so         pam_unix_session.so</PRE
3920 ></P
3921 ><P
3922 >The following example for the login program replaces the use of 
3923 the <TT
3924 CLASS="FILENAME"
3925 >pam_pwdb.so</TT
3926 > module which uses the system 
3927 password database (<TT
3928 CLASS="FILENAME"
3929 >/etc/passwd</TT
3930 >,
3931 <TT
3932 CLASS="FILENAME"
3933 >/etc/shadow</TT
3934 >, <TT
3935 CLASS="FILENAME"
3936 >/etc/group</TT
3937 >) with 
3938 the module <TT
3939 CLASS="FILENAME"
3940 >pam_smbpass.so</TT
3941 > which uses the Samba 
3942 database which contains the Microsoft MD4 encrypted password 
3943 hashes. This database is stored in either 
3944 <TT
3945 CLASS="FILENAME"
3946 >/usr/local/samba/private/smbpasswd</TT
3947 >, 
3948 <TT
3949 CLASS="FILENAME"
3950 >/etc/samba/smbpasswd</TT
3951 >, or in 
3952 <TT
3953 CLASS="FILENAME"
3954 >/etc/samba.d/smbpasswd</TT
3955 >, depending on the 
3956 Samba implementation for your Unix/Linux system. The 
3957 <TT
3958 CLASS="FILENAME"
3959 >pam_smbpass.so</TT
3960 > module is provided by 
3961 Samba version 2.2.1 or later. It can be compiled by specifying the 
3962 <B
3963 CLASS="COMMAND"
3964 >--with-pam_smbpass</B
3965 > options when running Samba's
3966 <TT
3967 CLASS="FILENAME"
3968 >configure</TT
3969 > script.  For more information
3970 on the <TT
3971 CLASS="FILENAME"
3972 >pam_smbpass</TT
3973 > module, see the documentation
3974 in the <TT
3975 CLASS="FILENAME"
3976 >source/pam_smbpass</TT
3977 > directory of the Samba 
3978 source distribution.</P
3979 ><P
3980 ><PRE
3981 CLASS="PROGRAMLISTING"
3982 >#%PAM-1.0
3983 # The PAM configuration file for the `login' service
3984 #
3985 auth            required        pam_smbpass.so nodelay
3986 account         required        pam_smbpass.so nodelay
3987 session         required        pam_smbpass.so nodelay
3988 password        required        pam_smbpass.so nodelay</PRE
3989 ></P
3990 ><P
3991 >The following is the PAM configuration file for a particular 
3992 Linux system. The default condition uses <TT
3993 CLASS="FILENAME"
3994 >pam_pwdb.so</TT
3995 >.</P
3996 ><P
3997 ><PRE
3998 CLASS="PROGRAMLISTING"
3999 >#%PAM-1.0
4000 # The PAM configuration file for the `samba' service
4001 #
4002 auth       required     /lib/security/pam_pwdb.so nullok nodelay shadow audit
4003 account    required     /lib/security/pam_pwdb.so audit nodelay
4004 session    required     /lib/security/pam_pwdb.so nodelay
4005 password   required     /lib/security/pam_pwdb.so shadow md5</PRE
4006 ></P
4007 ><P
4008 >In the following example the decision has been made to use the 
4009 smbpasswd database even for basic samba authentication. Such a 
4010 decision could also be made for the passwd program and would 
4011 thus allow the smbpasswd passwords to be changed using the passwd 
4012 program.</P
4013 ><P
4014 ><PRE
4015 CLASS="PROGRAMLISTING"
4016 >#%PAM-1.0
4017 # The PAM configuration file for the `samba' service
4018 #
4019 auth       required     /lib/security/pam_smbpass.so nodelay
4020 account    required     /lib/security/pam_pwdb.so audit nodelay
4021 session    required     /lib/security/pam_pwdb.so nodelay
4022 password   required     /lib/security/pam_smbpass.so nodelay smbconf=/etc/samba.d/smb.conf</PRE
4023 ></P
4024 ><P
4025 >Note: PAM allows stacking of authentication mechanisms. It is 
4026 also possible to pass information obtained within one PAM module through 
4027 to the next module in the PAM stack. Please refer to the documentation for 
4028 your particular system implementation for details regarding the specific 
4029 capabilities of PAM in this environment. Some Linux implmentations also 
4030 provide the <TT
4031 CLASS="FILENAME"
4032 >pam_stack.so</TT
4033 > module that allows all 
4034 authentication to be configured in a single central file. The 
4035 <TT
4036 CLASS="FILENAME"
4037 >pam_stack.so</TT
4038 > method has some very devoted followers 
4039 on the basis that it allows for easier administration. As with all issues in 
4040 life though, every decision makes trade-offs, so you may want examine the 
4041 PAM documentation for further helpful information.</P
4042 ></DIV
4043 ><DIV
4044 CLASS="SECT1"
4045 ><HR><H2
4046 CLASS="SECT1"
4047 ><A
4048 NAME="AEN640"
4049 ></A
4050 >4.2. Distributed Authentication</H2
4051 ><P
4052 >The astute administrator will realize from this that the 
4053 combination of <TT
4054 CLASS="FILENAME"
4055 >pam_smbpass.so</TT
4056 >, 
4057 <B
4058 CLASS="COMMAND"
4059 >winbindd</B
4060 >, and <B
4061 CLASS="COMMAND"
4062 >rsync</B
4063 > (see
4064 <A
4065 HREF="http://rsync.samba.org/"
4066 TARGET="_top"
4067 >http://rsync.samba.org/</A
4068 >)
4069 will allow the establishment of a centrally managed, distributed 
4070 user/password database that can also be used by all 
4071 PAM (eg: Linux) aware programs and applications. This arrangement 
4072 can have particularly potent advantages compared with the 
4073 use of Microsoft Active Directory Service (ADS) in so far as 
4074 reduction of wide area network authentication traffic.</P
4075 ></DIV
4076 ><DIV
4077 CLASS="SECT1"
4078 ><HR><H2
4079 CLASS="SECT1"
4080 ><A
4081 NAME="AEN647"
4082 ></A
4083 >4.3. PAM Configuration in smb.conf</H2
4084 ><P
4085 >There is an option in smb.conf called <A
4086 HREF="smb.conf.5.html#OBEYPAMRESTRICTIONS"
4087 TARGET="_top"
4088 >obey pam restrictions</A
4089 >. 
4090 The following is from the on-line help for this option in SWAT;</P
4091 ><P
4092 >When Samba 2.2 is configure to enable PAM support (i.e. 
4093 <TT
4094 CLASS="CONSTANT"
4095 >--with-pam</TT
4096 >), this parameter will 
4097 control whether or not Samba should obey PAM's account 
4098 and session management directives. The default behavior 
4099 is to use PAM for clear text authentication only and to 
4100 ignore any account or session management. Note that Samba always 
4101 ignores PAM for authentication in the case of 
4102 <A
4103 HREF="smb.conf.5.html#ENCRYPTPASSWORDS"
4104 TARGET="_top"
4105 >encrypt passwords = yes</A
4106 >. 
4107 The reason is that PAM modules cannot support the challenge/response 
4108 authentication mechanism needed in the presence of SMB 
4109 password encryption. </P
4110 ><P
4111 >Default: <B
4112 CLASS="COMMAND"
4113 >obey pam restrictions = no</B
4114 ></P
4115 ></DIV
4116 ></DIV
4117 ><DIV
4118 CLASS="CHAPTER"
4119 ><HR><H1
4120 ><A
4121 NAME="MSDFS"
4122 ></A
4123 >Chapter 5. Hosting a Microsoft Distributed File System tree on Samba</H1
4124 ><DIV
4125 CLASS="SECT1"
4126 ><H2
4127 CLASS="SECT1"
4128 ><A
4129 NAME="AEN667"
4130 ></A
4131 >5.1. Instructions</H2
4132 ><P
4133 >The Distributed File System (or Dfs) provides a means of 
4134         separating the logical view of files and directories that users 
4135         see from the actual physical locations of these resources on the 
4136         network. It allows for higher availability, smoother storage expansion, 
4137         load balancing etc. For more information about Dfs, refer to  <A
4138 HREF="http://www.microsoft.com/NTServer/nts/downloads/winfeatures/NTSDistrFile/AdminGuide.asp"
4139 TARGET="_top"
4140 >       Microsoft documentation</A
4141 >. </P
4142 ><P
4143 >This document explains how to host a Dfs tree on a Unix 
4144         machine (for Dfs-aware clients to browse) using Samba.</P
4145 ><P
4146 >To enable SMB-based DFS for Samba, configure it with the 
4147         <TT
4148 CLASS="PARAMETER"
4149 ><I
4150 >--with-msdfs</I
4151 ></TT
4152 > option. Once built, a 
4153         Samba server can be made a Dfs server by setting the global 
4154         boolean <A
4155 HREF="smb.conf.5.html#HOSTMSDFS"
4156 TARGET="_top"
4157 ><TT
4158 CLASS="PARAMETER"
4159 ><I
4160 >       host msdfs</I
4161 ></TT
4162 ></A
4163 > parameter in the <TT
4164 CLASS="FILENAME"
4165 >smb.conf
4166         </TT
4167 > file. You designate a share as a Dfs root using the share 
4168         level boolean <A
4169 HREF="smb.conf.5.html#MSDFSROOT"
4170 TARGET="_top"
4171 ><TT
4172 CLASS="PARAMETER"
4173 ><I
4174 >       msdfs root</I
4175 ></TT
4176 ></A
4177 > parameter. A Dfs root directory on 
4178         Samba hosts Dfs links in the form of symbolic links that point 
4179         to other servers. For example, a symbolic link
4180         <TT
4181 CLASS="FILENAME"
4182 >junction-&gt;msdfs:storage1\share1</TT
4183 > in 
4184         the share directory acts as the Dfs junction. When Dfs-aware 
4185         clients attempt to access the junction link, they are redirected 
4186         to the storage location (in this case, \\storage1\share1).</P
4187 ><P
4188 >Dfs trees on Samba work with all Dfs-aware clients ranging 
4189         from Windows 95 to 2000.</P
4190 ><P
4191 >Here's an example of setting up a Dfs tree on a Samba 
4192         server.</P
4193 ><P
4194 ><PRE
4195 CLASS="PROGRAMLISTING"
4196 ># The smb.conf file:
4197 [global]
4198         netbios name = SAMBA
4199         host msdfs   = yes
4200
4201 [dfs]
4202         path = /export/dfsroot
4203         msdfs root = yes
4204         </PRE
4205 ></P
4206 ><P
4207 >In the /export/dfsroot directory we set up our dfs links to 
4208         other servers on the network.</P
4209 ><P
4210 ><TT
4211 CLASS="PROMPT"
4212 >root# </TT
4213 ><TT
4214 CLASS="USERINPUT"
4215 ><B
4216 >cd /export/dfsroot</B
4217 ></TT
4218 ></P
4219 ><P
4220 ><TT
4221 CLASS="PROMPT"
4222 >root# </TT
4223 ><TT
4224 CLASS="USERINPUT"
4225 ><B
4226 >chown root /export/dfsroot</B
4227 ></TT
4228 ></P
4229 ><P
4230 ><TT
4231 CLASS="PROMPT"
4232 >root# </TT
4233 ><TT
4234 CLASS="USERINPUT"
4235 ><B
4236 >chmod 755 /export/dfsroot</B
4237 ></TT
4238 ></P
4239 ><P
4240 ><TT
4241 CLASS="PROMPT"
4242 >root# </TT
4243 ><TT
4244 CLASS="USERINPUT"
4245 ><B
4246 >ln -s msdfs:storageA\\shareA linka</B
4247 ></TT
4248 ></P
4249 ><P
4250 ><TT
4251 CLASS="PROMPT"
4252 >root# </TT
4253 ><TT
4254 CLASS="USERINPUT"
4255 ><B
4256 >ln -s msdfs:serverB\\share,serverC\\share linkb</B
4257 ></TT
4258 ></P
4259 ><P
4260 >You should set up the permissions and ownership of 
4261         the directory acting as the Dfs root such that only designated 
4262         users can create, delete or modify the msdfs links. Also note 
4263         that symlink names should be all lowercase. This limitation exists 
4264         to have Samba avoid trying all the case combinations to get at 
4265         the link name. Finally set up the symbolic links to point to the 
4266         network shares you want, and start Samba.</P
4267 ><P
4268 >Users on Dfs-aware clients can now browse the Dfs tree 
4269         on the Samba server at \\samba\dfs. Accessing 
4270         links linka or linkb (which appear as directories to the client) 
4271         takes users directly to the appropriate shares on the network.</P
4272 ><DIV
4273 CLASS="SECT2"
4274 ><HR><H3
4275 CLASS="SECT2"
4276 ><A
4277 NAME="AEN702"
4278 ></A
4279 >5.1.1. Notes</H3
4280 ><P
4281 ></P
4282 ><UL
4283 ><LI
4284 ><P
4285 >Windows clients need to be rebooted 
4286                         if a previously mounted non-dfs share is made a dfs 
4287                         root or vice versa. A better way is to introduce a 
4288                         new share and make it the dfs root.</P
4289 ></LI
4290 ><LI
4291 ><P
4292 >Currently there's a restriction that msdfs 
4293                         symlink names should all be lowercase.</P
4294 ></LI
4295 ><LI
4296 ><P
4297 >For security purposes, the directory 
4298                         acting as the root of the Dfs tree should have ownership 
4299                         and permissions set so that only designated users can 
4300                         modify the symbolic links in the directory.</P
4301 ></LI
4302 ></UL
4303 ></DIV
4304 ></DIV
4305 ></DIV
4306 ><DIV
4307 CLASS="CHAPTER"
4308 ><HR><H1
4309 ><A
4310 NAME="UNIX-PERMISSIONS"
4311 ></A
4312 >Chapter 6. UNIX Permission Bits and Windows NT Access Control Lists</H1
4313 ><DIV
4314 CLASS="SECT1"
4315 ><H2
4316 CLASS="SECT1"
4317 ><A
4318 NAME="AEN722"
4319 ></A
4320 >6.1. Viewing and changing UNIX permissions using the NT 
4321         security dialogs</H2
4322 ><P
4323 >New in the Samba 2.0.4 release is the ability for Windows 
4324         NT clients to use their native security settings dialog box to 
4325         view and modify the underlying UNIX permissions.</P
4326 ><P
4327 >Note that this ability is careful not to compromise 
4328         the security of the UNIX host Samba is running on, and 
4329         still obeys all the file permission rules that a Samba 
4330         administrator can set.</P
4331 ><P
4332 >In Samba 2.0.4 and above the default value of the 
4333         parameter <A
4334 HREF="smb.conf.5.html#NTACLSUPPORT"
4335 TARGET="_top"
4336 ><TT
4337 CLASS="PARAMETER"
4338 ><I
4339 >       nt acl support</I
4340 ></TT
4341 ></A
4342 > has been changed from 
4343         <TT
4344 CLASS="CONSTANT"
4345 >false</TT
4346 > to <TT
4347 CLASS="CONSTANT"
4348 >true</TT
4349 >, so 
4350         manipulation of permissions is turned on by default.</P
4351 ></DIV
4352 ><DIV
4353 CLASS="SECT1"
4354 ><HR><H2
4355 CLASS="SECT1"
4356 ><A
4357 NAME="AEN731"
4358 ></A
4359 >6.2. How to view file security on a Samba share</H2
4360 ><P
4361 >From an NT 4.0 client, single-click with the right 
4362         mouse button on any file or directory in a Samba mounted 
4363         drive letter or UNC path. When the menu pops-up, click 
4364         on the <SPAN
4365 CLASS="emphasis"
4366 ><I
4367 CLASS="EMPHASIS"
4368 >Properties</I
4369 ></SPAN
4370 > entry at the bottom of 
4371         the menu. This brings up the normal file properties dialog
4372         box, but with Samba 2.0.4 this will have a new tab along the top
4373         marked <SPAN
4374 CLASS="emphasis"
4375 ><I
4376 CLASS="EMPHASIS"
4377 >Security</I
4378 ></SPAN
4379 >. Click on this tab and you 
4380         will see three buttons, <SPAN
4381 CLASS="emphasis"
4382 ><I
4383 CLASS="EMPHASIS"
4384 >Permissions</I
4385 ></SPAN
4386 >,      
4387         <SPAN
4388 CLASS="emphasis"
4389 ><I
4390 CLASS="EMPHASIS"
4391 >Auditing</I
4392 ></SPAN
4393 >, and <SPAN
4394 CLASS="emphasis"
4395 ><I
4396 CLASS="EMPHASIS"
4397 >Ownership</I
4398 ></SPAN
4399 >. 
4400         The <SPAN
4401 CLASS="emphasis"
4402 ><I
4403 CLASS="EMPHASIS"
4404 >Auditing</I
4405 ></SPAN
4406 > button will cause either 
4407         an error message <SPAN
4408 CLASS="ERRORNAME"
4409 >A requested privilege is not held 
4410         by the client</SPAN
4411 > to appear if the user is not the 
4412         NT Administrator, or a dialog which is intended to allow an 
4413         Administrator to add auditing requirements to a file if the 
4414         user is logged on as the NT Administrator. This dialog is 
4415         non-functional with a Samba share at this time, as the only 
4416         useful button, the <B
4417 CLASS="COMMAND"
4418 >Add</B
4419 > button will not currently 
4420         allow a list of users to be seen.</P
4421 ></DIV
4422 ><DIV
4423 CLASS="SECT1"
4424 ><HR><H2
4425 CLASS="SECT1"
4426 ><A
4427 NAME="AEN742"
4428 ></A
4429 >6.3. Viewing file ownership</H2
4430 ><P
4431 >Clicking on the <B
4432 CLASS="COMMAND"
4433 >"Ownership"</B
4434 > button 
4435         brings up a dialog box telling you who owns the given file. The 
4436         owner name will be of the form :</P
4437 ><P
4438 ><B
4439 CLASS="COMMAND"
4440 >"SERVER\user (Long name)"</B
4441 ></P
4442 ><P
4443 >Where <TT
4444 CLASS="REPLACEABLE"
4445 ><I
4446 >SERVER</I
4447 ></TT
4448 > is the NetBIOS name of 
4449         the Samba server, <TT
4450 CLASS="REPLACEABLE"
4451 ><I
4452 >user</I
4453 ></TT
4454 > is the user name of 
4455         the UNIX user who owns the file, and <TT
4456 CLASS="REPLACEABLE"
4457 ><I
4458 >(Long name)</I
4459 ></TT
4460 >
4461         is the descriptive string identifying the user (normally found in the
4462         GECOS field of the UNIX password database). Click on the <B
4463 CLASS="COMMAND"
4464 >Close
4465         </B
4466 > button to remove this dialog.</P
4467 ><P
4468 >If the parameter <TT
4469 CLASS="PARAMETER"
4470 ><I
4471 >nt acl support</I
4472 ></TT
4473 >
4474         is set to <TT
4475 CLASS="CONSTANT"
4476 >false</TT
4477 > then the file owner will 
4478         be shown as the NT user <B
4479 CLASS="COMMAND"
4480 >"Everyone"</B
4481 >.</P
4482 ><P
4483 >The <B
4484 CLASS="COMMAND"
4485 >Take Ownership</B
4486 > button will not allow 
4487         you to change the ownership of this file to yourself (clicking on 
4488         it will display a dialog box complaining that the user you are 
4489         currently logged onto the NT client cannot be found). The reason 
4490         for this is that changing the ownership of a file is a privileged 
4491         operation in UNIX, available only to the <SPAN
4492 CLASS="emphasis"
4493 ><I
4494 CLASS="EMPHASIS"
4495 >root</I
4496 ></SPAN
4497
4498         user. As clicking on this button causes NT to attempt to change 
4499         the ownership of a file to the current user logged into the NT 
4500         client this will not work with Samba at this time.</P
4501 ><P
4502 >There is an NT chown command that will work with Samba 
4503         and allow a user with Administrator privilege connected 
4504         to a Samba 2.0.4 server as root to change the ownership of 
4505         files on both a local NTFS filesystem or remote mounted NTFS 
4506         or Samba drive. This is available as part of the <SPAN
4507 CLASS="emphasis"
4508 ><I
4509 CLASS="EMPHASIS"
4510 >Seclib
4511         </I
4512 ></SPAN
4513 > NT security library written by Jeremy Allison of 
4514         the Samba Team, available from the main Samba ftp site.</P
4515 ></DIV
4516 ><DIV
4517 CLASS="SECT1"
4518 ><HR><H2
4519 CLASS="SECT1"
4520 ><A
4521 NAME="AEN762"
4522 ></A
4523 >6.4. Viewing file or directory permissions</H2
4524 ><P
4525 >The third button is the <B
4526 CLASS="COMMAND"
4527 >"Permissions"</B
4528
4529         button. Clicking on this brings up a dialog box that shows both 
4530         the permissions and the UNIX owner of the file or directory. 
4531         The owner is displayed in the form :</P
4532 ><P
4533 ><B
4534 CLASS="COMMAND"
4535 >"SERVER\user (Long name)"</B
4536 ></P
4537 ><P
4538 >Where <TT
4539 CLASS="REPLACEABLE"
4540 ><I
4541 >SERVER</I
4542 ></TT
4543 > is the NetBIOS name of 
4544         the Samba server, <TT
4545 CLASS="REPLACEABLE"
4546 ><I
4547 >user</I
4548 ></TT
4549 > is the user name of 
4550         the UNIX user who owns the file, and <TT
4551 CLASS="REPLACEABLE"
4552 ><I
4553 >(Long name)</I
4554 ></TT
4555 >
4556         is the descriptive string identifying the user (normally found in the
4557         GECOS field of the UNIX password database).</P
4558 ><P
4559 >If the parameter <TT
4560 CLASS="PARAMETER"
4561 ><I
4562 >nt acl support</I
4563 ></TT
4564 >
4565         is set to <TT
4566 CLASS="CONSTANT"
4567 >false</TT
4568 > then the file owner will 
4569         be shown as the NT user <B
4570 CLASS="COMMAND"
4571 >"Everyone"</B
4572 > and the 
4573         permissions will be shown as NT "Full Control".</P
4574 ><P
4575 >The permissions field is displayed differently for files 
4576         and directories, so I'll describe the way file permissions 
4577         are displayed first.</P
4578 ><DIV
4579 CLASS="SECT2"
4580 ><HR><H3
4581 CLASS="SECT2"
4582 ><A
4583 NAME="AEN777"
4584 ></A
4585 >6.4.1. File Permissions</H3
4586 ><P
4587 >The standard UNIX user/group/world triple and 
4588                 the corresponding "read", "write", "execute" permissions 
4589                 triples are mapped by Samba into a three element NT ACL 
4590                 with the 'r', 'w', and 'x' bits mapped into the corresponding 
4591                 NT permissions. The UNIX world permissions are mapped into 
4592                 the global NT group <B
4593 CLASS="COMMAND"
4594 >Everyone</B
4595 >, followed 
4596                 by the list of permissions allowed for UNIX world. The UNIX 
4597                 owner and group permissions are displayed as an NT 
4598                 <B
4599 CLASS="COMMAND"
4600 >user</B
4601 > icon and an NT <B
4602 CLASS="COMMAND"
4603 >local 
4604                 group</B
4605 > icon respectively followed by the list 
4606                 of permissions allowed for the UNIX user and group.</P
4607 ><P
4608 >As many UNIX permission sets don't map into common 
4609                 NT names such as <B
4610 CLASS="COMMAND"
4611 >"read"</B
4612 >, <B
4613 CLASS="COMMAND"
4614 >               "change"</B
4615 > or <B
4616 CLASS="COMMAND"
4617 >"full control"</B
4618 > then 
4619                 usually the permissions will be prefixed by the words <B
4620 CLASS="COMMAND"
4621 >               "Special Access"</B
4622 > in the NT display list.</P
4623 ><P
4624 >But what happens if the file has no permissions allowed 
4625                 for a particular UNIX user group or world component ? In order 
4626                 to  allow "no permissions" to be seen and modified then Samba 
4627                 overloads the NT <B
4628 CLASS="COMMAND"
4629 >"Take Ownership"</B
4630 > ACL attribute 
4631                 (which has no meaning in UNIX) and reports a component with 
4632                 no permissions as having the NT <B
4633 CLASS="COMMAND"
4634 >"O"</B
4635 > bit set. 
4636                 This was chosen of course to make it look like a zero, meaning 
4637                 zero permissions. More details on the decision behind this will 
4638                 be given below.</P
4639 ></DIV
4640 ><DIV
4641 CLASS="SECT2"
4642 ><HR><H3
4643 CLASS="SECT2"
4644 ><A
4645 NAME="AEN791"
4646 ></A
4647 >6.4.2. Directory Permissions</H3
4648 ><P
4649 >Directories on an NT NTFS file system have two 
4650                 different sets of permissions. The first set of permissions 
4651                 is the ACL set on the directory itself, this is usually displayed 
4652                 in the first set of parentheses in the normal <B
4653 CLASS="COMMAND"
4654 >"RW"</B
4655
4656                 NT style. This first set of permissions is created by Samba in 
4657                 exactly the same way as normal file permissions are, described 
4658                 above, and is displayed in the same way.</P
4659 ><P
4660 >The second set of directory permissions has no real meaning 
4661                 in the UNIX permissions world and represents the <B
4662 CLASS="COMMAND"
4663 >               "inherited"</B
4664 > permissions that any file created within 
4665                 this directory would inherit.</P
4666 ><P
4667 >Samba synthesises these inherited permissions for NT by 
4668                 returning as an NT ACL the UNIX permission mode that a new file 
4669                 created by Samba on this share would receive.</P
4670 ></DIV
4671 ></DIV
4672 ><DIV
4673 CLASS="SECT1"
4674 ><HR><H2
4675 CLASS="SECT1"
4676 ><A
4677 NAME="AEN798"
4678 ></A
4679 >6.5. Modifying file or directory permissions</H2
4680 ><P
4681 >Modifying file and directory permissions is as simple 
4682         as changing the displayed permissions in the dialog box, and 
4683         clicking the <B
4684 CLASS="COMMAND"
4685 >OK</B
4686 > button. However, there are 
4687         limitations that a user needs to be aware of, and also interactions 
4688         with the standard Samba permission masks and mapping of DOS 
4689         attributes that need to also be taken into account.</P
4690 ><P
4691 >If the parameter <TT
4692 CLASS="PARAMETER"
4693 ><I
4694 >nt acl support</I
4695 ></TT
4696 >
4697         is set to <TT
4698 CLASS="CONSTANT"
4699 >false</TT
4700 > then any attempt to set 
4701         security permissions will fail with an <B
4702 CLASS="COMMAND"
4703 >"Access Denied"
4704         </B
4705 > message.</P
4706 ><P
4707 >The first thing to note is that the <B
4708 CLASS="COMMAND"
4709 >"Add"</B
4710
4711         button will not return a list of users in Samba 2.0.4 (it will give 
4712         an error message of <B
4713 CLASS="COMMAND"
4714 >"The remote procedure call failed 
4715         and did not execute"</B
4716 >). This means that you can only 
4717         manipulate the current user/group/world permissions listed in 
4718         the dialog box. This actually works quite well as these are the 
4719         only permissions that UNIX actually has.</P
4720 ><P
4721 >If a permission triple (either user, group, or world) 
4722         is removed from the list of permissions in the NT dialog box, 
4723         then when the <B
4724 CLASS="COMMAND"
4725 >"OK"</B
4726 > button is pressed it will 
4727         be applied as "no permissions" on the UNIX side. If you then 
4728         view the permissions again the "no permissions" entry will appear 
4729         as the NT <B
4730 CLASS="COMMAND"
4731 >"O"</B
4732 > flag, as described above. This 
4733         allows you to add permissions back to a file or directory once 
4734         you have removed them from a triple component.</P
4735 ><P
4736 >As UNIX supports only the "r", "w" and "x" bits of 
4737         an NT ACL then if other NT security attributes such as "Delete 
4738         access" are selected then they will be ignored when applied on 
4739         the Samba server.</P
4740 ><P
4741 >When setting permissions on a directory the second 
4742         set of permissions (in the second set of parentheses) is 
4743         by default applied to all files within that directory. If this 
4744         is not what you want you must uncheck the <B
4745 CLASS="COMMAND"
4746 >"Replace 
4747         permissions on existing files"</B
4748 > checkbox in the NT 
4749         dialog before clicking <B
4750 CLASS="COMMAND"
4751 >"OK"</B
4752 >.</P
4753 ><P
4754 >If you wish to remove all permissions from a 
4755         user/group/world  component then you may either highlight the 
4756         component and click the <B
4757 CLASS="COMMAND"
4758 >"Remove"</B
4759 > button, 
4760         or set the component to only have the special <B
4761 CLASS="COMMAND"
4762 >"Take
4763         Ownership"</B
4764 > permission (displayed as <B
4765 CLASS="COMMAND"
4766 >"O"
4767         </B
4768 >) highlighted.</P
4769 ></DIV
4770 ><DIV
4771 CLASS="SECT1"
4772 ><HR><H2
4773 CLASS="SECT1"
4774 ><A
4775 NAME="AEN820"
4776 ></A
4777 >6.6. Interaction with the standard Samba create mask 
4778         parameters</H2
4779 ><P
4780 >Note that with Samba 2.0.5 there are four new parameters 
4781         to control this interaction.  These are :</P
4782 ><P
4783 ><TT
4784 CLASS="PARAMETER"
4785 ><I
4786 >security mask</I
4787 ></TT
4788 ></P
4789 ><P
4790 ><TT
4791 CLASS="PARAMETER"
4792 ><I
4793 >force security mode</I
4794 ></TT
4795 ></P
4796 ><P
4797 ><TT
4798 CLASS="PARAMETER"
4799 ><I
4800 >directory security mask</I
4801 ></TT
4802 ></P
4803 ><P
4804 ><TT
4805 CLASS="PARAMETER"
4806 ><I
4807 >force directory security mode</I
4808 ></TT
4809 ></P
4810 ><P
4811 >Once a user clicks <B
4812 CLASS="COMMAND"
4813 >"OK"</B
4814 > to apply the 
4815         permissions Samba maps the given permissions into a user/group/world 
4816         r/w/x triple set, and then will check the changed permissions for a 
4817         file against the bits set in the <A
4818 HREF="smb.conf.5.html#SECURITYMASK"
4819 TARGET="_top"
4820
4821         <TT
4822 CLASS="PARAMETER"
4823 ><I
4824 >security mask</I
4825 ></TT
4826 ></A
4827 > parameter. Any bits that 
4828         were changed that are not set to '1' in this parameter are left alone 
4829         in the file permissions.</P
4830 ><P
4831 >Essentially, zero bits in the <TT
4832 CLASS="PARAMETER"
4833 ><I
4834 >security mask</I
4835 ></TT
4836 >
4837         mask may be treated as a set of bits the user is <SPAN
4838 CLASS="emphasis"
4839 ><I
4840 CLASS="EMPHASIS"
4841 >not</I
4842 ></SPAN
4843
4844         allowed to change, and one bits are those the user is allowed to change.
4845         </P
4846 ><P
4847 >If not set explicitly this parameter is set to the same value as 
4848         the <A
4849 HREF="smb.conf.5.html#CREATEMASK"
4850 TARGET="_top"
4851 ><TT
4852 CLASS="PARAMETER"
4853 ><I
4854 >create mask
4855         </I
4856 ></TT
4857 ></A
4858 > parameter to provide compatibility with Samba 2.0.4 
4859         where this permission change facility was introduced. To allow a user to 
4860         modify all the user/group/world permissions on a file, set this parameter 
4861         to 0777.</P
4862 ><P
4863 >Next Samba checks the changed permissions for a file against 
4864         the bits set in the <A
4865 HREF="smb.conf.5.html#FORCESECURITYMODE"
4866 TARGET="_top"
4867 >       <TT
4868 CLASS="PARAMETER"
4869 ><I
4870 >force security mode</I
4871 ></TT
4872 ></A
4873 > parameter. Any bits 
4874         that were changed that correspond to bits set to '1' in this parameter 
4875         are forced to be set.</P
4876 ><P
4877 >Essentially, bits set in the <TT
4878 CLASS="PARAMETER"
4879 ><I
4880 >force security mode
4881         </I
4882 ></TT
4883 > parameter may be treated as a set of bits that, when 
4884         modifying security on a file, the user has always set to be 'on'.</P
4885 ><P
4886 >If not set explicitly this parameter is set to the same value 
4887         as the <A
4888 HREF="smb.conf.5.html#FORCECREATEMODE"
4889 TARGET="_top"
4890 ><TT
4891 CLASS="PARAMETER"
4892 ><I
4893 >force 
4894         create mode</I
4895 ></TT
4896 ></A
4897 > parameter to provide compatibility
4898         with Samba 2.0.4 where the permission change facility was introduced.
4899         To allow a user to modify all the user/group/world permissions on a file
4900         with no restrictions set this parameter to 000.</P
4901 ><P
4902 >The <TT
4903 CLASS="PARAMETER"
4904 ><I
4905 >security mask</I
4906 ></TT
4907 > and <TT
4908 CLASS="PARAMETER"
4909 ><I
4910 >force 
4911         security mode</I
4912 ></TT
4913 > parameters are applied to the change 
4914         request in that order.</P
4915 ><P
4916 >For a directory Samba will perform the same operations as 
4917         described above for a file except using the parameter <TT
4918 CLASS="PARAMETER"
4919 ><I
4920 >       directory security mask</I
4921 ></TT
4922 > instead of <TT
4923 CLASS="PARAMETER"
4924 ><I
4925 >security 
4926         mask</I
4927 ></TT
4928 >, and <TT
4929 CLASS="PARAMETER"
4930 ><I
4931 >force directory security mode
4932         </I
4933 ></TT
4934 > parameter instead of <TT
4935 CLASS="PARAMETER"
4936 ><I
4937 >force security mode
4938         </I
4939 ></TT
4940 >.</P
4941 ><P
4942 >The <TT
4943 CLASS="PARAMETER"
4944 ><I
4945 >directory security mask</I
4946 ></TT
4947 > parameter 
4948         by default is set to the same value as the <TT
4949 CLASS="PARAMETER"
4950 ><I
4951 >directory mask
4952         </I
4953 ></TT
4954 > parameter and the <TT
4955 CLASS="PARAMETER"
4956 ><I
4957 >force directory security 
4958         mode</I
4959 ></TT
4960 > parameter by default is set to the same value as 
4961         the <TT
4962 CLASS="PARAMETER"
4963 ><I
4964 >force directory mode</I
4965 ></TT
4966 > parameter to provide 
4967         compatibility with Samba 2.0.4 where the permission change facility 
4968         was introduced.</P
4969 ><P
4970 >In this way Samba enforces the permission restrictions that 
4971         an administrator can set on a Samba share, whilst still allowing users 
4972         to modify the permission bits within that restriction.</P
4973 ><P
4974 >If you want to set up a share that allows users full control
4975         in modifying the permission bits on their files and directories and
4976         doesn't force any particular bits to be set 'on', then set the following
4977         parameters in the <A
4978 HREF="smb.conf.5.html"
4979 TARGET="_top"
4980 ><TT
4981 CLASS="FILENAME"
4982 >smb.conf(5)
4983         </TT
4984 ></A
4985 > file in that share specific section :</P
4986 ><P
4987 ><TT
4988 CLASS="PARAMETER"
4989 ><I
4990 >security mask = 0777</I
4991 ></TT
4992 ></P
4993 ><P
4994 ><TT
4995 CLASS="PARAMETER"
4996 ><I
4997 >force security mode = 0</I
4998 ></TT
4999 ></P
5000 ><P
5001 ><TT
5002 CLASS="PARAMETER"
5003 ><I
5004 >directory security mask = 0777</I
5005 ></TT
5006 ></P
5007 ><P
5008 ><TT
5009 CLASS="PARAMETER"
5010 ><I
5011 >force directory security mode = 0</I
5012 ></TT
5013 ></P
5014 ><P
5015 >As described, in Samba 2.0.4 the parameters :</P
5016 ><P
5017 ><TT
5018 CLASS="PARAMETER"
5019 ><I
5020 >create mask</I
5021 ></TT
5022 ></P
5023 ><P
5024 ><TT
5025 CLASS="PARAMETER"
5026 ><I
5027 >force create mode</I
5028 ></TT
5029 ></P
5030 ><P
5031 ><TT
5032 CLASS="PARAMETER"
5033 ><I
5034 >directory mask</I
5035 ></TT
5036 ></P
5037 ><P
5038 ><TT
5039 CLASS="PARAMETER"
5040 ><I
5041 >force directory mode</I
5042 ></TT
5043 ></P
5044 ><P
5045 >were used instead of the parameters discussed here.</P
5046 ></DIV
5047 ><DIV
5048 CLASS="SECT1"
5049 ><HR><H2
5050 CLASS="SECT1"
5051 ><A
5052 NAME="AEN884"
5053 ></A
5054 >6.7. Interaction with the standard Samba file attribute 
5055         mapping</H2
5056 ><P
5057 >Samba maps some of the DOS attribute bits (such as "read 
5058         only") into the UNIX permissions of a file. This means there can 
5059         be a conflict between the permission bits set via the security 
5060         dialog and the permission bits set by the file attribute mapping.
5061         </P
5062 ><P
5063 >One way this can show up is if a file has no UNIX read access
5064         for the owner it will show up as "read only" in the standard 
5065         file attributes tabbed dialog. Unfortunately this dialog is
5066         the same one that contains the security info in another tab.</P
5067 ><P
5068 >What this can mean is that if the owner changes the permissions
5069         to allow themselves read access using the security dialog, clicks
5070         <B
5071 CLASS="COMMAND"
5072 >"OK"</B
5073 > to get back to the standard attributes tab 
5074         dialog, and then clicks <B
5075 CLASS="COMMAND"
5076 >"OK"</B
5077 > on that dialog, then 
5078         NT will set the file permissions back to read-only (as that is what 
5079         the attributes still say in the dialog). This means that after setting 
5080         permissions and clicking <B
5081 CLASS="COMMAND"
5082 >"OK"</B
5083 > to get back to the 
5084         attributes dialog you should always hit <B
5085 CLASS="COMMAND"
5086 >"Cancel"</B
5087
5088         rather than <B
5089 CLASS="COMMAND"
5090 >"OK"</B
5091 > to ensure that your changes 
5092         are not overridden.</P
5093 ></DIV
5094 ></DIV
5095 ><DIV
5096 CLASS="CHAPTER"
5097 ><HR><H1
5098 ><A
5099 NAME="PRINTING"
5100 ></A
5101 >Chapter 7. Printing Support in Samba 2.2.x</H1
5102 ><DIV
5103 CLASS="SECT1"
5104 ><H2
5105 CLASS="SECT1"
5106 ><A
5107 NAME="AEN905"
5108 ></A
5109 >7.1. Introduction</H2
5110 ><P
5111 >Beginning with the 2.2.0 release, Samba supports 
5112 the native Windows NT printing mechanisms implemented via 
5113 MS-RPC (i.e. the SPOOLSS named pipe).  Previous versions of 
5114 Samba only supported LanMan printing calls.</P
5115 ><P
5116 >The additional functionality provided by the new 
5117 SPOOLSS support includes:</P
5118 ><P
5119 ></P
5120 ><UL
5121 ><LI
5122 ><P
5123 >Support for downloading printer driver 
5124         files to Windows 95/98/NT/2000 clients upon demand.
5125         </P
5126 ></LI
5127 ><LI
5128 ><P
5129 >Uploading of printer drivers via the 
5130         Windows NT Add Printer Wizard (APW) or the 
5131         Imprints tool set (refer to <A
5132 HREF="http://imprints.sourceforge.net"
5133 TARGET="_top"
5134 >http://imprints.sourceforge.net</A
5135 >). 
5136         </P
5137 ></LI
5138 ><LI
5139 ><P
5140 >Support for the native MS-RPC printing 
5141         calls such as StartDocPrinter, EnumJobs(), etc...  (See 
5142         the MSDN documentation at <A
5143 HREF="http://msdn.microsoft.com/"
5144 TARGET="_top"
5145 >http://msdn.microsoft.com/</A
5146
5147         for more information on the Win32 printing API)
5148         </P
5149 ></LI
5150 ><LI
5151 ><P
5152 >Support for NT Access Control Lists (ACL) 
5153         on printer objects</P
5154 ></LI
5155 ><LI
5156 ><P
5157 >Improved support for printer queue manipulation 
5158         through the use of an internal databases for spooled job 
5159         information</P
5160 ></LI
5161 ></UL
5162 ><P
5163 >There has been some initial confusion about what all this means
5164 and whether or not it is a requirement for printer drivers to be 
5165 installed on a Samba host in order to support printing from Windows 
5166 clients.  A bug existed in Samba 2.2.0 which made Windows NT/2000 clients 
5167 require that the Samba server possess a valid driver for the printer.  
5168 This is fixed in Samba 2.2.1 and once again, Windows NT/2000 clients
5169 can use the local APW for installing drivers to be used with a Samba 
5170 served printer.  This is the same behavior exhibited by Windows 9x clients.
5171 As a side note, Samba does not use these drivers in any way to process 
5172 spooled files.  They are utilized entirely by the clients.</P
5173 ><P
5174 >The following MS KB article, may be of some help if you are dealing with
5175 Windows 2000 clients:  <SPAN
5176 CLASS="emphasis"
5177 ><I
5178 CLASS="EMPHASIS"
5179 >How to Add Printers with No User 
5180 Interaction in Windows 2000</I
5181 ></SPAN
5182 ></P
5183 ><P
5184 ><A
5185 HREF="http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP"
5186 TARGET="_top"
5187 >http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP</A
5188 ></P
5189 ></DIV
5190 ><DIV
5191 CLASS="SECT1"
5192 ><HR><H2
5193 CLASS="SECT1"
5194 ><A
5195 NAME="AEN927"
5196 ></A
5197 >7.2. Configuration</H2
5198 ><DIV
5199 CLASS="WARNING"
5200 ><P
5201 ></P
5202 ><TABLE
5203 CLASS="WARNING"
5204 WIDTH="100%"
5205 BORDER="0"
5206 ><TR
5207 ><TD
5208 WIDTH="25"
5209 ALIGN="CENTER"
5210 VALIGN="TOP"
5211 ><IMG
5212 SRC="/docbook-dsssl/warning.gif"
5213 HSPACE="5"
5214 ALT="Warning"></TD
5215 ><TH
5216 ALIGN="LEFT"
5217 VALIGN="CENTER"
5218 ><B
5219 >[print$] vs. [printer$]</B
5220 ></TH
5221 ></TR
5222 ><TR
5223 ><TD
5224 >&nbsp;</TD
5225 ><TD
5226 ALIGN="LEFT"
5227 VALIGN="TOP"
5228 ><P
5229 >Previous versions of Samba recommended using a share named [printer$].  
5230 This name was taken from the printer$ service created by Windows 9x 
5231 clients when a printer was shared.  Windows 9x printer servers always have 
5232 a printer$ service which provides read-only access via no 
5233 password in order to support printer driver downloads.</P
5234 ><P
5235 >However, the initial implementation allowed for a 
5236 parameter named <TT
5237 CLASS="PARAMETER"
5238 ><I
5239 >printer driver location</I
5240 ></TT
5241
5242 to be used on a per share basis to specify the location of 
5243 the driver files associated with that printer.  Another 
5244 parameter named <TT
5245 CLASS="PARAMETER"
5246 ><I
5247 >printer driver</I
5248 ></TT
5249 > provided 
5250 a means of defining the printer driver name to be sent to 
5251 the client.</P
5252 ><P
5253 >These parameters, including <TT
5254 CLASS="PARAMETER"
5255 ><I
5256 >printer driver
5257 file</I
5258 ></TT
5259 > parameter, are being deprecated and should not 
5260 be used in new installations.  For more information on this change, 
5261 you should refer to the <A
5262 HREF="#MIGRATION"
5263 >Migration section</A
5264 >
5265 of this document.</P
5266 ></TD
5267 ></TR
5268 ></TABLE
5269 ></DIV
5270 ><DIV
5271 CLASS="SECT2"
5272 ><HR><H3
5273 CLASS="SECT2"
5274 ><A
5275 NAME="AEN938"
5276 ></A
5277 >7.2.1. Creating [print$]</H3
5278 ><P
5279 >In order to support the uploading of printer driver 
5280 files, you must first configure a file share named [print$].  
5281 The name of this share is hard coded in Samba's internals so 
5282 the name is very important (print$ is the service used by 
5283 Windows NT print servers to provide support for printer driver 
5284 download).</P
5285 ><P
5286 >You should modify the server's smb.conf file to add the global
5287 parameters and to create the 
5288 following file share (of course, some of the parameter values,
5289 such as 'path' are arbitrary and should be replaced with
5290 appropriate values for your site):</P
5291 ><P
5292 ><PRE
5293 CLASS="PROGRAMLISTING"
5294 >[global]
5295     ; members of the ntadmin group should be able
5296     ; to add drivers and set printer properties
5297     ; root is implicitly a 'printer admin'
5298     printer admin = @ntadmin
5299
5300 [print$]
5301     path = /usr/local/samba/printers
5302     guest ok = yes
5303     browseable = yes
5304     read only = yes
5305     ; since this share is configured as read only, then we need
5306     ; a 'write list'.  Check the file system permissions to make
5307     ; sure this account can copy files to the share.  If this
5308     ; is setup to a non-root account, then it should also exist
5309     ; as a 'printer admin'
5310     write list = @ntadmin,root</PRE
5311 ></P
5312 ><P
5313 >The <A
5314 HREF="smb.conf.5.html#WRITELIST"
5315 TARGET="_top"
5316 ><TT
5317 CLASS="PARAMETER"
5318 ><I
5319 >write list</I
5320 ></TT
5321 ></A
5322 > is used to allow administrative 
5323 level user accounts to have write access in order to update files 
5324 on the share.  See the <A
5325 HREF="smb.conf.5.html"
5326 TARGET="_top"
5327 >smb.conf(5) 
5328 man page</A
5329 > for more information on configuring file shares.</P
5330 ><P
5331 >The requirement for <A
5332 HREF="smb.conf.5.html#GUESTOK"
5333 TARGET="_top"
5334 ><B
5335 CLASS="COMMAND"
5336 >guest 
5337 ok = yes</B
5338 ></A
5339 > depends upon how your
5340 site is configured.  If users will be guaranteed to have 
5341 an account on the Samba host, then this is a non-issue.</P
5342 ><DIV
5343 CLASS="NOTE"
5344 ><P
5345 ></P
5346 ><TABLE
5347 CLASS="NOTE"
5348 WIDTH="100%"
5349 BORDER="0"
5350 ><TR
5351 ><TD
5352 WIDTH="25"
5353 ALIGN="CENTER"
5354 VALIGN="TOP"
5355 ><IMG
5356 SRC="/docbook-dsssl/note.gif"
5357 HSPACE="5"
5358 ALT="Note"></TD
5359 ><TH
5360 ALIGN="LEFT"
5361 VALIGN="CENTER"
5362 ><B
5363 >Author's Note</B
5364 ></TH
5365 ></TR
5366 ><TR
5367 ><TD
5368 >&nbsp;</TD
5369 ><TD
5370 ALIGN="LEFT"
5371 VALIGN="TOP"
5372 ><P
5373 >The non-issue is that if all your Windows NT users are guaranteed to be 
5374 authenticated by the Samba server (such as a domain member server and the NT 
5375 user has already been validated by the Domain Controller in 
5376 order to logon to the Windows NT console), then guest access 
5377 is not necessary.  Of course, in a workgroup environment where 
5378 you just want to be able to print without worrying about 
5379 silly accounts and security, then configure the share for 
5380 guest access.  You'll probably want to add <A
5381 HREF="smb.conf.5.html#MAPTOGUEST"
5382 TARGET="_top"
5383 ><B
5384 CLASS="COMMAND"
5385 >map to guest = Bad User</B
5386 ></A
5387 > in the [global] section as well.  Make sure 
5388 you understand what this parameter does before using it 
5389 though. --jerry</P
5390 ></TD
5391 ></TR
5392 ></TABLE
5393 ></DIV
5394 ><P
5395 >In order for a Windows NT print server to support 
5396 the downloading of driver files by multiple client architectures,
5397 it must create subdirectories within the [print$] service
5398 which correspond to each of the supported client architectures.
5399 Samba follows this model as well.</P
5400 ><P
5401 >Next create the directory tree below the [print$] share 
5402 for each architecture you wish to support.</P
5403 ><P
5404 ><PRE
5405 CLASS="PROGRAMLISTING"
5406 >[print$]-----
5407         |-W32X86           ; "Windows NT x86"
5408         |-WIN40            ; "Windows 95/98"
5409         |-W32ALPHA         ; "Windows NT Alpha_AXP"
5410         |-W32MIPS          ; "Windows NT R4000"
5411         |-W32PPC           ; "Windows NT PowerPC"</PRE
5412 ></P
5413 ><DIV
5414 CLASS="WARNING"
5415 ><P
5416 ></P
5417 ><TABLE
5418 CLASS="WARNING"
5419 WIDTH="100%"
5420 BORDER="0"
5421 ><TR
5422 ><TD
5423 WIDTH="25"
5424 ALIGN="CENTER"
5425 VALIGN="TOP"
5426 ><IMG
5427 SRC="/docbook-dsssl/warning.gif"
5428 HSPACE="5"
5429 ALT="Warning"></TD
5430 ><TH
5431 ALIGN="LEFT"
5432 VALIGN="CENTER"
5433 ><B
5434 >ATTENTION!  REQUIRED PERMISSIONS</B
5435 ></TH
5436 ></TR
5437 ><TR
5438 ><TD
5439 >&nbsp;</TD
5440 ><TD
5441 ALIGN="LEFT"
5442 VALIGN="TOP"
5443 ><P
5444 >In order to currently add a new driver to you Samba host, 
5445 one of two conditions must hold true:</P
5446 ><P
5447 ></P
5448 ><UL
5449 ><LI
5450 ><P
5451 >The account used to connect to the Samba host 
5452         must have a uid of 0 (i.e. a root account)</P
5453 ></LI
5454 ><LI
5455 ><P
5456 >The account used to connect to the Samba host
5457         must be a member of the <A
5458 HREF="smb.conf.5.html#PRINTERADMIN"
5459 TARGET="_top"
5460 ><TT
5461 CLASS="PARAMETER"
5462 ><I
5463 >printer 
5464         admin</I
5465 ></TT
5466 ></A
5467 > list.</P
5468 ></LI
5469 ></UL
5470 ><P
5471 >Of course, the connected account must still possess access
5472 to add files to the subdirectories beneath [print$]. Remember
5473 that all file shares are set to 'read only' by default.</P
5474 ></TD
5475 ></TR
5476 ></TABLE
5477 ></DIV
5478 ><P
5479 >Once you have created the required [print$] service and 
5480 associated subdirectories, simply log onto the Samba server using 
5481 a root (or <TT
5482 CLASS="PARAMETER"
5483 ><I
5484 >printer admin</I
5485 ></TT
5486 >) account
5487 from a Windows NT 4.0/2k client.  Open "Network Neighbourhood" or
5488 "My Network Places" and browse for the Samba host.  Once you have located
5489 the server, navigate to the "Printers..." folder.
5490 You should see an initial listing of printers
5491 that matches the printer shares defined on your Samba host.</P
5492 ></DIV
5493 ><DIV
5494 CLASS="SECT2"
5495 ><HR><H3
5496 CLASS="SECT2"
5497 ><A
5498 NAME="AEN973"
5499 ></A
5500 >7.2.2. Setting Drivers for Existing Printers</H3
5501 ><P
5502 >The initial listing of printers in the Samba host's 
5503 Printers folder will have no real printer driver assigned 
5504 to them.  By default, in Samba 2.2.0 this driver name was set to 
5505 <SPAN
5506 CLASS="emphasis"
5507 ><I
5508 CLASS="EMPHASIS"
5509 >NO PRINTER DRIVER AVAILABLE FOR THIS PRINTER</I
5510 ></SPAN
5511 >.
5512 Later versions changed this to a NULL string to allow the use
5513 tof the local Add Printer Wizard on NT/2000 clients.
5514 Attempting to view the printer properties for a printer
5515 which has this default driver assigned will result in 
5516 the error message:</P
5517 ><P
5518 ><SPAN
5519 CLASS="emphasis"
5520 ><I
5521 CLASS="EMPHASIS"
5522 >Device settings cannot be displayed.  The driver 
5523 for the specified printer is not installed, only spooler 
5524 properties will be displayed.  Do you want to install the 
5525 driver now?</I
5526 ></SPAN
5527 ></P
5528 ><P
5529 >Click "No" in the error dialog and you will be presented with
5530 the printer properties window.  The way to assign a driver to a 
5531 printer is to either</P
5532 ><P
5533 ></P
5534 ><UL
5535 ><LI
5536 ><P
5537 >Use the "New Driver..." button to install 
5538         a new printer driver, or</P
5539 ></LI
5540 ><LI
5541 ><P
5542 >Select a driver from the popup list of 
5543         installed drivers.  Initially this list will be empty.</P
5544 ></LI
5545 ></UL
5546 ><P
5547 >If you wish to install printer drivers for client 
5548 operating systems other than "Windows NT x86", you will need 
5549 to use the "Sharing" tab of the printer properties dialog.</P
5550 ><P
5551 >Assuming you have connected with a root account, you 
5552 will also be able modify other printer properties such as 
5553 ACLs and device settings using this dialog box.</P
5554 ><P
5555 >A few closing comments for this section, it is possible 
5556 on a Windows NT print server to have printers
5557 listed in the Printers folder which are not shared.  Samba does
5558 not make this distinction.  By definition, the only printers of
5559 which Samba is aware are those which are specified as shares in
5560 <TT
5561 CLASS="FILENAME"
5562 >smb.conf</TT
5563 >.</P
5564 ><P
5565 >Another interesting side note is that Windows NT clients do
5566 not use the SMB printer share, but rather can print directly 
5567 to any printer on another Windows NT host using MS-RPC.  This
5568 of course assumes that the printing client has the necessary
5569 privileges on the remote host serving the printer.  The default
5570 permissions assigned by Windows NT to a printer gives the "Print"
5571 permissions to the "Everyone" well-known group.</P
5572 ></DIV
5573 ><DIV
5574 CLASS="SECT2"
5575 ><HR><H3
5576 CLASS="SECT2"
5577 ><A
5578 NAME="AEN990"
5579 ></A
5580 >7.2.3. Support a large number of printers</H3
5581 ><P
5582 >One issue that has arisen during the development
5583 phase of Samba 2.2 is the need to support driver downloads for
5584 100's of printers.  Using the Windows NT APW is somewhat 
5585 awkward to say the list.  If more than one printer are using the 
5586 same driver, the <A
5587 HREF="rpcclient.1.html"
5588 TARGET="_top"
5589 ><B
5590 CLASS="COMMAND"
5591 >rpcclient's
5592 setdriver command</B
5593 ></A
5594 > can be used to set the driver
5595 associated with an installed driver.  The following is example
5596 of how this could be accomplished:</P
5597 ><P
5598 ><PRE
5599 CLASS="PROGRAMLISTING"
5600
5601 <TT
5602 CLASS="PROMPT"
5603 >$ </TT
5604 >rpcclient pogo -U root%secret -c "enumdrivers"
5605 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
5606  
5607 [Windows NT x86]
5608 Printer Driver Info 1:
5609      Driver Name: [HP LaserJet 4000 Series PS]
5610  
5611 Printer Driver Info 1:
5612      Driver Name: [HP LaserJet 2100 Series PS]
5613  
5614 Printer Driver Info 1:
5615      Driver Name: [HP LaserJet 4Si/4SiMX PS]
5616                                   
5617 <TT
5618 CLASS="PROMPT"
5619 >$ </TT
5620 >rpcclient pogo -U root%secret -c "enumprinters"
5621 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
5622      flags:[0x800000]
5623      name:[\\POGO\hp-print]
5624      description:[POGO\\POGO\hp-print,NO DRIVER AVAILABLE FOR THIS PRINTER,]
5625      comment:[]
5626                                   
5627 <TT
5628 CLASS="PROMPT"
5629 >$ </TT
5630 >rpcclient pogo -U root%secret \
5631 <TT
5632 CLASS="PROMPT"
5633 >&gt; </TT
5634 > -c "setdriver hp-print \"HP LaserJet 4000 Series PS\""
5635 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
5636 Successfully set hp-print to driver HP LaserJet 4000 Series PS.</PRE
5637 ></P
5638 ></DIV
5639 ><DIV
5640 CLASS="SECT2"
5641 ><HR><H3
5642 CLASS="SECT2"
5643 ><A
5644 NAME="AEN1001"
5645 ></A
5646 >7.2.4. Adding New Printers via the Windows NT APW</H3
5647 ><P
5648 >By default, Samba offers all printer shares defined in <TT
5649 CLASS="FILENAME"
5650 >smb.conf</TT
5651 >
5652 in the "Printers..." folder.  Also existing in this folder is the Windows NT 
5653 Add Printer Wizard icon.  The APW will be show only if</P
5654 ><P
5655 ></P
5656 ><UL
5657 ><LI
5658 ><P
5659 >The connected user is able to successfully
5660         execute an OpenPrinterEx(\\server) with administrative
5661         privileges (i.e. root or <TT
5662 CLASS="PARAMETER"
5663 ><I
5664 >printer admin</I
5665 ></TT
5666 >).
5667         </P
5668 ></LI
5669 ><LI
5670 ><P
5671 ><A
5672 HREF="smb.conf.5.html#SHOWADDPRINTERWIZARD"
5673 TARGET="_top"
5674 ><TT
5675 CLASS="PARAMETER"
5676 ><I
5677 >show 
5678         add printer wizard = yes</I
5679 ></TT
5680 ></A
5681 > (the default).
5682         </P
5683 ></LI
5684 ></UL
5685 ><P
5686 >In order to be able to use the APW to successfully add a printer to a Samba 
5687 server, the <A
5688 HREF="smb.conf.5.html#ADDPRINTERCOMMAND"
5689 TARGET="_top"
5690 ><TT
5691 CLASS="PARAMETER"
5692 ><I
5693 >add 
5694 printer command</I
5695 ></TT
5696 ></A
5697 > must have a defined value.  The program
5698 hook must successfully add the printer to the system (i.e. 
5699 <TT
5700 CLASS="FILENAME"
5701 >/etc/printcap</TT
5702 > or appropriate files) and 
5703 <TT
5704 CLASS="FILENAME"
5705 >smb.conf</TT
5706 > if necessary.</P
5707 ><P
5708 >When using the APW from a client, if the named printer share does 
5709 not exist, <B
5710 CLASS="COMMAND"
5711 >smbd</B
5712 > will execute the <TT
5713 CLASS="PARAMETER"
5714 ><I
5715 >add printer 
5716 command</I
5717 ></TT
5718 > and reparse to the <TT
5719 CLASS="FILENAME"
5720 >smb.conf</TT
5721 >
5722 to attempt to locate the new printer share.  If the share is still not defined,
5723 an error of "Access Denied" is returned to the client.  Note that the 
5724 <TT
5725 CLASS="PARAMETER"
5726 ><I
5727 >add printer program</I
5728 ></TT
5729 > is executed under the context
5730 of the connected user, not necessarily a root account.</P
5731 ><P
5732 >There is a complementary <A
5733 HREF="smb.conf.5.html#DELETEPRINTERCOMMAND"
5734 TARGET="_top"
5735 ><TT
5736 CLASS="PARAMETER"
5737 ><I
5738 >delete
5739 printer command</I
5740 ></TT
5741 ></A
5742 > for removing entries from the "Printers..."
5743 folder.</P
5744 ><P
5745 >The following is an example <A
5746 HREF="smb.conf.5.html#ADDPRINTERCOMMAN"
5747 TARGET="_top"
5748 ><TT
5749 CLASS="PARAMETER"
5750 ><I
5751 >add printer command</I
5752 ></TT
5753 ></A
5754 > script. It adds the appropriate entries to <TT
5755 CLASS="FILENAME"
5756 >/etc/printcap.local</TT
5757 > (change that to what you need) and returns a line of 'Done' which is needed for the whole process to work.</P
5758 ><PRE
5759 CLASS="PROGRAMLISTING"
5760 >#!/bin/sh
5761
5762 # Script to insert a new printer entry into printcap.local
5763 #
5764 # $1, printer name, used as the descriptive name
5765 # $2, share name, used as the printer name for Linux
5766 # $3, port name
5767 # $4, driver name
5768 # $5, location, used for the device file of the printer
5769 # $6, win9x location
5770
5771 #
5772 # Make sure we use the location that RedHat uses for local printer defs
5773 PRINTCAP=/etc/printcap.local
5774 DATE=`date +%Y%m%d-%H%M%S`
5775 LP=lp
5776 RESTART="service lpd restart"
5777
5778 # Keep a copy
5779 cp $PRINTCAP $PRINTCAP.$DATE
5780 # Add the printer to $PRINTCAP
5781 echo ""                                                 &#62;&#62; $PRINTCAP
5782 echo "$2|$1:\\"                                         &#62;&#62; $PRINTCAP
5783 echo "  :sd=/var/spool/lpd/$2:\\"                       &#62;&#62; $PRINTCAP
5784 echo "  :mx=0:ml=0:sh:\\"                               &#62;&#62; $PRINTCAP
5785 echo "  :lp=/usr/local/samba/var/print/$5.prn:"         &#62;&#62; $PRINTCAP
5786
5787 touch "/usr/local/samba/var/print/$5.prn" &#62;&#62; /tmp/printadd.$$ 2&#62;&#38;1
5788 chown $LP "/usr/local/samba/var/print/$5.prn" &#62;&#62; /tmp/printadd.$$ 2&#62;&#38;1
5789
5790 mkdir /var/spool/lpd/$2
5791 chmod 700 /var/spool/lpd/$2
5792 chown $LP /var/spool/lpd/$2
5793 #echo $1 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
5794 #echo $2 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
5795 #echo $3 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
5796 #echo $4 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
5797 #echo $5 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
5798 #echo $6 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
5799 $RESTART &#62;&#62; "/usr/local/samba/var/print/$5.prn"
5800 # Not sure if this is needed
5801 touch /usr/local/samba/lib/smb.conf
5802 #
5803 # You need to return a value, but I am not sure what it means.
5804 #
5805 echo "Done"
5806 exit 0</PRE
5807 ></DIV
5808 ><DIV
5809 CLASS="SECT2"
5810 ><HR><H3
5811 CLASS="SECT2"
5812 ><A
5813 NAME="AEN1031"
5814 ></A
5815 >7.2.5. Samba and Printer Ports</H3
5816 ><P
5817 >Windows NT/2000 print servers associate a port with each printer.  These normally
5818 take the form of LPT1:, COM1:, FILE:, etc...  Samba must also support the
5819 concept of ports associated with a printer.  By default, only one printer port,
5820 named "Samba Printer Port", exists on a system.  Samba does not really a port in
5821 order to print, rather it is a requirement of Windows clients.  </P
5822 ><P
5823 >Note that Samba does not support the concept of "Printer Pooling" internally 
5824 either.  This is when a logical printer is assigned to multiple ports as 
5825 a form of load balancing or fail over.</P
5826 ><P
5827 >If you require that multiple ports be defined for some reason,
5828 <TT
5829 CLASS="FILENAME"
5830 >smb.conf</TT
5831 > possesses a <A
5832 HREF="smb.conf.5.html#ENUMPORTSCOMMAND"
5833 TARGET="_top"
5834 ><TT
5835 CLASS="PARAMETER"
5836 ><I
5837 >enumports 
5838 command</I
5839 ></TT
5840 ></A
5841 > which can be used to define an external program 
5842 that generates a listing of ports on a system.</P
5843 ></DIV
5844 ></DIV
5845 ><DIV
5846 CLASS="SECT1"
5847 ><HR><H2
5848 CLASS="SECT1"
5849 ><A
5850 NAME="AEN1039"
5851 ></A
5852 >7.3. The Imprints Toolset</H2
5853 ><P
5854 >The Imprints tool set provides a UNIX equivalent of the 
5855         Windows NT Add Printer Wizard.  For complete information, please 
5856         refer to the Imprints web site at <A
5857 HREF="http://imprints.sourceforge.net/"
5858 TARGET="_top"
5859 >       http://imprints.sourceforge.net/</A
5860 > as well as the documentation 
5861         included with the imprints source distribution.  This section will 
5862         only provide a brief introduction to the features of Imprints.</P
5863 ><DIV
5864 CLASS="SECT2"
5865 ><HR><H3
5866 CLASS="SECT2"
5867 ><A
5868 NAME="AEN1043"
5869 ></A
5870 >7.3.1. What is Imprints?</H3
5871 ><P
5872 >Imprints is a collection of tools for supporting the goals 
5873                 of</P
5874 ><P
5875 ></P
5876 ><UL
5877 ><LI
5878 ><P
5879 >Providing a central repository information 
5880                         regarding Windows NT and 95/98 printer driver packages</P
5881 ></LI
5882 ><LI
5883 ><P
5884 >Providing the tools necessary for creating 
5885                         the Imprints printer driver packages.</P
5886 ></LI
5887 ><LI
5888 ><P
5889 >Providing an installation client which 
5890                         will obtain and install printer drivers on remote Samba 
5891                         and Windows NT 4 print servers.</P
5892 ></LI
5893 ></UL
5894 ></DIV
5895 ><DIV
5896 CLASS="SECT2"
5897 ><HR><H3
5898 CLASS="SECT2"
5899 ><A
5900 NAME="AEN1053"
5901 ></A
5902 >7.3.2. Creating Printer Driver Packages</H3
5903 ><P
5904 >The process of creating printer driver packages is beyond
5905                 the scope of this document (refer to Imprints.txt also included
5906                 with the Samba distribution for more information).  In short,
5907                 an Imprints driver package is a gzipped tarball containing the
5908                 driver files, related INF files, and a control file needed by the
5909                 installation client.</P
5910 ></DIV
5911 ><DIV
5912 CLASS="SECT2"
5913 ><HR><H3
5914 CLASS="SECT2"
5915 ><A
5916 NAME="AEN1056"
5917 ></A
5918 >7.3.3. The Imprints server</H3
5919 ><P
5920 >The Imprints server is really a database server that 
5921                 may be queried via standard HTTP mechanisms.  Each printer 
5922                 entry in the database has an associated URL for the actual
5923                 downloading of the package.  Each package is digitally signed
5924                 via GnuPG which can be used to verify that package downloaded
5925                 is actually the one referred in the Imprints database.  It is 
5926                 <SPAN
5927 CLASS="emphasis"
5928 ><I
5929 CLASS="EMPHASIS"
5930 >not</I
5931 ></SPAN
5932 > recommended that this security check 
5933                 be disabled.</P
5934 ></DIV
5935 ><DIV
5936 CLASS="SECT2"
5937 ><HR><H3
5938 CLASS="SECT2"
5939 ><A
5940 NAME="AEN1060"
5941 ></A
5942 >7.3.4. The Installation Client</H3
5943 ><P
5944 >More information regarding the Imprints installation client 
5945                 is available in the <TT
5946 CLASS="FILENAME"
5947 >Imprints-Client-HOWTO.ps</TT
5948
5949                 file included with the imprints source package.</P
5950 ><P
5951 >The Imprints installation client comes in two forms.</P
5952 ><P
5953 ></P
5954 ><UL
5955 ><LI
5956 ><P
5957 >a set of command line Perl scripts</P
5958 ></LI
5959 ><LI
5960 ><P
5961 >a GTK+ based graphical interface to 
5962                         the command line perl scripts</P
5963 ></LI
5964 ></UL
5965 ><P
5966 >The installation client (in both forms) provides a means
5967                 of querying the Imprints database server for a matching
5968                 list of known printer model names as well as a means to 
5969                 download and install the drivers on remote Samba and Windows
5970                 NT print servers.</P
5971 ><P
5972 >The basic installation process is in four steps and 
5973                 perl code is wrapped around <B
5974 CLASS="COMMAND"
5975 >smbclient</B
5976
5977                 and <B
5978 CLASS="COMMAND"
5979 >rpcclient</B
5980 >.</P
5981 ><P
5982 ><PRE
5983 CLASS="PROGRAMLISTING"
5984 >       
5985 foreach (supported architecture for a given driver)
5986 {
5987      1.  rpcclient: Get the appropriate upload directory 
5988          on the remote server
5989      2.  smbclient: Upload the driver files
5990      3.  rpcclient: Issues an AddPrinterDriver() MS-RPC
5991 }
5992         
5993 4.  rpcclient: Issue an AddPrinterEx() MS-RPC to actually
5994     create the printer</PRE
5995 ></P
5996 ><P
5997 >One of the problems encountered when implementing 
5998                 the Imprints tool set was the name space issues between 
5999                 various supported client architectures.  For example, Windows 
6000                 NT includes a driver named "Apple LaserWriter II NTX v51.8" 
6001                 and Windows 95 calls its version of this driver "Apple 
6002                 LaserWriter II NTX"</P
6003 ><P
6004 >The problem is how to know what client drivers have 
6005                 been uploaded for a printer.  As astute reader will remember 
6006                 that the Windows NT Printer Properties dialog only includes 
6007                 space for one printer driver name.  A quick look in the 
6008                 Windows NT 4.0 system registry at</P
6009 ><P
6010 ><TT
6011 CLASS="FILENAME"
6012 >HKLM\System\CurrentControlSet\Control\Print\Environment
6013                 </TT
6014 ></P
6015 ><P
6016 >will reveal that Windows NT always uses the NT driver 
6017                 name.  This is ok as Windows NT always requires that at least 
6018                 the Windows NT version of the printer driver is present.  
6019                 However, Samba does not have the requirement internally.  
6020                 Therefore, how can you use the NT driver name if is has not 
6021                 already been installed?</P
6022 ><P
6023 >The way of sidestepping this limitation is to require 
6024                 that all Imprints printer driver packages include both the Intel 
6025                 Windows NT and 95/98 printer drivers and that NT driver is 
6026                 installed first.</P
6027 ></DIV
6028 ></DIV
6029 ><DIV
6030 CLASS="SECT1"
6031 ><HR><H2
6032 CLASS="SECT1"
6033 ><A
6034 NAME="AEN1082"
6035 ></A
6036 >7.4. <A
6037 NAME="MIGRATION"
6038 ></A
6039 >Migration to from Samba 2.0.x to 2.2.x</H2
6040 ><P
6041 >Given that printer driver management has changed (we hope improved) in 
6042 2.2 over prior releases, migration from an existing setup to 2.2 can 
6043 follow several paths. Here are the possible scenarios for 
6044 migration:</P
6045 ><P
6046 ></P
6047 ><UL
6048 ><LI
6049 ><P
6050 >If you do not desire the new Windows NT 
6051         print driver support, nothing needs to be done.  
6052         All existing parameters work the same.</P
6053 ></LI
6054 ><LI
6055 ><P
6056 >If you want to take advantage of NT printer 
6057         driver support but do not want to migrate the 
6058         9x drivers to the new setup, the leave the existing 
6059         <TT
6060 CLASS="FILENAME"
6061 >printers.def</TT
6062 > file.  When smbd attempts 
6063         to locate a 
6064         9x driver for the printer in the TDB and fails it 
6065         will drop down to using the printers.def (and all 
6066         associated parameters).  The <B
6067 CLASS="COMMAND"
6068 >make_printerdef</B
6069
6070         tool will also remain for backwards compatibility but will 
6071         be removed in the next major release.</P
6072 ></LI
6073 ><LI
6074 ><P
6075 >If you install a Windows 9x driver for a printer 
6076         on your Samba host (in the printing TDB), this information will 
6077         take precedence and the three old printing parameters
6078         will be ignored (including print driver location).</P
6079 ></LI
6080 ><LI
6081 ><P
6082 >If you want to migrate an existing <TT
6083 CLASS="FILENAME"
6084 >printers.def</TT
6085
6086         file into the new setup, the current only solution is to use the Windows 
6087         NT APW to install the NT drivers and the 9x  drivers.  This can be scripted 
6088         using <B
6089 CLASS="COMMAND"
6090 >smbclient</B
6091 > and <B
6092 CLASS="COMMAND"
6093 >rpcclient</B
6094 >.  See the 
6095         Imprints installation client at <A
6096 HREF="http://imprints.sourceforge.net/"
6097 TARGET="_top"
6098 >http://imprints.sourceforge.net/</A
6099
6100         for an example.
6101         </P
6102 ></LI
6103 ></UL
6104 ><DIV
6105 CLASS="WARNING"
6106 ><P
6107 ></P
6108 ><TABLE
6109 CLASS="WARNING"
6110 WIDTH="100%"
6111 BORDER="0"
6112 ><TR
6113 ><TD
6114 WIDTH="25"
6115 ALIGN="CENTER"
6116 VALIGN="TOP"
6117 ><IMG
6118 SRC="/docbook-dsssl/warning.gif"
6119 HSPACE="5"
6120 ALT="Warning"></TD
6121 ><TH
6122 ALIGN="LEFT"
6123 VALIGN="CENTER"
6124 ><B
6125 >Achtung!</B
6126 ></TH
6127 ></TR
6128 ><TR
6129 ><TD
6130 >&nbsp;</TD
6131 ><TD
6132 ALIGN="LEFT"
6133 VALIGN="TOP"
6134 ><P
6135 >The following <TT
6136 CLASS="FILENAME"
6137 >smb.conf</TT
6138 > parameters are considered to 
6139 be deprecated and will be removed soon.  Do not use them in new 
6140 installations</P
6141 ><P
6142 ></P
6143 ><UL
6144 ><LI
6145 ><P
6146 ><TT
6147 CLASS="PARAMETER"
6148 ><I
6149 >printer driver file (G)</I
6150 ></TT
6151 >
6152         </P
6153 ></LI
6154 ><LI
6155 ><P
6156 ><TT
6157 CLASS="PARAMETER"
6158 ><I
6159 >printer driver (S)</I
6160 ></TT
6161 >
6162         </P
6163 ></LI
6164 ><LI
6165 ><P
6166 ><TT
6167 CLASS="PARAMETER"
6168 ><I
6169 >printer driver location (S)</I
6170 ></TT
6171 >
6172         </P
6173 ></LI
6174 ></UL
6175 ></TD
6176 ></TR
6177 ></TABLE
6178 ></DIV
6179 ><P
6180 >The have been two new parameters add in Samba 2.2.2 to for 
6181 better support of Samba 2.0.x backwards capability (<TT
6182 CLASS="PARAMETER"
6183 ><I
6184 >disable
6185 spoolss</I
6186 ></TT
6187 >) and for using local printers drivers on Windows 
6188 NT/2000 clients (<TT
6189 CLASS="PARAMETER"
6190 ><I
6191 >use client driver</I
6192 ></TT
6193 >). Both of 
6194 these options are described in the smb.coinf(5) man page and are 
6195 disabled by default.</P
6196 ></DIV
6197 ></DIV
6198 ><DIV
6199 CLASS="CHAPTER"
6200 ><HR><H1
6201 ><A
6202 NAME="PRINTINGDEBUG"
6203 ></A
6204 >Chapter 8. Debugging Printing Problems</H1
6205 ><DIV
6206 CLASS="SECT1"
6207 ><H2
6208 CLASS="SECT1"
6209 ><A
6210 NAME="AEN1128"
6211 ></A
6212 >8.1. Introduction</H2
6213 ><P
6214 >This is a short description of how to debug printing problems with
6215 Samba. This describes how to debug problems with printing from a SMB
6216 client to a Samba server, not the other way around. For the reverse
6217 see the examples/printing directory.</P
6218 ><P
6219 >Ok, so you want to print to a Samba server from your PC. The first
6220 thing you need to understand is that Samba does not actually do any
6221 printing itself, it just acts as a middleman between your PC client
6222 and your Unix printing subsystem. Samba receives the file from the PC
6223 then passes the file to a external "print command". What print command
6224 you use is up to you.</P
6225 ><P
6226 >The whole things is controlled using options in smb.conf. The most
6227 relevant options (which you should look up in the smb.conf man page)
6228 are:</P
6229 ><P
6230 ><PRE
6231 CLASS="PROGRAMLISTING"
6232 >      [global]
6233         print command     - send a file to a spooler
6234         lpq command       - get spool queue status
6235         lprm command      - remove a job
6236       [printers]
6237         path = /var/spool/lpd/samba</PRE
6238 ></P
6239 ><P
6240 >The following are nice to know about:</P
6241 ><P
6242 ><PRE
6243 CLASS="PROGRAMLISTING"
6244 >        queuepause command   - stop a printer or print queue
6245         queueresume command  - start a printer or print queue</PRE
6246 ></P
6247 ><P
6248 >Example:</P
6249 ><P
6250 ><PRE
6251 CLASS="PROGRAMLISTING"
6252 >        print command = /usr/bin/lpr -r -P%p %s
6253         lpq command   = /usr/bin/lpq    -P%p %s
6254         lprm command  = /usr/bin/lprm   -P%p %j
6255         queuepause command = /usr/sbin/lpc -P%p stop
6256         queuepause command = /usr/sbin/lpc -P%p start</PRE
6257 ></P
6258 ><P
6259 >Samba should set reasonable defaults for these depending on your
6260 system type, but it isn't clairvoyant. It is not uncommon that you
6261 have to tweak these for local conditions.  The commands should
6262 always have fully specified pathnames,  as the smdb may not have
6263 the correct PATH values.</P
6264 ><P
6265 >When you send a job to Samba to be printed,  it will make a temporary
6266 copy of it in the directory specified in the [printers] section.
6267 and it should be periodically cleaned out.  The lpr -r option
6268 requests that the temporary copy be removed after printing; If
6269 printing fails then you might find leftover files in this directory,
6270 and it should be periodically cleaned out.  Samba used the lpq
6271 command to determine the "job number" assigned to your print job
6272 by the spooler.</P
6273 ><P
6274 >The %&gt;letter&lt; are "macros" that get dynamically replaced with appropriate
6275 values when they are used. The %s gets replaced with the name of the spool
6276 file that Samba creates and the %p gets replaced with the name of the
6277 printer. The %j gets replaced with the "job number" which comes from
6278 the lpq output.</P
6279 ></DIV
6280 ><DIV
6281 CLASS="SECT1"
6282 ><HR><H2
6283 CLASS="SECT1"
6284 ><A
6285 NAME="AEN1144"
6286 ></A
6287 >8.2. Debugging printer problems</H2
6288 ><P
6289 >One way to debug printing problems is to start by replacing these
6290 command with shell scripts that record the arguments and the contents
6291 of the print file. A simple example of this kind of things might
6292 be:</P
6293 ><P
6294 ><PRE
6295 CLASS="PROGRAMLISTING"
6296 >       print command = /tmp/saveprint %p %s
6297
6298     #!/bin/saveprint
6299     # we make sure that we are the right user
6300     /usr/bin/id -p &#62;/tmp/tmp.print
6301     # we run the command and save the error messages
6302     # replace the command with the one appropriate for your system
6303     /usr/bin/lpr -r -P$1 $2 2&#62;&#62;&#38;/tmp/tmp.print</PRE
6304 ></P
6305 ><P
6306 >Then you print a file and try removing it.  You may find that the
6307 print queue needs to be stopped in order to see the queue status
6308 and remove the job:</P
6309 ><P
6310 ><PRE
6311 CLASS="PROGRAMLISTING"
6312 >&#13;h4: {42} % echo hi &#62;/tmp/hi
6313 h4: {43} % smbclient //localhost/lw4
6314 added interface ip=10.0.0.4 bcast=10.0.0.255 nmask=255.255.255.0
6315 Password: 
6316 Domain=[ASTART] OS=[Unix] Server=[Samba 2.0.7]
6317 smb: \&#62; print /tmp/hi
6318 putting file /tmp/hi as hi-17534 (0.0 kb/s) (average 0.0 kb/s)
6319 smb: \&#62; queue
6320 1049     3            hi-17534
6321 smb: \&#62; cancel 1049
6322 Error cancelling job 1049 : code 0
6323 smb: \&#62; cancel 1049
6324 Job 1049 cancelled
6325 smb: \&#62; queue
6326 smb: \&#62; exit</PRE
6327 ></P
6328 ><P
6329 >The 'code 0' indicates that the job was removed.  The comment
6330 by the  smbclient is a bit misleading on this.
6331 You can observe the command output and then and look at the
6332 /tmp/tmp.print file to see what the results are.  You can quickly
6333 find out if the problem is with your printing system.  Often people
6334 have problems with their /etc/printcap file or permissions on
6335 various print queues.</P
6336 ></DIV
6337 ><DIV
6338 CLASS="SECT1"
6339 ><HR><H2
6340 CLASS="SECT1"
6341 ><A
6342 NAME="AEN1153"
6343 ></A
6344 >8.3. What printers do I have?</H2
6345 ><P
6346 >You can use the 'testprns' program to check to see if the printer
6347 name you are using is recognized by Samba.  For example,  you can
6348 use:</P
6349 ><P
6350 ><PRE
6351 CLASS="PROGRAMLISTING"
6352 >    testprns printer /etc/printcap</PRE
6353 ></P
6354 ><P
6355 >Samba can get its printcap information from a file or from a program.
6356 You can try the following to see the format of the extracted
6357 information:</P
6358 ><P
6359 ><PRE
6360 CLASS="PROGRAMLISTING"
6361 >    testprns -a printer /etc/printcap
6362
6363     testprns -a printer '|/bin/cat printcap'</PRE
6364 ></P
6365 ></DIV
6366 ><DIV
6367 CLASS="SECT1"
6368 ><HR><H2
6369 CLASS="SECT1"
6370 ><A
6371 NAME="AEN1161"
6372 ></A
6373 >8.4. Setting up printcap and print servers</H2
6374 ><P
6375 >You may need to set up some printcaps for your Samba system to use.
6376 It is strongly recommended that you use the facilities provided by
6377 the print spooler to set up queues and printcap information.</P
6378 ><P
6379 >Samba requires either a printcap or program to deliver printcap
6380 information.  This printcap information has the format:</P
6381 ><P
6382 ><PRE
6383 CLASS="PROGRAMLISTING"
6384 >  name|alias1|alias2...:option=value:...</PRE
6385 ></P
6386 ><P
6387 >For almost all printing systems, the printer 'name' must be composed
6388 only of alphanumeric or underscore '_' characters.  Some systems also
6389 allow hyphens ('-') as well.  An alias is an alternative name for the
6390 printer,  and an alias with a space in it is used as a 'comment'
6391 about the printer.  The printcap format optionally uses a \ at the end of lines
6392 to extend the printcap to multiple lines.</P
6393 ><P
6394 >Here are some examples of printcap files:</P
6395 ><P
6396 ><P
6397 ></P
6398 ><OL
6399 TYPE="1"
6400 ><LI
6401 ><P
6402 >pr              just printer name</P
6403 ></LI
6404 ><LI
6405 ><P
6406 >pr|alias        printer name and alias</P
6407 ></LI
6408 ><LI
6409 ><P
6410 >pr|My Printer   printer name, alias used as comment</P
6411 ></LI
6412 ><LI
6413 ><P
6414 >pr:sh:\        Same as pr:sh:cm= testing
6415   :cm= \ 
6416   testing</P
6417 ></LI
6418 ><LI
6419 ><P
6420 >pr:sh           Same as pr:sh:cm= testing
6421   :cm= testing</P
6422 ></LI
6423 ></OL
6424 ></P
6425 ><P
6426 >Samba reads the printcap information when first started.  If you make
6427 changes in the printcap information, then you must do the following:</P
6428 ><P
6429 ></P
6430 ><OL
6431 TYPE="1"
6432 ><LI
6433 ><P
6434 >make sure that the print spooler is aware of these changes.
6435 The LPRng system uses the 'lpc reread' command to do this.</P
6436 ></LI
6437 ><LI
6438 ><P
6439 >make sure that the spool queues, etc., exist and have the
6440 correct permissions.  The LPRng system uses the 'checkpc -f'
6441 command to do this.</P
6442 ></LI
6443 ><LI
6444 ><P
6445 >You now should send a SIGHUP signal to the smbd server to have
6446 it reread the printcap information.</P
6447 ></LI
6448 ></OL
6449 ></DIV
6450 ><DIV
6451 CLASS="SECT1"
6452 ><HR><H2
6453 CLASS="SECT1"
6454 ><A
6455 NAME="AEN1189"
6456 ></A
6457 >8.5. Job sent, no output</H2
6458 ><P
6459 >This is the most frustrating part of printing.  You may have sent the
6460 job,  verified that the job was forwarded,  set up a wrapper around
6461 the command to send the file,  but there was no output from the printer.</P
6462 ><P
6463 >First,  check to make sure that the job REALLY is getting to the
6464 right print queue.  If you are using a BSD or LPRng print spooler,
6465 you can temporarily stop the printing of jobs.  Jobs can still be
6466 submitted, but they will not be printed.  Use:</P
6467 ><P
6468 ><PRE
6469 CLASS="PROGRAMLISTING"
6470 >  lpc -Pprinter stop</PRE
6471 ></P
6472 ><P
6473 >Now submit a print job and then use 'lpq -Pprinter' to see if the
6474 job is in the print queue.  If it is not in the print queue then
6475 you will have to find out why it is not being accepted for printing.</P
6476 ><P
6477 >Next, you may want to check to see what the format of the job really
6478 was.  With the assistance of the system administrator you can view
6479 the submitted jobs files.  You may be surprised to find that these
6480 are not in what you would expect to call a printable format.
6481 You can use the UNIX 'file' utitily to determine what the job
6482 format actually is:</P
6483 ><P
6484 ><PRE
6485 CLASS="PROGRAMLISTING"
6486 >    cd /var/spool/lpd/printer   # spool directory of print jobs
6487     ls                          # find job files
6488     file dfA001myhost</PRE
6489 ></P
6490 ><P
6491 >You should make sure that your printer supports this format OR that
6492 your system administrator has installed a 'print filter' that will
6493 convert the file to a format appropriate for your printer.</P
6494 ></DIV
6495 ><DIV
6496 CLASS="SECT1"
6497 ><HR><H2
6498 CLASS="SECT1"
6499 ><A
6500 NAME="AEN1200"
6501 ></A
6502 >8.6. Job sent, strange output</H2
6503 ><P
6504 >Once you have the job printing, you can then start worrying about
6505 making it print nicely.</P
6506 ><P
6507 >The most common problem is extra pages of output: banner pages
6508 OR blank pages at the end.</P
6509 ><P
6510 >If you are getting banner pages,  check and make sure that the
6511 printcap option or printer option is configured for no banners.
6512 If you have a printcap,  this is the :sh (suppress header or banner
6513 page) option.  You should have the following in your printer.</P
6514 ><P
6515 ><PRE
6516 CLASS="PROGRAMLISTING"
6517 >   printer: ... :sh</PRE
6518 ></P
6519 ><P
6520 >If you have this option and are still getting banner pages,  there
6521 is a strong chance that your printer is generating them for you
6522 automatically.  You should make sure that banner printing is disabled
6523 for the printer.  This usually requires using the printer setup software
6524 or procedures supplied by the printer manufacturer.</P
6525 ><P
6526 >If you get an extra page of output,  this could be due to problems
6527 with your job format,  or if you are generating PostScript jobs,
6528 incorrect setting on your printer driver on the MicroSoft client.
6529 For example, under Win95 there is a option:</P
6530 ><P
6531 ><PRE
6532 CLASS="PROGRAMLISTING"
6533 >  Printers|Printer Name|(Right Click)Properties|Postscript|Advanced|</PRE
6534 ></P
6535 ><P
6536 >that allows you to choose if a Ctrl-D is appended to all jobs.
6537 This is a very bad thing to do, as most spooling systems will
6538 automatically add a ^D to the end of the job if it is detected as
6539 PostScript.  The multiple ^D may cause an additional page of output.</P
6540 ></DIV
6541 ><DIV
6542 CLASS="SECT1"
6543 ><HR><H2
6544 CLASS="SECT1"
6545 ><A
6546 NAME="AEN1212"
6547 ></A
6548 >8.7. Raw PostScript printed</H2
6549 ><P
6550 >This is a problem that is usually caused by either the print spooling
6551 system putting information at the start of the print job that makes
6552 the printer think the job is a text file, or your printer simply
6553 does not support PostScript.  You may need to enable 'Automatic
6554 Format Detection' on your printer.</P
6555 ></DIV
6556 ><DIV
6557 CLASS="SECT1"
6558 ><HR><H2
6559 CLASS="SECT1"
6560 ><A
6561 NAME="AEN1215"
6562 ></A
6563 >8.8. Advanced Printing</H2
6564 ><P
6565 >Note that you can do some pretty magic things by using your
6566 imagination with the "print command" option and some shell scripts.
6567 Doing print accounting is easy by passing the %U option to a print
6568 command shell script. You could even make the print command detect
6569 the type of output and its size and send it to an appropriate
6570 printer.</P
6571 ></DIV
6572 ><DIV
6573 CLASS="SECT1"
6574 ><HR><H2
6575 CLASS="SECT1"
6576 ><A
6577 NAME="AEN1218"
6578 ></A
6579 >8.9. Real debugging</H2
6580 ><P
6581 >If the above debug tips don't help, then maybe you need to bring in
6582 the bug guns, system tracing. See Tracing.txt in this directory.</P
6583 ></DIV
6584 ></DIV
6585 ><DIV
6586 CLASS="CHAPTER"
6587 ><HR><H1
6588 ><A
6589 NAME="SECURITYLEVELS"
6590 ></A
6591 >Chapter 9. Security levels</H1
6592 ><DIV
6593 CLASS="SECT1"
6594 ><H2
6595 CLASS="SECT1"
6596 ><A
6597 NAME="AEN1231"
6598 ></A
6599 >9.1. Introduction</H2
6600 ><P
6601 >Samba supports the following options to the global smb.conf parameter</P
6602 ><P
6603 ><PRE
6604 CLASS="PROGRAMLISTING"
6605 >[global]
6606 <A
6607 HREF="smb.conf.5.html#SECURITY"
6608 TARGET="_top"
6609 ><TT
6610 CLASS="PARAMETER"
6611 ><I
6612 >security</I
6613 ></TT
6614 ></A
6615 > = [share|user(default)|domain|ads]</PRE
6616 ></P
6617 ><P
6618 >Please refer to the smb.conf man page for usage information and to the document
6619 <A
6620 HREF="DOMAIN_MEMBER.html"
6621 TARGET="_top"
6622 >DOMAIN_MEMBER.html</A
6623 > for further background details
6624 on domain mode security.  The Windows 2000 Kerberos domain security model
6625 (security = ads) is described in the <A
6626 HREF="ADS-HOWTO.html"
6627 TARGET="_top"
6628 >ADS-HOWTO.html</A
6629 >.</P
6630 ><P
6631 >Of the above, "security = server" means that Samba reports to clients that
6632 it is running in "user mode" but actually passes off all authentication
6633 requests to another "user mode" server. This requires an additional
6634 parameter "password server =" that points to the real authentication server.
6635 That real authentication server can be another Samba server or can be a
6636 Windows NT server, the later natively capable of encrypted password support.</P
6637 ></DIV
6638 ><DIV
6639 CLASS="SECT1"
6640 ><HR><H2
6641 CLASS="SECT1"
6642 ><A
6643 NAME="AEN1242"
6644 ></A
6645 >9.2. More complete description of security levels</H2
6646 ><P
6647 >A SMB server tells the client at startup what "security level" it is
6648 running. There are two options "share level" and "user level". Which
6649 of these two the client receives affects the way the client then tries
6650 to authenticate itself. It does not directly affect (to any great
6651 extent) the way the Samba server does security. I know this is
6652 strange, but it fits in with the client/server approach of SMB. In SMB
6653 everything is initiated and controlled by the client, and the server
6654 can only tell the client what is available and whether an action is
6655 allowed. </P
6656 ><P
6657 >I'll describe user level security first, as its simpler. In user level
6658 security the client will send a "session setup" command directly after
6659 the protocol negotiation. This contains a username and password. The
6660 server can either accept or reject that username/password
6661 combination. Note that at this stage the server has no idea what
6662 share the client will eventually try to connect to, so it can't base
6663 the "accept/reject" on anything other than:</P
6664 ><P
6665 ></P
6666 ><OL
6667 TYPE="1"
6668 ><LI
6669 ><P
6670 >the username/password</P
6671 ></LI
6672 ><LI
6673 ><P
6674 >the machine that the client is coming from</P
6675 ></LI
6676 ></OL
6677 ><P
6678 >If the server accepts the username/password then the client expects to
6679 be able to mount any share (using a "tree connection") without
6680 specifying a password. It expects that all access rights will be as
6681 the username/password specified in the "session setup". </P
6682 ><P
6683 >It is also possible for a client to send multiple "session setup"
6684 requests. When the server responds it gives the client a "uid" to use
6685 as an authentication tag for that username/password. The client can
6686 maintain multiple authentication contexts in this way (WinDD is an
6687 example of an application that does this)</P
6688 ><P
6689 >Ok, now for share level security. In share level security the client
6690 authenticates itself separately for each share. It will send a
6691 password along with each "tree connection" (share mount). It does not
6692 explicitly send a username with this operation. The client is
6693 expecting a password to be associated with each share, independent of
6694 the user. This means that samba has to work out what username the
6695 client probably wants to use. It is never explicitly sent the
6696 username. Some commercial SMB servers such as NT actually associate
6697 passwords directly with shares in share level security, but samba
6698 always uses the unix authentication scheme where it is a
6699 username/password that is authenticated, not a "share/password".</P
6700 ><P
6701 >Many clients send a "session setup" even if the server is in share
6702 level security. They normally send a valid username but no
6703 password. Samba records this username in a list of "possible
6704 usernames". When the client then does a "tree connection" it also adds
6705 to this list the name of the share they try to connect to (useful for
6706 home directories) and any users listed in the "user =" smb.conf
6707 line. The password is then checked in turn against these "possible
6708 usernames". If a match is found then the client is authenticated as
6709 that user.</P
6710 ><P
6711 >Finally "server level" security. In server level security the samba
6712 server reports to the client that it is in user level security. The
6713 client then does a "session setup" as described earlier. The samba
6714 server takes the username/password that the client sends and attempts
6715 to login to the "password server" by sending exactly the same
6716 username/password that it got from the client. If that server is in
6717 user level security and accepts the password then samba accepts the
6718 clients connection. This allows the samba server to use another SMB
6719 server as the "password server". </P
6720 ><P
6721 >You should also note that at the very start of all this, where the
6722 server tells the client what security level it is in, it also tells
6723 the client if it supports encryption. If it does then it supplies the
6724 client with a random "cryptkey". The client will then send all
6725 passwords in encrypted form. You have to compile samba with encryption
6726 enabled to support this feature, and you have to maintain a separate
6727 smbpasswd file with SMB style encrypted passwords. It is
6728 cryptographically impossible to translate from unix style encryption
6729 to SMB style encryption, although there are some fairly simple management
6730 schemes by which the two could be kept in sync.</P
6731 ></DIV
6732 ></DIV
6733 ><DIV
6734 CLASS="CHAPTER"
6735 ><HR><H1
6736 ><A
6737 NAME="DOMAIN-SECURITY"
6738 ></A
6739 >Chapter 10. security = domain in Samba 2.x</H1
6740 ><DIV
6741 CLASS="SECT1"
6742 ><H2
6743 CLASS="SECT1"
6744 ><A
6745 NAME="AEN1275"
6746 ></A
6747 >10.1. Joining an NT Domain with Samba 2.2</H2
6748 ><P
6749 >Assume you have a Samba 2.x server with a NetBIOS name of 
6750         <TT
6751 CLASS="CONSTANT"
6752 >SERV1</TT
6753 > and are joining an NT domain called
6754         <TT
6755 CLASS="CONSTANT"
6756 >DOM</TT
6757 >, which has a PDC with a NetBIOS name
6758         of <TT
6759 CLASS="CONSTANT"
6760 >DOMPDC</TT
6761 > and two backup domain controllers 
6762         with NetBIOS names <TT
6763 CLASS="CONSTANT"
6764 >DOMBDC1</TT
6765 > and <TT
6766 CLASS="CONSTANT"
6767 >DOMBDC2
6768         </TT
6769 >.</P
6770 ><P
6771 >In order to join the domain, first stop all Samba daemons 
6772         and run the command:</P
6773 ><P
6774 ><TT
6775 CLASS="PROMPT"
6776 >root# </TT
6777 ><TT
6778 CLASS="USERINPUT"
6779 ><B
6780 >smbpasswd -j DOM -r DOMPDC
6781         -U<TT
6782 CLASS="REPLACEABLE"
6783 ><I
6784 >Administrator%password</I
6785 ></TT
6786 ></B
6787 ></TT
6788 ></P
6789 ><P
6790 >as we are joining the domain DOM and the PDC for that domain 
6791         (the only machine that has write access to the domain SAM database) 
6792         is DOMPDC. The <TT
6793 CLASS="REPLACEABLE"
6794 ><I
6795 >Administrator%password</I
6796 ></TT
6797 > is 
6798         the login name and password for an account which has the necessary 
6799         privilege to add machines to the domain.  If this is successful 
6800         you will see the message:</P
6801 ><P
6802 ><TT
6803 CLASS="COMPUTEROUTPUT"
6804 >smbpasswd: Joined domain DOM.</TT
6805 >
6806         </P
6807 ><P
6808 >in your terminal window. See the <A
6809 HREF="smbpasswd.8.html"
6810 TARGET="_top"
6811 >       smbpasswd(8)</A
6812 > man page for more details.</P
6813 ><P
6814 >There is existing development code to join a domain
6815         without having to create the machine trust account on the PDC
6816         beforehand.  This code will hopefully be available soon
6817         in release branches as well.</P
6818 ><P
6819 >This command goes through the machine account password 
6820         change protocol, then writes the new (random) machine account 
6821         password for this Samba server into a file in the same directory 
6822         in which an smbpasswd file would be stored - normally :</P
6823 ><P
6824 ><TT
6825 CLASS="FILENAME"
6826 >/usr/local/samba/private</TT
6827 ></P
6828 ><P
6829 >In Samba 2.0.x, the filename looks like this:</P
6830 ><P
6831 ><TT
6832 CLASS="FILENAME"
6833 ><TT
6834 CLASS="REPLACEABLE"
6835 ><I
6836 >&lt;NT DOMAIN NAME&gt;</I
6837 ></TT
6838 >.<TT
6839 CLASS="REPLACEABLE"
6840 ><I
6841 >&lt;Samba 
6842         Server Name&gt;</I
6843 ></TT
6844 >.mac</TT
6845 ></P
6846 ><P
6847 >The <TT
6848 CLASS="FILENAME"
6849 >.mac</TT
6850 > suffix stands for machine account 
6851         password file. So in our example above, the file would be called:</P
6852 ><P
6853 ><TT
6854 CLASS="FILENAME"
6855 >DOM.SERV1.mac</TT
6856 ></P
6857 ><P
6858 >In Samba 2.2, this file has been replaced with a TDB 
6859         (Trivial Database) file named <TT
6860 CLASS="FILENAME"
6861 >secrets.tdb</TT
6862 >.
6863         </P
6864 ><P
6865 >This file is created and owned by root and is not 
6866         readable by any other user. It is the key to the domain-level 
6867         security for your system, and should be treated as carefully 
6868         as a shadow password file.</P
6869 ><P
6870 >Now, before restarting the Samba daemons you must 
6871         edit your <A
6872 HREF="smb.conf.5.html"
6873 TARGET="_top"
6874 ><TT
6875 CLASS="FILENAME"
6876 >smb.conf(5)</TT
6877 >
6878         </A
6879 > file to tell Samba it should now use domain security.</P
6880 ><P
6881 >Change (or add) your <A
6882 HREF="smb.conf.5.html#SECURITY"
6883 TARGET="_top"
6884 >       <TT
6885 CLASS="PARAMETER"
6886 ><I
6887 >security =</I
6888 ></TT
6889 ></A
6890 > line in the [global] section 
6891         of your smb.conf to read:</P
6892 ><P
6893 ><B
6894 CLASS="COMMAND"
6895 >security = domain</B
6896 ></P
6897 ><P
6898 >Next change the <A
6899 HREF="smb.conf.5.html#WORKGROUP"
6900 TARGET="_top"
6901 ><TT
6902 CLASS="PARAMETER"
6903 ><I
6904 >       workgroup =</I
6905 ></TT
6906 ></A
6907 > line in the [global] section to read: </P
6908 ><P
6909 ><B
6910 CLASS="COMMAND"
6911 >workgroup = DOM</B
6912 ></P
6913 ><P
6914 >as this is the name of the domain we are joining. </P
6915 ><P
6916 >You must also have the parameter <A
6917 HREF="smb.conf.5.html#ENCRYPTPASSWORDS"
6918 TARGET="_top"
6919 >       <TT
6920 CLASS="PARAMETER"
6921 ><I
6922 >encrypt passwords</I
6923 ></TT
6924 ></A
6925 > set to <TT
6926 CLASS="CONSTANT"
6927 >yes
6928         </TT
6929 > in order for your users to authenticate to the NT PDC.</P
6930 ><P
6931 >Finally, add (or modify) a <A
6932 HREF="smb.conf.5.html#PASSWORDSERVER"
6933 TARGET="_top"
6934 >       <TT
6935 CLASS="PARAMETER"
6936 ><I
6937 >password server =</I
6938 ></TT
6939 ></A
6940 > line in the [global]
6941         section to read: </P
6942 ><P
6943 ><B
6944 CLASS="COMMAND"
6945 >password server = DOMPDC DOMBDC1 DOMBDC2</B
6946 ></P
6947 ><P
6948 >These are the primary and backup domain controllers Samba 
6949         will attempt to contact in order to authenticate users. Samba will 
6950         try to contact each of these servers in order, so you may want to 
6951         rearrange this list in order to spread out the authentication load 
6952         among domain controllers.</P
6953 ><P
6954 >Alternatively, if you want smbd to automatically determine 
6955         the list of Domain controllers to use for authentication, you may 
6956         set this line to be :</P
6957 ><P
6958 ><B
6959 CLASS="COMMAND"
6960 >password server = *</B
6961 ></P
6962 ><P
6963 >This method, which was introduced in Samba 2.0.6, 
6964         allows Samba to use exactly the same mechanism that NT does. This 
6965         method either broadcasts or uses a WINS database in order to
6966         find domain controllers to authenticate against.</P
6967 ><P
6968 >Finally, restart your Samba daemons and get ready for 
6969         clients to begin using domain security!</P
6970 ></DIV
6971 ><DIV
6972 CLASS="SECT1"
6973 ><HR><H2
6974 CLASS="SECT1"
6975 ><A
6976 NAME="AEN1339"
6977 ></A
6978 >10.2. Samba and Windows 2000 Domains</H2
6979 ><P
6980 >Many people have asked regarding the state of Samba's ability to participate in
6981 a Windows 2000 Domain.  Samba 2.2 is able to act as a member server of a Windows
6982 2000 domain operating in mixed or native mode.</P
6983 ><P
6984 >There is much confusion between the circumstances that require a "mixed" mode
6985 Win2k DC and a when this host can be switched to "native" mode.  A "mixed" mode
6986 Win2k domain controller is only needed if Windows NT BDCs must exist in the same
6987 domain.  By default, a Win2k DC in "native" mode will still support
6988 NetBIOS and NTLMv1 for authentication of legacy clients such as Windows 9x and 
6989 NT 4.0.  Samba has the same requirements as a Windows NT 4.0 member server.</P
6990 ><P
6991 >The steps for adding a Samba 2.2 host to a Win2k domain are the same as those
6992 for adding a Samba server to a Windows NT 4.0 domain. The only exception is that 
6993 the "Server Manager" from NT 4 has been replaced by the "Active Directory Users and 
6994 Computers" MMC (Microsoft Management Console) plugin.</P
6995 ></DIV
6996 ><DIV
6997 CLASS="SECT1"
6998 ><HR><H2
6999 CLASS="SECT1"
7000 ><A
7001 NAME="AEN1344"
7002 ></A
7003 >10.3. Why is this better than security = server?</H2
7004 ><P
7005 >Currently, domain security in Samba doesn't free you from 
7006         having to create local Unix users to represent the users attaching 
7007         to your server. This means that if domain user <TT
7008 CLASS="CONSTANT"
7009 >DOM\fred
7010         </TT
7011 > attaches to your domain security Samba server, there needs 
7012         to be a local Unix user fred to represent that user in the Unix 
7013         filesystem. This is very similar to the older Samba security mode 
7014         <A
7015 HREF="smb.conf.5.html#SECURITYEQUALSSERVER"
7016 TARGET="_top"
7017 >security = server</A
7018 >, 
7019         where Samba would pass through the authentication request to a Windows 
7020         NT server in the same way as a Windows 95 or Windows 98 server would.
7021         </P
7022 ><P
7023 >Please refer to the <A
7024 HREF="winbind.html"
7025 TARGET="_top"
7026 >Winbind 
7027         paper</A
7028 > for information on a system to automatically
7029         assign UNIX uids and gids to Windows NT Domain users and groups.
7030         This code is available in development branches only at the moment,
7031         but will be moved to release branches soon.</P
7032 ><P
7033 >The advantage to domain-level security is that the 
7034         authentication in domain-level security is passed down the authenticated 
7035         RPC channel in exactly the same way that an NT server would do it. This 
7036         means Samba servers now participate in domain trust relationships in 
7037         exactly the same way NT servers do (i.e., you can add Samba servers into 
7038         a resource domain and have the authentication passed on from a resource
7039         domain PDC to an account domain PDC.</P
7040 ><P
7041 >In addition, with <B
7042 CLASS="COMMAND"
7043 >security = server</B
7044 > every Samba 
7045         daemon on a server has to keep a connection open to the 
7046         authenticating server for as long as that daemon lasts. This can drain 
7047         the connection resources on a Microsoft NT server and cause it to run 
7048         out of available connections. With <B
7049 CLASS="COMMAND"
7050 >security = domain</B
7051 >, 
7052         however, the Samba daemons connect to the PDC/BDC only for as long 
7053         as is necessary to authenticate the user, and then drop the connection, 
7054         thus conserving PDC connection resources.</P
7055 ><P
7056 >And finally, acting in the same manner as an NT server 
7057         authenticating to a PDC means that as part of the authentication 
7058         reply, the Samba server gets the user identification information such 
7059         as the user SID, the list of NT groups the user belongs to, etc. All 
7060         this information will allow Samba to be extended in the future into 
7061         a mode the developers currently call appliance mode. In this mode, 
7062         no local Unix users will be necessary, and Samba will generate Unix 
7063         uids and gids from the information passed back from the PDC when a 
7064         user is authenticated, making a Samba server truly plug and play 
7065         in an NT domain environment. Watch for this code soon.</P
7066 ><P
7067 ><SPAN
7068 CLASS="emphasis"
7069 ><I
7070 CLASS="EMPHASIS"
7071 >NOTE:</I
7072 ></SPAN
7073 > Much of the text of this document 
7074         was first published in the Web magazine <A
7075 HREF="http://www.linuxworld.com"
7076 TARGET="_top"
7077 >       
7078         LinuxWorld</A
7079 > as the article <A
7080 HREF="http://www.linuxworld.com/linuxworld/lw-1998-10/lw-10-samba.html"
7081 TARGET="_top"
7082 >Doing 
7083         the NIS/NT Samba</A
7084 >.</P
7085 ></DIV
7086 ></DIV
7087 ><DIV
7088 CLASS="CHAPTER"
7089 ><HR><H1
7090 ><A
7091 NAME="WINBIND"
7092 ></A
7093 >Chapter 11. Unified Logons between Windows NT and UNIX using Winbind</H1
7094 ><DIV
7095 CLASS="SECT1"
7096 ><H2
7097 CLASS="SECT1"
7098 ><A
7099 NAME="AEN1397"
7100 ></A
7101 >11.1. Abstract</H2
7102 ><P
7103 >Integration of UNIX and Microsoft Windows NT through 
7104         a unified logon has been considered a "holy grail" in heterogeneous 
7105         computing environments for a long time. We present 
7106         <SPAN
7107 CLASS="emphasis"
7108 ><I
7109 CLASS="EMPHASIS"
7110 >winbind</I
7111 ></SPAN
7112 >, a component of the Samba suite 
7113         of programs as a solution to the unified logon problem. Winbind 
7114         uses a UNIX implementation 
7115         of Microsoft RPC calls, Pluggable Authentication Modules, and the Name 
7116         Service Switch to allow Windows NT domain users to appear and operate 
7117         as UNIX users on a UNIX machine. This paper describes the winbind 
7118         system, explaining the functionality it provides, how it is configured, 
7119         and how it works internally.</P
7120 ></DIV
7121 ><DIV
7122 CLASS="SECT1"
7123 ><HR><H2
7124 CLASS="SECT1"
7125 ><A
7126 NAME="AEN1401"
7127 ></A
7128 >11.2. Introduction</H2
7129 ><P
7130 >It is well known that UNIX and Microsoft Windows NT have 
7131         different models for representing user and group information and 
7132         use different technologies for implementing them. This fact has 
7133         made it difficult to integrate the two systems in a satisfactory 
7134         manner.</P
7135 ><P
7136 >One common solution in use today has been to create 
7137         identically named user accounts on both the UNIX and Windows systems 
7138         and use the Samba suite of programs to provide file and print services 
7139         between the two. This solution is far from perfect however, as 
7140         adding and deleting users on both sets of machines becomes a chore 
7141         and two sets of passwords are required both of which
7142         can lead to synchronization problems between the UNIX and Windows 
7143         systems and confusion for users.</P
7144 ><P
7145 >We divide the unified logon problem for UNIX machines into 
7146         three smaller problems:</P
7147 ><P
7148 ></P
7149 ><UL
7150 ><LI
7151 ><P
7152 >Obtaining Windows NT user and group information
7153                 </P
7154 ></LI
7155 ><LI
7156 ><P
7157 >Authenticating Windows NT users
7158                 </P
7159 ></LI
7160 ><LI
7161 ><P
7162 >Password changing for Windows NT users
7163                 </P
7164 ></LI
7165 ></UL
7166 ><P
7167 >Ideally, a prospective solution to the unified logon problem 
7168         would satisfy all the above components without duplication of 
7169         information on the UNIX machines and without creating additional 
7170         tasks for the system administrator when maintaining users and 
7171         groups on either system. The winbind system provides a simple 
7172         and elegant solution to all three components of the unified logon 
7173         problem.</P
7174 ></DIV
7175 ><DIV
7176 CLASS="SECT1"
7177 ><HR><H2
7178 CLASS="SECT1"
7179 ><A
7180 NAME="AEN1414"
7181 ></A
7182 >11.3. What Winbind Provides</H2
7183 ><P
7184 >Winbind unifies UNIX and Windows NT account management by 
7185         allowing a UNIX box to become a full member of a NT domain. Once 
7186         this is done the UNIX box will see NT users and groups as if 
7187         they were native UNIX users and groups, allowing the NT domain 
7188         to be used in much the same manner that NIS+ is used within 
7189         UNIX-only environments.</P
7190 ><P
7191 >The end result is that whenever any 
7192         program on the UNIX machine asks the operating system to lookup 
7193         a user or group name, the query will be resolved by asking the 
7194         NT domain controller for the specified domain to do the lookup.
7195         Because Winbind hooks into the operating system at a low level 
7196         (via the NSS name resolution modules in the C library) this 
7197         redirection to the NT domain controller is completely 
7198         transparent.</P
7199 ><P
7200 >Users on the UNIX machine can then use NT user and group 
7201         names as they would use "native" UNIX names. They can chown files 
7202         so that they are owned by NT domain users or even login to the 
7203         UNIX machine and run a UNIX X-Window session as a domain user.</P
7204 ><P
7205 >The only obvious indication that Winbind is being used is 
7206         that user and group names take the form DOMAIN\user and 
7207         DOMAIN\group. This is necessary as it allows Winbind to determine 
7208         that redirection to a domain controller is wanted for a particular 
7209         lookup and which trusted domain is being referenced.</P
7210 ><P
7211 >Additionally, Winbind provides an authentication service 
7212         that hooks into the Pluggable Authentication Modules (PAM) system 
7213         to provide authentication via a NT domain to any PAM enabled 
7214         applications. This capability solves the problem of synchronizing 
7215         passwords between systems since all passwords are stored in a single 
7216         location (on the domain controller).</P
7217 ><DIV
7218 CLASS="SECT2"
7219 ><HR><H3
7220 CLASS="SECT2"
7221 ><A
7222 NAME="AEN1421"
7223 ></A
7224 >11.3.1. Target Uses</H3
7225 ><P
7226 >Winbind is targeted at organizations that have an 
7227                 existing NT based domain infrastructure into which they wish 
7228                 to put UNIX workstations or servers. Winbind will allow these 
7229                 organizations to deploy UNIX workstations without having to 
7230                 maintain a separate account infrastructure. This greatly 
7231                 simplifies the administrative overhead of deploying UNIX 
7232                 workstations into a NT based organization.</P
7233 ><P
7234 >Another interesting way in which we expect Winbind to 
7235                 be used is as a central part of UNIX based appliances. Appliances 
7236                 that provide file and print services to Microsoft based networks 
7237                 will be able to use Winbind to provide seamless integration of 
7238                 the appliance into the domain.</P
7239 ></DIV
7240 ></DIV
7241 ><DIV
7242 CLASS="SECT1"
7243 ><HR><H2
7244 CLASS="SECT1"
7245 ><A
7246 NAME="AEN1425"
7247 ></A
7248 >11.4. How Winbind Works</H2
7249 ><P
7250 >The winbind system is designed around a client/server 
7251         architecture. A long running <B
7252 CLASS="COMMAND"
7253 >winbindd</B
7254 > daemon 
7255         listens on a UNIX domain socket waiting for requests
7256         to arrive. These requests are generated by the NSS and PAM 
7257         clients and processed sequentially.</P
7258 ><P
7259 >The technologies used to implement winbind are described 
7260         in detail below.</P
7261 ><DIV
7262 CLASS="SECT2"
7263 ><HR><H3
7264 CLASS="SECT2"
7265 ><A
7266 NAME="AEN1430"
7267 ></A
7268 >11.4.1. Microsoft Remote Procedure Calls</H3
7269 ><P
7270 >Over the last two years, efforts have been underway 
7271                 by various Samba Team members to decode various aspects of 
7272                 the Microsoft Remote Procedure Call (MSRPC) system. This 
7273                 system is used for most network related operations between 
7274                 Windows NT machines including remote management, user authentication
7275                 and print spooling. Although initially this work was done 
7276                 to aid the implementation of Primary Domain Controller (PDC) 
7277                 functionality in Samba, it has also yielded a body of code which 
7278                 can be used for other purposes.</P
7279 ><P
7280 >Winbind uses various MSRPC calls to enumerate domain users 
7281                 and groups and to obtain detailed information about individual 
7282                 users or groups. Other MSRPC calls can be used to authenticate 
7283                 NT domain users and to change user passwords. By directly querying 
7284                 a Windows PDC for user and group information, winbind maps the 
7285                 NT account information onto UNIX user and group names.</P
7286 ></DIV
7287 ><DIV
7288 CLASS="SECT2"
7289 ><HR><H3
7290 CLASS="SECT2"
7291 ><A
7292 NAME="AEN1434"
7293 ></A
7294 >11.4.2. Name Service Switch</H3
7295 ><P
7296 >The Name Service Switch, or NSS, is a feature that is 
7297                 present in many UNIX operating systems. It allows system 
7298                 information such as hostnames, mail aliases and user information 
7299                 to be resolved from different sources. For example, a standalone 
7300                 UNIX workstation may resolve system information from a series of 
7301                 flat files stored on the local filesystem. A networked workstation 
7302                 may first attempt to resolve system information from local files, 
7303                 and then consult a NIS database for user information or a DNS server 
7304                 for hostname information.</P
7305 ><P
7306 >The NSS application programming interface allows winbind 
7307                 to present itself as a source of system information when 
7308                 resolving UNIX usernames and groups.  Winbind uses this interface, 
7309                 and information obtained from a Windows NT server using MSRPC 
7310                 calls to provide a new source of account enumeration.  Using standard 
7311                 UNIX library calls, one can enumerate the users and groups on
7312                 a UNIX machine running winbind and see all users and groups in 
7313                 a NT domain plus any trusted domain as though they were local 
7314                 users and groups.</P
7315 ><P
7316 >The primary control file for NSS is 
7317                 <TT
7318 CLASS="FILENAME"
7319 >/etc/nsswitch.conf</TT
7320 >. 
7321                 When a UNIX application makes a request to do a lookup 
7322                 the C library looks in <TT
7323 CLASS="FILENAME"
7324 >/etc/nsswitch.conf</TT
7325
7326                 for a line which matches the service type being requested, for 
7327                 example the "passwd" service type is used when user or group names 
7328                 are looked up. This     config line species which implementations 
7329                 of that service should be tried and in what order. If the passwd 
7330                 config line is:</P
7331 ><P
7332 ><B
7333 CLASS="COMMAND"
7334 >passwd: files example</B
7335 ></P
7336 ><P
7337 >then the C library will first load a module called 
7338                 <TT
7339 CLASS="FILENAME"
7340 >/lib/libnss_files.so</TT
7341 > followed by
7342                 the module <TT
7343 CLASS="FILENAME"
7344 >/lib/libnss_example.so</TT
7345 >. The 
7346                 C library will dynamically load each of these modules in turn 
7347                 and call resolver functions within the modules to try to resolve 
7348                 the request. Once the request is resolved the C library returns the
7349                 result to the application.</P
7350 ><P
7351 >This NSS interface provides a very easy way for Winbind 
7352                 to hook into the operating system. All that needs to be done 
7353                 is to put <TT
7354 CLASS="FILENAME"
7355 >libnss_winbind.so</TT
7356 > in <TT
7357 CLASS="FILENAME"
7358 >/lib/</TT
7359
7360                 then add "winbind" into <TT
7361 CLASS="FILENAME"
7362 >/etc/nsswitch.conf</TT
7363 > at 
7364                 the appropriate place. The C library will then call Winbind to 
7365                 resolve user and group names.</P
7366 ></DIV
7367 ><DIV
7368 CLASS="SECT2"
7369 ><HR><H3
7370 CLASS="SECT2"
7371 ><A
7372 NAME="AEN1450"
7373 ></A
7374 >11.4.3. Pluggable Authentication Modules</H3
7375 ><P
7376 >Pluggable Authentication Modules, also known as PAM, 
7377                 is a system for abstracting authentication and authorization 
7378                 technologies. With a PAM module it is possible to specify different 
7379                 authentication methods for different system applications without 
7380                 having to recompile these applications. PAM is also useful
7381                 for implementing a particular policy for authorization. For example, 
7382                 a system administrator may only allow console logins from users 
7383                 stored in the local password file but only allow users resolved from 
7384                 a NIS database to log in over the network.</P
7385 ><P
7386 >Winbind uses the authentication management and password 
7387                 management PAM interface to integrate Windows NT users into a 
7388                 UNIX system. This allows Windows NT users to log in to a UNIX 
7389                 machine and be authenticated against a suitable Primary Domain 
7390                 Controller. These users can also change their passwords and have 
7391                 this change take effect directly on the Primary Domain Controller.
7392                 </P
7393 ><P
7394 >PAM is configured by providing control files in the directory 
7395                 <TT
7396 CLASS="FILENAME"
7397 >/etc/pam.d/</TT
7398 > for each of the services that 
7399                 require authentication. When an authentication request is made 
7400                 by an application the PAM code in the C library looks up this
7401                 control file to determine what modules to load to do the 
7402                 authentication check and in what order. This interface makes adding 
7403                 a new authentication service for Winbind very easy, all that needs 
7404                 to be done is that the <TT
7405 CLASS="FILENAME"
7406 >pam_winbind.so</TT
7407 > module 
7408                 is copied to <TT
7409 CLASS="FILENAME"
7410 >/lib/security/</TT
7411 > and the PAM 
7412                 control files for relevant services are updated to allow 
7413                 authentication via winbind. See the PAM documentation
7414                 for more details.</P
7415 ></DIV
7416 ><DIV
7417 CLASS="SECT2"
7418 ><HR><H3
7419 CLASS="SECT2"
7420 ><A
7421 NAME="AEN1458"
7422 ></A
7423 >11.4.4. User and Group ID Allocation</H3
7424 ><P
7425 >When a user or group is created under Windows NT 
7426                 is it allocated a numerical relative identifier (RID). This is 
7427                 slightly different to UNIX which has a range of numbers that are 
7428                 used to identify users, and the same range in which to identify 
7429                 groups. It is winbind's job to convert RIDs to UNIX id numbers and
7430                 vice versa.  When winbind is configured it is given part of the UNIX 
7431                 user id space and a part of the UNIX group id space in which to 
7432                 store Windows NT users and groups. If a Windows NT user is 
7433                 resolved for the first time, it is allocated the next UNIX id from 
7434                 the range. The same process applies for Windows NT groups. Over 
7435                 time, winbind will have mapped all Windows NT users and groups
7436                 to UNIX user ids and group ids.</P
7437 ><P
7438 >The results of this mapping are stored persistently in 
7439                 an ID mapping database held in a tdb database). This ensures that 
7440                 RIDs are mapped to UNIX IDs in a consistent way.</P
7441 ></DIV
7442 ><DIV
7443 CLASS="SECT2"
7444 ><HR><H3
7445 CLASS="SECT2"
7446 ><A
7447 NAME="AEN1462"
7448 ></A
7449 >11.4.5. Result Caching</H3
7450 ><P
7451 >An active system can generate a lot of user and group 
7452                 name lookups. To reduce the network cost of these lookups winbind 
7453                 uses a caching scheme based on the SAM sequence number supplied 
7454                 by NT domain controllers.  User or group information returned 
7455                 by a PDC is cached by winbind along with a sequence number also 
7456                 returned by the PDC. This sequence number is incremented by 
7457                 Windows NT whenever any user or group information is modified. If 
7458                 a cached entry has expired, the sequence number is requested from 
7459                 the PDC and compared against the sequence number of the cached entry. 
7460                 If the sequence numbers do not match, then the cached information 
7461                 is discarded and up to date information is requested directly 
7462                 from the PDC.</P
7463 ></DIV
7464 ></DIV
7465 ><DIV
7466 CLASS="SECT1"
7467 ><HR><H2
7468 CLASS="SECT1"
7469 ><A
7470 NAME="AEN1465"
7471 ></A
7472 >11.5. Installation and Configuration</H2
7473 ><P
7474 >Many thanks to John Trostel <A
7475 HREF="mailto:jtrostel@snapserver.com"
7476 TARGET="_top"
7477 >jtrostel@snapserver.com</A
7478 >
7479 for providing the HOWTO for this section.</P
7480 ><P
7481 >This HOWTO describes how to get winbind services up and running 
7482 to control access and authenticate users on your Linux box using 
7483 the winbind services which come with SAMBA 2.2.2.</P
7484 ><P
7485 >There is also some Solaris specific information in 
7486 <TT
7487 CLASS="FILENAME"
7488 >docs/textdocs/Solaris-Winbind-HOWTO.txt</TT
7489 >.
7490 Future revisions of this document will incorporate that
7491 information.</P
7492 ><DIV
7493 CLASS="SECT2"
7494 ><HR><H3
7495 CLASS="SECT2"
7496 ><A
7497 NAME="AEN1472"
7498 ></A
7499 >11.5.1. Introduction</H3
7500 ><P
7501 >This HOWTO describes the procedures used to get winbind up and 
7502 running on my RedHat 7.1 system.  Winbind is capable of providing access 
7503 and authentication control for Windows Domain users through an NT 
7504 or Win2K PDC for 'regular' services, such as telnet a nd ftp, as
7505 well for SAMBA services.</P
7506 ><P
7507 >This HOWTO has been written from a 'RedHat-centric' perspective, so if 
7508 you are using another distribution, you may have to modify the instructions 
7509 somewhat to fit the way your distribution works.</P
7510 ><P
7511 ></P
7512 ><UL
7513 ><LI
7514 ><P
7515 >       <SPAN
7516 CLASS="emphasis"
7517 ><I
7518 CLASS="EMPHASIS"
7519 >Why should I to this?</I
7520 ></SPAN
7521 >
7522         </P
7523 ><P
7524 >This allows the SAMBA administrator to rely on the 
7525         authentication mechanisms on the NT/Win2K PDC for the authentication 
7526         of domain members.  NT/Win2K users no longer need to have separate 
7527         accounts on the SAMBA server.
7528         </P
7529 ></LI
7530 ><LI
7531 ><P
7532 >       <SPAN
7533 CLASS="emphasis"
7534 ><I
7535 CLASS="EMPHASIS"
7536 >Who should be reading this document?</I
7537 ></SPAN
7538 >
7539         </P
7540 ><P
7541 >       This HOWTO is designed for system administrators.  If you are 
7542         implementing SAMBA on a file server and wish to (fairly easily) 
7543         integrate existing NT/Win2K users from your PDC onto the
7544         SAMBA server, this HOWTO is for you.  That said, I am no NT or PAM 
7545         expert, so you may find a better or easier way to accomplish 
7546         these tasks.
7547         </P
7548 ></LI
7549 ></UL
7550 ></DIV
7551 ><DIV
7552 CLASS="SECT2"
7553 ><HR><H3
7554 CLASS="SECT2"
7555 ><A
7556 NAME="AEN1485"
7557 ></A
7558 >11.5.2. Requirements</H3
7559 ><P
7560 >If you have a samba configuration file that you are currently 
7561 using... <SPAN
7562 CLASS="emphasis"
7563 ><I
7564 CLASS="EMPHASIS"
7565 >BACK IT UP!</I
7566 ></SPAN
7567 >  If your system already uses PAM, 
7568 <SPAN
7569 CLASS="emphasis"
7570 ><I
7571 CLASS="EMPHASIS"
7572 >back up the <TT
7573 CLASS="FILENAME"
7574 >/etc/pam.d</TT
7575 > directory 
7576 contents!</I
7577 ></SPAN
7578 > If you haven't already made a boot disk, 
7579 <SPAN
7580 CLASS="emphasis"
7581 ><I
7582 CLASS="EMPHASIS"
7583 >MAKE ONE NOW!</I
7584 ></SPAN
7585 ></P
7586 ><P
7587 >Messing with the pam configuration files can make it nearly impossible 
7588 to log in to yourmachine. That's why you want to be able to boot back 
7589 into your machine in single user mode and restore your 
7590 <TT
7591 CLASS="FILENAME"
7592 >/etc/pam.d</TT
7593 > back to the original state they were in if 
7594 you get frustrated with the way things are going.  ;-)</P
7595 ><P
7596 >The latest version of SAMBA (version 2.2.2 as of this writing), now 
7597 includes a functioning winbindd daemon.  Please refer to the 
7598 <A
7599 HREF="http://samba.org/"
7600 TARGET="_top"
7601 >main SAMBA web page</A
7602 > or, 
7603 better yet, your closest SAMBA mirror site for instructions on 
7604 downloading the source code.</P
7605 ><P
7606 >To allow Domain users the ability to access SAMBA shares and 
7607 files, as well as potentially other services provided by your 
7608 SAMBA machine, PAM (pluggable authentication modules) must
7609 be setup properly on your machine.  In order to compile the 
7610 winbind modules, you should have at least the pam libraries resident 
7611 on your system.  For recent RedHat systems (7.1, for instance), that 
7612 means <TT
7613 CLASS="FILENAME"
7614 >pam-0.74-22</TT
7615 >.  For best results, it is helpful to also
7616 install the development packages in <TT
7617 CLASS="FILENAME"
7618 >pam-devel-0.74-22</TT
7619 >.</P
7620 ></DIV
7621 ><DIV
7622 CLASS="SECT2"
7623 ><HR><H3
7624 CLASS="SECT2"
7625 ><A
7626 NAME="AEN1499"
7627 ></A
7628 >11.5.3. Testing Things Out</H3
7629 ><P
7630 >Before starting, it is probably best to kill off all the SAMBA 
7631 related daemons running on your server.  Kill off all <B
7632 CLASS="COMMAND"
7633 >smbd</B
7634 >, 
7635 <B
7636 CLASS="COMMAND"
7637 >nmbd</B
7638 >, and <B
7639 CLASS="COMMAND"
7640 >winbindd</B
7641 > processes that may 
7642 be running.  To use PAM, you will want to make sure that you have the 
7643 standard PAM package (for RedHat) which supplies the <TT
7644 CLASS="FILENAME"
7645 >/etc/pam.d</TT
7646
7647 directory structure, including the pam modules are used by pam-aware 
7648 services, several pam libraries, and the <TT
7649 CLASS="FILENAME"
7650 >/usr/doc</TT
7651
7652 and <TT
7653 CLASS="FILENAME"
7654 >/usr/man</TT
7655 > entries for pam.  Winbind built better 
7656 in SAMBA if the pam-devel package was also installed.  This package includes 
7657 the header files needed to compile pam-aware applications. For instance, 
7658 my RedHat system has both <TT
7659 CLASS="FILENAME"
7660 >pam-0.74-22</TT
7661 > and
7662 <TT
7663 CLASS="FILENAME"
7664 >pam-devel-0.74-22</TT
7665 > RPMs installed.</P
7666 ><DIV
7667 CLASS="SECT3"
7668 ><HR><H4
7669 CLASS="SECT3"
7670 ><A
7671 NAME="AEN1510"
7672 ></A
7673 >11.5.3.1. Configure and compile SAMBA</H4
7674 ><P
7675 >The configuration and compilation of SAMBA is pretty straightforward.
7676 The first three steps may not be necessary depending upon
7677 whether or not you have previously built the Samba binaries.</P
7678 ><P
7679 ><PRE
7680 CLASS="PROGRAMLISTING"
7681 ><TT
7682 CLASS="PROMPT"
7683 >root#</TT
7684 > <B
7685 CLASS="COMMAND"
7686 >autoconf</B
7687 >
7688 <TT
7689 CLASS="PROMPT"
7690 >root#</TT
7691 > <B
7692 CLASS="COMMAND"
7693 >make clean</B
7694 >
7695 <TT
7696 CLASS="PROMPT"
7697 >root#</TT
7698 > <B
7699 CLASS="COMMAND"
7700 >rm config.cache</B
7701 >
7702 <TT
7703 CLASS="PROMPT"
7704 >root#</TT
7705 > <B
7706 CLASS="COMMAND"
7707 >./configure --with-winbind</B
7708 >
7709 <TT
7710 CLASS="PROMPT"
7711 >root#</TT
7712 > <B
7713 CLASS="COMMAND"
7714 >make</B
7715 >
7716 <TT
7717 CLASS="PROMPT"
7718 >root#</TT
7719 > <B
7720 CLASS="COMMAND"
7721 >make install</B
7722 ></PRE
7723 ></P
7724 ><P
7725 >This will, by default, install SAMBA in <TT
7726 CLASS="FILENAME"
7727 >/usr/local/samba</TT
7728 >.
7729 See the main SAMBA documentation if you want to install SAMBA somewhere else.
7730 It will also build the winbindd executable and libraries. </P
7731 ></DIV
7732 ><DIV
7733 CLASS="SECT3"
7734 ><HR><H4
7735 CLASS="SECT3"
7736 ><A
7737 NAME="AEN1529"
7738 ></A
7739 >11.5.3.2. Configure <TT
7740 CLASS="FILENAME"
7741 >nsswitch.conf</TT
7742 > and the 
7743 winbind libraries</H4
7744 ><P
7745 >The libraries needed to run the <B
7746 CLASS="COMMAND"
7747 >winbindd</B
7748 > daemon 
7749 through nsswitch need to be copied to their proper locations, so</P
7750 ><P
7751 ><TT
7752 CLASS="PROMPT"
7753 >root#</TT
7754 > <B
7755 CLASS="COMMAND"
7756 >cp ../samba/source/nsswitch/libnss_winbind.so /lib</B
7757 ></P
7758 ><P
7759 >I also found it necessary to make the following symbolic link:</P
7760 ><P
7761 ><TT
7762 CLASS="PROMPT"
7763 >root#</TT
7764 > <B
7765 CLASS="COMMAND"
7766 >ln -s /lib/libnss_winbind.so /lib/libnss_winbind.so.2</B
7767 ></P
7768 ><P
7769 >And, in the case of Sun solaris:</P
7770 ><P
7771 ><TT
7772 CLASS="PROMPT"
7773 >root#</TT
7774 > <B
7775 CLASS="COMMAND"
7776 >ln -s /usr/lib/libnss_winbind.so /usr/lib/libnss_winbind.so.1</B
7777 >
7778 <TT
7779 CLASS="PROMPT"
7780 >root#</TT
7781 > <B
7782 CLASS="COMMAND"
7783 >ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.1</B
7784 >
7785 <TT
7786 CLASS="PROMPT"
7787 >root#</TT
7788 > <B
7789 CLASS="COMMAND"
7790 >ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.2</B
7791 ></P
7792 ><P
7793 >Now, as root you need to edit <TT
7794 CLASS="FILENAME"
7795 >/etc/nsswitch.conf</TT
7796 > to 
7797 allow user and group entries to be visible from the <B
7798 CLASS="COMMAND"
7799 >winbindd</B
7800
7801 daemon.  My <TT
7802 CLASS="FILENAME"
7803 >/etc/nsswitch.conf</TT
7804 > file look like 
7805 this after editing:</P
7806 ><P
7807 ><PRE
7808 CLASS="PROGRAMLISTING"
7809 >       passwd:     files winbind
7810         shadow:     files 
7811         group:      files winbind</PRE
7812 ></P
7813 ><P
7814 >       
7815 The libraries needed by the winbind daemon will be automatically 
7816 entered into the <B
7817 CLASS="COMMAND"
7818 >ldconfig</B
7819 > cache the next time 
7820 your system reboots, but it 
7821 is faster (and you don't need to reboot) if you do it manually:</P
7822 ><P
7823 ><TT
7824 CLASS="PROMPT"
7825 >root#</TT
7826 > <B
7827 CLASS="COMMAND"
7828 >/sbin/ldconfig -v | grep winbind</B
7829 ></P
7830 ><P
7831 >This makes <TT
7832 CLASS="FILENAME"
7833 >libnss_winbind</TT
7834 > available to winbindd 
7835 and echos back a check to you.</P
7836 ></DIV
7837 ><DIV
7838 CLASS="SECT3"
7839 ><HR><H4
7840 CLASS="SECT3"
7841 ><A
7842 NAME="AEN1562"
7843 ></A
7844 >11.5.3.3. Configure smb.conf</H4
7845 ><P
7846 >Several parameters are needed in the smb.conf file to control 
7847 the behavior of <B
7848 CLASS="COMMAND"
7849 >winbindd</B
7850 >. Configure 
7851 <TT
7852 CLASS="FILENAME"
7853 >smb.conf</TT
7854 > These are described in more detail in 
7855 the <A
7856 HREF="winbindd.8.html"
7857 TARGET="_top"
7858 >winbindd(8)</A
7859 > man page.  My 
7860 <TT
7861 CLASS="FILENAME"
7862 >smb.conf</TT
7863 > file was modified to
7864 include the following entries in the [global] section:</P
7865 ><P
7866 ><PRE
7867 CLASS="PROGRAMLISTING"
7868 >[global]
7869      &#60;...&#62;
7870      # separate domain and username with '+', like DOMAIN+username
7871      <A
7872 HREF="winbindd.8.html#WINBINDSEPARATOR"
7873 TARGET="_top"
7874 >winbind separator</A
7875 > = +
7876      # use uids from 10000 to 20000 for domain users
7877      <A
7878 HREF="winbindd.8.html#WINBINDUID"
7879 TARGET="_top"
7880 >winbind uid</A
7881 > = 10000-20000
7882      # use gids from 10000 to 20000 for domain groups
7883      <A
7884 HREF="winbindd.8.html#WINBINDGID"
7885 TARGET="_top"
7886 >winbind gid</A
7887 > = 10000-20000
7888      # allow enumeration of winbind users and groups
7889      <A
7890 HREF="winbindd.8.html#WINBINDENUMUSERS"
7891 TARGET="_top"
7892 >winbind enum users</A
7893 > = yes
7894      <A
7895 HREF="winbindd.8.html#WINBINDENUMGROUP"
7896 TARGET="_top"
7897 >winbind enum groups</A
7898 > = yes
7899      # give winbind users a real shell (only needed if they have telnet access)
7900      <A
7901 HREF="winbindd.8.html#TEMPLATEHOMEDIR"
7902 TARGET="_top"
7903 >template homedir</A
7904 > = /home/winnt/%D/%U
7905      <A
7906 HREF="winbindd.8.html#TEMPLATESHELL"
7907 TARGET="_top"
7908 >template shell</A
7909 > = /bin/bash</PRE
7910 ></P
7911 ></DIV
7912 ><DIV
7913 CLASS="SECT3"
7914 ><HR><H4
7915 CLASS="SECT3"
7916 ><A
7917 NAME="AEN1578"
7918 ></A
7919 >11.5.3.4. Join the SAMBA server to the PDC domain</H4
7920 ><P
7921 >Enter the following command to make the SAMBA server join the 
7922 PDC domain, where <TT
7923 CLASS="REPLACEABLE"
7924 ><I
7925 >DOMAIN</I
7926 ></TT
7927 > is the name of 
7928 your Windows domain and <TT
7929 CLASS="REPLACEABLE"
7930 ><I
7931 >Administrator</I
7932 ></TT
7933 > is 
7934 a domain user who has administrative privileges in the domain.</P
7935 ><P
7936 ><TT
7937 CLASS="PROMPT"
7938 >root#</TT
7939 > <B
7940 CLASS="COMMAND"
7941 >/usr/local/samba/bin/net rpc join -s PDC -U Administrator</B
7942 ></P
7943 ><P
7944 >The proper response to the command should be: "Joined the domain 
7945 <TT
7946 CLASS="REPLACEABLE"
7947 ><I
7948 >DOMAIN</I
7949 ></TT
7950 >" where <TT
7951 CLASS="REPLACEABLE"
7952 ><I
7953 >DOMAIN</I
7954 ></TT
7955
7956 is your DOMAIN name.</P
7957 ></DIV
7958 ><DIV
7959 CLASS="SECT3"
7960 ><HR><H4
7961 CLASS="SECT3"
7962 ><A
7963 NAME="AEN1589"
7964 ></A
7965 >11.5.3.5. Start up the winbindd daemon and test it!</H4
7966 ><P
7967 >Eventually, you will want to modify your smb startup script to 
7968 automatically invoke the winbindd daemon when the other parts of 
7969 SAMBA start, but it is possible to test out just the winbind
7970 portion first.  To start up winbind services, enter the following 
7971 command as root:</P
7972 ><P
7973 ><TT
7974 CLASS="PROMPT"
7975 >root#</TT
7976 > <B
7977 CLASS="COMMAND"
7978 >/usr/local/samba/bin/winbindd</B
7979 ></P
7980 ><P
7981 >I'm always paranoid and like to make sure the daemon 
7982 is really running...</P
7983 ><P
7984 ><TT
7985 CLASS="PROMPT"
7986 >root#</TT
7987 > <B
7988 CLASS="COMMAND"
7989 >ps -ae | grep winbindd</B
7990 ></P
7991 ><P
7992 >This command should produce output like this, if the daemon is running</P
7993 ><P
7994 >3025 ?        00:00:00 winbindd</P
7995 ><P
7996 >Now... for the real test, try to get some information about the 
7997 users on your PDC</P
7998 ><P
7999 ><TT
8000 CLASS="PROMPT"
8001 >root#</TT
8002 > <B
8003 CLASS="COMMAND"
8004 >/usr/local/samba/bin/wbinfo -u</B
8005 ></P
8006 ><P
8007 >       
8008 This should echo back a list of users on your Windows users on 
8009 your PDC.  For example, I get the following response:</P
8010 ><P
8011 ><PRE
8012 CLASS="PROGRAMLISTING"
8013 >CEO+Administrator
8014 CEO+burdell
8015 CEO+Guest
8016 CEO+jt-ad
8017 CEO+krbtgt
8018 CEO+TsInternetUser</PRE
8019 ></P
8020 ><P
8021 >Obviously, I have named my domain 'CEO' and my <TT
8022 CLASS="PARAMETER"
8023 ><I
8024 >winbind
8025 separator</I
8026 ></TT
8027 > is '+'.</P
8028 ><P
8029 >You can do the same sort of thing to get group information from 
8030 the PDC:</P
8031 ><P
8032 ><PRE
8033 CLASS="PROGRAMLISTING"
8034 ><TT
8035 CLASS="PROMPT"
8036 >root#</TT
8037 > <B
8038 CLASS="COMMAND"
8039 >/usr/local/samba/bin/wbinfo -g</B
8040 >
8041 CEO+Domain Admins
8042 CEO+Domain Users
8043 CEO+Domain Guests
8044 CEO+Domain Computers
8045 CEO+Domain Controllers
8046 CEO+Cert Publishers
8047 CEO+Schema Admins
8048 CEO+Enterprise Admins
8049 CEO+Group Policy Creator Owners</PRE
8050 ></P
8051 ><P
8052 >The function 'getent' can now be used to get unified 
8053 lists of both local and PDC users and groups.
8054 Try the following command:</P
8055 ><P
8056 ><TT
8057 CLASS="PROMPT"
8058 >root#</TT
8059 > <B
8060 CLASS="COMMAND"
8061 >getent passwd</B
8062 ></P
8063 ><P
8064 >You should get a list that looks like your <TT
8065 CLASS="FILENAME"
8066 >/etc/passwd</TT
8067
8068 list followed by the domain users with their new uids, gids, home 
8069 directories and default shells.</P
8070 ><P
8071 >The same thing can be done for groups with the command</P
8072 ><P
8073 ><TT
8074 CLASS="PROMPT"
8075 >root#</TT
8076 > <B
8077 CLASS="COMMAND"
8078 >getent group</B
8079 ></P
8080 ></DIV
8081 ><DIV
8082 CLASS="SECT3"
8083 ><HR><H4
8084 CLASS="SECT3"
8085 ><A
8086 NAME="AEN1625"
8087 ></A
8088 >11.5.3.6. Fix the init.d startup scripts</H4
8089 ><DIV
8090 CLASS="SECT4"
8091 ><H5
8092 CLASS="SECT4"
8093 ><A
8094 NAME="AEN1627"
8095 ></A
8096 >11.5.3.6.1. Linux</H5
8097 ><P
8098 >The <B
8099 CLASS="COMMAND"
8100 >winbindd</B
8101 > daemon needs to start up after the 
8102 <B
8103 CLASS="COMMAND"
8104 >smbd</B
8105 > and <B
8106 CLASS="COMMAND"
8107 >nmbd</B
8108 > daemons are running.  
8109 To accomplish this task, you need to modify the startup scripts of your system. They are located at <TT
8110 CLASS="FILENAME"
8111 >/etc/init.d/smb</TT
8112 > in RedHat and 
8113 <TT
8114 CLASS="FILENAME"
8115 >/etc/init.d/samba</TT
8116 > in Debian.
8117 script to add commands to invoke this daemon in the proper sequence.  My 
8118 startup script starts up <B
8119 CLASS="COMMAND"
8120 >smbd</B
8121 >, 
8122 <B
8123 CLASS="COMMAND"
8124 >nmbd</B
8125 >, and <B
8126 CLASS="COMMAND"
8127 >winbindd</B
8128 > from the 
8129 <TT
8130 CLASS="FILENAME"
8131 >/usr/local/samba/bin</TT
8132 > directory directly.  The 'start' 
8133 function in the script looks like this:</P
8134 ><P
8135 ><PRE
8136 CLASS="PROGRAMLISTING"
8137 >start() {
8138         KIND="SMB"
8139         echo -n $"Starting $KIND services: "
8140         daemon /usr/local/samba/bin/smbd $SMBDOPTIONS
8141         RETVAL=$?
8142         echo
8143         KIND="NMB"
8144         echo -n $"Starting $KIND services: "
8145         daemon /usr/local/samba/bin/nmbd $NMBDOPTIONS
8146         RETVAL2=$?
8147         echo
8148         KIND="Winbind"
8149         echo -n $"Starting $KIND services: "
8150         daemon /usr/local/samba/bin/winbindd
8151         RETVAL3=$?
8152         echo
8153         [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] &#38;&#38; touch /var/lock/subsys/smb || \
8154            RETVAL=1
8155         return $RETVAL
8156 }</PRE
8157 ></P
8158 ><P
8159 >The 'stop' function has a corresponding entry to shut down the 
8160 services and look s like this:</P
8161 ><P
8162 ><PRE
8163 CLASS="PROGRAMLISTING"
8164 >stop() {
8165         KIND="SMB"
8166         echo -n $"Shutting down $KIND services: "
8167         killproc smbd
8168         RETVAL=$?
8169         echo
8170         KIND="NMB"
8171         echo -n $"Shutting down $KIND services: "
8172         killproc nmbd
8173         RETVAL2=$?
8174         echo
8175         KIND="Winbind"
8176         echo -n $"Shutting down $KIND services: "
8177         killproc winbindd
8178         RETVAL3=$?
8179         [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] &#38;&#38; rm -f /var/lock/subsys/smb
8180         echo ""
8181         return $RETVAL
8182 }</PRE
8183 ></P
8184 ></DIV
8185 ><DIV
8186 CLASS="SECT4"
8187 ><HR><H5
8188 CLASS="SECT4"
8189 ><A
8190 NAME="AEN1644"
8191 ></A
8192 >11.5.3.6.2. Solaris</H5
8193 ><P
8194 >On solaris, you need to modify the 
8195 <TT
8196 CLASS="FILENAME"
8197 >/etc/init.d/samba.server</TT
8198 > startup script. It usually 
8199 only starts smbd and nmbd but should now start winbindd too. If you 
8200 have samba installed in <TT
8201 CLASS="FILENAME"
8202 >/usr/local/samba/bin</TT
8203 >, 
8204 the file could contains something like this:</P
8205 ><P
8206 ><PRE
8207 CLASS="PROGRAMLISTING"
8208 >##
8209 ## samba.server
8210 ##
8211
8212 if [ ! -d /usr/bin ]
8213 then                    # /usr not mounted
8214         exit
8215 fi
8216
8217 killproc() {            # kill the named process(es)
8218         pid=`/usr/bin/ps -e |
8219              /usr/bin/grep -w $1 |
8220              /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
8221         [ "$pid" != "" ] &#38;&#38; kill $pid
8222 }
8223  
8224 # Start/stop processes required for samba server
8225
8226 case "$1" in
8227
8228 'start')
8229 #
8230 # Edit these lines to suit your installation (paths, workgroup, host)
8231 #
8232 echo Starting SMBD
8233    /usr/local/samba/bin/smbd -D -s \
8234         /usr/local/samba/smb.conf
8235
8236 echo Starting NMBD
8237    /usr/local/samba/bin/nmbd -D -l \
8238         /usr/local/samba/var/log -s /usr/local/samba/smb.conf
8239
8240 echo Starting Winbind Daemon
8241    /usr/local/samba/bin/winbindd
8242    ;;
8243
8244 'stop')
8245    killproc nmbd
8246    killproc smbd
8247    killproc winbindd
8248    ;;
8249
8250 *)
8251    echo "Usage: /etc/init.d/samba.server { start | stop }"
8252    ;;
8253 esac</PRE
8254 ></P
8255 ></DIV
8256 ><DIV
8257 CLASS="SECT4"
8258 ><HR><H5
8259 CLASS="SECT4"
8260 ><A
8261 NAME="AEN1651"
8262 ></A
8263 >11.5.3.6.3. Restarting</H5
8264 ><P
8265 >If you restart the <B
8266 CLASS="COMMAND"
8267 >smbd</B
8268 >, <B
8269 CLASS="COMMAND"
8270 >nmbd</B
8271 >, 
8272 and <B
8273 CLASS="COMMAND"
8274 >winbindd</B
8275 > daemons at this point, you
8276 should be able to connect to the samba server as a domain member just as
8277 if you were a local user.</P
8278 ></DIV
8279 ></DIV
8280 ><DIV
8281 CLASS="SECT3"
8282 ><HR><H4
8283 CLASS="SECT3"
8284 ><A
8285 NAME="AEN1657"
8286 ></A
8287 >11.5.3.7. Configure Winbind and PAM</H4
8288 ><P
8289 >If you have made it this far, you know that winbindd and samba are working
8290 together.  If you want to use winbind to provide authentication for other 
8291 services, keep reading.  The pam configuration files need to be altered in
8292 this step.  (Did you remember to make backups of your original 
8293 <TT
8294 CLASS="FILENAME"
8295 >/etc/pam.d</TT
8296 > files? If not, do it now.)</P
8297 ><P
8298 >You will need a pam module to use winbindd with these other services.  This 
8299 module will be compiled in the <TT
8300 CLASS="FILENAME"
8301 >../source/nsswitch</TT
8302 > directory
8303 by invoking the command</P
8304 ><P
8305 ><TT
8306 CLASS="PROMPT"
8307 >root#</TT
8308 > <B
8309 CLASS="COMMAND"
8310 >make nsswitch/pam_winbind.so</B
8311 ></P
8312 ><P
8313 >from the <TT
8314 CLASS="FILENAME"
8315 >../source</TT
8316 > directory.  The
8317 <TT
8318 CLASS="FILENAME"
8319 >pam_winbind.so</TT
8320 > file should be copied to the location of
8321 your other pam security modules.  On my RedHat system, this was the
8322 <TT
8323 CLASS="FILENAME"
8324 >/lib/security</TT
8325 > directory. On Solaris, the pam security 
8326 modules reside in <TT
8327 CLASS="FILENAME"
8328 >/usr/lib/security</TT
8329 >.</P
8330 ><P
8331 ><TT
8332 CLASS="PROMPT"
8333 >root#</TT
8334 > <B
8335 CLASS="COMMAND"
8336 >cp ../samba/source/nsswitch/pam_winbind.so /lib/security</B
8337 ></P
8338 ><DIV
8339 CLASS="SECT4"
8340 ><HR><H5
8341 CLASS="SECT4"
8342 ><A
8343 NAME="AEN1674"
8344 ></A
8345 >11.5.3.7.1. Linux/FreeBSD-specific PAM configuration</H5
8346 ><P
8347 >The <TT
8348 CLASS="FILENAME"
8349 >/etc/pam.d/samba</TT
8350 > file does not need to be changed. I 
8351 just left this fileas it was:</P
8352 ><P
8353 ><PRE
8354 CLASS="PROGRAMLISTING"
8355 >auth    required        /lib/security/pam_stack.so service=system-auth
8356 account required        /lib/security/pam_stack.so service=system-auth</PRE
8357 ></P
8358 ><P
8359 >The other services that I modified to allow the use of winbind 
8360 as an authentication service were the normal login on the console (or a terminal 
8361 session), telnet logins, and ftp service.  In order to enable these 
8362 services, you may first need to change the entries in 
8363 <TT
8364 CLASS="FILENAME"
8365 >/etc/xinetd.d</TT
8366 > (or <TT
8367 CLASS="FILENAME"
8368 >/etc/inetd.conf</TT
8369 >).  
8370 RedHat 7.1 uses the new xinetd.d structure, in this case you need 
8371 to change the lines in <TT
8372 CLASS="FILENAME"
8373 >/etc/xinetd.d/telnet</TT
8374
8375 and <TT
8376 CLASS="FILENAME"
8377 >/etc/xinetd.d/wu-ftp</TT
8378 > from </P
8379 ><P
8380 ><PRE
8381 CLASS="PROGRAMLISTING"
8382 >enable = no</PRE
8383 ></P
8384 ><P
8385 >to</P
8386 ><P
8387 ><PRE
8388 CLASS="PROGRAMLISTING"
8389 >enable = yes</PRE
8390 ></P
8391 ><P
8392 >       
8393 For ftp services to work properly, you will also need to either 
8394 have individual directories for the domain users already present on 
8395 the server, or change the home directory template to a general
8396 directory for all domain users.  These can be easily set using 
8397 the <TT
8398 CLASS="FILENAME"
8399 >smb.conf</TT
8400 > global entry 
8401 <B
8402 CLASS="COMMAND"
8403 >template homedir</B
8404 >.</P
8405 ><P
8406 >The <TT
8407 CLASS="FILENAME"
8408 >/etc/pam.d/ftp</TT
8409 > file can be changed 
8410 to allow winbind ftp access in a manner similar to the
8411 samba file.  My <TT
8412 CLASS="FILENAME"
8413 >/etc/pam.d/ftp</TT
8414 > file was 
8415 changed to look like this:</P
8416 ><P
8417 ><PRE
8418 CLASS="PROGRAMLISTING"
8419 >auth       required     /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
8420 auth       sufficient   /lib/security/pam_winbind.so
8421 auth       required     /lib/security/pam_stack.so service=system-auth
8422 auth       required     /lib/security/pam_shells.so
8423 account    sufficient   /lib/security/pam_winbind.so
8424 account    required     /lib/security/pam_stack.so service=system-auth
8425 session    required     /lib/security/pam_stack.so service=system-auth</PRE
8426 ></P
8427 ><P
8428 >The <TT
8429 CLASS="FILENAME"
8430 >/etc/pam.d/login</TT
8431 > file can be changed nearly the 
8432 same way.  It now looks like this:</P
8433 ><P
8434 ><PRE
8435 CLASS="PROGRAMLISTING"
8436 >auth       required     /lib/security/pam_securetty.so
8437 auth       sufficient   /lib/security/pam_winbind.so
8438 auth       sufficient   /lib/security/pam_unix.so use_first_pass
8439 auth       required     /lib/security/pam_stack.so service=system-auth
8440 auth       required     /lib/security/pam_nologin.so
8441 account    sufficient   /lib/security/pam_winbind.so
8442 account    required     /lib/security/pam_stack.so service=system-auth
8443 password   required     /lib/security/pam_stack.so service=system-auth
8444 session    required     /lib/security/pam_stack.so service=system-auth
8445 session    optional     /lib/security/pam_console.so</PRE
8446 ></P
8447 ><P
8448 >In this case, I added the <B
8449 CLASS="COMMAND"
8450 >auth sufficient /lib/security/pam_winbind.so</B
8451
8452 lines as before, but also added the <B
8453 CLASS="COMMAND"
8454 >required pam_securetty.so</B
8455
8456 above it, to disallow root logins over the network.  I also added a 
8457 <B
8458 CLASS="COMMAND"
8459 >sufficient /lib/security/pam_unix.so use_first_pass</B
8460 >
8461 line after the <B
8462 CLASS="COMMAND"
8463 >winbind.so</B
8464 > line to get rid of annoying 
8465 double prompts for passwords.</P
8466 ></DIV
8467 ><DIV
8468 CLASS="SECT4"
8469 ><HR><H5
8470 CLASS="SECT4"
8471 ><A
8472 NAME="AEN1707"
8473 ></A
8474 >11.5.3.7.2. Solaris-specific configuration</H5
8475 ><P
8476 >The /etc/pam.conf needs to be changed. I changed this file so that my Domain
8477 users can logon both locally as well as telnet.The following are the changes
8478 that I made.You can customize the pam.conf file as per your requirements,but
8479 be sure of those changes because in the worst case it will leave your system
8480 nearly impossible to boot.</P
8481 ><P
8482 ><PRE
8483 CLASS="PROGRAMLISTING"
8484 >#
8485 #ident  "@(#)pam.conf   1.14    99/09/16 SMI"
8486 #
8487 # Copyright (c) 1996-1999, Sun Microsystems, Inc.
8488 # All Rights Reserved.
8489 #
8490 # PAM configuration
8491 #
8492 # Authentication management
8493 #
8494 login   auth required   /usr/lib/security/pam_winbind.so
8495 login   auth required   /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass 
8496 login   auth required   /usr/lib/security/$ISA/pam_dial_auth.so.1 try_first_pass 
8497 #
8498 rlogin  auth sufficient /usr/lib/security/pam_winbind.so
8499 rlogin  auth sufficient /usr/lib/security/$ISA/pam_rhosts_auth.so.1
8500 rlogin  auth required   /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
8501 #
8502 dtlogin auth sufficient /usr/lib/security/pam_winbind.so
8503 dtlogin auth required   /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
8504 #
8505 rsh     auth required   /usr/lib/security/$ISA/pam_rhosts_auth.so.1
8506 other   auth sufficient /usr/lib/security/pam_winbind.so
8507 other   auth required   /usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
8508 #
8509 # Account management
8510 #
8511 login   account sufficient      /usr/lib/security/pam_winbind.so
8512 login   account requisite       /usr/lib/security/$ISA/pam_roles.so.1 
8513 login   account required        /usr/lib/security/$ISA/pam_unix.so.1 
8514 #
8515 dtlogin account sufficient      /usr/lib/security/pam_winbind.so
8516 dtlogin account requisite       /usr/lib/security/$ISA/pam_roles.so.1 
8517 dtlogin account required        /usr/lib/security/$ISA/pam_unix.so.1 
8518 #
8519 other   account sufficient      /usr/lib/security/pam_winbind.so
8520 other   account requisite       /usr/lib/security/$ISA/pam_roles.so.1 
8521 other   account required        /usr/lib/security/$ISA/pam_unix.so.1 
8522 #
8523 # Session management
8524 #
8525 other   session required        /usr/lib/security/$ISA/pam_unix.so.1 
8526 #
8527 # Password management
8528 #
8529 #other   password sufficient     /usr/lib/security/pam_winbind.so
8530 other   password required       /usr/lib/security/$ISA/pam_unix.so.1 
8531 dtsession auth required /usr/lib/security/$ISA/pam_unix.so.1
8532 #
8533 # Support for Kerberos V5 authentication (uncomment to use Kerberos)
8534 #
8535 #rlogin auth optional   /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
8536 #login  auth optional   /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
8537 #dtlogin        auth optional   /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
8538 #other  auth optional   /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
8539 #dtlogin        account optional /usr/lib/security/$ISA/pam_krb5.so.1
8540 #other  account optional /usr/lib/security/$ISA/pam_krb5.so.1
8541 #other  session optional /usr/lib/security/$ISA/pam_krb5.so.1
8542 #other  password optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass</PRE
8543 ></P
8544 ><P
8545 >I also added a try_first_pass line after the winbind.so line to get rid of
8546 annoying double prompts for passwords.</P
8547 ><P
8548 >Now restart your Samba &#38; try connecting through your application that you
8549 configured in the pam.conf.</P
8550 ></DIV
8551 ></DIV
8552 ></DIV
8553 ></DIV
8554 ><DIV
8555 CLASS="SECT1"
8556 ><HR><H2
8557 CLASS="SECT1"
8558 ><A
8559 NAME="AEN1714"
8560 ></A
8561 >11.6. Limitations</H2
8562 ><P
8563 >Winbind has a number of limitations in its current 
8564         released version that we hope to overcome in future 
8565         releases:</P
8566 ><P
8567 ></P
8568 ><UL
8569 ><LI
8570 ><P
8571 >Winbind is currently only available for 
8572                 the Linux operating system, although ports to other operating 
8573                 systems are certainly possible. For such ports to be feasible, 
8574                 we require the C library of the target operating system to 
8575                 support the Name Service Switch and Pluggable Authentication
8576                 Modules systems. This is becoming more common as NSS and 
8577                 PAM gain        support among UNIX vendors.</P
8578 ></LI
8579 ><LI
8580 ><P
8581 >The mappings of Windows NT RIDs to UNIX ids 
8582                 is not made algorithmically and depends on the order in which 
8583                 unmapped users or groups are seen by winbind. It may be difficult 
8584                 to recover the mappings of rid to UNIX id mapping if the file 
8585                 containing this information is corrupted or destroyed.</P
8586 ></LI
8587 ><LI
8588 ><P
8589 >Currently the winbind PAM module does not take 
8590                 into account possible workstation and logon time restrictions 
8591                 that may be been set for Windows NT users.</P
8592 ></LI
8593 ></UL
8594 ></DIV
8595 ><DIV
8596 CLASS="SECT1"
8597 ><HR><H2
8598 CLASS="SECT1"
8599 ><A
8600 NAME="AEN1724"
8601 ></A
8602 >11.7. Conclusion</H2
8603 ><P
8604 >The winbind system, through the use of the Name Service 
8605         Switch, Pluggable Authentication Modules, and appropriate 
8606         Microsoft RPC calls have allowed us to provide seamless 
8607         integration of Microsoft Windows NT domain users on a
8608         UNIX system. The result is a great reduction in the administrative 
8609         cost of running a mixed UNIX and NT network.</P
8610 ></DIV
8611 ></DIV
8612 ><DIV
8613 CLASS="CHAPTER"
8614 ><HR><H1
8615 ><A
8616 NAME="SAMBA-PDC"
8617 ></A
8618 >Chapter 12. How to Configure Samba 2.2 as a Primary Domain Controller</H1
8619 ><DIV
8620 CLASS="SECT1"
8621 ><H2
8622 CLASS="SECT1"
8623 ><A
8624 NAME="AEN1744"
8625 ></A
8626 >12.1. Prerequisite Reading</H2
8627 ><P
8628 >Before you continue reading in this chapter, please make sure 
8629 that you are comfortable with configuring basic files services
8630 in smb.conf and how to enable and administer password 
8631 encryption in Samba.  Theses two topics are covered in the
8632 <A
8633 HREF="smb.conf.5.html"
8634 TARGET="_top"
8635 ><TT
8636 CLASS="FILENAME"
8637 >smb.conf(5)</TT
8638 ></A
8639
8640 manpage and the <A
8641 HREF="ENCRYPTION.html"
8642 TARGET="_top"
8643 >Encryption chapter</A
8644
8645 of this HOWTO Collection.</P
8646 ></DIV
8647 ><DIV
8648 CLASS="SECT1"
8649 ><HR><H2
8650 CLASS="SECT1"
8651 ><A
8652 NAME="AEN1750"
8653 ></A
8654 >12.2. Background</H2
8655 ><DIV
8656 CLASS="NOTE"
8657 ><P
8658 ></P
8659 ><TABLE
8660 CLASS="NOTE"
8661 WIDTH="100%"
8662 BORDER="0"
8663 ><TR
8664 ><TD
8665 WIDTH="25"
8666 ALIGN="CENTER"
8667 VALIGN="TOP"
8668 ><IMG
8669 SRC="/docbook-dsssl/note.gif"
8670 HSPACE="5"
8671 ALT="Note"></TD
8672 ><TD
8673 ALIGN="LEFT"
8674 VALIGN="TOP"
8675 ><P
8676 ><SPAN
8677 CLASS="emphasis"
8678 ><I
8679 CLASS="EMPHASIS"
8680 >Author's Note:</I
8681 ></SPAN
8682 > This document is a combination 
8683 of David Bannon's "Samba 2.2 PDC HOWTO" and "Samba NT Domain FAQ". 
8684 Both documents are superseded by this one.</P
8685 ></TD
8686 ></TR
8687 ></TABLE
8688 ></DIV
8689 ><P
8690 >Versions of Samba prior to release 2.2 had marginal capabilities to act
8691 as a Windows NT 4.0 Primary Domain Controller
8692
8693 (PDC).  With Samba 2.2.0, we are proud to announce official support for
8694 Windows NT 4.0-style domain logons from Windows NT 4.0 and Windows 
8695 2000 clients.  This article outlines the steps
8696 necessary for configuring Samba as a PDC.  It is necessary to have a
8697 working Samba server prior to implementing the PDC functionality.  If
8698 you have not followed the steps outlined in <A
8699 HREF="UNIX_INSTALL.html"
8700 TARGET="_top"
8701 > UNIX_INSTALL.html</A
8702 >, please make sure
8703 that your server is configured correctly before proceeding.  Another
8704 good resource in the <A
8705 HREF="smb.conf.5.html"
8706 TARGET="_top"
8707 >smb.conf(5) man
8708 page</A
8709 >. The following functionality should work in 2.2:</P
8710 ><P
8711 ></P
8712 ><UL
8713 ><LI
8714 ><P
8715 >       domain logons for Windows NT 4.0/2000 clients.
8716         </P
8717 ></LI
8718 ><LI
8719 ><P
8720 >       placing a Windows 9x client in user level security
8721         </P
8722 ></LI
8723 ><LI
8724 ><P
8725 >       retrieving a list of users and groups from a Samba PDC to
8726         Windows 9x/NT/2000 clients
8727         </P
8728 ></LI
8729 ><LI
8730 ><P
8731 >       roving (roaming) user profiles
8732         </P
8733 ></LI
8734 ><LI
8735 ><P
8736 >       Windows NT 4.0-style system policies
8737         </P
8738 ></LI
8739 ></UL
8740 ><P
8741 >The following pieces of functionality are not included in the 2.2 release:</P
8742 ><P
8743 ></P
8744 ><UL
8745 ><LI
8746 ><P
8747 >       Windows NT 4 domain trusts
8748         </P
8749 ></LI
8750 ><LI
8751 ><P
8752 >       SAM replication with Windows NT 4.0 Domain Controllers
8753         (i.e. a Samba PDC and a Windows NT BDC or vice versa) 
8754         </P
8755 ></LI
8756 ><LI
8757 ><P
8758 >       Adding users via the User Manager for Domains
8759         </P
8760 ></LI
8761 ><LI
8762 ><P
8763 >       Acting as a Windows 2000 Domain Controller (i.e. Kerberos and 
8764         Active Directory)
8765         </P
8766 ></LI
8767 ></UL
8768 ><P
8769 >Please note that Windows 9x clients are not true members of a domain
8770 for reasons outlined in this article.  Therefore the protocol for
8771 support Windows 9x-style domain logons is completely different
8772 from NT4 domain logons and has been officially supported for some 
8773 time.</P
8774 ><P
8775 >Implementing a Samba PDC can basically be divided into 2 broad
8776 steps.</P
8777 ><P
8778 ></P
8779 ><OL
8780 TYPE="1"
8781 ><LI
8782 ><P
8783 >       Configuring the Samba PDC
8784         </P
8785 ></LI
8786 ><LI
8787 ><P
8788 >       Creating machine trust accounts and joining clients 
8789         to the domain
8790         </P
8791 ></LI
8792 ></OL
8793 ><P
8794 >There are other minor details such as user profiles, system
8795 policies, etc...  However, these are not necessarily specific
8796 to a Samba PDC as much as they are related to Windows NT networking
8797 concepts.  They will be mentioned only briefly here.</P
8798 ></DIV
8799 ><DIV
8800 CLASS="SECT1"
8801 ><HR><H2
8802 CLASS="SECT1"
8803 ><A
8804 NAME="AEN1789"
8805 ></A
8806 >12.3. Configuring the Samba Domain Controller</H2
8807 ><P
8808 >The first step in creating a working Samba PDC is to 
8809 understand the parameters necessary in smb.conf.  I will not
8810 attempt to re-explain the parameters here as they are more that
8811 adequately covered in <A
8812 HREF="smb.conf.5.html"
8813 TARGET="_top"
8814 > the smb.conf
8815 man page</A
8816 >.  For convenience, the parameters have been
8817 linked with the actual smb.conf description.</P
8818 ><P
8819 >Here is an example <TT
8820 CLASS="FILENAME"
8821 >smb.conf</TT
8822 > for acting as a PDC:</P
8823 ><P
8824 ><PRE
8825 CLASS="PROGRAMLISTING"
8826 >[global]
8827     ; Basic server settings
8828     <A
8829 HREF="smb.conf.5.html#NETBIOSNAME"
8830 TARGET="_top"
8831 >netbios name</A
8832 > = <TT
8833 CLASS="REPLACEABLE"
8834 ><I
8835 >POGO</I
8836 ></TT
8837 >
8838     <A
8839 HREF="smb.conf.5.html#WORKGROUP"
8840 TARGET="_top"
8841 >workgroup</A
8842 > = <TT
8843 CLASS="REPLACEABLE"
8844 ><I
8845 >NARNIA</I
8846 ></TT
8847 >
8848
8849     ; we should act as the domain and local master browser
8850     <A
8851 HREF="smb.conf.5.html#OSLEVEL"
8852 TARGET="_top"
8853 >os level</A
8854 > = 64
8855     <A
8856 HREF="smb.conf.5.html#PERFERREDMASTER"
8857 TARGET="_top"
8858 >preferred master</A
8859 > = yes
8860     <A
8861 HREF="smb.conf.5.html#DOMAINMASTER"
8862 TARGET="_top"
8863 >domain master</A
8864 > = yes
8865     <A
8866 HREF="smb.conf.5.html#LOCALMASTER"
8867 TARGET="_top"
8868 >local master</A
8869 > = yes
8870     
8871     ; security settings (must user security = user)
8872     <A
8873 HREF="smb.conf.5.html#SECURITYEQUALSUSER"
8874 TARGET="_top"
8875 >security</A
8876 > = user
8877     
8878     ; encrypted passwords are a requirement for a PDC
8879     <A
8880 HREF="smb.conf.5.html#ENCRYPTPASSWORDS"
8881 TARGET="_top"
8882 >encrypt passwords</A
8883 > = yes
8884     
8885     ; support domain logons
8886     <A
8887 HREF="smb.conf.5.html#DOMAINLOGONS"
8888 TARGET="_top"
8889 >domain logons</A
8890 > = yes
8891     
8892     ; where to store user profiles?
8893     <A
8894 HREF="smb.conf.5.html#LOGONPATH"
8895 TARGET="_top"
8896 >logon path</A
8897 > = \\%N\profiles\%u
8898     
8899     ; where is a user's home directory and where should it
8900     ; be mounted at?
8901     <A
8902 HREF="smb.conf.5.html#LOGONDRIVE"
8903 TARGET="_top"
8904 >logon drive</A
8905 > = H:
8906     <A
8907 HREF="smb.conf.5.html#LOGONHOME"
8908 TARGET="_top"
8909 >logon home</A
8910 > = \\homeserver\%u
8911     
8912     ; specify a generic logon script for all users
8913     ; this is a relative **DOS** path to the [netlogon] share
8914     <A
8915 HREF="smb.conf.5.html#LOGONSCRIPT"
8916 TARGET="_top"
8917 >logon script</A
8918 > = logon.cmd
8919
8920 ; necessary share for domain controller
8921 [netlogon]
8922     <A
8923 HREF="smb.conf.5.html#PATH"
8924 TARGET="_top"
8925 >path</A
8926 > = /usr/local/samba/lib/netlogon
8927     <A
8928 HREF="smb.conf.5.html#READONLY"
8929 TARGET="_top"
8930 >read only</A
8931 > = yes
8932     <A
8933 HREF="smb.conf.5.html#WRITELIST"
8934 TARGET="_top"
8935 >write list</A
8936 > = <TT
8937 CLASS="REPLACEABLE"
8938 ><I
8939 >ntadmin</I
8940 ></TT
8941 >
8942     
8943 ; share for storing user profiles
8944 [profiles]
8945     <A
8946 HREF="smb.conf.5.html#PATH"
8947 TARGET="_top"
8948 >path</A
8949 > = /export/smb/ntprofile
8950     <A
8951 HREF="smb.conf.5.html#READONLY"
8952 TARGET="_top"
8953 >read only</A
8954 > = no
8955     <A
8956 HREF="smb.conf.5.html#CREATEMASK"
8957 TARGET="_top"
8958 >create mask</A
8959 > = 0600
8960     <A
8961 HREF="smb.conf.5.html#DIRECTORYMASK"
8962 TARGET="_top"
8963 >directory mask</A
8964 > = 0700</PRE
8965 ></P
8966 ><P
8967 >There are a couple of points to emphasize in the above configuration.</P
8968 ><P
8969 ></P
8970 ><UL
8971 ><LI
8972 ><P
8973 >       Encrypted passwords must be enabled.  For more details on how 
8974         to do this, refer to <A
8975 HREF="ENCRYPTION.html"
8976 TARGET="_top"
8977 >ENCRYPTION.html</A
8978 >.
8979         </P
8980 ></LI
8981 ><LI
8982 ><P
8983 >       The server must support domain logons and a
8984         <TT
8985 CLASS="FILENAME"
8986 >[netlogon]</TT
8987 > share
8988         </P
8989 ></LI
8990 ><LI
8991 ><P
8992 >       The server must be the domain master browser in order for Windows 
8993         client to locate the server as a DC.  Please refer to the various 
8994         Network Browsing documentation included with this distribution for 
8995         details.
8996         </P
8997 ></LI
8998 ></UL
8999 ><P
9000 >As Samba 2.2 does not offer a complete implementation of group mapping
9001 between Windows NT groups and Unix groups (this is really quite
9002 complicated to explain in a short space), you should refer to the
9003 <A
9004 HREF="smb.conf.5.html#DOMAINADMINGROUP"
9005 TARGET="_top"
9006 >domain admin
9007 group</A
9008 > smb.conf parameter for information of creating "Domain
9009 Admins" style accounts.</P
9010 ></DIV
9011 ><DIV
9012 CLASS="SECT1"
9013 ><HR><H2
9014 CLASS="SECT1"
9015 ><A
9016 NAME="AEN1832"
9017 ></A
9018 >12.4. Creating Machine Trust Accounts and Joining Clients to the
9019 Domain</H2
9020 ><P
9021 >A machine trust account is a Samba account that is used to
9022 authenticate a client machine (rather than a user) to the Samba
9023 server.  In Windows terminology, this is known as a "Computer
9024 Account."</P
9025 ><P
9026 >The password of a machine trust account acts as the shared secret for
9027 secure communication with the Domain Controller.  This is a security
9028 feature to prevent an unauthorized machine with the same NetBIOS name
9029 from joining the domain and gaining access to domain user/group
9030 accounts.  Windows NT and 2000 clients use machine trust accounts, but
9031 Windows 9x clients do not.  Hence, a Windows 9x client is never a true
9032 member of a domain because it does not possess a machine trust
9033 account, and thus has no shared secret with the domain controller.</P
9034 ><P
9035 >A Windows PDC stores each machine trust account in the Windows
9036 Registry.  A Samba PDC, however, stores each machine trust account 
9037 in two parts, as follows:
9038
9039 <P
9040 ></P
9041 ><UL
9042 ><LI
9043 ><P
9044 >A Samba account, stored in the same location as user
9045     LanMan and NT password hashes (currently
9046     <TT
9047 CLASS="FILENAME"
9048 >smbpasswd</TT
9049 >). The Samba account 
9050     possesses and uses only the NT password hash.</P
9051 ></LI
9052 ><LI
9053 ><P
9054 >A corresponding Unix account, typically stored in
9055     <TT
9056 CLASS="FILENAME"
9057 >/etc/passwd</TT
9058 >. (Future releases will alleviate the need to
9059     create <TT
9060 CLASS="FILENAME"
9061 >/etc/passwd</TT
9062 > entries.) </P
9063 ></LI
9064 ></UL
9065 ></P
9066 ><P
9067 >There are two ways to create machine trust accounts:</P
9068 ><P
9069 ></P
9070 ><UL
9071 ><LI
9072 ><P
9073 > Manual creation. Both the Samba and corresponding
9074         Unix account are created by hand.</P
9075 ></LI
9076 ><LI
9077 ><P
9078 > "On-the-fly" creation. The Samba machine trust
9079         account is automatically created by Samba at the time the client
9080         is joined to the domain. (For security, this is the
9081         recommended method.) The corresponding Unix account may be
9082         created automatically or manually. </P
9083 ></LI
9084 ></UL
9085 ><DIV
9086 CLASS="SECT2"
9087 ><HR><H3
9088 CLASS="SECT2"
9089 ><A
9090 NAME="AEN1851"
9091 ></A
9092 >12.4.1. Manual Creation of Machine Trust Accounts</H3
9093 ><P
9094 >The first step in manually creating a machine trust account is to
9095 manually create the corresponding Unix account in
9096 <TT
9097 CLASS="FILENAME"
9098 >/etc/passwd</TT
9099 >.  This can be done using
9100 <B
9101 CLASS="COMMAND"
9102 >vipw</B
9103 > or other 'add user' command that is normally
9104 used to create new Unix accounts.  The following is an example for a
9105 Linux based Samba server:</P
9106 ><P
9107 >  <TT
9108 CLASS="PROMPT"
9109 >root# </TT
9110 ><B
9111 CLASS="COMMAND"
9112 >/usr/sbin/useradd -g 100 -d /dev/null -c <TT
9113 CLASS="REPLACEABLE"
9114 ><I
9115 >"machine 
9116 nickname"</I
9117 ></TT
9118 > -s /bin/false <TT
9119 CLASS="REPLACEABLE"
9120 ><I
9121 >machine_name</I
9122 ></TT
9123 >$ </B
9124 ></P
9125 ><P
9126 ><TT
9127 CLASS="PROMPT"
9128 >root# </TT
9129 ><B
9130 CLASS="COMMAND"
9131 >passwd -l <TT
9132 CLASS="REPLACEABLE"
9133 ><I
9134 >machine_name</I
9135 ></TT
9136 >$</B
9137 ></P
9138 ><P
9139 >The <TT
9140 CLASS="FILENAME"
9141 >/etc/passwd</TT
9142 > entry will list the machine name 
9143 with a "$" appended, won't have a password, will have a null shell and no 
9144 home directory. For example a machine named 'doppy' would have an 
9145 <TT
9146 CLASS="FILENAME"
9147 >/etc/passwd</TT
9148 > entry like this:</P
9149 ><P
9150 ><PRE
9151 CLASS="PROGRAMLISTING"
9152 >doppy$:x:505:501:<TT
9153 CLASS="REPLACEABLE"
9154 ><I
9155 >machine_nickname</I
9156 ></TT
9157 >:/dev/null:/bin/false</PRE
9158 ></P
9159 ><P
9160 >Above, <TT
9161 CLASS="REPLACEABLE"
9162 ><I
9163 >machine_nickname</I
9164 ></TT
9165 > can be any
9166 descriptive name for the client, i.e., BasementComputer.
9167 <TT
9168 CLASS="REPLACEABLE"
9169 ><I
9170 >machine_name</I
9171 ></TT
9172 > absolutely must be the NetBIOS
9173 name of the client to be joined to the domain.  The "$" must be
9174 appended to the NetBIOS name of the client or Samba will not recognize
9175 this as a machine trust account.</P
9176 ><P
9177 >Now that the corresponding Unix account has been created, the next step is to create 
9178 the Samba account for the client containing the well-known initial 
9179 machine trust account password.  This can be done using the <A
9180 HREF="smbpasswd.8.html"
9181 TARGET="_top"
9182 ><B
9183 CLASS="COMMAND"
9184 >smbpasswd(8)</B
9185 ></A
9186 > command 
9187 as shown here:</P
9188 ><P
9189 ><TT
9190 CLASS="PROMPT"
9191 >root# </TT
9192 ><B
9193 CLASS="COMMAND"
9194 >smbpasswd -a -m <TT
9195 CLASS="REPLACEABLE"
9196 ><I
9197 >machine_name</I
9198 ></TT
9199 ></B
9200 ></P
9201 ><P
9202 >where <TT
9203 CLASS="REPLACEABLE"
9204 ><I
9205 >machine_name</I
9206 ></TT
9207 > is the machine's NetBIOS
9208 name.  The RID of the new machine account is generated from the UID of 
9209 the corresponding Unix account.</P
9210 ><DIV
9211 CLASS="WARNING"
9212 ><P
9213 ></P
9214 ><TABLE
9215 CLASS="WARNING"
9216 WIDTH="100%"
9217 BORDER="0"
9218 ><TR
9219 ><TD
9220 WIDTH="25"
9221 ALIGN="CENTER"
9222 VALIGN="TOP"
9223 ><IMG
9224 SRC="/docbook-dsssl/warning.gif"
9225 HSPACE="5"
9226 ALT="Warning"></TD
9227 ><TH
9228 ALIGN="LEFT"
9229 VALIGN="CENTER"
9230 ><B
9231 >Join the client to the domain immediately</B
9232 ></TH
9233 ></TR
9234 ><TR
9235 ><TD
9236 >&nbsp;</TD
9237 ><TD
9238 ALIGN="LEFT"
9239 VALIGN="TOP"
9240 ><P
9241 >       Manually creating a machine trust account using this method is the 
9242         equivalent of creating a machine trust account on a Windows NT PDC using 
9243         the "Server Manager".  From the time at which the account is created
9244         to the time which the client joins the domain and changes the password,
9245         your domain is vulnerable to an intruder joining your domain using a
9246         a machine with the same NetBIOS name.  A PDC inherently trusts
9247         members of the domain and will serve out a large degree of user 
9248         information to such clients.  You have been warned!
9249         </P
9250 ></TD
9251 ></TR
9252 ></TABLE
9253 ></DIV
9254 ></DIV
9255 ><DIV
9256 CLASS="SECT2"
9257 ><HR><H3
9258 CLASS="SECT2"
9259 ><A
9260 NAME="AEN1886"
9261 ></A
9262 >12.4.2. "On-the-Fly" Creation of Machine Trust Accounts</H3
9263 ><P
9264 >The second (and recommended) way of creating machine trust accounts is
9265 simply to allow the Samba server to create them as needed when the client
9266 is joined to the domain. </P
9267 ><P
9268 >Since each Samba machine trust account requires a corresponding
9269 Unix account, a method for automatically creating the
9270 Unix account is usually supplied; this requires configuration of the
9271 <A
9272 HREF="smb.conf.5.html#ADDUSERSCRIPT"
9273 TARGET="_top"
9274 >add user script</A
9275
9276 option in <TT
9277 CLASS="FILENAME"
9278 >smb.conf</TT
9279 >.  This
9280 method is not required, however; corresponding Unix accounts may also
9281 be created manually.</P
9282 ><P
9283 >Below is an example for a RedHat 6.2 Linux system.</P
9284 ><P
9285 ><PRE
9286 CLASS="PROGRAMLISTING"
9287 >[global]
9288    # &#60;...remainder of parameters...&#62;
9289    add user script = /usr/sbin/useradd -d /dev/null -g 100 -s /bin/false -M %u </PRE
9290 ></P
9291 ></DIV
9292 ><DIV
9293 CLASS="SECT2"
9294 ><HR><H3
9295 CLASS="SECT2"
9296 ><A
9297 NAME="AEN1895"
9298 ></A
9299 >12.4.3. Joining the Client to the Domain</H3
9300 ><P
9301 >The procedure for joining a client to the domain varies with the
9302 version of Windows.</P
9303 ><P
9304 ></P
9305 ><UL
9306 ><LI
9307 ><P
9308 ><SPAN
9309 CLASS="emphasis"
9310 ><I
9311 CLASS="EMPHASIS"
9312 >Windows 2000</I
9313 ></SPAN
9314 ></P
9315 ><P
9316 > When the user elects to join the client to a domain, Windows prompts for
9317         an account and password that is privileged to join the domain.  A
9318         Samba administrative account (i.e., a Samba account that has root
9319         privileges on the Samba server) must be entered here; the
9320         operation will fail if an ordinary user account is given. 
9321         The password for this account should be
9322         set to a different password than the associated
9323         <TT
9324 CLASS="FILENAME"
9325 >/etc/passwd</TT
9326 > entry, for security
9327         reasons. </P
9328 ><P
9329 >The session key of the Samba administrative account acts as an
9330         encryption key for setting the password of the machine trust
9331         account. The machine trust account will be created on-the-fly, or
9332         updated if it already exists.</P
9333 ></LI
9334 ><LI
9335 ><P
9336 ><SPAN
9337 CLASS="emphasis"
9338 ><I
9339 CLASS="EMPHASIS"
9340 >Windows NT</I
9341 ></SPAN
9342 ></P
9343 ><P
9344 > If the machine trust account was created manually, on the
9345         Identification Changes menu enter the domain name, but do not
9346         check the box "Create a Computer Account in the Domain."  In this case,
9347         the existing machine trust account is used to join the machine to
9348         the domain.</P
9349 ><P
9350 > If the machine trust account is to be created
9351         on-the-fly, on the Identification Changes menu enter the domain
9352         name, and check the box "Create a Computer Account in the Domain."  In
9353         this case, joining the domain proceeds as above for Windows 2000
9354         (i.e., you must supply a Samba administrative account when
9355         prompted).</P
9356 ></LI
9357 ></UL
9358 ></DIV
9359 ></DIV
9360 ><DIV
9361 CLASS="SECT1"
9362 ><HR><H2
9363 CLASS="SECT1"
9364 ><A
9365 NAME="AEN1910"
9366 ></A
9367 >12.5. Common Problems and Errors</H2
9368 ><P
9369 ></P
9370 ><P
9371 ></P
9372 ><UL
9373 ><LI
9374 ><P
9375 >       <SPAN
9376 CLASS="emphasis"
9377 ><I
9378 CLASS="EMPHASIS"
9379 >I cannot include a '$' in a machine name.</I
9380 ></SPAN
9381 >
9382         </P
9383 ><P
9384 >       A 'machine name' in (typically) <TT
9385 CLASS="FILENAME"
9386 >/etc/passwd</TT
9387 >       
9388         of the machine name with a '$' appended. FreeBSD (and other BSD 
9389         systems?) won't create a user with a '$' in their name.
9390         </P
9391 ><P
9392 >       The problem is only in the program used to make the entry, once 
9393         made, it works perfectly. So create a user without the '$' and 
9394         use <B
9395 CLASS="COMMAND"
9396 >vipw</B
9397 > to edit the entry, adding the '$'. Or create 
9398         the whole entry with vipw if you like, make sure you use a 
9399         unique User ID !
9400         </P
9401 ></LI
9402 ><LI
9403 ><P
9404 >       <SPAN
9405 CLASS="emphasis"
9406 ><I
9407 CLASS="EMPHASIS"
9408 >I get told "You already have a connection to the Domain...." 
9409         or "Cannot join domain, the credentials supplied conflict with an 
9410         existing set.." when creating a machine trust account.</I
9411 ></SPAN
9412 >
9413         </P
9414 ><P
9415 >       This happens if you try to create a machine trust account from the 
9416         machine itself and already have a connection (e.g. mapped drive) 
9417         to a share (or IPC$) on the Samba PDC.  The following command
9418         will remove all network drive connections:
9419         </P
9420 ><P
9421 >       <TT
9422 CLASS="PROMPT"
9423 >C:\WINNT\&#62;</TT
9424 > <B
9425 CLASS="COMMAND"
9426 >net use * /d</B
9427 >
9428         </P
9429 ><P
9430 >       Further, if the machine is a already a 'member of a workgroup' that 
9431         is the same name as the domain you are joining (bad idea) you will 
9432         get this message.  Change the workgroup name to something else, it 
9433         does not matter what, reboot, and try again.
9434         </P
9435 ></LI
9436 ><LI
9437 ><P
9438 >       <SPAN
9439 CLASS="emphasis"
9440 ><I
9441 CLASS="EMPHASIS"
9442 >The system can not log you on (C000019B)....</I
9443 ></SPAN
9444 >
9445         </P
9446 ><P
9447 >I joined the domain successfully but after upgrading 
9448         to a newer version of the Samba code I get the message, "The system 
9449         can not log you on (C000019B), Please try a gain or consult your 
9450         system administrator" when attempting to logon.
9451         </P
9452 ><P
9453 >       This occurs when the domain SID stored in 
9454         <TT
9455 CLASS="FILENAME"
9456 >private/WORKGROUP.SID</TT
9457 > is 
9458         changed.  For example, you remove the file and <B
9459 CLASS="COMMAND"
9460 >smbd</B
9461 > automatically 
9462         creates a new one.  Or you are swapping back and forth between 
9463         versions 2.0.7, TNG and the HEAD branch code (not recommended).  The 
9464         only way to correct the problem is to restore the original domain 
9465         SID or remove the domain client from the domain and rejoin.
9466         </P
9467 ></LI
9468 ><LI
9469 ><P
9470 >       <SPAN
9471 CLASS="emphasis"
9472 ><I
9473 CLASS="EMPHASIS"
9474 >The machine trust account for this computer either does not 
9475         exist or is not accessible.</I
9476 ></SPAN
9477 >
9478         </P
9479 ><P
9480 >       When I try to join the domain I get the message "The machine account 
9481         for this computer either does not exist or is not accessible". What's 
9482         wrong?
9483         </P
9484 ><P
9485 >       This problem is caused by the PDC not having a suitable machine trust account. 
9486         If you are using the <TT
9487 CLASS="PARAMETER"
9488 ><I
9489 >add user script</I
9490 ></TT
9491 > method to create 
9492         accounts then this would indicate that it has not worked. Ensure the domain 
9493         admin user system is working.
9494         </P
9495 ><P
9496 >       Alternatively if you are creating account entries manually then they 
9497         have not been created correctly. Make sure that you have the entry 
9498         correct for the machine trust account in smbpasswd file on the Samba PDC. 
9499         If you added the account using an editor rather than using the smbpasswd 
9500         utility, make sure that the account name is the machine NetBIOS name 
9501         with a '$' appended to it ( i.e. computer_name$ ). There must be an entry 
9502         in both /etc/passwd and the smbpasswd file. Some people have reported 
9503         that inconsistent subnet masks between the Samba server and the NT 
9504         client have caused this problem.   Make sure that these are consistent 
9505         for both client and server.
9506         </P
9507 ></LI
9508 ><LI
9509 ><P
9510 >       <SPAN
9511 CLASS="emphasis"
9512 ><I
9513 CLASS="EMPHASIS"
9514 >When I attempt to login to a Samba Domain from a NT4/W2K workstation,
9515         I get a message about my account being disabled.</I
9516 ></SPAN
9517 >
9518         </P
9519 ><P
9520 >       This problem is caused by a PAM related bug in Samba 2.2.0.  This bug is 
9521         fixed in 2.2.1.  Other symptoms could be unaccessible shares on 
9522         NT/W2K member servers in the domain or the following error in your smbd.log:
9523         passdb/pampass.c:pam_account(268) PAM: UNKNOWN ERROR for User: %user%
9524         </P
9525 ><P
9526 >       At first be ensure to enable the useraccounts with <B
9527 CLASS="COMMAND"
9528 >smbpasswd -e 
9529         %user%</B
9530 >, this is normally done, when you create an account.
9531         </P
9532 ><P
9533 >       In order to work around this problem in 2.2.0, configure the 
9534         <TT
9535 CLASS="PARAMETER"
9536 ><I
9537 >account</I
9538 ></TT
9539 > control flag in 
9540         <TT
9541 CLASS="FILENAME"
9542 >/etc/pam.d/samba</TT
9543 > file as follows:
9544         </P
9545 ><P
9546 ><PRE
9547 CLASS="PROGRAMLISTING"
9548 >       account required        pam_permit.so
9549         </PRE
9550 ></P
9551 ><P
9552 >       If you want to remain backward compatibility to samba 2.0.x use
9553         <TT
9554 CLASS="FILENAME"
9555 >pam_permit.so</TT
9556 >, it's also possible to use 
9557         <TT
9558 CLASS="FILENAME"
9559 >pam_pwdb.so</TT
9560 >. There are some bugs if you try to 
9561         use <TT
9562 CLASS="FILENAME"
9563 >pam_unix.so</TT
9564 >, if you need this, be ensure to use
9565         the most recent version of this file.
9566         </P
9567 ></LI
9568 ></UL
9569 ></DIV
9570 ><DIV
9571 CLASS="SECT1"
9572 ><HR><H2
9573 CLASS="SECT1"
9574 ><A
9575 NAME="AEN1958"
9576 ></A
9577 >12.6. System Policies and Profiles</H2
9578 ><P
9579 >Much of the information necessary to implement System Policies and
9580 Roving User Profiles in a Samba domain is the same as that for 
9581 implementing these same items in a Windows NT 4.0 domain. 
9582 You should read the white paper <A
9583 HREF="http://www.microsoft.com/ntserver/management/deployment/planguide/prof_policies.asp"
9584 TARGET="_top"
9585 >Implementing
9586 Profiles and Policies in Windows NT 4.0</A
9587 > available from Microsoft.</P
9588 ><P
9589 >Here are some additional details:</P
9590 ><P
9591 ></P
9592 ><UL
9593 ><LI
9594 ><P
9595 >       <SPAN
9596 CLASS="emphasis"
9597 ><I
9598 CLASS="EMPHASIS"
9599 >What about Windows NT Policy Editor?</I
9600 ></SPAN
9601 >
9602         </P
9603 ><P
9604 >       To create or edit <TT
9605 CLASS="FILENAME"
9606 >ntconfig.pol</TT
9607 > you must use 
9608         the NT Server Policy Editor, <B
9609 CLASS="COMMAND"
9610 >poledit.exe</B
9611 >       which 
9612         is included with NT Server but <SPAN
9613 CLASS="emphasis"
9614 ><I
9615 CLASS="EMPHASIS"
9616 >not NT Workstation</I
9617 ></SPAN
9618 >. 
9619         There is a Policy Editor on a NTws 
9620         but it is not suitable for creating <SPAN
9621 CLASS="emphasis"
9622 ><I
9623 CLASS="EMPHASIS"
9624 >Domain Policies</I
9625 ></SPAN
9626 >. 
9627         Further, although the Windows 95 
9628         Policy Editor can be installed on an NT Workstation/Server, it will not
9629         work with NT policies because the registry key that are set by the policy templates. 
9630         However, the files from the NT Server will run happily enough on an NTws.       
9631         You need <TT
9632 CLASS="FILENAME"
9633 >poledit.exe, common.adm</TT
9634 > and <TT
9635 CLASS="FILENAME"
9636 >winnt.adm</TT
9637 >. It is convenient
9638         to put the two *.adm files in <TT
9639 CLASS="FILENAME"
9640 >c:\winnt\inf</TT
9641 > which is where
9642         the binary will look for them unless told otherwise. Note also that that 
9643         directory is 'hidden'.
9644         </P
9645 ><P
9646 >       The Windows NT policy editor is also included with the Service Pack 3 (and 
9647         later) for Windows NT 4.0. Extract the files using <B
9648 CLASS="COMMAND"
9649 >servicepackname /x</B
9650 >, 
9651         i.e. that's <B
9652 CLASS="COMMAND"
9653 >Nt4sp6ai.exe /x</B
9654 > for service pack 6a.  The policy editor, 
9655         <B
9656 CLASS="COMMAND"
9657 >poledit.exe</B
9658 > and the associated template files (*.adm) should
9659         be extracted as well.  It is also possible to downloaded the policy template 
9660         files for Office97 and get a copy of the policy editor.  Another possible 
9661         location is with the Zero Administration Kit available for download from Microsoft.
9662         </P
9663 ></LI
9664 ><LI
9665 ><P
9666 >       <SPAN
9667 CLASS="emphasis"
9668 ><I
9669 CLASS="EMPHASIS"
9670 >Can Win95 do Policies?</I
9671 ></SPAN
9672 >
9673         </P
9674 ><P
9675 >       Install the group policy handler for Win9x to pick up group 
9676         policies.   Look on the Win98 CD in <TT
9677 CLASS="FILENAME"
9678 >\tools\reskit\netadmin\poledit</TT
9679 >. 
9680         Install group policies on a Win9x client by double-clicking 
9681         <TT
9682 CLASS="FILENAME"
9683 >grouppol.inf</TT
9684 >. Log off and on again a couple of 
9685         times and see if Win98 picks up group policies.  Unfortunately this needs 
9686         to be done on every Win9x machine that uses group policies....
9687         </P
9688 ><P
9689 >       If group policies don't work one reports suggests getting the updated 
9690         (read: working) grouppol.dll for Windows 9x. The group list is grabbed 
9691         from /etc/group.
9692         </P
9693 ></LI
9694 ><LI
9695 ><P
9696 >       <SPAN
9697 CLASS="emphasis"
9698 ><I
9699 CLASS="EMPHASIS"
9700 >How do I get 'User Manager' and 'Server Manager'</I
9701 ></SPAN
9702 >
9703         </P
9704 ><P
9705 >       Since I don't need to buy an NT Server CD now, how do I get 
9706         the 'User Manager for Domains', the 'Server Manager'?
9707         </P
9708 ><P
9709 >       Microsoft distributes a version of these tools called nexus for 
9710         installation on Windows 95 systems.  The tools set includes
9711         </P
9712 ><P
9713 ></P
9714 ><UL
9715 ><LI
9716 ><P
9717 >Server Manager</P
9718 ></LI
9719 ><LI
9720 ><P
9721 >User Manager for Domains</P
9722 ></LI
9723 ><LI
9724 ><P
9725 >Event Viewer</P
9726 ></LI
9727 ></UL
9728 ><P
9729 >       Click here to download the archived file <A
9730 HREF="ftp://ftp.microsoft.com/Softlib/MSLFILES/NEXUS.EXE"
9731 TARGET="_top"
9732 >ftp://ftp.microsoft.com/Softlib/MSLFILES/NEXUS.EXE</A
9733 >
9734         </P
9735 ><P
9736 >       The Windows NT 4.0 version of the 'User Manager for 
9737         Domains' and 'Server Manager' are available from Microsoft via ftp 
9738         from <A
9739 HREF="ftp://ftp.microsoft.com/Softlib/MSLFILES/SRVTOOLS.EXE"
9740 TARGET="_top"
9741 >ftp://ftp.microsoft.com/Softlib/MSLFILES/SRVTOOLS.EXE</A
9742 >
9743         </P
9744 ></LI
9745 ></UL
9746 ></DIV
9747 ><DIV
9748 CLASS="SECT1"
9749 ><HR><H2
9750 CLASS="SECT1"
9751 ><A
9752 NAME="AEN2002"
9753 ></A
9754 >12.7. What other help can I get?</H2
9755 ><P
9756 >There are many sources of information available in the form 
9757 of mailing lists, RFC's and documentation.  The docs that come 
9758 with the samba distribution contain very good explanations of 
9759 general SMB topics such as browsing.</P
9760 ><P
9761 ></P
9762 ><UL
9763 ><LI
9764 ><P
9765 >       <SPAN
9766 CLASS="emphasis"
9767 ><I
9768 CLASS="EMPHASIS"
9769 >What are some diagnostics tools I can use to debug the domain logon 
9770         process and where can I find them?</I
9771 ></SPAN
9772 >
9773         </P
9774 ><P
9775 >       One of the best diagnostic tools for debugging problems is Samba itself.  
9776         You can use the -d option for both smbd and nmbd to specify what 
9777         'debug level' at which to run.  See the man pages on smbd, nmbd  and 
9778         smb.conf for more information on debugging options.  The debug 
9779         level can range from 1 (the default) to 10 (100 for debugging passwords).
9780         </P
9781 ><P
9782 >       Another helpful method of debugging is to compile samba using the 
9783         <B
9784 CLASS="COMMAND"
9785 >gcc -g </B
9786 > flag.   This will include debug 
9787         information in the binaries and allow you to attach gdb to the 
9788         running smbd / nmbd process.  In order to attach gdb to an smbd 
9789         process for an NT workstation, first get the workstation to make the 
9790         connection. Pressing ctrl-alt-delete and going down to the domain box 
9791         is sufficient (at least, on the first time you join the domain) to 
9792         generate a 'LsaEnumTrustedDomains'. Thereafter, the workstation 
9793         maintains an open connection, and therefore there will be an smbd 
9794         process running (assuming that you haven't set a really short smbd 
9795         idle timeout)  So, in between pressing ctrl alt delete, and actually 
9796         typing in your password, you can gdb attach and continue.
9797         </P
9798 ><P
9799 >       Some useful samba commands worth investigating:
9800         </P
9801 ><P
9802 ></P
9803 ><UL
9804 ><LI
9805 ><P
9806 >testparam | more</P
9807 ></LI
9808 ><LI
9809 ><P
9810 >smbclient -L //{netbios name of server}</P
9811 ></LI
9812 ></UL
9813 ><P
9814 >       An SMB enabled version of tcpdump is available from 
9815         <A
9816 HREF="http://www.tcpdump.org/"
9817 TARGET="_top"
9818 >http://www.tcpdup.org/</A
9819 >.
9820         Ethereal, another good packet sniffer for Unix and Win32
9821         hosts, can be downloaded from <A
9822 HREF="http://www.ethereal.com/"
9823 TARGET="_top"
9824 >http://www.ethereal.com</A
9825 >.
9826         </P
9827 ><P
9828 >       For tracing things on the Microsoft Windows NT, Network Monitor 
9829         (aka. netmon) is available on the Microsoft Developer Network CD's, 
9830         the Windows NT Server install CD and the SMS CD's.  The version of 
9831         netmon that ships with SMS allows for dumping packets between any two 
9832         computers (i.e. placing the network interface in promiscuous mode).  
9833         The version on the NT Server install CD will only allow monitoring 
9834         of network traffic directed to the local NT box and broadcasts on the 
9835         local subnet.  Be aware that Ethereal can read and write netmon 
9836         formatted files.
9837         </P
9838 ></LI
9839 ><LI
9840 ><P
9841 >       <SPAN
9842 CLASS="emphasis"
9843 ><I
9844 CLASS="EMPHASIS"
9845 >How do I install 'Network Monitor' on an NT Workstation 
9846         or a Windows 9x box?</I
9847 ></SPAN
9848 >
9849         </P
9850 ><P
9851 >       Installing netmon on an NT workstation requires a couple 
9852         of steps.  The following are for installing Netmon V4.00.349, which comes 
9853         with Microsoft Windows NT Server 4.0, on Microsoft Windows NT 
9854         Workstation 4.0.  The process should be similar for other version of 
9855         Windows NT / Netmon.  You will need both the Microsoft Windows 
9856         NT Server 4.0 Install CD and the Workstation 4.0 Install CD.
9857         </P
9858 ><P
9859 >       Initially you will need to install 'Network Monitor Tools and Agent' 
9860         on the NT Server.  To do this 
9861         </P
9862 ><P
9863 ></P
9864 ><UL
9865 ><LI
9866 ><P
9867 >Goto Start - Settings - Control Panel - 
9868                 Network - Services - Add </P
9869 ></LI
9870 ><LI
9871 ><P
9872 >Select the 'Network Monitor Tools and Agent' and 
9873                 click on 'OK'.</P
9874 ></LI
9875 ><LI
9876 ><P
9877 >Click 'OK' on the Network Control Panel.
9878                 </P
9879 ></LI
9880 ><LI
9881 ><P
9882 >Insert the Windows NT Server 4.0 install CD 
9883                 when prompted.</P
9884 ></LI
9885 ></UL
9886 ><P
9887 >       At this point the Netmon files should exist in 
9888         <TT
9889 CLASS="FILENAME"
9890 >%SYSTEMROOT%\System32\netmon\*.*</TT
9891 >.    
9892         Two subdirectories exist as well, <TT
9893 CLASS="FILENAME"
9894 >parsers\</TT
9895
9896         which contains the necessary DLL's for parsing the netmon packet 
9897         dump, and <TT
9898 CLASS="FILENAME"
9899 >captures\</TT
9900 >.
9901         </P
9902 ><P
9903 >       In order to install the Netmon tools on an NT Workstation, you will 
9904         first need to install the 'Network  Monitor Agent' from the Workstation 
9905         install CD.
9906         </P
9907 ><P
9908 ></P
9909 ><UL
9910 ><LI
9911 ><P
9912 >Goto Start - Settings - Control Panel - 
9913                 Network - Services - Add</P
9914 ></LI
9915 ><LI
9916 ><P
9917 >Select the 'Network Monitor Agent' and click 
9918                 on 'OK'.</P
9919 ></LI
9920 ><LI
9921 ><P
9922 >Click 'OK' on the Network Control Panel.
9923                 </P
9924 ></LI
9925 ><LI
9926 ><P
9927 >Insert the Windows NT Workstation 4.0 install 
9928                 CD when prompted.</P
9929 ></LI
9930 ></UL
9931 ><P
9932 >       Now copy the files from the NT Server in %SYSTEMROOT%\System32\netmon\*.* 
9933         to %SYSTEMROOT%\System32\netmon\*.* on the Workstation and set 
9934         permissions as  you deem appropriate for your site. You will need 
9935         administrative rights on the NT box to run netmon.
9936         </P
9937 ><P
9938 >       To install Netmon on a Windows 9x box install the network monitor agent 
9939         from the Windows 9x CD (\admin\nettools\netmon).  There is a readme 
9940         file located with the netmon driver files on the CD if you need 
9941         information on how to do this.  Copy the files from a working 
9942         Netmon installation.
9943         </P
9944 ></LI
9945 ><LI
9946 ><P
9947 >       The following is a list if helpful URLs and other links:
9948         </P
9949 ><P
9950 ></P
9951 ><UL
9952 ><LI
9953 ><P
9954 >Home of Samba site <A
9955 HREF="http://samba.org"
9956 TARGET="_top"
9957 >        http://samba.org</A
9958 >. We have a mirror near you !</P
9959 ></LI
9960 ><LI
9961 ><P
9962 > The <SPAN
9963 CLASS="emphasis"
9964 ><I
9965 CLASS="EMPHASIS"
9966 >Development</I
9967 ></SPAN
9968 > document 
9969         on the Samba mirrors might mention your problem. If so,
9970         it might mean that the developers are working on it.</P
9971 ></LI
9972 ><LI
9973 ><P
9974 >See how Scott Merrill simulates a BDC behavior at 
9975         <A
9976 HREF="http://www.skippy.net/linux/smb-howto.html"
9977 TARGET="_top"
9978 >        http://www.skippy.net/linux/smb-howto.html</A
9979 >. </P
9980 ></LI
9981 ><LI
9982 ><P
9983 >Although 2.0.7 has almost had its day as a PDC, David Bannon will
9984         keep the 2.0.7 PDC pages at <A
9985 HREF="http://bioserve.latrobe.edu.au/samba"
9986 TARGET="_top"
9987 >        http://bioserve.latrobe.edu.au/samba</A
9988 > going for a while yet.</P
9989 ></LI
9990 ><LI
9991 ><P
9992 >Misc links to CIFS information 
9993         <A
9994 HREF="http://samba.org/cifs/"
9995 TARGET="_top"
9996 >http://samba.org/cifs/</A
9997 ></P
9998 ></LI
9999 ><LI
10000 ><P
10001 >NT Domains for Unix <A
10002 HREF="http://mailhost.cb1.com/~lkcl/ntdom/"
10003 TARGET="_top"
10004 >        http://mailhost.cb1.com/~lkcl/ntdom/</A
10005 ></P
10006 ></LI
10007 ><LI
10008 ><P
10009 >FTP site for older SMB specs: 
10010         <A
10011 HREF="ftp://ftp.microsoft.com/developr/drg/CIFS/"
10012 TARGET="_top"
10013 >        ftp://ftp.microsoft.com/developr/drg/CIFS/</A
10014 ></P
10015 ></LI
10016 ></UL
10017 ></LI
10018 ></UL
10019 ><P
10020 ></P
10021 ><UL
10022 ><LI
10023 ><P
10024 >       <SPAN
10025 CLASS="emphasis"
10026 ><I
10027 CLASS="EMPHASIS"
10028 >How do I get help from the mailing lists?</I
10029 ></SPAN
10030 >
10031         </P
10032 ><P
10033 >       There are a number of Samba related mailing lists. Go to <A
10034 HREF="http://samba.org"
10035 TARGET="_top"
10036 >http://samba.org</A
10037 >, click on your nearest mirror
10038         and then click on <B
10039 CLASS="COMMAND"
10040 >Support</B
10041 > and then click on <B
10042 CLASS="COMMAND"
10043 >       Samba related mailing lists</B
10044 >.
10045         </P
10046 ><P
10047 >       For questions relating to Samba TNG go to
10048         <A
10049 HREF="http://www.samba-tng.org/"
10050 TARGET="_top"
10051 >http://www.samba-tng.org/</A
10052
10053         It has been requested that you don't post questions about Samba-TNG to the
10054         main stream Samba lists.</P
10055 ><P
10056 >       If you post a message to one of the lists please observe the following guide lines :
10057         </P
10058 ><P
10059 ></P
10060 ><UL
10061 ><LI
10062 ><P
10063 > Always remember that the developers are volunteers, they are 
10064                 not paid and they never guarantee to produce a particular feature at 
10065                 a particular time. Any time lines are 'best guess' and nothing more.
10066                 </P
10067 ></LI
10068 ><LI
10069 ><P
10070 > Always mention what version of samba you are using and what 
10071                 operating system its running under. You should probably list the
10072         relevant sections of your smb.conf file, at least the options 
10073         in [global] that affect PDC support.</P
10074 ></LI
10075 ><LI
10076 ><P
10077 >In addition to the version, if you obtained Samba via
10078         CVS mention the date when you last checked it out.</P
10079 ></LI
10080 ><LI
10081 ><P
10082 > Try and make your question clear and brief, lots of long, 
10083                 convoluted questions get deleted before they are completely read ! 
10084                 Don't post html encoded messages (if you can select colour or font 
10085                 size its html).</P
10086 ></LI
10087 ><LI
10088 ><P
10089 > If you run one of those nifty 'I'm on holidays' things when 
10090                 you are away, make sure its configured  to not answer mailing lists.
10091                 </P
10092 ></LI
10093 ><LI
10094 ><P
10095 > Don't cross post. Work out which is the best list to post to 
10096                 and see what happens, i.e. don't post to both samba-ntdom and samba-technical.
10097         Many people active on the lists subscribe to more 
10098                 than one list and get annoyed to see the same message two or more times. 
10099                 Often someone will see a message and thinking it would be better dealt 
10100                 with on another, will forward it on for you.</P
10101 ></LI
10102 ><LI
10103 ><P
10104 >You might include <SPAN
10105 CLASS="emphasis"
10106 ><I
10107 CLASS="EMPHASIS"
10108 >partial</I
10109 ></SPAN
10110 >
10111         log files written at a debug level set to as much as 20.  
10112         Please don't send the entire log but enough to give the context of the 
10113         error messages.</P
10114 ></LI
10115 ><LI
10116 ><P
10117 >(Possibly) If you have a complete netmon trace ( from the opening of 
10118         the pipe to the error ) you can send the *.CAP file as well.</P
10119 ></LI
10120 ><LI
10121 ><P
10122 >Please think carefully before attaching a document to an email.
10123         Consider pasting the relevant parts into the body of the message. The samba
10124         mailing lists go to a huge number of people, do they all need a copy of your 
10125         smb.conf in their attach directory?</P
10126 ></LI
10127 ></UL
10128 ></LI
10129 ><LI
10130 ><P
10131 >       <SPAN
10132 CLASS="emphasis"
10133 ><I
10134 CLASS="EMPHASIS"
10135 >How do I get off the mailing lists?</I
10136 ></SPAN
10137 >
10138         </P
10139 ><P
10140 >To have your name removed from a samba mailing list, go to the
10141         same place you went to to get on it. Go to <A
10142 HREF="http://lists.samba.org/"
10143 TARGET="_top"
10144 >http://lists.samba.org</A
10145 >, 
10146         click on your nearest mirror and then click on <B
10147 CLASS="COMMAND"
10148 >Support</B
10149 > and 
10150         then click on <B
10151 CLASS="COMMAND"
10152 > Samba related mailing lists</B
10153 >. Or perhaps see 
10154         <A
10155 HREF="http://lists.samba.org/mailman/roster/samba-ntdom"
10156 TARGET="_top"
10157 >here</A
10158 >
10159         </P
10160 ><P
10161 >       Please don't post messages to the list asking to be removed, you will just
10162         be referred to the above address (unless that process failed in some way...)
10163         </P
10164 ></LI
10165 ></UL
10166 ></DIV
10167 ><DIV
10168 CLASS="SECT1"
10169 ><HR><H2
10170 CLASS="SECT1"
10171 ><A
10172 NAME="AEN2116"
10173 ></A
10174 >12.8. Domain Control for Windows 9x/ME</H2
10175 ><DIV
10176 CLASS="NOTE"
10177 ><P
10178 ></P
10179 ><TABLE
10180 CLASS="NOTE"
10181 WIDTH="100%"
10182 BORDER="0"
10183 ><TR
10184 ><TD
10185 WIDTH="25"
10186 ALIGN="CENTER"
10187 VALIGN="TOP"
10188 ><IMG
10189 SRC="/docbook-dsssl/note.gif"
10190 HSPACE="5"
10191 ALT="Note"></TD
10192 ><TD
10193 ALIGN="LEFT"
10194 VALIGN="TOP"
10195 ><P
10196 >The following section contains much of the original 
10197 DOMAIN.txt file previously included with Samba.  Much of 
10198 the material is based on what went into the book <SPAN
10199 CLASS="emphasis"
10200 ><I
10201 CLASS="EMPHASIS"
10202 >Special 
10203 Edition, Using Samba</I
10204 ></SPAN
10205 >, by Richard Sharpe.</P
10206 ></TD
10207 ></TR
10208 ></TABLE
10209 ></DIV
10210 ><P
10211 >A domain and a workgroup are exactly the same thing in terms of network
10212 browsing.  The difference is that a distributable authentication
10213 database is associated with a domain, for secure login access to a
10214 network.  Also, different access rights can be granted to users if they
10215 successfully authenticate against a domain logon server (NT server and 
10216 other systems based on NT server support this, as does at least Samba TNG now).</P
10217 ><P
10218 >The SMB client logging on to a domain has an expectation that every other
10219 server in the domain should accept the same authentication information.
10220 Network browsing functionality of domains and workgroups is
10221 identical and is explained in BROWSING.txt. It should be noted, that browsing
10222 is totally orthogonal to logon support.</P
10223 ><P
10224 >Issues related to the single-logon network model are discussed in this
10225 section.  Samba supports domain logons, network logon scripts, and user
10226 profiles for MS Windows for workgroups and MS Windows 9X/ME clients
10227 which will be the focus of this section.</P
10228 ><P
10229 >When an SMB client in a domain wishes to logon it broadcast requests for a
10230 logon server.  The first one to reply gets the job, and validates its
10231 password using whatever mechanism the Samba administrator has installed.
10232 It is possible (but very stupid) to create a domain where the user
10233 database is not shared between servers, i.e. they are effectively workgroup
10234 servers advertising themselves as participating in a domain.  This
10235 demonstrates how authentication is quite different from but closely
10236 involved with domains.</P
10237 ><P
10238 >Using these features you can make your clients verify their logon via
10239 the Samba server; make clients run a batch file when they logon to
10240 the network and download their preferences, desktop and start menu.</P
10241 ><P
10242 >Before launching into the configuration instructions, it is 
10243 worthwhile lookingat how a Windows 9x/ME client performs a logon:</P
10244 ><P
10245 ></P
10246 ><OL
10247 TYPE="1"
10248 ><LI
10249 ><P
10250 >       The client broadcasts (to the IP broadcast address of the subnet it is in)
10251         a NetLogon request. This is sent to the NetBIOS name DOMAIN&#60;1c&#62; at the
10252         NetBIOS layer.  The client chooses the first response it receives, which
10253         contains the NetBIOS name of the logon server to use in the format of 
10254         \\SERVER.
10255         </P
10256 ></LI
10257 ><LI
10258 ><P
10259 >       The client then connects to that server, logs on (does an SMBsessetupX) and
10260         then connects to the IPC$ share (using an SMBtconX).
10261         </P
10262 ></LI
10263 ><LI
10264 ><P
10265 >       The client then does a NetWkstaUserLogon request, which retrieves the name
10266         of the user's logon script. 
10267         </P
10268 ></LI
10269 ><LI
10270 ><P
10271 >       The client then connects to the NetLogon share and searches for this    
10272         and if it is found and can be read, is retrieved and executed by the client.
10273         After this, the client disconnects from the NetLogon share.
10274         </P
10275 ></LI
10276 ><LI
10277 ><P
10278 >       The client then sends a NetUserGetInfo request to the server, to retrieve
10279         the user's home share, which is used to search for profiles. Since the
10280         response to the NetUserGetInfo request does not contain much more       
10281         the user's home share, profiles for Win9X clients MUST reside in the user
10282         home directory.
10283         </P
10284 ></LI
10285 ><LI
10286 ><P
10287 >       The client then connects to the user's home share and searches for the 
10288         user's profile. As it turns out, you can specify the user's home share as
10289         a sharename and path. For example, \\server\fred\.profile.
10290         If the profiles are found, they are implemented.
10291         </P
10292 ></LI
10293 ><LI
10294 ><P
10295 >       The client then disconnects from the user's home share, and reconnects to
10296         the NetLogon share and looks for CONFIG.POL, the policies file. If this is
10297         found, it is read and implemented.
10298         </P
10299 ></LI
10300 ></OL
10301 ><DIV
10302 CLASS="SECT2"
10303 ><HR><H3
10304 CLASS="SECT2"
10305 ><A
10306 NAME="AEN2142"
10307 ></A
10308 >12.8.1. Configuration Instructions:    Network Logons</H3
10309 ><P
10310 >The main difference between a PDC and a Windows 9x logon 
10311 server configuration is that</P
10312 ><P
10313 ></P
10314 ><UL
10315 ><LI
10316 ><P
10317 >Password encryption is not required for a Windows 9x logon server.</P
10318 ></LI
10319 ><LI
10320 ><P
10321 >Windows 9x/ME clients do not possess machine trust accounts.</P
10322 ></LI
10323 ></UL
10324 ><P
10325 >Therefore, a Samba PDC will also act as a Windows 9x logon 
10326 server.</P
10327 ><DIV
10328 CLASS="WARNING"
10329 ><P
10330 ></P
10331 ><TABLE
10332 CLASS="WARNING"
10333 WIDTH="100%"
10334 BORDER="0"
10335 ><TR
10336 ><TD
10337 WIDTH="25"
10338 ALIGN="CENTER"
10339 VALIGN="TOP"
10340 ><IMG
10341 SRC="/docbook-dsssl/warning.gif"
10342 HSPACE="5"
10343 ALT="Warning"></TD
10344 ><TH
10345 ALIGN="LEFT"
10346 VALIGN="CENTER"
10347 ><B
10348 >security mode and master browsers</B
10349 ></TH
10350 ></TR
10351 ><TR
10352 ><TD
10353 >&nbsp;</TD
10354 ><TD
10355 ALIGN="LEFT"
10356 VALIGN="TOP"
10357 ><P
10358 >There are a few comments to make in order to tie up some 
10359 loose ends.  There has been much debate over the issue of whether
10360 or not it is ok to configure Samba as a Domain Controller in security
10361 modes other than <TT
10362 CLASS="CONSTANT"
10363 >USER</TT
10364 >.  The only security mode 
10365 which  will not work due to technical reasons is <TT
10366 CLASS="CONSTANT"
10367 >SHARE</TT
10368 >
10369 mode security.  <TT
10370 CLASS="CONSTANT"
10371 >DOMAIN</TT
10372 > and <TT
10373 CLASS="CONSTANT"
10374 >SERVER</TT
10375 >
10376 mode security is really just a variation on SMB user level security.</P
10377 ><P
10378 >Actually, this issue is also closely tied to the debate on whether 
10379 or not Samba must be the domain master browser for its workgroup
10380 when operating as a DC.  While it may technically be possible
10381 to configure a server as such (after all, browsing and domain logons
10382 are two distinctly different functions), it is not a good idea to
10383 so.  You should remember that the DC must register the DOMAIN#1b NetBIOS 
10384 name.  This is the name used by Windows clients to locate the DC.
10385 Windows clients do not distinguish between the DC and the DMB.
10386 For this reason, it is very wise to configure the Samba DC as the DMB.</P
10387 ><P
10388 >Now back to the issue of configuring a Samba DC to use a mode other
10389 than "security = user".  If a Samba host is configured to use 
10390 another SMB server or DC in order to validate user connection 
10391 requests, then it is a fact that some other machine on the network 
10392 (the "password server") knows more about user than the Samba host.
10393 99% of the time, this other host is a domain controller.  Now 
10394 in order to operate in domain mode security, the "workgroup" parameter
10395 must be set to the name of the Windows NT domain (which already 
10396 has a domain controller, right?)</P
10397 ><P
10398 >Therefore configuring a Samba box as a DC for a domain that 
10399 already by definition has a PDC is asking for trouble.
10400 Therefore, you should always configure the Samba DC to be the DMB
10401 for its domain.</P
10402 ></TD
10403 ></TR
10404 ></TABLE
10405 ></DIV
10406 ></DIV
10407 ><DIV
10408 CLASS="SECT2"
10409 ><HR><H3
10410 CLASS="SECT2"
10411 ><A
10412 NAME="AEN2161"
10413 ></A
10414 >12.8.2. Configuration Instructions:    Setting up Roaming User Profiles</H3
10415 ><DIV
10416 CLASS="WARNING"
10417 ><P
10418 ></P
10419 ><TABLE
10420 CLASS="WARNING"
10421 WIDTH="100%"
10422 BORDER="0"
10423 ><TR
10424 ><TD
10425 WIDTH="25"
10426 ALIGN="CENTER"
10427 VALIGN="TOP"
10428 ><IMG
10429 SRC="/docbook-dsssl/warning.gif"
10430 HSPACE="5"
10431 ALT="Warning"></TD
10432 ><TD
10433 ALIGN="LEFT"
10434 VALIGN="TOP"
10435 ><P
10436 ><SPAN
10437 CLASS="emphasis"
10438 ><I
10439 CLASS="EMPHASIS"
10440 >NOTE!</I
10441 ></SPAN
10442 > Roaming profiles support is different 
10443 for Win9X and WinNT.</P
10444 ></TD
10445 ></TR
10446 ></TABLE
10447 ></DIV
10448 ><P
10449 >Before discussing how to configure roaming profiles, it is useful to see how
10450 Win9X and WinNT clients implement these features.</P
10451 ><P
10452 >Win9X clients send a NetUserGetInfo request to the server to get the user's
10453 profiles location. However, the response does not have room for a separate 
10454 profiles location field, only the user's home share. This means that Win9X 
10455 profiles are restricted to being in the user's home directory.</P
10456 ><P
10457 >WinNT clients send a NetSAMLogon RPC request, which contains many fields, 
10458 including a separate field for the location of the user's profiles. 
10459 This means that support for profiles is different for Win9X and WinNT.</P
10460 ><DIV
10461 CLASS="SECT3"
10462 ><HR><H4
10463 CLASS="SECT3"
10464 ><A
10465 NAME="AEN2169"
10466 ></A
10467 >12.8.2.1. Windows NT Configuration</H4
10468 ><P
10469 >To support WinNT clients, in the [global] section of smb.conf set the
10470 following (for example):</P
10471 ><P
10472 ><PRE
10473 CLASS="PROGRAMLISTING"
10474 >logon path = \\profileserver\profileshare\profilepath\%U\moreprofilepath</PRE
10475 ></P
10476 ><P
10477 >The default for this option is \\%N\%U\profile, namely
10478 \\sambaserver\username\profile.  The \\N%\%U service is created
10479 automatically by the [homes] service.
10480 If you are using a samba server for the profiles, you _must_ make the
10481 share specified in the logon path browseable. </P
10482 ><DIV
10483 CLASS="NOTE"
10484 ><P
10485 ></P
10486 ><TABLE
10487 CLASS="NOTE"
10488 WIDTH="100%"
10489 BORDER="0"
10490 ><TR
10491 ><TD
10492 WIDTH="25"
10493 ALIGN="CENTER"
10494 VALIGN="TOP"
10495 ><IMG
10496 SRC="/docbook-dsssl/note.gif"
10497 HSPACE="5"
10498 ALT="Note"></TD
10499 ><TD
10500 ALIGN="LEFT"
10501 VALIGN="TOP"
10502 ><P
10503 >[lkcl 26aug96 - we have discovered a problem where Windows clients can
10504 maintain a connection to the [homes] share in between logins.  The
10505 [homes] share must NOT therefore be used in a profile path.]</P
10506 ></TD
10507 ></TR
10508 ></TABLE
10509 ></DIV
10510 ></DIV
10511 ><DIV
10512 CLASS="SECT3"
10513 ><HR><H4
10514 CLASS="SECT3"
10515 ><A
10516 NAME="AEN2177"
10517 ></A
10518 >12.8.2.2. Windows 9X Configuration</H4
10519 ><P
10520 >To support Win9X clients, you must use the "logon home" parameter. Samba has
10521 now been fixed so that "net use/home" now works as well, and it, too, relies
10522 on the "logon home" parameter.</P
10523 ><P
10524 >By using the logon home parameter, you are restricted to putting Win9X 
10525 profiles in the user's home directory.   But wait! There is a trick you 
10526 can use. If you set the following in the [global] section of your 
10527 smb.conf file:</P
10528 ><P
10529 ><PRE
10530 CLASS="PROGRAMLISTING"
10531 >logon home = \\%L\%U\.profiles</PRE
10532 ></P
10533 ><P
10534 >then your Win9X clients will dutifully put their clients in a subdirectory
10535 of your home directory called .profiles (thus making them hidden).</P
10536 ><P
10537 >Not only that, but 'net use/home' will also work, because of a feature in 
10538 Win9X. It removes any directory stuff off the end of the home directory area
10539 and only uses the server and share portion. That is, it looks like you
10540 specified \\%L\%U for "logon home".</P
10541 ></DIV
10542 ><DIV
10543 CLASS="SECT3"
10544 ><HR><H4
10545 CLASS="SECT3"
10546 ><A
10547 NAME="AEN2185"
10548 ></A
10549 >12.8.2.3. Win9X and WinNT Configuration</H4
10550 ><P
10551 >You can support profiles for both Win9X and WinNT clients by setting both the
10552 "logon home" and "logon path" parameters. For example:</P
10553 ><P
10554 ><PRE
10555 CLASS="PROGRAMLISTING"
10556 >logon home = \\%L\%U\.profiles
10557 logon path = \\%L\profiles\%U</PRE
10558 ></P
10559 ><DIV
10560 CLASS="NOTE"
10561 ><P
10562 ></P
10563 ><TABLE
10564 CLASS="NOTE"
10565 WIDTH="100%"
10566 BORDER="0"
10567 ><TR
10568 ><TD
10569 WIDTH="25"
10570 ALIGN="CENTER"
10571 VALIGN="TOP"
10572 ><IMG
10573 SRC="/docbook-dsssl/note.gif"
10574 HSPACE="5"
10575 ALT="Note"></TD
10576 ><TD
10577 ALIGN="LEFT"
10578 VALIGN="TOP"
10579 ><P
10580 >I have not checked what 'net use /home' does on NT when "logon home" is
10581 set as above.</P
10582 ></TD
10583 ></TR
10584 ></TABLE
10585 ></DIV
10586 ></DIV
10587 ><DIV
10588 CLASS="SECT3"
10589 ><HR><H4
10590 CLASS="SECT3"
10591 ><A
10592 NAME="AEN2192"
10593 ></A
10594 >12.8.2.4. Windows 9X Profile Setup</H4
10595 ><P
10596 >When a user first logs in on Windows 9X, the file user.DAT is created,
10597 as are folders "Start Menu", "Desktop", "Programs" and "Nethood".  
10598 These directories and their contents will be merged with the local
10599 versions stored in c:\windows\profiles\username on subsequent logins,
10600 taking the most recent from each.  You will need to use the [global]
10601 options "preserve case = yes", "short preserve case = yes" and
10602 "case sensitive = no" in order to maintain capital letters in shortcuts
10603 in any of the profile folders.</P
10604 ><P
10605 >The user.DAT file contains all the user's preferences.  If you wish to
10606 enforce a set of preferences, rename their user.DAT file to user.MAN,
10607 and deny them write access to this file.</P
10608 ><P
10609 ></P
10610 ><OL
10611 TYPE="1"
10612 ><LI
10613 ><P
10614 >       On the Windows 95 machine, go to Control Panel | Passwords and
10615         select the User Profiles tab.  Select the required level of
10616         roaming preferences.  Press OK, but do _not_ allow the computer
10617         to reboot.
10618         </P
10619 ></LI
10620 ><LI
10621 ><P
10622 >       On the Windows 95 machine, go to Control Panel | Network |
10623         Client for Microsoft Networks | Preferences.  Select 'Log on to
10624         NT Domain'.  Then, ensure that the Primary Logon is 'Client for
10625         Microsoft Networks'.  Press OK, and this time allow the computer
10626         to reboot.
10627         </P
10628 ></LI
10629 ></OL
10630 ><P
10631 >Under Windows 95, Profiles are downloaded from the Primary Logon.
10632 If you have the Primary Logon as 'Client for Novell Networks', then
10633 the profiles and logon script will be downloaded from your Novell
10634 Server.  If you have the Primary Logon as 'Windows Logon', then the
10635 profiles will be loaded from the local machine - a bit against the
10636 concept of roaming profiles, if you ask me.</P
10637 ><P
10638 >You will now find that the Microsoft Networks Login box contains
10639 [user, password, domain] instead of just [user, password].  Type in
10640 the samba server's domain name (or any other domain known to exist,
10641 but bear in mind that the user will be authenticated against this
10642 domain and profiles downloaded from it, if that domain logon server
10643 supports it), user name and user's password.</P
10644 ><P
10645 >Once the user has been successfully validated, the Windows 95 machine
10646 will inform you that 'The user has not logged on before' and asks you
10647 if you wish to save the user's preferences?  Select 'yes'.</P
10648 ><P
10649 >Once the Windows 95 client comes up with the desktop, you should be able
10650 to examine the contents of the directory specified in the "logon path"
10651 on the samba server and verify that the "Desktop", "Start Menu",
10652 "Programs" and "Nethood" folders have been created.</P
10653 ><P
10654 >These folders will be cached locally on the client, and updated when
10655 the user logs off (if you haven't made them read-only by then :-).
10656 You will find that if the user creates further folders or short-cuts,
10657 that the client will merge the profile contents downloaded with the
10658 contents of the profile directory already on the local client, taking
10659 the newest folders and short-cuts from each set.</P
10660 ><P
10661 >If you have made the folders / files read-only on the samba server,
10662 then you will get errors from the w95 machine on logon and logout, as
10663 it attempts to merge the local and the remote profile.  Basically, if
10664 you have any errors reported by the w95 machine, check the Unix file
10665 permissions and ownership rights on the profile directory contents,
10666 on the samba server.</P
10667 ><P
10668 >If you have problems creating user profiles, you can reset the user's
10669 local desktop cache, as shown below.  When this user then next logs in,
10670 they will be told that they are logging in "for the first time".</P
10671 ><P
10672 ></P
10673 ><OL
10674 TYPE="1"
10675 ><LI
10676 ><P
10677 >       instead of logging in under the [user, password, domain] dialog,
10678         press escape.
10679         </P
10680 ></LI
10681 ><LI
10682 ><P
10683 >       run the regedit.exe program, and look in:
10684         </P
10685 ><P
10686 >       HKEY_LOCAL_MACHINE\Windows\CurrentVersion\ProfileList
10687         </P
10688 ><P
10689 >       you will find an entry, for each user, of ProfilePath.  Note the
10690         contents of this key (likely to be c:\windows\profiles\username),
10691         then delete the key ProfilePath for the required user.
10692         </P
10693 ><P
10694 >       [Exit the registry editor].
10695         </P
10696 ></LI
10697 ><LI
10698 ><P
10699 >       <SPAN
10700 CLASS="emphasis"
10701 ><I
10702 CLASS="EMPHASIS"
10703 >WARNING</I
10704 ></SPAN
10705 > - before deleting the contents of the 
10706         directory listed in
10707    the ProfilePath (this is likely to be c:\windows\profiles\username),
10708    ask them if they have any important files stored on their desktop
10709    or in their start menu.  delete the contents of the directory
10710    ProfilePath (making a backup if any of the files are needed).
10711         </P
10712 ><P
10713 >   This will have the effect of removing the local (read-only hidden
10714    system file) user.DAT in their profile directory, as well as the
10715    local "desktop", "nethood", "start menu" and "programs" folders.
10716         </P
10717 ></LI
10718 ><LI
10719 ><P
10720 >       search for the user's .PWL password-caching file in the c:\windows
10721         directory, and delete it.
10722         </P
10723 ></LI
10724 ><LI
10725 ><P
10726 >       log off the windows 95 client.
10727         </P
10728 ></LI
10729 ><LI
10730 ><P
10731 >       check the contents of the profile path (see "logon path" described
10732         above), and delete the user.DAT or user.MAN file for the user,
10733         making a backup if required.  
10734         </P
10735 ></LI
10736 ></OL
10737 ><P
10738 >If all else fails, increase samba's debug log levels to between 3 and 10,
10739 and / or run a packet trace program such as tcpdump or netmon.exe, and
10740 look for any error reports.</P
10741 ><P
10742 >If you have access to an NT server, then first set up roaming profiles
10743 and / or netlogons on the NT server.  Make a packet trace, or examine
10744 the example packet traces provided with NT server, and see what the
10745 differences are with the equivalent samba trace.</P
10746 ></DIV
10747 ><DIV
10748 CLASS="SECT3"
10749 ><HR><H4
10750 CLASS="SECT3"
10751 ><A
10752 NAME="AEN2228"
10753 ></A
10754 >12.8.2.5. Windows NT Workstation 4.0</H4
10755 ><P
10756 >When a user first logs in to a Windows NT Workstation, the profile
10757 NTuser.DAT is created.  The profile location can be now specified
10758 through the "logon path" parameter.  </P
10759 ><DIV
10760 CLASS="NOTE"
10761 ><P
10762 ></P
10763 ><TABLE
10764 CLASS="NOTE"
10765 WIDTH="100%"
10766 BORDER="0"
10767 ><TR
10768 ><TD
10769 WIDTH="25"
10770 ALIGN="CENTER"
10771 VALIGN="TOP"
10772 ><IMG
10773 SRC="/docbook-dsssl/note.gif"
10774 HSPACE="5"
10775 ALT="Note"></TD
10776 ><TD
10777 ALIGN="LEFT"
10778 VALIGN="TOP"
10779 ><P
10780 >[lkcl 10aug97 - i tried setting the path to
10781 \\samba-server\homes\profile, and discovered that this fails because
10782 a background process maintains the connection to the [homes] share
10783 which does _not_ close down in between user logins.  you have to
10784 have \\samba-server\%L\profile, where user is the username created
10785 from the [homes] share].</P
10786 ></TD
10787 ></TR
10788 ></TABLE
10789 ></DIV
10790 ><P
10791 >There is a parameter that is now available for use with NT Profiles:
10792 "logon drive".  This should be set to "h:" or any other drive, and
10793 should be used in conjunction with the new "logon home" parameter.</P
10794 ><P
10795 >The entry for the NT 4.0 profile is a _directory_ not a file.  The NT
10796 help on profiles mentions that a directory is also created with a .PDS
10797 extension.  The user, while logging in, must have write permission to
10798 create the full profile path (and the folder with the .PDS extension)
10799 [lkcl 10aug97 - i found that the creation of the .PDS directory failed,
10800 and had to create these manually for each user, with a shell script.
10801 also, i presume, but have not tested, that the full profile path must
10802 be browseable just as it is for w95, due to the manner in which they
10803 attempt to create the full profile path: test existence of each path
10804 component; create path component].</P
10805 ><P
10806 >In the profile directory, NT creates more folders than 95.  It creates
10807 "Application Data" and others, as well as "Desktop", "Nethood",
10808 "Start Menu" and "Programs".  The profile itself is stored in a file
10809 NTuser.DAT.  Nothing appears to be stored in the .PDS directory, and
10810 its purpose is currently unknown.</P
10811 ><P
10812 >You can use the System Control Panel to copy a local profile onto
10813 a samba server (see NT Help on profiles: it is also capable of firing
10814 up the correct location in the System Control Panel for you).  The
10815 NT Help file also mentions that renaming NTuser.DAT to NTuser.MAN
10816 turns a profile into a mandatory one.</P
10817 ><DIV
10818 CLASS="NOTE"
10819 ><P
10820 ></P
10821 ><TABLE
10822 CLASS="NOTE"
10823 WIDTH="100%"
10824 BORDER="0"
10825 ><TR
10826 ><TD
10827 WIDTH="25"
10828 ALIGN="CENTER"
10829 VALIGN="TOP"
10830 ><IMG
10831 SRC="/docbook-dsssl/note.gif"
10832 HSPACE="5"
10833 ALT="Note"></TD
10834 ><TD
10835 ALIGN="LEFT"
10836 VALIGN="TOP"
10837 ><P
10838 >[lkcl 10aug97 - i notice that NT Workstation tells me that it is
10839 downloading a profile from a slow link.  whether this is actually the
10840 case, or whether there is some configuration issue, as yet unknown,
10841 that makes NT Workstation _think_ that the link is a slow one is a
10842 matter to be resolved].</P
10843 ><P
10844 >[lkcl 20aug97 - after samba digest correspondence, one user found, and
10845 another confirmed, that profiles cannot be loaded from a samba server
10846 unless "security = user" and "encrypt passwords = yes" (see the file
10847 ENCRYPTION.txt) or "security = server" and "password server = ip.address.
10848 of.yourNTserver" are used.  Either of these options will allow the NT
10849 workstation to access the samba server using LAN manager encrypted
10850 passwords, without the user intervention normally required by NT
10851 workstation for clear-text passwords].</P
10852 ><P
10853 >[lkcl 25aug97 - more comments received about NT profiles: the case of
10854 the profile _matters_.  the file _must_ be called NTuser.DAT or, for
10855 a mandatory profile, NTuser.MAN].</P
10856 ></TD
10857 ></TR
10858 ></TABLE
10859 ></DIV
10860 ></DIV
10861 ><DIV
10862 CLASS="SECT3"
10863 ><HR><H4
10864 CLASS="SECT3"
10865 ><A
10866 NAME="AEN2241"
10867 ></A
10868 >12.8.2.6. Windows NT Server</H4
10869 ><P
10870 >There is nothing to stop you specifying any path that you like for the
10871 location of users' profiles.  Therefore, you could specify that the
10872 profile be stored on a samba server, or any other SMB server, as long as
10873 that SMB server supports encrypted passwords.</P
10874 ></DIV
10875 ><DIV
10876 CLASS="SECT3"
10877 ><HR><H4
10878 CLASS="SECT3"
10879 ><A
10880 NAME="AEN2244"
10881 ></A
10882 >12.8.2.7. Sharing Profiles between W95 and NT Workstation 4.0</H4
10883 ><DIV
10884 CLASS="WARNING"
10885 ><P
10886 ></P
10887 ><TABLE
10888 CLASS="WARNING"
10889 WIDTH="100%"
10890 BORDER="0"
10891 ><TR
10892 ><TD
10893 WIDTH="25"
10894 ALIGN="CENTER"
10895 VALIGN="TOP"
10896 ><IMG
10897 SRC="/docbook-dsssl/warning.gif"
10898 HSPACE="5"
10899 ALT="Warning"></TD
10900 ><TH
10901 ALIGN="LEFT"
10902 VALIGN="CENTER"
10903 ><B
10904 >Potentially outdated or incorrect material follows</B
10905 ></TH
10906 ></TR
10907 ><TR
10908 ><TD
10909 >&nbsp;</TD
10910 ><TD
10911 ALIGN="LEFT"
10912 VALIGN="TOP"
10913 ><P
10914 >I think this is all bogus, but have not deleted it. (Richard Sharpe)</P
10915 ></TD
10916 ></TR
10917 ></TABLE
10918 ></DIV
10919 ><P
10920 >The default logon path is \\%N\%U.  NT Workstation will attempt to create
10921 a directory "\\samba-server\username.PDS" if you specify the logon path
10922 as "\\samba-server\username" with the NT User Manager.  Therefore, you
10923 will need to specify (for example) "\\samba-server\username\profile".
10924 NT 4.0 will attempt to create "\\samba-server\username\profile.PDS", which
10925 is more likely to succeed.</P
10926 ><P
10927 >If you then want to share the same Start Menu / Desktop with W95, you will
10928 need to specify "logon path = \\samba-server\username\profile" [lkcl 10aug97
10929 this has its drawbacks: i created a shortcut to telnet.exe, which attempts
10930 to run from the c:\winnt\system32 directory.  this directory is obviously
10931 unlikely to exist on a Win95-only host].</P
10932 ><P
10933 >&#13;If you have this set up correctly, you will find separate user.DAT and
10934 NTuser.DAT files in the same profile directory.</P
10935 ><DIV
10936 CLASS="NOTE"
10937 ><P
10938 ></P
10939 ><TABLE
10940 CLASS="NOTE"
10941 WIDTH="100%"
10942 BORDER="0"
10943 ><TR
10944 ><TD
10945 WIDTH="25"
10946 ALIGN="CENTER"
10947 VALIGN="TOP"
10948 ><IMG
10949 SRC="/docbook-dsssl/note.gif"
10950 HSPACE="5"
10951 ALT="Note"></TD
10952 ><TD
10953 ALIGN="LEFT"
10954 VALIGN="TOP"
10955 ><P
10956 >[lkcl 25aug97 - there are some issues to resolve with downloading of
10957 NT profiles, probably to do with time/date stamps.  i have found that
10958 NTuser.DAT is never updated on the workstation after the first time that
10959 it is copied to the local workstation profile directory.  this is in
10960 contrast to w95, where it _does_ transfer / update profiles correctly].</P
10961 ></TD
10962 ></TR
10963 ></TABLE
10964 ></DIV
10965 ></DIV
10966 ></DIV
10967 ></DIV
10968 ><DIV
10969 CLASS="SECT1"
10970 ><HR><H2
10971 CLASS="SECT1"
10972 ><A
10973 NAME="AEN2254"
10974 ></A
10975 >12.9. DOMAIN_CONTROL.txt : Windows NT Domain Control &#38; Samba</H2
10976 ><DIV
10977 CLASS="WARNING"
10978 ><P
10979 ></P
10980 ><TABLE
10981 CLASS="WARNING"
10982 WIDTH="100%"
10983 BORDER="0"
10984 ><TR
10985 ><TD
10986 WIDTH="25"
10987 ALIGN="CENTER"
10988 VALIGN="TOP"
10989 ><IMG
10990 SRC="/docbook-dsssl/warning.gif"
10991 HSPACE="5"
10992 ALT="Warning"></TD
10993 ><TH
10994 ALIGN="LEFT"
10995 VALIGN="CENTER"
10996 ><B
10997 >Possibly Outdated Material</B
10998 ></TH
10999 ></TR
11000 ><TR
11001 ><TD
11002 >&nbsp;</TD
11003 ><TD
11004 ALIGN="LEFT"
11005 VALIGN="TOP"
11006 ><P
11007 >       This appendix was originally authored by John H Terpstra of 
11008         the Samba Team and is included here for posterity.
11009         </P
11010 ></TD
11011 ></TR
11012 ></TABLE
11013 ></DIV
11014 ><P
11015 ><SPAN
11016 CLASS="emphasis"
11017 ><I
11018 CLASS="EMPHASIS"
11019 >NOTE :</I
11020 ></SPAN
11021
11022 The term "Domain Controller" and those related to it refer to one specific
11023 method of authentication that can underly an SMB domain. Domain Controllers
11024 prior to Windows NT Server 3.1 were sold by various companies and based on 
11025 private extensions to the LAN Manager 2.1 protocol. Windows NT introduced
11026 Microsoft-specific ways of distributing the user authentication database.
11027 See DOMAIN.txt for examples of how Samba can participate in or create
11028 SMB domains based on shared authentication database schemes other than the 
11029 Windows NT SAM.</P
11030 ><P
11031 >Windows NT Server can be installed as either a plain file and print server
11032 (WORKGROUP workstation or server) or as a server that participates in Domain
11033 Control (DOMAIN member, Primary Domain controller or Backup Domain controller).
11034 The same is true for OS/2 Warp Server, Digital Pathworks and other similar
11035 products, all of which can participate in Domain Control along with Windows NT.</P
11036 ><P
11037 >To many people these terms can be confusing, so let's try to clear the air.</P
11038 ><P
11039 >Every Windows NT system (workstation or server) has a registry database.
11040 The registry contains entries that describe the initialization information
11041 for all services (the equivalent of Unix Daemons) that run within the Windows
11042 NT environment. The registry also contains entries that tell application
11043 software where to find dynamically loadable libraries that they depend upon.
11044 In fact, the registry contains entries that describes everything that anything
11045 may need to know to interact with the rest of the system.</P
11046 ><P
11047 >The registry files can be located on any Windows NT machine by opening a
11048 command prompt and typing:</P
11049 ><P
11050 ><TT
11051 CLASS="PROMPT"
11052 >C:\WINNT\&#62;</TT
11053 > dir %SystemRoot%\System32\config</P
11054 ><P
11055 >The environment variable %SystemRoot% value can be obtained by typing:</P
11056 ><P
11057 ><TT
11058 CLASS="PROMPT"
11059 >C:\WINNT&#62;</TT
11060 >echo %SystemRoot%</P
11061 ><P
11062 >The active parts of the registry that you may want to be familiar with are
11063 the files called: default, system, software, sam and security.</P
11064 ><P
11065 >In a domain environment, Microsoft Windows NT domain controllers participate
11066 in replication of the SAM and SECURITY files so that all controllers within
11067 the domain have an exactly identical copy of each.</P
11068 ><P
11069 >The Microsoft Windows NT system is structured within a security model that
11070 says that all applications and services must authenticate themselves before
11071 they can obtain permission from the security manager to do what they set out
11072 to do.</P
11073 ><P
11074 >The Windows NT User database also resides within the registry. This part of
11075 the registry contains the user's security identifier, home directory, group
11076 memberships, desktop profile, and so on.</P
11077 ><P
11078 >Every Windows NT system (workstation as well as server) will have its own
11079 registry. Windows NT Servers that participate in Domain Security control
11080 have a database that they share in common - thus they do NOT own an
11081 independent full registry database of their own, as do Workstations and
11082 plain Servers.</P
11083 ><P
11084 >The User database is called the SAM (Security Access Manager) database and
11085 is used for all user authentication as well as for authentication of inter-
11086 process authentication (i.e. to ensure that the service action a user has
11087 requested is permitted within the limits of that user's privileges).</P
11088 ><P
11089 >The Samba team have produced a utility that can dump the Windows NT SAM into 
11090 smbpasswd format: see ENCRYPTION.txt for information on smbpasswd and
11091 /pub/samba/pwdump on your nearest Samba mirror for the utility. This 
11092 facility is useful but cannot be easily used to implement SAM replication
11093 to Samba systems.</P
11094 ><P
11095 >Windows for Workgroups, Windows 95, and Windows NT Workstations and Servers
11096 can participate in a Domain security system that is controlled by Windows NT
11097 servers that have been correctly configured. Almost every domain will have
11098 ONE Primary Domain Controller (PDC). It is desirable that each domain will
11099 have at least one Backup Domain Controller (BDC).</P
11100 ><P
11101 >The PDC and BDCs then participate in replication of the SAM database so that
11102 each Domain Controlling participant will have an up to date SAM component
11103 within its registry.</P
11104 ></DIV
11105 ></DIV
11106 ><DIV
11107 CLASS="CHAPTER"
11108 ><HR><H1
11109 ><A
11110 NAME="SAMBA-BDC"
11111 ></A
11112 >Chapter 13. How to Act as a Backup Domain Controller in a Purely Samba Controlled Domain</H1
11113 ><DIV
11114 CLASS="SECT1"
11115 ><H2
11116 CLASS="SECT1"
11117 ><A
11118 NAME="AEN2290"
11119 ></A
11120 >13.1. Prerequisite Reading</H2
11121 ><P
11122 >Before you continue reading in this chapter, please make sure
11123 that you are comfortable with configuring a Samba PDC
11124 as described in the <A
11125 HREF="Samba-PDC-HOWTO.html"
11126 TARGET="_top"
11127 >Samba-PDC-HOWTO</A
11128 >.</P
11129 ></DIV
11130 ><DIV
11131 CLASS="SECT1"
11132 ><HR><H2
11133 CLASS="SECT1"
11134 ><A
11135 NAME="AEN2294"
11136 ></A
11137 >13.2. Background</H2
11138 ><P
11139 >What is a Domain Controller? It is a machine that is able to answer
11140 logon requests from workstations in a Windows NT Domain. Whenever a
11141 user logs into a Windows NT Workstation, the workstation connects to a
11142 Domain Controller and asks him whether the username and password the
11143 user typed in is correct.  The Domain Controller replies with a lot of
11144 information about the user, for example the place where the users
11145 profile is stored, the users full name of the user. All this
11146 information is stored in the NT user database, the so-called SAM.</P
11147 ><P
11148 >There are two kinds of Domain Controller in a NT 4 compatible Domain:
11149 A Primary Domain Controller (PDC) and one or more Backup Domain
11150 Controllers (BDC). The PDC contains the master copy of the
11151 SAM. Whenever the SAM has to change, for example when a user changes
11152 his password, this change has to be done on the PDC. A Backup Domain
11153 Controller is a machine that maintains a read-only copy of the
11154 SAM. This way it is able to reply to logon requests and authenticate
11155 users in case the PDC is not available. During this time no changes to
11156 the SAM are possible. Whenever changes to the SAM are done on the PDC,
11157 all BDC receive the changes from the PDC.</P
11158 ><P
11159 >Since version 2.2 Samba officially supports domain logons for all
11160 current Windows Clients, including Windows 2000 and XP. This text
11161 assumes the domain to be named SAMBA. To be able to act as a PDC, some
11162 parameters in the [global]-section of the smb.conf have to be set:</P
11163 ><P
11164 ><PRE
11165 CLASS="PROGRAMLISTING"
11166 >workgroup = SAMBA
11167 domain master = yes
11168 domain logons = yes</PRE
11169 ></P
11170 ><P
11171 >Several other things like a [homes] and a [netlogon] share also may be
11172 set along with settings for the profile path, the users home drive and
11173 others. This will not be covered in this document.</P
11174 ></DIV
11175 ><DIV
11176 CLASS="SECT1"
11177 ><HR><H2
11178 CLASS="SECT1"
11179 ><A
11180 NAME="AEN2302"
11181 ></A
11182 >13.3. What qualifies a Domain Controller on the network?</H2
11183 ><P
11184 >Every machine that is a Domain Controller for the domain SAMBA has to
11185 register the NetBIOS group name SAMBA#1c with the WINS server and/or
11186 by broadcast on the local network. The PDC also registers the unique
11187 NetBIOS name SAMBA#1b with the WINS server. The name type #1b is
11188 normally reserved for the domain master browser, a role that has
11189 nothing to do with anything related to authentication, but the
11190 Microsoft Domain implementation requires the domain master browser to
11191 be on the same machine as the PDC.</P
11192 ><DIV
11193 CLASS="SECT2"
11194 ><HR><H3
11195 CLASS="SECT2"
11196 ><A
11197 NAME="AEN2305"
11198 ></A
11199 >13.3.1. How does a Workstation find its domain controller?</H3
11200 ><P
11201 >A NT workstation in the domain SAMBA that wants a local user to be
11202 authenticated has to find the domain controller for SAMBA. It does
11203 this by doing a NetBIOS name query for the group name SAMBA#1c. It
11204 assumes that each of the machines it gets back from the queries is a
11205 domain controller and can answer logon requests. To not open security
11206 holes both the workstation and the selected (TODO: How is the DC
11207 chosen) domain controller authenticate each other. After that the
11208 workstation sends the user's credentials (his name and password) to
11209 the domain controller, asking for approval.</P
11210 ></DIV
11211 ><DIV
11212 CLASS="SECT2"
11213 ><HR><H3
11214 CLASS="SECT2"
11215 ><A
11216 NAME="AEN2308"
11217 ></A
11218 >13.3.2. When is the PDC needed?</H3
11219 ><P
11220 >Whenever a user wants to change his password, this has to be done on
11221 the PDC. To find the PDC, the workstation does a NetBIOS name query
11222 for SAMBA#1b, assuming this machine maintains the master copy of the
11223 SAM. The workstation contacts the PDC, both mutually authenticate and
11224 the password change is done.</P
11225 ></DIV
11226 ></DIV
11227 ><DIV
11228 CLASS="SECT1"
11229 ><HR><H2
11230 CLASS="SECT1"
11231 ><A
11232 NAME="AEN2311"
11233 ></A
11234 >13.4. Can Samba be a Backup Domain Controller?</H2
11235 ><P
11236 >With version 2.2, no. The native NT SAM replication protocols have
11237 not yet been fully implemented. The Samba Team is working on
11238 understanding and implementing the protocols, but this work has not
11239 been finished for version 2.2.</P
11240 ><P
11241 >Can I get the benefits of a BDC with Samba?  Yes. The main reason for
11242 implementing a BDC is availability. If the PDC is a Samba machine,
11243 a second Samba machine can be set up to
11244 service logon requests whenever the PDC is down.</P
11245 ></DIV
11246 ><DIV
11247 CLASS="SECT1"
11248 ><HR><H2
11249 CLASS="SECT1"
11250 ><A
11251 NAME="AEN2315"
11252 ></A
11253 >13.5. How do I set up a Samba BDC?</H2
11254 ><P
11255 >Several things have to be done:</P
11256 ><P
11257 ></P
11258 ><UL
11259 ><LI
11260 ><P
11261 >The domain SID has to be the same on the PDC and the BDC. This used to
11262 be stored in the file private/MACHINE.SID. This file is not created
11263 anymore since Samba 2.2.5 or even earlier. Nowadays the domain SID is
11264 stored in the file private/secrets.tdb. Simply copying the secrets.tdb
11265 from the PDC to the BDC does not work, as the BDC would
11266 generate a new SID for itself and override the domain SID with this
11267 new BDC SID.</P
11268 ><P
11269 >To retrieve the domain SID from the PDC or an existing BDC and store it in the
11270 secrets.tdb, execute 'net rpc getsid' on the BDC.</P
11271 ></LI
11272 ><LI
11273 ><P
11274 >The Unix user database has to be synchronized from the PDC to the
11275 BDC. This means that both the /etc/passwd and /etc/group have to be
11276 replicated from the PDC to the BDC. This can be done manually
11277 whenever changes are made, or the PDC is set up as a NIS master
11278 server and the BDC as a NIS slave server. To set up the BDC as a
11279 mere NIS client would not be enough, as the BDC would not be able to
11280 access its user database in case of a PDC failure.</P
11281 ></LI
11282 ><LI
11283 ><P
11284 >The Samba password database in the file private/smbpasswd has to be
11285 replicated from the PDC to the BDC. This is a bit tricky, see the
11286 next section.</P
11287 ></LI
11288 ><LI
11289 ><P
11290 >Any netlogon share has to be replicated from the PDC to the
11291 BDC. This can be done manually whenever login scripts are changed,
11292 or it can be done automatically together with the smbpasswd
11293 synchronization.</P
11294 ></LI
11295 ></UL
11296 ><P
11297 >Finally, the BDC has to be found by the workstations. This can be done
11298 by setting</P
11299 ><P
11300 ><PRE
11301 CLASS="PROGRAMLISTING"
11302 >workgroup = samba
11303 domain master = no
11304 domain logons = yes</PRE
11305 ></P
11306 ><P
11307 >in the [global]-section of the smb.conf of the BDC. This makes the BDC
11308 only register the name SAMBA#1c with the WINS server. This is no
11309 problem as the name SAMBA#1c is a NetBIOS group name that is meant to
11310 be registered by more than one machine. The parameter 'domain master =
11311 no' forces the BDC not to register SAMBA#1b which as a unique NetBIOS
11312 name is reserved for the Primary Domain Controller.</P
11313 ><DIV
11314 CLASS="SECT2"
11315 ><HR><H3
11316 CLASS="SECT2"
11317 ><A
11318 NAME="AEN2332"
11319 ></A
11320 >13.5.1. How do I replicate the smbpasswd file?</H3
11321 ><P
11322 >Replication of the smbpasswd file is sensitive. It has to be done
11323 whenever changes to the SAM are made. Every user's password change is
11324 done in the smbpasswd file and has to be replicated to the BDC. So
11325 replicating the smbpasswd file very often is necessary.</P
11326 ><P
11327 >As the smbpasswd file contains plain text password equivalents, it
11328 must not be sent unencrypted over the wire. The best way to set up
11329 smbpasswd replication from the PDC to the BDC is to use the utility
11330 rsync. rsync can use ssh as a transport. ssh itself can be set up to
11331 accept *only* rsync transfer without requiring the user to type a
11332 password.</P
11333 ></DIV
11334 ></DIV
11335 ></DIV
11336 ><DIV
11337 CLASS="CHAPTER"
11338 ><HR><H1
11339 ><A
11340 NAME="SAMBA-LDAP-HOWTO"
11341 ></A
11342 >Chapter 14. Storing Samba's User/Machine Account information in an LDAP Directory</H1
11343 ><DIV
11344 CLASS="SECT1"
11345 ><H2
11346 CLASS="SECT1"
11347 ><A
11348 NAME="AEN2353"
11349 ></A
11350 >14.1. Purpose</H2
11351 ><P
11352 >This document describes how to use an LDAP directory for storing Samba user
11353 account information traditionally stored in the smbpasswd(5) file.  It is
11354 assumed that the reader already has a basic understanding of LDAP concepts
11355 and has a working directory server already installed.  For more information
11356 on LDAP architectures and Directories, please refer to the following sites.</P
11357 ><P
11358 ></P
11359 ><UL
11360 ><LI
11361 ><P
11362 >OpenLDAP - <A
11363 HREF="http://www.openldap.org/"
11364 TARGET="_top"
11365 >http://www.openldap.org/</A
11366 ></P
11367 ></LI
11368 ><LI
11369 ><P
11370 >iPlanet Directory Server - <A
11371 HREF="http://iplanet.netscape.com/directory"
11372 TARGET="_top"
11373 >http://iplanet.netscape.com/directory</A
11374 ></P
11375 ></LI
11376 ></UL
11377 ><P
11378 >Note that <A
11379 HREF="http://www.ora.com/"
11380 TARGET="_top"
11381 >O'Reilly Publishing</A
11382 > is working on
11383 a guide to LDAP for System Administrators which has a planned release date of
11384 early summer, 2002.</P
11385 ><P
11386 >Two additional Samba resources which may prove to be helpful are</P
11387 ><P
11388 ></P
11389 ><UL
11390 ><LI
11391 ><P
11392 >The <A
11393 HREF="http://www.unav.es/cti/ldap-smb/ldap-smb-2_2-howto.html"
11394 TARGET="_top"
11395 >Samba-PDC-LDAP-HOWTO</A
11396 >
11397         maintained by Ignacio Coupeau.</P
11398 ></LI
11399 ><LI
11400 ><P
11401 >The NT migration scripts from <A
11402 HREF="http://samba.idealx.org/"
11403 TARGET="_top"
11404 >IDEALX</A
11405 > that are
11406         geared to manage users and group in such a Samba-LDAP Domain Controller configuration.
11407         </P
11408 ></LI
11409 ></UL
11410 ></DIV
11411 ><DIV
11412 CLASS="SECT1"
11413 ><HR><H2
11414 CLASS="SECT1"
11415 ><A
11416 NAME="AEN2373"
11417 ></A
11418 >14.2. Introduction</H2
11419 ><P
11420 >Traditionally, when configuring <A
11421 HREF="smb.conf.5.html#ENCRYPTPASSWORDS"
11422 TARGET="_top"
11423 >"encrypt
11424 passwords = yes"</A
11425 > in Samba's <TT
11426 CLASS="FILENAME"
11427 >smb.conf</TT
11428 > file, user account
11429 information such as username, LM/NT password hashes, password change times, and account
11430 flags have been stored in the <TT
11431 CLASS="FILENAME"
11432 >smbpasswd(5)</TT
11433 > file.  There are several
11434 disadvantages to this approach for sites with very large numbers of users (counted
11435 in the thousands).</P
11436 ><P
11437 ></P
11438 ><UL
11439 ><LI
11440 ><P
11441 >The first is that all lookups must be performed sequentially.  Given that
11442 there are approximately two lookups per domain logon (one for a normal
11443 session connection such as when mapping a network drive or printer), this
11444 is a performance bottleneck for lareg sites.  What is needed is an indexed approach
11445 such as is used in databases.</P
11446 ></LI
11447 ><LI
11448 ><P
11449 >The second problem is that administrators who desired to replicate a
11450 smbpasswd file to more than one Samba server were left to use external
11451 tools such as <B
11452 CLASS="COMMAND"
11453 >rsync(1)</B
11454 > and <B
11455 CLASS="COMMAND"
11456 >ssh(1)</B
11457 >
11458 and wrote custom, in-house scripts.</P
11459 ></LI
11460 ><LI
11461 ><P
11462 >And finally, the amount of information which is stored in an
11463 smbpasswd entry leaves no room for additional attributes such as
11464 a home directory, password expiration time, or even a Relative
11465 Identified (RID).</P
11466 ></LI
11467 ></UL
11468 ><P
11469 >As a result of these defeciencies, a more robust means of storing user attributes
11470 used by smbd was developed.  The API which defines access to user accounts
11471 is commonly referred to as the samdb interface (previously this was called the passdb
11472 API, and is still so named in the CVS trees). In Samba 2.2.3, enabling support
11473 for a samdb backend (e.g. <TT
11474 CLASS="PARAMETER"
11475 ><I
11476 >--with-ldapsam</I
11477 ></TT
11478 > or
11479 <TT
11480 CLASS="PARAMETER"
11481 ><I
11482 >--with-tdbsam</I
11483 ></TT
11484 >) requires compile time support.</P
11485 ><P
11486 >When compiling Samba to include the <TT
11487 CLASS="PARAMETER"
11488 ><I
11489 >--with-ldapsam</I
11490 ></TT
11491 > autoconf
11492 option, smbd (and associated tools) will store and lookup user accounts in
11493 an LDAP directory.  In reality, this is very easy to understand.  If you are
11494 comfortable with using an smbpasswd file, simply replace "smbpasswd" with
11495 "LDAP directory" in all the documentation.</P
11496 ><P
11497 >There are a few points to stress about what the <TT
11498 CLASS="PARAMETER"
11499 ><I
11500 >--with-ldapsam</I
11501 ></TT
11502 >
11503 does not provide.  The LDAP support referred to in the this documentation does not
11504 include:</P
11505 ><P
11506 ></P
11507 ><UL
11508 ><LI
11509 ><P
11510 >A means of retrieving user account information from
11511         an Windows 2000 Active Directory server.</P
11512 ></LI
11513 ><LI
11514 ><P
11515 >A means of replacing /etc/passwd.</P
11516 ></LI
11517 ></UL
11518 ><P
11519 >The second item can be accomplished by using LDAP NSS and PAM modules.  LGPL
11520 versions of these libraries can be obtained from PADL Software
11521 (<A
11522 HREF="http://www.padl.com/"
11523 TARGET="_top"
11524 >http://www.padl.com/</A
11525 >).  However,
11526 the details of configuring these packages are beyond the scope of this document.</P
11527 ></DIV
11528 ><DIV
11529 CLASS="SECT1"
11530 ><HR><H2
11531 CLASS="SECT1"
11532 ><A
11533 NAME="AEN2402"
11534 ></A
11535 >14.3. Supported LDAP Servers</H2
11536 ><P
11537 >The LDAP samdb code in 2.2.3 has been developed and tested using the OpenLDAP
11538 2.0 server and client libraries.  The same code should be able to work with
11539 Netscape's Directory Server and client SDK. However, due to lack of testing
11540 so far, there are bound to be compile errors and bugs.  These should not be
11541 hard to fix. If you are so inclined, please be sure to forward all patches to
11542 <A
11543 HREF="samba-patches@samba.org"
11544 TARGET="_top"
11545 >samba-patches@samba.org</A
11546 > and
11547 <A
11548 HREF="jerry@samba.org"
11549 TARGET="_top"
11550 >jerry@samba.org</A
11551 >.</P
11552 ></DIV
11553 ><DIV
11554 CLASS="SECT1"
11555 ><HR><H2
11556 CLASS="SECT1"
11557 ><A
11558 NAME="AEN2407"
11559 ></A
11560 >14.4. Schema and Relationship to the RFC 2307 posixAccount</H2
11561 ><P
11562 >Samba 2.2.3 includes the necessary schema file for OpenLDAP 2.0 in
11563 <TT
11564 CLASS="FILENAME"
11565 >examples/LDAP/samba.schema</TT
11566 >.  (Note that this schema
11567 file has been modified since the experimental support initially included
11568 in 2.2.2).  The sambaAccount objectclass is given here:</P
11569 ><P
11570 ><PRE
11571 CLASS="PROGRAMLISTING"
11572 >objectclass ( 1.3.1.5.1.4.1.7165.2.2.2 NAME 'sambaAccount' SUP top STRUCTURAL
11573      DESC 'Samba Account'
11574      MUST ( uid $ rid )
11575      MAY  ( cn $ lmPassword $ ntPassword $ pwdLastSet $ logonTime $
11576             logoffTime $ kickoffTime $ pwdCanChange $ pwdMustChange $ acctFlags $
11577             displayName $ smbHome $ homeDrive $ scriptPath $ profilePath $
11578             description $ userWorkstations $ primaryGroupID $ domain ))</PRE
11579 ></P
11580 ><P
11581 >The samba.schema file has been formatted for OpenLDAP 2.0.  The OID's are
11582 owned by the Samba Team and as such is legal to be openly published.
11583 If you translate the schema to be used with Netscape DS, please
11584 submit the modified schema file as a patch to <A
11585 HREF="jerry@samba.org"
11586 TARGET="_top"
11587 >jerry@samba.org</A
11588 ></P
11589 ><P
11590 >Just as the smbpasswd file is mean to store information which supplements a
11591 user's <TT
11592 CLASS="FILENAME"
11593 >/etc/passwd</TT
11594 > entry, so is the sambaAccount object
11595 meant to supplement the UNIX user account information.  A sambaAccount is a
11596 <TT
11597 CLASS="CONSTANT"
11598 >STRUCTURAL</TT
11599 > objectclass so it can be stored individually
11600 in the directory.  However, there are several fields (e.g. uid) which overlap
11601 with the posixAccount objectclass outlined in RFC2307.  This is by design.</P
11602 ><P
11603 >In order to store all user account information (UNIX and Samba) in the directory,
11604 it is necessary to use the sambaAccount and posixAccount objectclasses in
11605 combination.  However, smbd will still obtain the user's UNIX account
11606 information via the standard C library calls (e.g. getpwnam(), et. al.).
11607 This means that the Samba server must also have the LDAP NSS library installed
11608 and functioning correctly.  This division of information makes it possible to
11609 store all Samba account information in LDAP, but still maintain UNIX account
11610 information in NIS while the network is transitioning to a full LDAP infrastructure.</P
11611 ></DIV
11612 ><DIV
11613 CLASS="SECT1"
11614 ><HR><H2
11615 CLASS="SECT1"
11616 ><A
11617 NAME="AEN2419"
11618 ></A
11619 >14.5. Configuring Samba with LDAP</H2
11620 ><DIV
11621 CLASS="SECT2"
11622 ><H3
11623 CLASS="SECT2"
11624 ><A
11625 NAME="AEN2421"
11626 ></A
11627 >14.5.1. OpenLDAP configuration</H3
11628 ><P
11629 >To include support for the sambaAccount object in an OpenLDAP directory
11630 server, first copy the samba.schema file to slapd's configuration directory.</P
11631 ><P
11632 ><TT
11633 CLASS="PROMPT"
11634 >root# </TT
11635 ><B
11636 CLASS="COMMAND"
11637 >cp samba.schema /etc/openldap/schema/</B
11638 ></P
11639 ><P
11640 >Next, include the <TT
11641 CLASS="FILENAME"
11642 >samba.schema</TT
11643 > file in <TT
11644 CLASS="FILENAME"
11645 >slapd.conf</TT
11646 >.
11647 The sambaAccount object contains two attributes which depend upon other schema
11648 files.  The 'uid' attribute is defined in <TT
11649 CLASS="FILENAME"
11650 >cosine.schema</TT
11651 > and
11652 the 'displayName' attribute is defined in the <TT
11653 CLASS="FILENAME"
11654 >inetorgperson.schema</TT
11655 >
11656 file.  Both of these must be included before the <TT
11657 CLASS="FILENAME"
11658 >samba.schema</TT
11659 > file.</P
11660 ><P
11661 ><PRE
11662 CLASS="PROGRAMLISTING"
11663 >## /etc/openldap/slapd.conf
11664
11665 ## schema files (core.schema is required by default)
11666 include            /etc/openldap/schema/core.schema
11667
11668 ## needed for sambaAccount
11669 include            /etc/openldap/schema/cosine.schema
11670 include            /etc/openldap/schema/inetorgperson.schema
11671 include            /etc/openldap/schema/samba.schema
11672
11673 ## uncomment this line if you want to support the RFC2307 (NIS) schema
11674 ## include         /etc/openldap/schema/nis.schema
11675
11676 ....</PRE
11677 ></P
11678 ><P
11679 >It is recommended that you maintain some indices on some of the most usefull attributes,
11680 like in the following example, to speed up searches made on sambaAccount objectclasses
11681 (and possibly posixAccount and posixGroup as well).</P
11682 ><P
11683 ><PRE
11684 CLASS="PROGRAMLISTING"
11685 ># Indices to maintain
11686 ## required by OpenLDAP 2.0
11687 index objectclass   eq
11688
11689 ## support pb_getsampwnam()
11690 index uid           pres,eq
11691 ## support pdb_getsambapwrid()
11692 index rid           eq
11693
11694 ## uncomment these if you are storing posixAccount and
11695 ## posixGroup entries in the directory as well
11696 ##index uidNumber     eq
11697 ##index gidNumber     eq
11698 ##index cn            eq
11699 ##index memberUid     eq</PRE
11700 ></P
11701 ></DIV
11702 ><DIV
11703 CLASS="SECT2"
11704 ><HR><H3
11705 CLASS="SECT2"
11706 ><A
11707 NAME="AEN2438"
11708 ></A
11709 >14.5.2. Configuring Samba</H3
11710 ><P
11711 >The following parameters are available in smb.conf only with <TT
11712 CLASS="PARAMETER"
11713 ><I
11714 >--with-ldapsam</I
11715 ></TT
11716 >
11717 was included with compiling Samba.</P
11718 ><P
11719 ></P
11720 ><UL
11721 ><LI
11722 ><P
11723 ><A
11724 HREF="smb.conf.5.html#LDAPSSL"
11725 TARGET="_top"
11726 >ldap ssl</A
11727 ></P
11728 ></LI
11729 ><LI
11730 ><P
11731 ><A
11732 HREF="smb.conf.5.html#LDAPSERVER"
11733 TARGET="_top"
11734 >ldap server</A
11735 ></P
11736 ></LI
11737 ><LI
11738 ><P
11739 ><A
11740 HREF="smb.conf.5.html#LDAPADMINDN"
11741 TARGET="_top"
11742 >ldap admin dn</A
11743 ></P
11744 ></LI
11745 ><LI
11746 ><P
11747 ><A
11748 HREF="smb.conf.5.html#LDAPSUFFIX"
11749 TARGET="_top"
11750 >ldap suffix</A
11751 ></P
11752 ></LI
11753 ><LI
11754 ><P
11755 ><A
11756 HREF="smb.conf.5.html#LDAPFILTER"
11757 TARGET="_top"
11758 >ldap filter</A
11759 ></P
11760 ></LI
11761 ><LI
11762 ><P
11763 ><A
11764 HREF="smb.conf.5.html#LDAPPORT"
11765 TARGET="_top"
11766 >ldap port</A
11767 ></P
11768 ></LI
11769 ></UL
11770 ><P
11771 >These are described in the <A
11772 HREF="smb.conf.5.html"
11773 TARGET="_top"
11774 >smb.conf(5)</A
11775 > man
11776 page and so will not be repeated here.  However, a sample smb.conf file for
11777 use with an LDAP directory could appear as</P
11778 ><P
11779 ><PRE
11780 CLASS="PROGRAMLISTING"
11781 >## /usr/local/samba/lib/smb.conf
11782 [global]
11783      security = user
11784      encrypt passwords = yes
11785
11786      netbios name = TASHTEGO
11787      workgroup = NARNIA
11788
11789      # ldap related parameters
11790
11791      # define the DN to use when binding to the directory servers
11792      # The password for this DN is not stored in smb.conf.  Rather it
11793      # must be set by using 'smbpasswd -w <TT
11794 CLASS="REPLACEABLE"
11795 ><I
11796 >secretpw</I
11797 ></TT
11798 >' to store the
11799      # passphrase in the secrets.tdb file.  If the "ldap admin dn" values
11800      # changes, this password will need to be reset.
11801      ldap admin dn = "cn=Samba Manager,ou=people,dc=samba,dc=org"
11802
11803      #  specify the LDAP server's hostname (defaults to locahost)
11804      ldap server = ahab.samba.org
11805
11806      # Define the SSL option when connecting to the directory
11807      # ('off', 'start tls', or 'on' (default))
11808      ldap ssl = start tls
11809
11810      # define the port to use in the LDAP session (defaults to 636 when
11811      # "ldap ssl = on")
11812      ldap port = 389
11813
11814      # specify the base DN to use when searching the directory
11815      ldap suffix = "ou=people,dc=samba,dc=org"
11816
11817      # generally the default ldap search filter is ok
11818      # ldap filter = "(&amp;(uid=%u)(objectclass=sambaAccount))"</PRE
11819 ></P
11820 ></DIV
11821 ></DIV
11822 ><DIV
11823 CLASS="SECT1"
11824 ><HR><H2
11825 CLASS="SECT1"
11826 ><A
11827 NAME="AEN2466"
11828 ></A
11829 >14.6. Accounts and Groups management</H2
11830 ><P
11831 >As users accounts are managed thru the sambaAccount objectclass, you should
11832 modify you existing administration tools to deal with sambaAccount attributes.</P
11833 ><P
11834 >Machines accounts are managed with the sambaAccount objectclass, just
11835 like users accounts. However, it's up to you to stored thoses accounts
11836 in a different tree of you LDAP namespace: you should use
11837 "ou=Groups,dc=plainjoe,dc=org" to store groups and
11838 "ou=People,dc=plainjoe,dc=org" to store users. Just configure your
11839 NSS and PAM accordingly (usually, in the /etc/ldap.conf configuration
11840 file).</P
11841 ><P
11842 >In Samba release 2.2.3, the group management system is based on posix
11843 groups. This meand that Samba make usage of the posixGroup objectclass.
11844 For now, there is no NT-like group system management (global and local
11845 groups).</P
11846 ></DIV
11847 ><DIV
11848 CLASS="SECT1"
11849 ><HR><H2
11850 CLASS="SECT1"
11851 ><A
11852 NAME="AEN2471"
11853 ></A
11854 >14.7. Security and sambaAccount</H2
11855 ><P
11856 >There are two important points to remember when discussing the security
11857 of sambaAccount entries in the directory.</P
11858 ><P
11859 ></P
11860 ><UL
11861 ><LI
11862 ><P
11863 ><SPAN
11864 CLASS="emphasis"
11865 ><I
11866 CLASS="EMPHASIS"
11867 >Never</I
11868 ></SPAN
11869 > retrieve the lmPassword or
11870         ntPassword attribute values over an unencrypted LDAP session.</P
11871 ></LI
11872 ><LI
11873 ><P
11874 ><SPAN
11875 CLASS="emphasis"
11876 ><I
11877 CLASS="EMPHASIS"
11878 >Never</I
11879 ></SPAN
11880 > allow non-admin users to
11881         view the lmPassword or ntPassword attribute values.</P
11882 ></LI
11883 ></UL
11884 ><P
11885 >These password hashes are clear text equivalents and can be used to impersonate
11886 the user without deriving the original clear text strings.  For more information
11887 on the details of LM/NT password hashes, refer to the <A
11888 HREF="ENCRYPTION.html"
11889 TARGET="_top"
11890 >ENCRYPTION chapter</A
11891 > of the Samba-HOWTO-Collection.</P
11892 ><P
11893 >To remedy the first security issue, the "ldap ssl" smb.conf parameter defaults
11894 to require an encrypted session (<B
11895 CLASS="COMMAND"
11896 >ldap ssl = on</B
11897 >) using
11898 the default port of 636
11899 when contacting the directory server.  When using an OpenLDAP 2.0 server, it
11900 is possible to use the use the StartTLS LDAP extended  operation in the place of
11901 LDAPS.  In either case, you are strongly discouraged to disable this security
11902 (<B
11903 CLASS="COMMAND"
11904 >ldap ssl = off</B
11905 >).</P
11906 ><P
11907 >Note that the LDAPS protocol is deprecated in favor of the LDAPv3 StartTLS
11908 extended operation.  However, the OpenLDAP library still provides support for
11909 the older method of securing communication between clients and servers.</P
11910 ><P
11911 >The second security precaution is to prevent non-administrative users from
11912 harvesting password hashes from the directory.  This can be done using the
11913 following ACL in <TT
11914 CLASS="FILENAME"
11915 >slapd.conf</TT
11916 >:</P
11917 ><P
11918 ><PRE
11919 CLASS="PROGRAMLISTING"
11920 >## allow the "ldap admin dn" access, but deny everyone else
11921 access to attrs=lmPassword,ntPassword
11922      by dn="cn=Samba Admin,ou=people,dc=plainjoe,dc=org" write
11923      by * none</PRE
11924 ></P
11925 ></DIV
11926 ><DIV
11927 CLASS="SECT1"
11928 ><HR><H2
11929 CLASS="SECT1"
11930 ><A
11931 NAME="AEN2491"
11932 ></A
11933 >14.8. LDAP specials attributes for sambaAccounts</H2
11934 ><P
11935 >The sambaAccount objectclass is composed of the following attributes:</P
11936 ><P
11937 ></P
11938 ><UL
11939 ><LI
11940 ><P
11941 ><TT
11942 CLASS="CONSTANT"
11943 >lmPassword</TT
11944 >: the LANMAN password 16-byte hash stored as a character
11945         representation of a hexidecimal string.</P
11946 ></LI
11947 ><LI
11948 ><P
11949 ><TT
11950 CLASS="CONSTANT"
11951 >ntPassword</TT
11952 >: the NT password hash 16-byte stored as a character
11953         representation of a hexidecimal string.</P
11954 ></LI
11955 ><LI
11956 ><P
11957 ><TT
11958 CLASS="CONSTANT"
11959 >pwdLastSet</TT
11960 >: The integer time in seconds since 1970 when the
11961         <TT
11962 CLASS="CONSTANT"
11963 >lmPassword</TT
11964 > and <TT
11965 CLASS="CONSTANT"
11966 >ntPassword</TT
11967 > attributes were last set.
11968         </P
11969 ></LI
11970 ><LI
11971 ><P
11972 ><TT
11973 CLASS="CONSTANT"
11974 >acctFlags</TT
11975 >: string of 11 characters surrounded by square brackets []
11976         representing account flags such as U (user), W(workstation), X(no password expiration), and
11977         D(disabled).</P
11978 ></LI
11979 ><LI
11980 ><P
11981 ><TT
11982 CLASS="CONSTANT"
11983 >logonTime</TT
11984 >: Integer value currently unused</P
11985 ></LI
11986 ><LI
11987 ><P
11988 ><TT
11989 CLASS="CONSTANT"
11990 >logoffTime</TT
11991 >: Integer value currently unused</P
11992 ></LI
11993 ><LI
11994 ><P
11995 ><TT
11996 CLASS="CONSTANT"
11997 >kickoffTime</TT
11998 >: Integer value currently unused</P
11999 ></LI
12000 ><LI
12001 ><P
12002 ><TT
12003 CLASS="CONSTANT"
12004 >pwdCanChange</TT
12005 >: Integer value currently unused</P
12006 ></LI
12007 ><LI
12008 ><P
12009 ><TT
12010 CLASS="CONSTANT"
12011 >pwdMustChange</TT
12012 >: Integer value currently unused</P
12013 ></LI
12014 ><LI
12015 ><P
12016 ><TT
12017 CLASS="CONSTANT"
12018 >homeDrive</TT
12019 >: specifies the drive letter to which to map the
12020         UNC path specified by homeDirectory. The drive letter must be specified in the form "X:"
12021         where X is the letter of the drive to map. Refer to the "logon drive" parameter in the
12022         smb.conf(5) man page for more information.</P
12023 ></LI
12024 ><LI
12025 ><P
12026 ><TT
12027 CLASS="CONSTANT"
12028 >scriptPath</TT
12029 >: The scriptPath property specifies the path of
12030         the user's logon script, .CMD, .EXE, or .BAT file. The string can be null. The path
12031         is relative to the netlogon share.  Refer to the "logon script" parameter in the
12032         smb.conf(5) man page for more information.</P
12033 ></LI
12034 ><LI
12035 ><P
12036 ><TT
12037 CLASS="CONSTANT"
12038 >profilePath</TT
12039 >: specifies a path to the user's profile.
12040         This value can be a null string, a local absolute path, or a UNC path.  Refer to the
12041         "logon path" parameter in the smb.conf(5) man page for more information.</P
12042 ></LI
12043 ><LI
12044 ><P
12045 ><TT
12046 CLASS="CONSTANT"
12047 >smbHome</TT
12048 >: The homeDirectory property specifies the path of
12049         the home directory for the user. The string can be null. If homeDrive is set and specifies
12050         a drive letter, homeDirectory should be a UNC path. The path must be a network
12051         UNC path of the form \\server\share\directory. This value can be a null string.
12052         Refer to the "logon home" parameter in the smb.conf(5) man page for more information.
12053         </P
12054 ></LI
12055 ><LI
12056 ><P
12057 ><TT
12058 CLASS="CONSTANT"
12059 >userWorkstation</TT
12060 >: character string value currently unused.
12061         </P
12062 ></LI
12063 ><LI
12064 ><P
12065 ><TT
12066 CLASS="CONSTANT"
12067 >rid</TT
12068 >: the integer representation of the user's relative identifier
12069         (RID).</P
12070 ></LI
12071 ><LI
12072 ><P
12073 ><TT
12074 CLASS="CONSTANT"
12075 >primaryGroupID</TT
12076 >: the relative identifier (RID) of the primary group
12077         of the user.</P
12078 ></LI
12079 ></UL
12080 ><P
12081 >The majority of these parameters are only used when Samba is acting as a PDC of
12082 a domain (refer to the <A
12083 HREF="Samba-PDC-HOWTO.html"
12084 TARGET="_top"
12085 >Samba-PDC-HOWTO</A
12086 > for details on
12087 how to configure Samba as a Primary Domain Controller). The following four attributes
12088 are only stored with the sambaAccount entry if the values are non-default values:</P
12089 ><P
12090 ></P
12091 ><UL
12092 ><LI
12093 ><P
12094 >smbHome</P
12095 ></LI
12096 ><LI
12097 ><P
12098 >scriptPath</P
12099 ></LI
12100 ><LI
12101 ><P
12102 >logonPath</P
12103 ></LI
12104 ><LI
12105 ><P
12106 >homeDrive</P
12107 ></LI
12108 ></UL
12109 ><P
12110 >These attributes are only stored with the sambaAccount entry if
12111 the values are non-default values.  For example, assume TASHTEGO has now been
12112 configured as a PDC and that <B
12113 CLASS="COMMAND"
12114 >logon home = \\%L\%u</B
12115 > was defined in
12116 its <TT
12117 CLASS="FILENAME"
12118 >smb.conf</TT
12119 > file. When a user named "becky" logons to the domain,
12120 the <TT
12121 CLASS="PARAMETER"
12122 ><I
12123 >logon home</I
12124 ></TT
12125 > string is expanded to \\TASHTEGO\becky.
12126 If the smbHome attribute exists in the entry "uid=becky,ou=people,dc=samba,dc=org",
12127 this value is used.  However, if this attribute does not exist, then the value
12128 of the <TT
12129 CLASS="PARAMETER"
12130 ><I
12131 >logon home</I
12132 ></TT
12133 > parameter is used in its place.  Samba
12134 will only write the attribute value to the directory entry is the value is
12135 something other than the default (e.g. \\MOBY\becky).</P
12136 ></DIV
12137 ><DIV
12138 CLASS="SECT1"
12139 ><HR><H2
12140 CLASS="SECT1"
12141 ><A
12142 NAME="AEN2561"
12143 ></A
12144 >14.9. Example LDIF Entries for a sambaAccount</H2
12145 ><P
12146 >The following is a working LDIF with the inclusion of the posixAccount objectclass:</P
12147 ><P
12148 ><PRE
12149 CLASS="PROGRAMLISTING"
12150 >dn: uid=guest2, ou=people,dc=plainjoe,dc=org
12151 ntPassword: 878D8014606CDA29677A44EFA1353FC7
12152 pwdMustChange: 2147483647
12153 primaryGroupID: 1201
12154 lmPassword: 552902031BEDE9EFAAD3B435B51404EE
12155 pwdLastSet: 1010179124
12156 logonTime: 0
12157 objectClass: sambaAccount
12158 uid: guest2
12159 kickoffTime: 2147483647
12160 acctFlags: [UX         ]
12161 logoffTime: 2147483647
12162 rid: 19006
12163 pwdCanChange: 0</PRE
12164 ></P
12165 ><P
12166 >The following is an LDIF entry for using both the sambaAccount and
12167 posixAccount objectclasses:</P
12168 ><P
12169 ><PRE
12170 CLASS="PROGRAMLISTING"
12171 >dn: uid=gcarter, ou=people,dc=plainjoe,dc=org
12172 logonTime: 0
12173 displayName: Gerald Carter
12174 lmPassword: 552902031BEDE9EFAAD3B435B51404EE
12175 primaryGroupID: 1201
12176 objectClass: posixAccount
12177 objectClass: sambaAccount
12178 acctFlags: [UX         ]
12179 userPassword: {crypt}BpM2ej8Rkzogo
12180 uid: gcarter
12181 uidNumber: 9000
12182 cn: Gerald Carter
12183 loginShell: /bin/bash
12184 logoffTime: 2147483647
12185 gidNumber: 100
12186 kickoffTime: 2147483647
12187 pwdLastSet: 1010179230
12188 rid: 19000
12189 homeDirectory: /home/tashtego/gcarter
12190 pwdCanChange: 0
12191 pwdMustChange: 2147483647
12192 ntPassword: 878D8014606CDA29677A44EFA1353FC7</PRE
12193 ></P
12194 ></DIV
12195 ><DIV
12196 CLASS="SECT1"
12197 ><HR><H2
12198 CLASS="SECT1"
12199 ><A
12200 NAME="AEN2569"
12201 ></A
12202 >14.10. Comments</H2
12203 ><P
12204 >Please mail all comments regarding this HOWTO to <A
12205 HREF="mailto:jerry@samba.org"
12206 TARGET="_top"
12207 >jerry@samba.org</A
12208 >.  This documents was
12209 last updated to reflect the Samba 2.2.3 release.&#13;</P
12210 ></DIV
12211 ></DIV
12212 ><DIV
12213 CLASS="CHAPTER"
12214 ><HR><H1
12215 ><A
12216 NAME="ADS"
12217 ></A
12218 >Chapter 15. Using samba 3.0 with ActiveDirectory support</H1
12219 ><P
12220 >This is a VERY ROUGH guide to setting up the current (November 2001)
12221 pre-alpha version of Samba 3.0 with kerberos authentication against a
12222 Windows2000 KDC. The procedures listed here are likely to change as
12223 the code develops.</P
12224 ><P
12225 >Pieces you need before you begin:
12226 <P
12227 ></P
12228 ><TABLE
12229 BORDER="0"
12230 ><TBODY
12231 ><TR
12232 ><TD
12233 >a Windows 2000 server.</TD
12234 ></TR
12235 ><TR
12236 ><TD
12237 >samba 3.0 or higher.</TD
12238 ></TR
12239 ><TR
12240 ><TD
12241 >the MIT kerberos development libraries (either install from the above sources or use a package). The heimdal libraries will not work.</TD
12242 ></TR
12243 ><TR
12244 ><TD
12245 >the OpenLDAP development libraries.</TD
12246 ></TR
12247 ></TBODY
12248 ></TABLE
12249 ><P
12250 ></P
12251 ></P
12252 ><DIV
12253 CLASS="SECT1"
12254 ><HR><H2
12255 CLASS="SECT1"
12256 ><A
12257 NAME="AEN2587"
12258 ></A
12259 >15.1. Installing the required packages for Debian</H2
12260 ><P
12261 >On Debian you need to install the following packages:
12262 <P
12263 ></P
12264 ><TABLE
12265 BORDER="0"
12266 ><TBODY
12267 ><TR
12268 ><TD
12269 >libkrb5-dev</TD
12270 ></TR
12271 ><TR
12272 ><TD
12273 >krb5-user</TD
12274 ></TR
12275 ></TBODY
12276 ></TABLE
12277 ><P
12278 ></P
12279 ></P
12280 ></DIV
12281 ><DIV
12282 CLASS="SECT1"
12283 ><HR><H2
12284 CLASS="SECT1"
12285 ><A
12286 NAME="AEN2593"
12287 ></A
12288 >15.2. Installing the required packages for RedHat</H2
12289 ><P
12290 >On RedHat this means you should have at least: 
12291 <P
12292 ></P
12293 ><TABLE
12294 BORDER="0"
12295 ><TBODY
12296 ><TR
12297 ><TD
12298 >krb5-workstation (for kinit)</TD
12299 ></TR
12300 ><TR
12301 ><TD
12302 >krb5-libs (for linking with)</TD
12303 ></TR
12304 ><TR
12305 ><TD
12306 >krb5-devel (because you are compiling from source)</TD
12307 ></TR
12308 ></TBODY
12309 ></TABLE
12310 ><P
12311 ></P
12312 ></P
12313 ><P
12314 >in addition to the standard development environment.</P
12315 ><P
12316 >Note that these are not standard on a RedHat install, and you may need 
12317 to get them off CD2.</P
12318 ></DIV
12319 ><DIV
12320 CLASS="SECT1"
12321 ><HR><H2
12322 CLASS="SECT1"
12323 ><A
12324 NAME="AEN2602"
12325 ></A
12326 >15.3. Compile Samba</H2
12327 ><P
12328 >If your kerberos libraries are in a non-standard location then
12329   remember to add the configure option --with-krb5=DIR.</P
12330 ><P
12331 >After you run configure make sure that include/config.h contains 
12332   lines like this:</P
12333 ><P
12334 ><PRE
12335 CLASS="PROGRAMLISTING"
12336 >#define HAVE_KRB5 1
12337 #define HAVE_LDAP 1</PRE
12338 ></P
12339 ><P
12340 >If it doesn't then configure did not find your krb5 libraries or
12341   your ldap libraries. Look in config.log to figure out why and fix
12342   it.</P
12343 ><P
12344 >Then compile and install Samba as usual. You must use at least the
12345   following 3 options in smb.conf:</P
12346 ><P
12347 ><PRE
12348 CLASS="PROGRAMLISTING"
12349 >  realm = YOUR.KERBEROS.REALM
12350   ads server = your.kerberos.server
12351   security = ADS
12352   encrypt passwords = yes</PRE
12353 ></P
12354 ><P
12355 >Strictly speaking, you can omit the realm name and you can use an IP
12356   address for the ads server. In that case Samba will auto-detect these.</P
12357 ><P
12358 >You do *not* need a smbpasswd file, although it won't do any harm
12359   and if you have one then Samba will be able to fall back to normal
12360   password security for older clients. I expect that the above
12361   required options will change soon when we get better active
12362   directory integration.</P
12363 ></DIV
12364 ><DIV
12365 CLASS="SECT1"
12366 ><HR><H2
12367 CLASS="SECT1"
12368 ><A
12369 NAME="AEN2614"
12370 ></A
12371 >15.4. Setup your /etc/krb5.conf</H2
12372 ><P
12373 >The minimal configuration for krb5.conf is:</P
12374 ><P
12375 ><PRE
12376 CLASS="PROGRAMLISTING"
12377 >       [realms]
12378     YOUR.KERBEROS.REALM = {
12379         kdc = your.kerberos.server
12380     }</PRE
12381 ></P
12382 ><P
12383 >Test your config by doing a "kinit USERNAME@REALM" and making sure that
12384   your password is accepted by the Win2000 KDC. </P
12385 ><P
12386 >NOTE: The realm must be uppercase. </P
12387 ><P
12388 >You also must ensure that you can do a reverse DNS lookup on the IP
12389 address of your KDC. Also, the name that this reverse lookup maps to
12390 must either be the netbios name of the KDC (ie. the hostname with no
12391 domain attached) or it can alternatively be the netbios name
12392 followed by the realm. </P
12393 ><P
12394 >The easiest way to ensure you get this right is to add a /etc/hosts
12395 entry mapping the IP address of your KDC to its netbios name. If you
12396 don't get this right then you will get a "local error" when you try
12397 to join the realm.</P
12398 ><P
12399 >If all you want is kerberos support in smbclient then you can skip
12400 straight to step 5 now. Step 3 is only needed if you want kerberos
12401 support in smbd.</P
12402 ></DIV
12403 ><DIV
12404 CLASS="SECT1"
12405 ><HR><H2
12406 CLASS="SECT1"
12407 ><A
12408 NAME="AEN2624"
12409 ></A
12410 >15.5. Create the computer account</H2
12411 ><P
12412 >Do a "kinit" as a user that has authority to change arbitrary
12413 passwords on the KDC ("Administrator" is a good choice). Then as a
12414 user that has write permission on the Samba private directory
12415 (usually root) run:
12416 <B
12417 CLASS="COMMAND"
12418 >net ads join</B
12419 ></P
12420 ><DIV
12421 CLASS="SECT2"
12422 ><HR><H3
12423 CLASS="SECT2"
12424 ><A
12425 NAME="AEN2628"
12426 ></A
12427 >15.5.1. Possible errors</H3
12428 ><P
12429 ><P
12430 ></P
12431 ><DIV
12432 CLASS="VARIABLELIST"
12433 ><DL
12434 ><DT
12435 >"bash: kinit: command not found"</DT
12436 ><DD
12437 ><P
12438 >kinit is in the krb5-workstation RPM on RedHat systems, and is in /usr/kerberos/bin, so it won't be in the path until you log in again (or open a new terminal)</P
12439 ></DD
12440 ><DT
12441 >"ADS support not compiled in"</DT
12442 ><DD
12443 ><P
12444 >Samba must be reconfigured (remove config.cache) and recompiled (make clean all install) after the kerberos libs and headers are installed.</P
12445 ></DD
12446 ></DL
12447 ></DIV
12448 ></P
12449 ></DIV
12450 ></DIV
12451 ><DIV
12452 CLASS="SECT1"
12453 ><HR><H2
12454 CLASS="SECT1"
12455 ><A
12456 NAME="AEN2640"
12457 ></A
12458 >15.6. Test your server setup</H2
12459 ><P
12460 >On a Windows 2000 client try <B
12461 CLASS="COMMAND"
12462 >net use * \\server\share</B
12463 >. You should
12464 be logged in with kerberos without needing to know a password. If
12465 this fails then run <B
12466 CLASS="COMMAND"
12467 >klist tickets</B
12468 >. Did you get a ticket for the
12469 server? Does it have an encoding type of DES-CBC-MD5 ? </P
12470 ></DIV
12471 ><DIV
12472 CLASS="SECT1"
12473 ><HR><H2
12474 CLASS="SECT1"
12475 ><A
12476 NAME="AEN2645"
12477 ></A
12478 >15.7. Testing with smbclient</H2
12479 ><P
12480 >On your Samba server try to login to a Win2000 server or your Samba
12481 server using smbclient and kerberos. Use smbclient as usual, but
12482 specify the -k option to choose kerberos authentication.</P
12483 ></DIV
12484 ><DIV
12485 CLASS="SECT1"
12486 ><HR><H2
12487 CLASS="SECT1"
12488 ><A
12489 NAME="AEN2648"
12490 ></A
12491 >15.8. Notes</H2
12492 ><P
12493 >You must change administrator password at least once after DC install,
12494  to create the right encoding types</P
12495 ><P
12496 >w2k doesn't seem to create the _kerberos._udp and _ldap._tcp in
12497    their defaults DNS setup. Maybe fixed in service packs?</P
12498 ></DIV
12499 ></DIV
12500 ><DIV
12501 CLASS="CHAPTER"
12502 ><HR><H1
12503 ><A
12504 NAME="IMPROVED-BROWSING"
12505 ></A
12506 >Chapter 16. Improved browsing in samba</H1
12507 ><DIV
12508 CLASS="SECT1"
12509 ><H2
12510 CLASS="SECT1"
12511 ><A
12512 NAME="AEN2659"
12513 ></A
12514 >16.1. Overview of browsing</H2
12515 ><P
12516 >SMB networking provides a mechanism by which clients can access a list
12517 of machines in a network, a so-called "browse list".  This list
12518 contains machines that are ready to offer file and/or print services
12519 to other machines within the network. Thus it does not include
12520 machines which aren't currently able to do server tasks.  The browse
12521 list is heavily used by all SMB clients.  Configuration of SMB
12522 browsing has been problematic for some Samba users, hence this
12523 document.</P
12524 ><P
12525 >Browsing will NOT work if name resolution from NetBIOS names to IP
12526 addresses does not function correctly. Use of a WINS server is highly
12527 recommended to aid the resolution of NetBIOS (SMB) names to IP addresses.
12528 WINS allows remote segment clients to obtain NetBIOS name_type information
12529 that can NOT be provided by any other means of name resolution.</P
12530 ></DIV
12531 ><DIV
12532 CLASS="SECT1"
12533 ><HR><H2
12534 CLASS="SECT1"
12535 ><A
12536 NAME="AEN2663"
12537 ></A
12538 >16.2. Browsing support in samba</H2
12539 ><P
12540 >Samba now fully supports browsing.  The browsing is supported by nmbd
12541 and is also controlled by options in the smb.conf file (see smb.conf(5)).</P
12542 ><P
12543 >Samba can act as a local browse master for a workgroup and the ability
12544 for samba to support domain logons and scripts is now available.  See
12545 DOMAIN.txt for more information on domain logons.</P
12546 ><P
12547 >Samba can also act as a domain master browser for a workgroup.  This
12548 means that it will collate lists from local browse masters into a
12549 wide area network server list.  In order for browse clients to
12550 resolve the names they may find in this list, it is recommended that
12551 both samba and your clients use a WINS server.</P
12552 ><P
12553 >Note that you should NOT set Samba to be the domain master for a
12554 workgroup that has the same name as an NT Domain: on each wide area
12555 network, you must only ever have one domain master browser per workgroup,
12556 regardless of whether it is NT, Samba or any other type of domain master
12557 that is providing this service.</P
12558 ><P
12559 >[Note that nmbd can be configured as a WINS server, but it is not
12560 necessary to specifically use samba as your WINS server.  NTAS can
12561 be configured as your WINS server.  In a mixed NT server and
12562 samba environment on a Wide Area Network, it is recommended that
12563 you use the NT server's WINS server capabilities.  In a samba-only
12564 environment, it is recommended that you use one and only one nmbd
12565 as your WINS server].</P
12566 ><P
12567 >To get browsing to work you need to run nmbd as usual, but will need
12568 to use the "workgroup" option in smb.conf to control what workgroup
12569 Samba becomes a part of.</P
12570 ><P
12571 >Samba also has a useful option for a Samba server to offer itself for
12572 browsing on another subnet.  It is recommended that this option is only
12573 used for 'unusual' purposes: announcements over the internet, for
12574 example.  See "remote announce" in the smb.conf man page.  </P
12575 ></DIV
12576 ><DIV
12577 CLASS="SECT1"
12578 ><HR><H2
12579 CLASS="SECT1"
12580 ><A
12581 NAME="AEN2672"
12582 ></A
12583 >16.3. Problem resolution</H2
12584 ><P
12585 >If something doesn't work then hopefully the log.nmb file will help
12586 you track down the problem.  Try a debug level of 2 or 3 for finding
12587 problems. Also note that the current browse list usually gets stored
12588 in text form in a file called browse.dat.</P
12589 ><P
12590 >Note that if it doesn't work for you, then you should still be able to
12591 type the server name as \\SERVER in filemanager then hit enter and
12592 filemanager should display the list of available shares.</P
12593 ><P
12594 >Some people find browsing fails because they don't have the global
12595 "guest account" set to a valid account.  Remember that the IPC$
12596 connection that lists the shares is done as guest, and thus you must
12597 have a valid guest account.</P
12598 ><P
12599 >Also, a lot of people are getting bitten by the problem of too many
12600 parameters on the command line of nmbd in inetd.conf.  This trick is to
12601 not use spaces between the option and the parameter (eg: -d2 instead
12602 of -d 2), and to not use the -B and -N options.  New versions of nmbd
12603 are now far more likely to correctly find your broadcast and network
12604 address, so in most cases these aren't needed.</P
12605 ><P
12606 >The other big problem people have is that their broadcast address,
12607 netmask or IP address is wrong (specified with the "interfaces" option
12608 in smb.conf)</P
12609 ></DIV
12610 ><DIV
12611 CLASS="SECT1"
12612 ><HR><H2
12613 CLASS="SECT1"
12614 ><A
12615 NAME="AEN2679"
12616 ></A
12617 >16.4. Browsing across subnets</H2
12618 ><P
12619 >With the release of Samba 1.9.17(alpha1 and above) Samba has been
12620 updated to enable it to support the replication of browse lists
12621 across subnet boundaries.  New code and options have been added to
12622 achieve this.  This section describes how to set this feature up
12623 in different settings.</P
12624 ><P
12625 >To see browse lists that span TCP/IP subnets (ie.  networks separated
12626 by routers that don't pass broadcast traffic) you must set up at least
12627 one WINS server.  The WINS server acts as a DNS for NetBIOS names, allowing
12628 NetBIOS name to IP address translation to be done by doing a direct
12629 query of the WINS server.  This is done via a directed UDP packet on
12630 port 137 to the WINS server machine.  The reason for a WINS server is
12631 that by default, all NetBIOS name to IP address translation is done
12632 by broadcasts from the querying machine.  This means that machines
12633 on one subnet will not be able to resolve the names of machines on
12634 another subnet without using a WINS server.</P
12635 ><P
12636 >Remember, for browsing across subnets to work correctly, all machines,
12637 be they Windows 95, Windows NT, or Samba servers must have the IP address
12638 of a WINS server given to them by a DHCP server, or by manual configuration 
12639 (for Win95 and WinNT, this is in the TCP/IP Properties, under Network 
12640 settings) for Samba this is in the smb.conf file.</P
12641 ><DIV
12642 CLASS="SECT2"
12643 ><HR><H3
12644 CLASS="SECT2"
12645 ><A
12646 NAME="AEN2684"
12647 ></A
12648 >16.4.1. How does cross subnet browsing work ?</H3
12649 ><P
12650 >Cross subnet browsing is a complicated dance, containing multiple
12651 moving parts.  It has taken Microsoft several years to get the code
12652 that achieves this correct, and Samba lags behind in some areas.
12653 However, with the 1.9.17 release, Samba is capable of cross subnet
12654 browsing when configured correctly.</P
12655 ><P
12656 >Consider a network set up as follows :</P
12657 ><P
12658 ><PRE
12659 CLASS="PROGRAMLISTING"
12660 >                                   (DMB)
12661              N1_A      N1_B        N1_C       N1_D        N1_E
12662               |          |           |          |           |
12663           -------------------------------------------------------
12664             |          subnet 1                       |
12665           +---+                                      +---+
12666           |R1 | Router 1                  Router 2   |R2 |
12667           +---+                                      +---+
12668             |                                          |
12669             |  subnet 2              subnet 3          |
12670   --------------------------       ------------------------------------
12671   |     |     |      |               |        |         |           |
12672  N2_A  N2_B  N2_C   N2_D           N3_A     N3_B      N3_C        N3_D 
12673                     (WINS)</PRE
12674 ></P
12675 ><P
12676 >Consisting of 3 subnets (1, 2, 3) connected by two routers
12677 (R1, R2) - these do not pass broadcasts.  Subnet 1 has 5 machines
12678 on it, subnet 2 has 4 machines, subnet 3 has 4 machines.  Assume
12679 for the moment that all these machines are configured to be in the
12680 same workgroup (for simplicities sake).  Machine N1_C on subnet 1
12681 is configured as Domain Master Browser (ie.  it will collate the
12682 browse lists for the workgroup).  Machine N2_D is configured as
12683 WINS server and all the other machines are configured to register
12684 their NetBIOS names with it.</P
12685 ><P
12686 >As all these machines are booted up, elections for master browsers
12687 will take place on each of the three subnets.  Assume that machine
12688 N1_C wins on subnet 1, N2_B wins on subnet 2, and N3_D wins on
12689 subnet 3 - these machines are known as local master browsers for
12690 their particular subnet.  N1_C has an advantage in winning as the
12691 local master browser on subnet 1 as it is set up as Domain Master
12692 Browser.</P
12693 ><P
12694 >On each of the three networks, machines that are configured to 
12695 offer sharing services will broadcast that they are offering
12696 these services.  The local master browser on each subnet will
12697 receive these broadcasts and keep a record of the fact that
12698 the machine is offering a service.  This list of records is
12699 the basis of the browse list.  For this case, assume that
12700 all the machines are configured to offer services so all machines
12701 will be on the browse list.</P
12702 ><P
12703 >For each network, the local master browser on that network is
12704 considered 'authoritative' for all the names it receives via
12705 local broadcast.  This is because a machine seen by the local
12706 master browser via a local broadcast must be on the same 
12707 network as the local master browser and thus is a 'trusted'
12708 and 'verifiable' resource.  Machines on other networks that
12709 the local master browsers learn about when collating their
12710 browse lists have not been directly seen - these records are
12711 called 'non-authoritative'.</P
12712 ><P
12713 >At this point the browse lists look as follows (these are 
12714 the machines you would see in your network neighborhood if
12715 you looked in it on a particular network right now).</P
12716 ><P
12717 ><PRE
12718 CLASS="PROGRAMLISTING"
12719 >Subnet           Browse Master   List
12720 ------           -------------   ----
12721 Subnet1          N1_C            N1_A, N1_B, N1_C, N1_D, N1_E
12722
12723 Subnet2          N2_B            N2_A, N2_B, N2_C, N2_D
12724
12725 Subnet3          N3_D            N3_A, N3_B, N3_C, N3_D</PRE
12726 ></P
12727 ><P
12728 >Note that at this point all the subnets are separate, no
12729 machine is seen across any of the subnets.</P
12730 ><P
12731 >Now examine subnet 2.  As soon as N2_B has become the local
12732 master browser it looks for a Domain master browser to synchronize
12733 its browse list with.  It does this by querying the WINS server
12734 (N2_D) for the IP address associated with the NetBIOS name 
12735 WORKGROUP&gt;1B&lt;.  This name was registerd by the Domain master
12736 browser (N1_C) with the WINS server as soon as it was booted.</P
12737 ><P
12738 >Once N2_B knows the address of the Domain master browser it
12739 tells it that is the local master browser for subnet 2 by
12740 sending a MasterAnnouncement packet as a UDP port 138 packet.
12741 It then synchronizes with it by doing a NetServerEnum2 call.  This
12742 tells the Domain Master Browser to send it all the server
12743 names it knows about.  Once the domain master browser receives
12744 the MasterAnnouncement packet it schedules a synchronization
12745 request to the sender of that packet.  After both synchronizations
12746 are done the browse lists look like :</P
12747 ><P
12748 ><PRE
12749 CLASS="PROGRAMLISTING"
12750 >Subnet           Browse Master   List
12751 ------           -------------   ----
12752 Subnet1          N1_C            N1_A, N1_B, N1_C, N1_D, N1_E, 
12753                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*)
12754
12755 Subnet2          N2_B            N2_A, N2_B, N2_C, N2_D
12756                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
12757
12758 Subnet3          N3_D            N3_A, N3_B, N3_C, N3_D
12759
12760 Servers with a (*) after them are non-authoritative names.</PRE
12761 ></P
12762 ><P
12763 >At this point users looking in their network neighborhood on
12764 subnets 1 or 2 will see all the servers on both, users on
12765 subnet 3 will still only see the servers on their own subnet.</P
12766 ><P
12767 >The same sequence of events that occured for N2_B now occurs
12768 for the local master browser on subnet 3 (N3_D).  When it
12769 synchronizes browse lists with the domain master browser (N1_A)
12770 it gets both the server entries on subnet 1, and those on
12771 subnet 2.  After N3_D has synchronized with N1_C and vica-versa
12772 the browse lists look like.</P
12773 ><P
12774 ><PRE
12775 CLASS="PROGRAMLISTING"
12776 >Subnet           Browse Master   List
12777 ------           -------------   ----
12778 Subnet1          N1_C            N1_A, N1_B, N1_C, N1_D, N1_E, 
12779                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*),
12780                                  N3_A(*), N3_B(*), N3_C(*), N3_D(*)
12781
12782 Subnet2          N2_B            N2_A, N2_B, N2_C, N2_D
12783                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
12784
12785 Subnet3          N3_D            N3_A, N3_B, N3_C, N3_D
12786                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*),
12787                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*)
12788
12789 Servers with a (*) after them are non-authoritative names.</PRE
12790 ></P
12791 ><P
12792 >At this point users looking in their network neighborhood on
12793 subnets 1 or 3 will see all the servers on all sunbets, users on
12794 subnet 2 will still only see the servers on subnets 1 and 2, but not 3.</P
12795 ><P
12796 >Finally, the local master browser for subnet 2 (N2_B) will sync again
12797 with the domain master browser (N1_C) and will recieve the missing
12798 server entries.  Finally - and as a steady state (if no machines
12799 are removed or shut off) the browse lists will look like :</P
12800 ><P
12801 ><PRE
12802 CLASS="PROGRAMLISTING"
12803 >Subnet           Browse Master   List
12804 ------           -------------   ----
12805 Subnet1          N1_C            N1_A, N1_B, N1_C, N1_D, N1_E, 
12806                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*),
12807                                  N3_A(*), N3_B(*), N3_C(*), N3_D(*)
12808
12809 Subnet2          N2_B            N2_A, N2_B, N2_C, N2_D
12810                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*)
12811                                  N3_A(*), N3_B(*), N3_C(*), N3_D(*)
12812
12813 Subnet3          N3_D            N3_A, N3_B, N3_C, N3_D
12814                                  N1_A(*), N1_B(*), N1_C(*), N1_D(*), N1_E(*),
12815                                  N2_A(*), N2_B(*), N2_C(*), N2_D(*)
12816         
12817 Servers with a (*) after them are non-authoritative names.</PRE
12818 ></P
12819 ><P
12820 >Synchronizations between the domain master browser and local
12821 master browsers will continue to occur, but this should be a
12822 steady state situation.</P
12823 ><P
12824 >If either router R1 or R2 fails the following will occur:</P
12825 ><P
12826 ></P
12827 ><OL
12828 TYPE="1"
12829 ><LI
12830 ><P
12831 >       Names of computers on each side of the inaccessible network fragments
12832         will be maintained for as long as 36 minutes, in the network neighbourhood
12833         lists.
12834         </P
12835 ></LI
12836 ><LI
12837 ><P
12838 >       Attempts to connect to these inaccessible computers will fail, but the
12839         names will not be removed from the network neighbourhood lists.
12840         </P
12841 ></LI
12842 ><LI
12843 ><P
12844 >       If one of the fragments is cut off from the WINS server, it will only
12845         be able to access servers on its local subnet, by using subnet-isolated
12846         broadcast NetBIOS name resolution.  The effects are similar to that of
12847         losing access to a DNS server.
12848         </P
12849 ></LI
12850 ></OL
12851 ></DIV
12852 ></DIV
12853 ><DIV
12854 CLASS="SECT1"
12855 ><HR><H2
12856 CLASS="SECT1"
12857 ><A
12858 NAME="AEN2719"
12859 ></A
12860 >16.5. Setting up a WINS server</H2
12861 ><P
12862 >Either a Samba machine or a Windows NT Server machine may be set up
12863 as a WINS server.  To set a Samba machine to be a WINS server you must
12864 add the following option to the smb.conf file on the selected machine :
12865 in the [globals] section add the line </P
12866 ><P
12867 ><B
12868 CLASS="COMMAND"
12869 >               wins support = yes</B
12870 ></P
12871 ><P
12872 >Versions of Samba previous to 1.9.17 had this parameter default to
12873 yes.  If you have any older versions of Samba on your network it is
12874 strongly suggested you upgrade to 1.9.17 or above, or at the very
12875 least set the parameter to 'no' on all these machines.</P
12876 ><P
12877 >Machines with "<B
12878 CLASS="COMMAND"
12879 >wins support = yes</B
12880 >" will keep a list of 
12881 all NetBIOS names registered with them, acting as a DNS for NetBIOS names.</P
12882 ><P
12883 >You should set up only ONE wins server.  Do NOT set the
12884 "<B
12885 CLASS="COMMAND"
12886 >wins support = yes</B
12887 >" option on more than one Samba 
12888 server.</P
12889 ><P
12890 >To set up a Windows NT Server as a WINS server you need to set up
12891 the WINS service - see your NT documentation for details.  Note that
12892 Windows NT WINS Servers can replicate to each other, allowing more
12893 than one to be set up in a complex subnet environment.  As Microsoft
12894 refuse to document these replication protocols Samba cannot currently
12895 participate in these replications.  It is possible in the future that
12896 a Samba-&#62;Samba WINS replication protocol may be defined, in which
12897 case more than one Samba machine could be set up as a WINS server
12898 but currently only one Samba server should have the "wins support = yes"
12899 parameter set.</P
12900 ><P
12901 >After the WINS server has been configured you must ensure that all
12902 machines participating on the network are configured with the address
12903 of this WINS server.  If your WINS server is a Samba machine, fill in
12904 the Samba machine IP address in the "Primary WINS Server" field of
12905 the "Control Panel-&#62;Network-&#62;Protocols-&#62;TCP-&#62;WINS Server" dialogs
12906 in Windows 95 or Windows NT.  To tell a Samba server the IP address
12907 of the WINS server add the following line to the [global] section of
12908 all smb.conf files :</P
12909 ><P
12910 ><B
12911 CLASS="COMMAND"
12912 >               wins server = &gt;name or IP address&lt;</B
12913 ></P
12914 ><P
12915 >where &gt;name or IP address&lt; is either the DNS name of the WINS server
12916 machine or its IP address.</P
12917 ><P
12918 >Note that this line MUST NOT BE SET in the smb.conf file of the Samba
12919 server acting as the WINS server itself.  If you set both the
12920 "<B
12921 CLASS="COMMAND"
12922 >wins support = yes</B
12923 >" option and the 
12924 "<B
12925 CLASS="COMMAND"
12926 >wins server = &gt;name&lt;</B
12927 >" option then
12928 nmbd will fail to start.</P
12929 ><P
12930 >There are two possible scenarios for setting up cross subnet browsing.
12931 The first details setting up cross subnet browsing on a network containing
12932 Windows 95, Samba and Windows NT machines that are not configured as
12933 part of a Windows NT Domain.  The second details setting up cross subnet
12934 browsing on networks that contain NT Domains.</P
12935 ></DIV
12936 ><DIV
12937 CLASS="SECT1"
12938 ><HR><H2
12939 CLASS="SECT1"
12940 ><A
12941 NAME="AEN2738"
12942 ></A
12943 >16.6. Setting up Browsing in a WORKGROUP</H2
12944 ><P
12945 >To set up cross subnet browsing on a network containing machines
12946 in up to be in a WORKGROUP, not an NT Domain you need to set up one
12947 Samba server to be the Domain Master Browser (note that this is *NOT*
12948 the same as a Primary Domain Controller, although in an NT Domain the
12949 same machine plays both roles).  The role of a Domain master browser is
12950 to collate the browse lists from local master browsers on all the
12951 subnets that have a machine participating in the workgroup.  Without
12952 one machine configured as a domain master browser each subnet would
12953 be an isolated workgroup, unable to see any machines on any other
12954 subnet.  It is the presense of a domain master browser that makes
12955 cross subnet browsing possible for a workgroup.</P
12956 ><P
12957 >In an WORKGROUP environment the domain master browser must be a
12958 Samba server, and there must only be one domain master browser per
12959 workgroup name.  To set up a Samba server as a domain master browser,
12960 set the following option in the [global] section of the smb.conf file :</P
12961 ><P
12962 ><B
12963 CLASS="COMMAND"
12964 >               domain master = yes</B
12965 ></P
12966 ><P
12967 >The domain master browser should also preferrably be the local master
12968 browser for its own subnet.  In order to achieve this set the following
12969 options in the [global] section of the smb.conf file :</P
12970 ><P
12971 ><PRE
12972 CLASS="PROGRAMLISTING"
12973 >        domain master = yes
12974         local master = yes
12975         preferred master = yes
12976         os level = 65</PRE
12977 ></P
12978 ><P
12979 >The domain master browser may be the same machine as the WINS
12980 server, if you require.</P
12981 ><P
12982 >Next, you should ensure that each of the subnets contains a
12983 machine that can act as a local master browser for the
12984 workgroup.  Any NT machine should be able to do this, as will
12985 Windows 95 machines (although these tend to get rebooted more
12986 often, so it's not such a good idea to use these).  To make a 
12987 Samba server a local master browser set the following
12988 options in the [global] section of the smb.conf file :</P
12989 ><P
12990 ><PRE
12991 CLASS="PROGRAMLISTING"
12992 >        domain master = no
12993         local master = yes
12994         preferred master = yes
12995         os level = 65</PRE
12996 ></P
12997 ><P
12998 >Do not do this for more than one Samba server on each subnet,
12999 or they will war with each other over which is to be the local
13000 master browser.</P
13001 ><P
13002 >The "local master" parameter allows Samba to act as a local master
13003 browser.  The "preferred master" causes nmbd to force a browser
13004 election on startup and the "os level" parameter sets Samba high
13005 enough so that it should win any browser elections.</P
13006 ><P
13007 >If you have an NT machine on the subnet that you wish to
13008 be the local master browser then you can disable Samba from
13009 becoming a local master browser by setting the following
13010 options in the [global] section of the smb.conf file :</P
13011 ><P
13012 ><PRE
13013 CLASS="PROGRAMLISTING"
13014 >        domain master = no
13015         local master = no
13016         preferred master = no
13017         os level = 0</PRE
13018 ></P
13019 ></DIV
13020 ><DIV
13021 CLASS="SECT1"
13022 ><HR><H2
13023 CLASS="SECT1"
13024 ><A
13025 NAME="AEN2756"
13026 ></A
13027 >16.7. Setting up Browsing in a DOMAIN</H2
13028 ><P
13029 >If you are adding Samba servers to a Windows NT Domain then
13030 you must not set up a Samba server as a domain master browser.
13031 By default, a Windows NT Primary Domain Controller for a Domain
13032 name is also the Domain master browser for that name, and many
13033 things will break if a Samba server registers the Domain master
13034 browser NetBIOS name (DOMAIN&gt;1B&lt;) with WINS instead of the PDC.</P
13035 ><P
13036 >For subnets other than the one containing the Windows NT PDC
13037 you may set up Samba servers as local master browsers as
13038 described.  To make a Samba server a local master browser set 
13039 the following options in the [global] section of the smb.conf 
13040 file :</P
13041 ><P
13042 ><PRE
13043 CLASS="PROGRAMLISTING"
13044 >        domain master = no
13045         local master = yes
13046         preferred master = yes
13047         os level = 65</PRE
13048 ></P
13049 ><P
13050 >If you wish to have a Samba server fight the election with machines
13051 on the same subnet you may set the "os level" parameter to lower
13052 levels.  By doing this you can tune the order of machines that
13053 will become local master browsers if they are running.  For
13054 more details on this see the section "FORCING SAMBA TO BE THE MASTER"
13055 below.</P
13056 ><P
13057 >If you have Windows NT machines that are members of the domain
13058 on all subnets, and you are sure they will always be running then
13059 you can disable Samba from taking part in browser elections and
13060 ever becoming a local master browser by setting following options 
13061 in the [global] section of the smb.conf file :</P
13062 ><P
13063 ><B
13064 CLASS="COMMAND"
13065 >        domain master = no
13066         local master = no
13067         preferred master = no
13068         os level = 0</B
13069 ></P
13070 ></DIV
13071 ><DIV
13072 CLASS="SECT1"
13073 ><HR><H2
13074 CLASS="SECT1"
13075 ><A
13076 NAME="AEN2766"
13077 ></A
13078 >16.8. Forcing samba to be the master</H2
13079 ><P
13080 >Who becomes the "master browser" is determined by an election process
13081 using broadcasts.  Each election packet contains a number of parameters
13082 which determine what precedence (bias) a host should have in the
13083 election.  By default Samba uses a very low precedence and thus loses
13084 elections to just about anyone else.</P
13085 ><P
13086 >If you want Samba to win elections then just set the "os level" global
13087 option in smb.conf to a higher number.  It defaults to 0.  Using 34
13088 would make it win all elections over every other system (except other
13089 samba systems!)</P
13090 ><P
13091 >A "os level" of 2 would make it beat WfWg and Win95, but not NTAS.  A
13092 NTAS domain controller uses level 32.</P
13093 ><P
13094 >The maximum os level is 255</P
13095 ><P
13096 >If you want samba to force an election on startup, then set the
13097 "preferred master" global option in smb.conf to "yes".  Samba will
13098 then have a slight advantage over other potential master browsers
13099 that are not preferred master browsers.  Use this parameter with
13100 care, as if you have two hosts (whether they are windows 95 or NT or
13101 samba) on the same local subnet both set with "preferred master" to
13102 "yes", then periodically and continually they will force an election
13103 in order to become the local master browser.</P
13104 ><P
13105 >If you want samba to be a "domain master browser", then it is
13106 recommended that you also set "preferred master" to "yes", because
13107 samba will not become a domain master browser for the whole of your
13108 LAN or WAN if it is not also a local master browser on its own
13109 broadcast isolated subnet.</P
13110 ><P
13111 >It is possible to configure two samba servers to attempt to become
13112 the domain master browser for a domain.  The first server that comes
13113 up will be the domain master browser.  All other samba servers will
13114 attempt to become the domain master browser every 5 minutes.  They
13115 will find that another samba server is already the domain master
13116 browser and will fail.  This provides automatic redundancy, should
13117 the current domain master browser fail.</P
13118 ></DIV
13119 ><DIV
13120 CLASS="SECT1"
13121 ><HR><H2
13122 CLASS="SECT1"
13123 ><A
13124 NAME="AEN2775"
13125 ></A
13126 >16.9. Making samba the domain master</H2
13127 ><P
13128 >The domain master is responsible for collating the browse lists of
13129 multiple subnets so that browsing can occur between subnets.  You can
13130 make samba act as the domain master by setting "domain master = yes"
13131 in smb.conf.  By default it will not be a domain master.</P
13132 ><P
13133 >Note that you should NOT set Samba to be the domain master for a
13134 workgroup that has the same name as an NT Domain.</P
13135 ><P
13136 >When samba is the domain master and the master browser it will listen
13137 for master announcements (made roughly every twelve minutes) from local
13138 master browsers on other subnets and then contact them to synchronise
13139 browse lists.</P
13140 ><P
13141 >If you want samba to be the domain master then I suggest you also set
13142 the "os level" high enough to make sure it wins elections, and set
13143 "preferred master" to "yes", to get samba to force an election on
13144 startup.</P
13145 ><P
13146 >Note that all your servers (including samba) and clients should be
13147 using a WINS server to resolve NetBIOS names.  If your clients are only
13148 using broadcasting to resolve NetBIOS names, then two things will occur:</P
13149 ><P
13150 ></P
13151 ><OL
13152 TYPE="1"
13153 ><LI
13154 ><P
13155 >       your local master browsers will be unable to find a domain master
13156         browser, as it will only be looking on the local subnet.
13157         </P
13158 ></LI
13159 ><LI
13160 ><P
13161 >       if a client happens to get hold of a domain-wide browse list, and
13162         a user attempts to access a host in that list, it will be unable to
13163         resolve the NetBIOS name of that host.
13164         </P
13165 ></LI
13166 ></OL
13167 ><P
13168 >If, however, both samba and your clients are using a WINS server, then:</P
13169 ><P
13170 ></P
13171 ><OL
13172 TYPE="1"
13173 ><LI
13174 ><P
13175 >       your local master browsers will contact the WINS server and, as long as
13176         samba has registered that it is a domain master browser with the WINS
13177         server, your local master browser will receive samba's ip address
13178         as its domain master browser.
13179         </P
13180 ></LI
13181 ><LI
13182 ><P
13183 >       when a client receives a domain-wide browse list, and a user attempts
13184         to access a host in that list, it will contact the WINS server to
13185         resolve the NetBIOS name of that host.  as long as that host has
13186         registered its NetBIOS name with the same WINS server, the user will
13187         be able to see that host.  
13188         </P
13189 ></LI
13190 ></OL
13191 ></DIV
13192 ><DIV
13193 CLASS="SECT1"
13194 ><HR><H2
13195 CLASS="SECT1"
13196 ><A
13197 NAME="AEN2793"
13198 ></A
13199 >16.10. Note about broadcast addresses</H2
13200 ><P
13201 >If your network uses a "0" based broadcast address (for example if it
13202 ends in a 0) then you will strike problems.  Windows for Workgroups
13203 does not seem to support a 0's broadcast and you will probably find
13204 that browsing and name lookups won't work.</P
13205 ></DIV
13206 ><DIV
13207 CLASS="SECT1"
13208 ><HR><H2
13209 CLASS="SECT1"
13210 ><A
13211 NAME="AEN2796"
13212 ></A
13213 >16.11. Multiple interfaces</H2
13214 ><P
13215 >Samba now supports machines with multiple network interfaces.  If you
13216 have multiple interfaces then you will need to use the "interfaces"
13217 option in smb.conf to configure them.  See smb.conf(5) for details.</P
13218 ></DIV
13219 ></DIV
13220 ><DIV
13221 CLASS="CHAPTER"
13222 ><HR><H1
13223 ><A
13224 NAME="SPEED"
13225 ></A
13226 >Chapter 17. Samba performance issues</H1
13227 ><DIV
13228 CLASS="SECT1"
13229 ><H2
13230 CLASS="SECT1"
13231 ><A
13232 NAME="AEN2814"
13233 ></A
13234 >17.1. Comparisons</H2
13235 ><P
13236 >The Samba server uses TCP to talk to the client. Thus if you are
13237 trying to see if it performs well you should really compare it to
13238 programs that use the same protocol. The most readily available
13239 programs for file transfer that use TCP are ftp or another TCP based
13240 SMB server.</P
13241 ><P
13242 >If you want to test against something like a NT or WfWg server then
13243 you will have to disable all but TCP on either the client or
13244 server. Otherwise you may well be using a totally different protocol
13245 (such as Netbeui) and comparisons may not be valid.</P
13246 ><P
13247 >Generally you should find that Samba performs similarly to ftp at raw
13248 transfer speed. It should perform quite a bit faster than NFS,
13249 although this very much depends on your system.</P
13250 ><P
13251 >Several people have done comparisons between Samba and Novell, NFS or
13252 WinNT. In some cases Samba performed the best, in others the worst. I
13253 suspect the biggest factor is not Samba vs some other system but the
13254 hardware and drivers used on the various systems. Given similar
13255 hardware Samba should certainly be competitive in speed with other
13256 systems.</P
13257 ></DIV
13258 ><DIV
13259 CLASS="SECT1"
13260 ><HR><H2
13261 CLASS="SECT1"
13262 ><A
13263 NAME="AEN2820"
13264 ></A
13265 >17.2. Oplocks</H2
13266 ><DIV
13267 CLASS="SECT2"
13268 ><H3
13269 CLASS="SECT2"
13270 ><A
13271 NAME="AEN2822"
13272 ></A
13273 >17.2.1. Overview</H3
13274 ><P
13275 >Oplocks are the way that SMB clients get permission from a server to
13276 locally cache file operations. If a server grants an oplock
13277 (opportunistic lock) then the client is free to assume that it is the
13278 only one accessing the file and it will agressively cache file
13279 data. With some oplock types the client may even cache file open/close
13280 operations. This can give enormous performance benefits.</P
13281 ><P
13282 >With the release of Samba 1.9.18 we now correctly support opportunistic 
13283 locks. This is turned on by default, and can be turned off on a share-
13284 by-share basis by setting the parameter :</P
13285 ><P
13286 ><B
13287 CLASS="COMMAND"
13288 >oplocks = False</B
13289 ></P
13290 ><P
13291 >We recommend that you leave oplocks on however, as current benchmark
13292 tests with NetBench seem to give approximately a 30% improvement in
13293 speed with them on. This is on average however, and the actual 
13294 improvement seen can be orders of magnitude greater, depending on
13295 what the client redirector is doing.</P
13296 ><P
13297 >Previous to Samba 1.9.18 there was a 'fake oplocks' option. This
13298 option has been left in the code for backwards compatibility reasons
13299 but it's use is now deprecated. A short summary of what the old
13300 code did follows.</P
13301 ></DIV
13302 ><DIV
13303 CLASS="SECT2"
13304 ><HR><H3
13305 CLASS="SECT2"
13306 ><A
13307 NAME="AEN2830"
13308 ></A
13309 >17.2.2. Level2 Oplocks</H3
13310 ><P
13311 >With Samba 2.0.5 a new capability - level2 (read only) oplocks is
13312 supported (although the option is off by default - see the smb.conf
13313 man page for details). Turning on level2 oplocks (on a share-by-share basis)
13314 by setting the parameter :</P
13315 ><P
13316 ><B
13317 CLASS="COMMAND"
13318 >level2 oplocks = true</B
13319 ></P
13320 ><P
13321 >should speed concurrent access to files that are not commonly written
13322 to, such as application serving shares (ie. shares that contain common
13323 .EXE files - such as a Microsoft Office share) as it allows clients to
13324 read-ahread cache copies of these files.</P
13325 ></DIV
13326 ><DIV
13327 CLASS="SECT2"
13328 ><HR><H3
13329 CLASS="SECT2"
13330 ><A
13331 NAME="AEN2836"
13332 ></A
13333 >17.2.3. Old 'fake oplocks' option - deprecated</H3
13334 ><P
13335 >Samba can also fake oplocks, by granting a oplock whenever a client 
13336 asks for one. This is controlled using the smb.conf option "fake 
13337 oplocks". If you set "fake oplocks = yes" then you are telling the 
13338 client that it may agressively cache the file data for all opens.</P
13339 ><P
13340 >Enabling 'fake oplocks' on all read-only shares or shares that you know
13341 will only be accessed from one client at a time you will see a big
13342 performance improvement on many operations. If you enable this option
13343 on shares where multiple clients may be accessing the files read-write
13344 at the same time you can get data corruption.</P
13345 ></DIV
13346 ></DIV
13347 ><DIV
13348 CLASS="SECT1"
13349 ><HR><H2
13350 CLASS="SECT1"
13351 ><A
13352 NAME="AEN2840"
13353 ></A
13354 >17.3. Socket options</H2
13355 ><P
13356 >There are a number of socket options that can greatly affect the
13357 performance of a TCP based server like Samba.</P
13358 ><P
13359 >The socket options that Samba uses are settable both on the command
13360 line with the -O option, or in the smb.conf file.</P
13361 ><P
13362 >The "socket options" section of the smb.conf manual page describes how
13363 to set these and gives recommendations.</P
13364 ><P
13365 >Getting the socket options right can make a big difference to your
13366 performance, but getting them wrong can degrade it by just as
13367 much. The correct settings are very dependent on your local network.</P
13368 ><P
13369 >The socket option TCP_NODELAY is the one that seems to make the
13370 biggest single difference for most networks. Many people report that
13371 adding "socket options = TCP_NODELAY" doubles the read performance of
13372 a Samba drive. The best explanation I have seen for this is that the
13373 Microsoft TCP/IP stack is slow in sending tcp ACKs.</P
13374 ></DIV
13375 ><DIV
13376 CLASS="SECT1"
13377 ><HR><H2
13378 CLASS="SECT1"
13379 ><A
13380 NAME="AEN2847"
13381 ></A
13382 >17.4. Read size</H2
13383 ><P
13384 >The option "read size" affects the overlap of disk reads/writes with
13385 network reads/writes. If the amount of data being transferred in
13386 several of the SMB commands (currently SMBwrite, SMBwriteX and
13387 SMBreadbraw) is larger than this value then the server begins writing
13388 the data before it has received the whole packet from the network, or
13389 in the case of SMBreadbraw, it begins writing to the network before
13390 all the data has been read from disk.</P
13391 ><P
13392 >This overlapping works best when the speeds of disk and network access
13393 are similar, having very little effect when the speed of one is much
13394 greater than the other.</P
13395 ><P
13396 >The default value is 16384, but very little experimentation has been
13397 done yet to determine the optimal value, and it is likely that the best
13398 value will vary greatly between systems anyway. A value over 65536 is
13399 pointless and will cause you to allocate memory unnecessarily.</P
13400 ></DIV
13401 ><DIV
13402 CLASS="SECT1"
13403 ><HR><H2
13404 CLASS="SECT1"
13405 ><A
13406 NAME="AEN2852"
13407 ></A
13408 >17.5. Max xmit</H2
13409 ><P
13410 >At startup the client and server negotiate a "maximum transmit" size,
13411 which limits the size of nearly all SMB commands. You can set the
13412 maximum size that Samba will negotiate using the "max xmit = " option
13413 in smb.conf. Note that this is the maximum size of SMB request that 
13414 Samba will accept, but not the maximum size that the *client* will accept.
13415 The client maximum receive size is sent to Samba by the client and Samba
13416 honours this limit.</P
13417 ><P
13418 >It defaults to 65536 bytes (the maximum), but it is possible that some
13419 clients may perform better with a smaller transmit unit. Trying values
13420 of less than 2048 is likely to cause severe problems.</P
13421 ><P
13422 >In most cases the default is the best option.</P
13423 ></DIV
13424 ><DIV
13425 CLASS="SECT1"
13426 ><HR><H2
13427 CLASS="SECT1"
13428 ><A
13429 NAME="AEN2857"
13430 ></A
13431 >17.6. Locking</H2
13432 ><P
13433 >By default Samba does not implement strict locking on each read/write
13434 call (although it did in previous versions). If you enable strict
13435 locking (using "strict locking = yes") then you may find that you
13436 suffer a severe performance hit on some systems.</P
13437 ><P
13438 >The performance hit will probably be greater on NFS mounted
13439 filesystems, but could be quite high even on local disks.</P
13440 ></DIV
13441 ><DIV
13442 CLASS="SECT1"
13443 ><HR><H2
13444 CLASS="SECT1"
13445 ><A
13446 NAME="AEN2861"
13447 ></A
13448 >17.7. Share modes</H2
13449 ><P
13450 >Some people find that opening files is very slow. This is often
13451 because of the "share modes" code needed to fully implement the dos
13452 share modes stuff. You can disable this code using "share modes =
13453 no". This will gain you a lot in opening and closing files but will
13454 mean that (in some cases) the system won't force a second user of a
13455 file to open the file read-only if the first has it open
13456 read-write. For many applications that do their own locking this
13457 doesn't matter, but for some it may. Most Windows applications
13458 depend heavily on "share modes" working correctly and it is
13459 recommended that the Samba share mode support be left at the
13460 default of "on".</P
13461 ><P
13462 >The share mode code in Samba has been re-written in the 1.9.17
13463 release following tests with the Ziff-Davis NetBench PC Benchmarking
13464 tool. It is now believed that Samba 1.9.17 implements share modes
13465 similarly to Windows NT.</P
13466 ><P
13467 >NOTE: In the most recent versions of Samba there is an option to use
13468 shared memory via mmap() to implement the share modes. This makes
13469 things much faster. See the Makefile for how to enable this.</P
13470 ></DIV
13471 ><DIV
13472 CLASS="SECT1"
13473 ><HR><H2
13474 CLASS="SECT1"
13475 ><A
13476 NAME="AEN2866"
13477 ></A
13478 >17.8. Log level</H2
13479 ><P
13480 >If you set the log level (also known as "debug level") higher than 2
13481 then you may suffer a large drop in performance. This is because the
13482 server flushes the log file after each operation, which can be very
13483 expensive. </P
13484 ></DIV
13485 ><DIV
13486 CLASS="SECT1"
13487 ><HR><H2
13488 CLASS="SECT1"
13489 ><A
13490 NAME="AEN2869"
13491 ></A
13492 >17.9. Wide lines</H2
13493 ><P
13494 >The "wide links" option is now enabled by default, but if you disable
13495 it (for better security) then you may suffer a performance hit in
13496 resolving filenames. The performance loss is lessened if you have
13497 "getwd cache = yes", which is now the default.</P
13498 ></DIV
13499 ><DIV
13500 CLASS="SECT1"
13501 ><HR><H2
13502 CLASS="SECT1"
13503 ><A
13504 NAME="AEN2872"
13505 ></A
13506 >17.10. Read raw</H2
13507 ><P
13508 >The "read raw" operation is designed to be an optimised, low-latency
13509 file read operation. A server may choose to not support it,
13510 however. and Samba makes support for "read raw" optional, with it
13511 being enabled by default.</P
13512 ><P
13513 >In some cases clients don't handle "read raw" very well and actually
13514 get lower performance using it than they get using the conventional
13515 read operations. </P
13516 ><P
13517 >So you might like to try "read raw = no" and see what happens on your
13518 network. It might lower, raise or not affect your performance. Only
13519 testing can really tell.</P
13520 ></DIV
13521 ><DIV
13522 CLASS="SECT1"
13523 ><HR><H2
13524 CLASS="SECT1"
13525 ><A
13526 NAME="AEN2877"
13527 ></A
13528 >17.11. Write raw</H2
13529 ><P
13530 >The "write raw" operation is designed to be an optimised, low-latency
13531 file write operation. A server may choose to not support it,
13532 however. and Samba makes support for "write raw" optional, with it
13533 being enabled by default.</P
13534 ><P
13535 >Some machines may find "write raw" slower than normal write, in which
13536 case you may wish to change this option.</P
13537 ></DIV
13538 ><DIV
13539 CLASS="SECT1"
13540 ><HR><H2
13541 CLASS="SECT1"
13542 ><A
13543 NAME="AEN2881"
13544 ></A
13545 >17.12. Read prediction</H2
13546 ><P
13547 >Samba can do read prediction on some of the SMB commands. Read
13548 prediction means that Samba reads some extra data on the last file it
13549 read while waiting for the next SMB command to arrive. It can then
13550 respond more quickly when the next read request arrives.</P
13551 ><P
13552 >This is disabled by default. You can enable it by using "read
13553 prediction = yes".</P
13554 ><P
13555 >Note that read prediction is only used on files that were opened read
13556 only.</P
13557 ><P
13558 >Read prediction should particularly help for those silly clients (such
13559 as "Write" under NT) which do lots of very small reads on a file.</P
13560 ><P
13561 >Samba will not read ahead more data than the amount specified in the
13562 "read size" option. It always reads ahead on 1k block boundaries.</P
13563 ></DIV
13564 ><DIV
13565 CLASS="SECT1"
13566 ><HR><H2
13567 CLASS="SECT1"
13568 ><A
13569 NAME="AEN2888"
13570 ></A
13571 >17.13. Memory mapping</H2
13572 ><P
13573 >Samba supports reading files via memory mapping them. One some
13574 machines this can give a large boost to performance, on others it
13575 makes not difference at all, and on some it may reduce performance.</P
13576 ><P
13577 >To enable you you have to recompile Samba with the -DUSE_MMAP option
13578 on the FLAGS line of the Makefile.</P
13579 ><P
13580 >Note that memory mapping is only used on files opened read only, and
13581 is not used by the "read raw" operation. Thus you may find memory
13582 mapping is more effective if you disable "read raw" using "read raw =
13583 no".</P
13584 ></DIV
13585 ><DIV
13586 CLASS="SECT1"
13587 ><HR><H2
13588 CLASS="SECT1"
13589 ><A
13590 NAME="AEN2893"
13591 ></A
13592 >17.14. Slow Clients</H2
13593 ><P
13594 >One person has reported that setting the protocol to COREPLUS rather
13595 than LANMAN2 gave a dramatic speed improvement (from 10k/s to 150k/s).</P
13596 ><P
13597 >I suspect that his PC's (386sx16 based) were asking for more data than
13598 they could chew. I suspect a similar speed could be had by setting
13599 "read raw = no" and "max xmit = 2048", instead of changing the
13600 protocol. Lowering the "read size" might also help.</P
13601 ></DIV
13602 ><DIV
13603 CLASS="SECT1"
13604 ><HR><H2
13605 CLASS="SECT1"
13606 ><A
13607 NAME="AEN2897"
13608 ></A
13609 >17.15. Slow Logins</H2
13610 ><P
13611 >Slow logins are almost always due to the password checking time. Using
13612 the lowest practical "password level" will improve things a lot. You
13613 could also enable the "UFC crypt" option in the Makefile.</P
13614 ></DIV
13615 ><DIV
13616 CLASS="SECT1"
13617 ><HR><H2
13618 CLASS="SECT1"
13619 ><A
13620 NAME="AEN2900"
13621 ></A
13622 >17.16. Client tuning</H2
13623 ><P
13624 >Often a speed problem can be traced to the client. The client (for
13625 example Windows for Workgroups) can often be tuned for better TCP
13626 performance.</P
13627 ><P
13628 >See your client docs for details. In particular, I have heard rumours
13629 that the WfWg options TCPWINDOWSIZE and TCPSEGMENTSIZE can have a
13630 large impact on performance.</P
13631 ><P
13632 >Also note that some people have found that setting DefaultRcvWindow in
13633 the [MSTCP] section of the SYSTEM.INI file under WfWg to 3072 gives a
13634 big improvement. I don't know why.</P
13635 ><P
13636 >My own experience wth DefaultRcvWindow is that I get much better
13637 performance with a large value (16384 or larger). Other people have
13638 reported that anything over 3072 slows things down enourmously. One
13639 person even reported a speed drop of a factor of 30 when he went from
13640 3072 to 8192. I don't know why.</P
13641 ><P
13642 >It probably depends a lot on your hardware, and the type of unix box
13643 you have at the other end of the link.</P
13644 ><P
13645 >Paul Cochrane has done some testing on client side tuning and come 
13646 to the following conclusions:</P
13647 ><P
13648 >Install the W2setup.exe file from www.microsoft.com. This is an 
13649 update for the winsock stack and utilities which improve performance.</P
13650 ><P
13651 >Configure the win95 TCPIP registry settings to give better 
13652 perfomance. I use a program called MTUSPEED.exe which I got off the 
13653 net. There are various other utilities of this type freely available. 
13654 The setting which give the best performance for me are:</P
13655 ><P
13656 ></P
13657 ><OL
13658 TYPE="1"
13659 ><LI
13660 ><P
13661 >MaxMTU                  Remove</P
13662 ></LI
13663 ><LI
13664 ><P
13665 >RWIN                    Remove</P
13666 ></LI
13667 ><LI
13668 ><P
13669 >MTUAutoDiscover         Disable</P
13670 ></LI
13671 ><LI
13672 ><P
13673 >MTUBlackHoleDetect      Disable</P
13674 ></LI
13675 ><LI
13676 ><P
13677 >Time To Live            Enabled</P
13678 ></LI
13679 ><LI
13680 ><P
13681 >Time To Live - HOPS     32</P
13682 ></LI
13683 ><LI
13684 ><P
13685 >NDI Cache Size          0</P
13686 ></LI
13687 ></OL
13688 ><P
13689 >I tried virtually all of the items mentioned in the document and 
13690 the only one which made a difference to me was the socket options. It 
13691 turned out I was better off without any!!!!!</P
13692 ><P
13693 >In terms of overall speed of transfer, between various win95 clients 
13694 and a DX2-66 20MB server with a crappy NE2000 compatible and old IDE 
13695 drive (Kernel 2.0.30). The transfer rate was reasonable for 10 baseT.</P
13696 ><P
13697 >FIXME
13698 The figures are:          Put              Get 
13699 P166 client 3Com card:    420-440kB/s      500-520kB/s
13700 P100 client 3Com card:    390-410kB/s      490-510kB/s
13701 DX4-75 client NE2000:     370-380kB/s      330-350kB/s</P
13702 ><P
13703 >I based these test on transfer two files a 4.5MB text file and a 15MB 
13704 textfile. The results arn't bad considering the hardware Samba is 
13705 running on. It's a crap machine!!!!</P
13706 ><P
13707 >The updates mentioned in 1 and 2 brought up the transfer rates from 
13708 just over 100kB/s in some clients.</P
13709 ><P
13710 >A new client is a P333 connected via a 100MB/s card and hub. The 
13711 transfer rates from this were good: 450-500kB/s on put and 600+kB/s 
13712 on get.</P
13713 ><P
13714 >Looking at standard FTP throughput, Samba is a bit slower (100kB/s 
13715 upwards). I suppose there is more going on in the samba protocol, but 
13716 if it could get up to the rate of FTP the perfomance would be quite 
13717 staggering.</P
13718 ></DIV
13719 ><DIV
13720 CLASS="SECT1"
13721 ><HR><H2
13722 CLASS="SECT1"
13723 ><A
13724 NAME="AEN2932"
13725 ></A
13726 >17.17. My Results</H2
13727 ><P
13728 >Some people want to see real numbers in a document like this, so here
13729 they are. I have a 486sx33 client running WfWg 3.11 with the 3.11b
13730 tcp/ip stack. It has a slow IDE drive and 20Mb of ram. It has a SMC
13731 Elite-16 ISA bus ethernet card. The only WfWg tuning I've done is to
13732 set DefaultRcvWindow in the [MSTCP] section of system.ini to 16384. My
13733 server is a 486dx3-66 running Linux. It also has 20Mb of ram and a SMC
13734 Elite-16 card. You can see my server config in the examples/tridge/
13735 subdirectory of the distribution.</P
13736 ><P
13737 >I get 490k/s on reading a 8Mb file with copy.
13738 I get 441k/s writing the same file to the samba server.</P
13739 ><P
13740 >Of course, there's a lot more to benchmarks than 2 raw throughput
13741 figures, but it gives you a ballpark figure.</P
13742 ><P
13743 >I've also tested Win95 and WinNT, and found WinNT gave me the best
13744 speed as a samba client. The fastest client of all (for me) is
13745 smbclient running on another linux box. Maybe I'll add those results
13746 here someday ...</P
13747 ></DIV
13748 ></DIV
13749 ><DIV
13750 CLASS="CHAPTER"
13751 ><HR><H1
13752 ><A
13753 NAME="OTHER-CLIENTS"
13754 ></A
13755 >Chapter 18. Samba and other CIFS clients</H1
13756 ><P
13757 >This chapter contains client-specific information.</P
13758 ><DIV
13759 CLASS="SECT1"
13760 ><HR><H2
13761 CLASS="SECT1"
13762 ><A
13763 NAME="AEN2953"
13764 ></A
13765 >18.1. Macintosh clients?</H2
13766 ><P
13767 >Yes. <A
13768 HREF="http://www.thursby.com/"
13769 TARGET="_top"
13770 >Thursby</A
13771 > now have a CIFS Client / Server called DAVE - see</P
13772 ><P
13773 >They test it against Windows 95, Windows NT and samba for
13774 compatibility issues.  At the time of writing, DAVE was at version
13775 1.0.1. The 1.0.0 to 1.0.1 update is available as a free download from
13776 the Thursby web site (the speed of finder copies has been greatly
13777 enhanced, and there are bug-fixes included).</P
13778 ><P
13779
13780 Alternatives - There are two free implementations of AppleTalk for
13781 several kinds of UNIX machnes, and several more commercial ones.
13782 These products allow you to run file services and print services
13783 natively to Macintosh users, with no additional support required on
13784 the Macintosh.  The two free omplementations are 
13785 <A
13786 HREF="http://www.umich.edu/~rsug/netatalk/"
13787 TARGET="_top"
13788 >Netatalk</A
13789 >, and 
13790 <A
13791 HREF="http://www.cs.mu.oz.au/appletalk/atalk.html"
13792 TARGET="_top"
13793 >CAP</A
13794 >.  
13795 What Samba offers MS
13796 Windows users, these packages offer to Macs.  For more info on these
13797 packages, Samba, and Linux (and other UNIX-based systems) see
13798 <A
13799 HREF="http://www.eats.com/linux_mac_win.html"
13800 TARGET="_top"
13801 >http://www.eats.com/linux_mac_win.html</A
13802 ></P
13803 ></DIV
13804 ><DIV
13805 CLASS="SECT1"
13806 ><HR><H2
13807 CLASS="SECT1"
13808 ><A
13809 NAME="AEN2962"
13810 ></A
13811 >18.2. OS2 Client</H2
13812 ><DIV
13813 CLASS="SECT2"
13814 ><H3
13815 CLASS="SECT2"
13816 ><A
13817 NAME="AEN2964"
13818 ></A
13819 >18.2.1. How can I configure OS/2 Warp Connect or 
13820                 OS/2 Warp 4 as a client for Samba?</H3
13821 ><P
13822 >A more complete answer to this question can be 
13823                 found on <A
13824 HREF="http://carol.wins.uva.nl/~leeuw/samba/warp.html"
13825 TARGET="_top"
13826 >               http://carol.wins.uva.nl/~leeuw/samba/warp.html</A
13827 >.</P
13828 ><P
13829 >Basically, you need three components:</P
13830 ><P
13831 ></P
13832 ><UL
13833 ><LI
13834 ><P
13835 >The File and Print Client ('IBM Peer')
13836                         </P
13837 ></LI
13838 ><LI
13839 ><P
13840 >TCP/IP ('Internet support') 
13841                         </P
13842 ></LI
13843 ><LI
13844 ><P
13845 >The "NetBIOS over TCP/IP" driver ('TCPBEUI')
13846                         </P
13847 ></LI
13848 ></UL
13849 ><P
13850 >Installing the first two together with the base operating 
13851                 system on a blank system is explained in the Warp manual. If Warp 
13852                 has already been installed, but you now want to install the 
13853                 networking support, use the "Selective Install for Networking" 
13854                 object in the "System Setup" folder.</P
13855 ><P
13856 >Adding the "NetBIOS over TCP/IP" driver is not described 
13857                 in the manual and just barely in the online documentation. Start 
13858                 MPTS.EXE, click on OK, click on "Configure LAPS" and click 
13859                 on "IBM OS/2 NETBIOS OVER TCP/IP" in  'Protocols'.  This line 
13860                 is then moved to 'Current Configuration'. Select that line, 
13861                 click on "Change number" and increase it from 0 to 1. Save this
13862                 configuration.</P
13863 ><P
13864 >If the Samba server(s) is not on your local subnet, you 
13865                 can optionally add IP names and addresses of these servers 
13866                 to the "Names List", or specify a  WINS server ('NetBIOS 
13867                 Nameserver' in IBM and RFC terminology). For Warp Connect you 
13868                 may need to download an update for 'IBM Peer' to bring it on 
13869                 the same level as Warp 4. See the webpage mentioned above.</P
13870 ></DIV
13871 ><DIV
13872 CLASS="SECT2"
13873 ><HR><H3
13874 CLASS="SECT2"
13875 ><A
13876 NAME="AEN2979"
13877 ></A
13878 >18.2.2. How can I configure OS/2 Warp 3 (not Connect), 
13879                 OS/2 1.2, 1.3 or 2.x for Samba?</H3
13880 ><P
13881 >You can use the free Microsoft LAN Manager 2.2c Client 
13882                 for OS/2 from 
13883                 <A
13884 HREF="ftp://ftp.microsoft.com/BusSys/Clients/LANMAN.OS2/"
13885 TARGET="_top"
13886 >               ftp://ftp.microsoft.com/BusSys/Clients/LANMAN.OS2/</A
13887 >.
13888         See <A
13889 HREF="http://carol.wins.uva.nl/~leeuw/lanman.html"
13890 TARGET="_top"
13891 >               http://carol.wins.uva.nl/~leeuw/lanman.html</A
13892 > for 
13893                 more information on how to install and use this client. In 
13894                 a nutshell, edit the file \OS2VER in the root directory of 
13895                 the OS/2 boot partition and add the lines:</P
13896 ><P
13897 ><PRE
13898 CLASS="PROGRAMLISTING"
13899 >               20=setup.exe
13900                 20=netwksta.sys
13901                 20=netvdd.sys
13902                 </PRE
13903 ></P
13904 ><P
13905 >before you install the client. Also, don't use the 
13906                 included NE2000 driver because it is buggy. Try the NE2000 
13907                 or NS2000 driver from 
13908                 <A
13909 HREF="ftp://ftp.cdrom.com/pub/os2/network/ndis/"
13910 TARGET="_top"
13911 >               ftp://ftp.cdrom.com/pub/os2/network/ndis/</A
13912 > instead.
13913                 </P
13914 ></DIV
13915 ><DIV
13916 CLASS="SECT2"
13917 ><HR><H3
13918 CLASS="SECT2"
13919 ><A
13920 NAME="AEN2988"
13921 ></A
13922 >18.2.3. Are there any other issues when OS/2 (any version) 
13923                 is used as a client?</H3
13924 ><P
13925 >When you do a NET VIEW or use the "File and Print 
13926                 Client Resource Browser", no Samba servers show up. This can 
13927                 be fixed by a patch from <A
13928 HREF="http://carol.wins.uva.nl/~leeuw/samba/fix.html"
13929 TARGET="_top"
13930 >               http://carol.wins.uva.nl/~leeuw/samba/fix.html</A
13931 >.
13932                 The patch will be included in a later version of Samba. It also 
13933                 fixes a couple of other problems, such as preserving long 
13934                 filenames when objects are dragged from the Workplace Shell 
13935                 to the Samba server. </P
13936 ></DIV
13937 ><DIV
13938 CLASS="SECT2"
13939 ><HR><H3
13940 CLASS="SECT2"
13941 ><A
13942 NAME="AEN2992"
13943 ></A
13944 >18.2.4. How do I get printer driver download working 
13945                 for OS/2 clients?</H3
13946 ><P
13947 >First, create a share called [PRINTDRV] that is 
13948                 world-readable.  Copy your OS/2 driver files there.  Note 
13949                 that the .EA_ files must still be separate, so you will need 
13950                 to use the original install files, and not copy an installed 
13951                 driver from an OS/2 system.</P
13952 ><P
13953 >Install the NT driver first for that printer.  Then, 
13954                 add to your smb.conf a parameter, os2 driver map = 
13955                 <TT
13956 CLASS="REPLACEABLE"
13957 ><I
13958 >filename</I
13959 ></TT
13960 >".  Then, in the file 
13961                 specified by <TT
13962 CLASS="REPLACEABLE"
13963 ><I
13964 >filename</I
13965 ></TT
13966 >, map the 
13967                 name of the NT driver name to the OS/2 driver name as 
13968                 follows:</P
13969 ><P
13970 ><B
13971 CLASS="COMMAND"
13972 >nt driver name = os2 "driver 
13973                 name"."device name"</B
13974 >, e.g.:
13975                 HP LaserJet 5L = LASERJET.HP LaserJet 5L</P
13976 ><P
13977 >You can have multiple drivers mapped in this file.</P
13978 ><P
13979 >If you only specify the OS/2 driver name, and not the 
13980                 device name, the first attempt to download the driver will 
13981                 actually download the files, but the OS/2 client will tell 
13982                 you the driver is not available.  On the second attempt, it 
13983                 will work.  This is fixed simply by adding the device name
13984                  to the mapping, after which it will work on the first attempt.
13985                 </P
13986 ></DIV
13987 ></DIV
13988 ><DIV
13989 CLASS="SECT1"
13990 ><HR><H2
13991 CLASS="SECT1"
13992 ><A
13993 NAME="AEN3002"
13994 ></A
13995 >18.3. Windows for Workgroups</H2
13996 ><DIV
13997 CLASS="SECT2"
13998 ><H3
13999 CLASS="SECT2"
14000 ><A
14001 NAME="AEN3004"
14002 ></A
14003 >18.3.1. Use latest TCP/IP stack from Microsoft</H3
14004 ><P
14005 >Use the latest TCP/IP stack from microsoft if you use Windows
14006 for workgroups.</P
14007 ><P
14008 >The early TCP/IP stacks had lots of bugs.</P
14009 ><P
14010
14011 Microsoft has released an incremental upgrade to their TCP/IP 32-Bit
14012 VxD drivers.  The latest release can be found on their ftp site at
14013 ftp.microsoft.com, located in /peropsys/windows/public/tcpip/wfwt32.exe.
14014 There is an update.txt file there that describes the problems that were
14015 fixed.  New files include WINSOCK.DLL, TELNET.EXE, WSOCK.386, VNBT.386,
14016 WSTCP.386, TRACERT.EXE, NETSTAT.EXE, and NBTSTAT.EXE.</P
14017 ></DIV
14018 ><DIV
14019 CLASS="SECT2"
14020 ><HR><H3
14021 CLASS="SECT2"
14022 ><A
14023 NAME="AEN3009"
14024 ></A
14025 >18.3.2. Delete .pwl files after password change</H3
14026 ><P
14027 >WfWg does a lousy job with passwords. I find that if I change my
14028 password on either the unix box or the PC the safest thing to do is to
14029 delete the .pwl files in the windows directory. The PC will complain about not finding the files, but will soon get over it, allowing you to enter the new password.</P
14030 ><P
14031
14032 If you don't do this you may find that WfWg remembers and uses the old
14033 password, even if you told it a new one.</P
14034 ><P
14035
14036 Often WfWg will totally ignore a password you give it in a dialog box.</P
14037 ></DIV
14038 ><DIV
14039 CLASS="SECT2"
14040 ><HR><H3
14041 CLASS="SECT2"
14042 ><A
14043 NAME="AEN3014"
14044 ></A
14045 >18.3.3. Configure WfW password handling</H3
14046 ><P
14047 >There is a program call admincfg.exe
14048 on the last disk (disk 8) of the WFW 3.11 disk set.  To install it
14049 type EXPAND A:\ADMINCFG.EX_ C:\WINDOWS\ADMINCFG.EXE Then add an icon
14050 for it via the "Progam Manager" "New" Menu.  This program allows you
14051 to control how WFW handles passwords.  ie disable Password Caching etc
14052 for use with <B
14053 CLASS="COMMAND"
14054 >security = user</B
14055 ></P
14056 ></DIV
14057 ><DIV
14058 CLASS="SECT2"
14059 ><HR><H3
14060 CLASS="SECT2"
14061 ><A
14062 NAME="AEN3018"
14063 ></A
14064 >18.3.4. Case handling of passwords</H3
14065 ><P
14066 >Windows for Workgroups uppercases the password before sending it to the server. Unix passwords can be case-sensitive though. Check the <A
14067 HREF="smb.conf.5.html"
14068 TARGET="_top"
14069 >smb.conf(5)</A
14070 > information on <B
14071 CLASS="COMMAND"
14072 >password level</B
14073 > to specify what characters samba should try to uppercase when checking.</P
14074 ></DIV
14075 ></DIV
14076 ><DIV
14077 CLASS="SECT1"
14078 ><HR><H2
14079 CLASS="SECT1"
14080 ><A
14081 NAME="AEN3023"
14082 ></A
14083 >18.4. Windows '95/'98</H2
14084 ><P
14085 >When using Windows 95 OEM SR2 the following updates are recommended where Samba
14086 is being used. Please NOTE that the above change will affect you once these
14087 updates  have been installed.</P
14088 ><P
14089
14090 There are more updates than the ones mentioned here. You are referred to the
14091 Microsoft Web site for all currently available updates to your specific version
14092 of Windows 95.</P
14093 ><P
14094 ></P
14095 ><OL
14096 TYPE="1"
14097 ><LI
14098 ><P
14099 >Kernel Update: KRNLUPD.EXE</P
14100 ></LI
14101 ><LI
14102 ><P
14103 >Ping Fix: PINGUPD.EXE</P
14104 ></LI
14105 ><LI
14106 ><P
14107 >RPC Update: RPCRTUPD.EXE</P
14108 ></LI
14109 ><LI
14110 ><P
14111 >TCP/IP Update: VIPUPD.EXE</P
14112 ></LI
14113 ><LI
14114 ><P
14115 >Redirector Update: VRDRUPD.EXE</P
14116 ></LI
14117 ></OL
14118 ><P
14119 >Also, if using MS OutLook it is desirable to install the OLEUPD.EXE fix. This
14120 fix may stop your machine from hanging for an extended period when exiting
14121 OutLook and you may also notice a significant speedup when accessing network
14122 neighborhood services.</P
14123 ></DIV
14124 ><DIV
14125 CLASS="SECT1"
14126 ><HR><H2
14127 CLASS="SECT1"
14128 ><A
14129 NAME="AEN3039"
14130 ></A
14131 >18.5. Windows 2000 Service Pack 2</H2
14132 ><P
14133
14134 There are several annoyances with Windows 2000 SP2. One of which
14135 only appears when using a Samba server to host user profiles
14136 to Windows 2000 SP2 clients in a Windows domain.  This assumes
14137 that Samba is a member of the domain, but the problem will
14138 likely occur if it is not.</P
14139 ><P
14140
14141 In order to server profiles successfully to Windows 2000 SP2 
14142 clients (when not operating as a PDC), Samba must have 
14143 <B
14144 CLASS="COMMAND"
14145 >nt acl support = no</B
14146 >
14147 added to the file share which houses the roaming profiles.
14148 If this is not done, then the Windows 2000 SP2 client will
14149 complain about not being able to access the profile (Access 
14150 Denied) and create multiple copies of it on disk (DOMAIN.user.001,
14151 DOMAIN.user.002, etc...).  See the 
14152 <A
14153 HREF="smb.conf.5.html"
14154 TARGET="_top"
14155 >smb.conf(5)</A
14156 > man page
14157 for more details on this option.  Also note that the 
14158 <B
14159 CLASS="COMMAND"
14160 >nt acl support</B
14161 > parameter was formally a global parameter in
14162 releases prior to Samba 2.2.2.</P
14163 ><P
14164
14165 The following is a minimal profile share:</P
14166 ><P
14167 ><PRE
14168 CLASS="PROGRAMLISTING"
14169 >       [profile]
14170                 path = /export/profile
14171                 create mask = 0600
14172                 directory mask = 0700
14173                 nt acl support = no
14174                 read only = no</PRE
14175 ></P
14176 ><P
14177 >The reason for this bug is that the Win2k SP2 client copies
14178 the security descriptor for the profile which contains
14179 the Samba server's SID, and not the domain SID.  The client
14180 compares the SID for SAMBA\user and realizes it is
14181 different that the one assigned to DOMAIN\user.  Hence the reason
14182 for the "access denied" message.</P
14183 ><P
14184 >By disabling the <B
14185 CLASS="COMMAND"
14186 >nt acl support</B
14187 > parameter, Samba will send
14188 the Win2k client a response to the QuerySecurityDescriptor
14189 trans2 call which causes the client to set a default ACL
14190 for the profile. This default ACL includes </P
14191 ><P
14192 ><B
14193 CLASS="COMMAND"
14194 >DOMAIN\user    "Full Control"</B
14195 ></P
14196 ><P
14197 ><SPAN
14198 CLASS="emphasis"
14199 ><I
14200 CLASS="EMPHASIS"
14201 >NOTE : This bug does not occur when using winbind to
14202 create accounts on the Samba host for Domain users.</I
14203 ></SPAN
14204 ></P
14205 ></DIV
14206 ></DIV
14207 ><DIV
14208 CLASS="CHAPTER"
14209 ><HR><H1
14210 ><A
14211 NAME="CVS-ACCESS"
14212 ></A
14213 >Chapter 19. HOWTO Access Samba source code via CVS</H1
14214 ><DIV
14215 CLASS="SECT1"
14216 ><H2
14217 CLASS="SECT1"
14218 ><A
14219 NAME="AEN3063"
14220 ></A
14221 >19.1. Introduction</H2
14222 ><P
14223 >Samba is developed in an open environment.  Developers use CVS
14224 (Concurrent Versioning System) to "checkin" (also known as 
14225 "commit") new source code.  Samba's various CVS branches can
14226 be accessed via anonymous CVS using the instructions
14227 detailed in this chapter.</P
14228 ><P
14229 >This document is a modified version of the instructions found at
14230 <A
14231 HREF="http://samba.org/samba/cvs.html"
14232 TARGET="_top"
14233 >http://samba.org/samba/cvs.html</A
14234 ></P
14235 ></DIV
14236 ><DIV
14237 CLASS="SECT1"
14238 ><HR><H2
14239 CLASS="SECT1"
14240 ><A
14241 NAME="AEN3068"
14242 ></A
14243 >19.2. CVS Access to samba.org</H2
14244 ><P
14245 >The machine samba.org runs a publicly accessible CVS 
14246 repository for access to the source code of several packages, 
14247 including samba, rsync and jitterbug. There are two main ways of 
14248 accessing the CVS server on this host.</P
14249 ><DIV
14250 CLASS="SECT2"
14251 ><HR><H3
14252 CLASS="SECT2"
14253 ><A
14254 NAME="AEN3071"
14255 ></A
14256 >19.2.1. Access via CVSweb</H3
14257 ><P
14258 >You can access the source code via your 
14259 favourite WWW browser. This allows you to access the contents of 
14260 individual files in the repository and also to look at the revision 
14261 history and commit logs of individual files. You can also ask for a diff 
14262 listing between any two versions on the repository.</P
14263 ><P
14264 >Use the URL : <A
14265 HREF="http://samba.org/cgi-bin/cvsweb"
14266 TARGET="_top"
14267 >http://samba.org/cgi-bin/cvsweb</A
14268 ></P
14269 ></DIV
14270 ><DIV
14271 CLASS="SECT2"
14272 ><HR><H3
14273 CLASS="SECT2"
14274 ><A
14275 NAME="AEN3076"
14276 ></A
14277 >19.2.2. Access via cvs</H3
14278 ><P
14279 >You can also access the source code via a 
14280 normal cvs client.  This gives you much more control over you can 
14281 do with the repository and allows you to checkout whole source trees 
14282 and keep them up to date via normal cvs commands. This is the 
14283 preferred method of access if you are a developer and not
14284 just a casual browser.</P
14285 ><P
14286 >To download the latest cvs source code, point your
14287 browser at the URL : <A
14288 HREF="http://www.cyclic.com/"
14289 TARGET="_top"
14290 >http://www.cyclic.com/</A
14291 >.
14292 and click on the 'How to get cvs' link. CVS is free software under 
14293 the GNU GPL (as is Samba).  Note that there are several graphical CVS clients
14294 which provide a graphical interface to the sometimes mundane CVS commands.
14295 Links to theses clients are also available from http://www.cyclic.com.</P
14296 ><P
14297 >To gain access via anonymous cvs use the following steps. 
14298 For this example it is assumed that you want a copy of the 
14299 samba source code. For the other source code repositories 
14300 on this system just substitute the correct package name</P
14301 ><P
14302 ></P
14303 ><OL
14304 TYPE="1"
14305 ><LI
14306 ><P
14307 >       Install a recent copy of cvs. All you really need is a 
14308         copy of the cvs client binary. 
14309         </P
14310 ></LI
14311 ><LI
14312 ><P
14313 >       Run the command 
14314         </P
14315 ><P
14316 >       <B
14317 CLASS="COMMAND"
14318 >cvs -d :pserver:cvs@samba.org:/cvsroot login</B
14319 >
14320         </P
14321 ><P
14322 >       When it asks you for a password type <TT
14323 CLASS="USERINPUT"
14324 ><B
14325 >cvs</B
14326 ></TT
14327 >.
14328         </P
14329 ></LI
14330 ><LI
14331 ><P
14332 >       Run the command 
14333         </P
14334 ><P
14335 >       <B
14336 CLASS="COMMAND"
14337 >cvs -d :pserver:cvs@samba.org:/cvsroot co samba</B
14338 >
14339         </P
14340 ><P
14341 >       This will create a directory called samba containing the 
14342         latest samba source code (i.e. the HEAD tagged cvs branch). This 
14343         currently corresponds to the 3.0 development tree. 
14344         </P
14345 ><P
14346 >       CVS branches other HEAD can be obtained by using the <TT
14347 CLASS="PARAMETER"
14348 ><I
14349 >-r</I
14350 ></TT
14351 >
14352         and defining a tag name.  A list of branch tag names can be found on the
14353         "Development" page of the samba web site.  A common request is to obtain the
14354         latest 2.2 release code.  This could be done by using the following command.
14355         </P
14356 ><P
14357 >       <B
14358 CLASS="COMMAND"
14359 >cvs -d :pserver:cvs@samba.org:/cvsroot co -r SAMBA_2_2 samba</B
14360 >
14361         </P
14362 ></LI
14363 ><LI
14364 ><P
14365 >       Whenever you want to merge in the latest code changes use 
14366         the following command from within the samba directory: 
14367         </P
14368 ><P
14369 >       <B
14370 CLASS="COMMAND"
14371 >cvs update -d -P</B
14372 >
14373         </P
14374 ></LI
14375 ></OL
14376 ></DIV
14377 ></DIV
14378 ></DIV
14379 ><DIV
14380 CLASS="CHAPTER"
14381 ><HR><H1
14382 ><A
14383 NAME="BUGREPORT"
14384 ></A
14385 >Chapter 20. Reporting Bugs</H1
14386 ><DIV
14387 CLASS="SECT1"
14388 ><H2
14389 CLASS="SECT1"
14390 ><A
14391 NAME="AEN3111"
14392 ></A
14393 >20.1. Introduction</H2
14394 ><P
14395 >The email address for bug reports is samba@samba.org</P
14396 ><P
14397 >Please take the time to read this file before you submit a bug
14398 report. Also, please see if it has changed between releases, as we
14399 may be changing the bug reporting mechanism at some time.</P
14400 ><P
14401 >Please also do as much as you can yourself to help track down the
14402 bug. Samba is maintained by a dedicated group of people who volunteer
14403 their time, skills and efforts. We receive far more mail about it than
14404 we can possibly answer, so you have a much higher chance of an answer
14405 and a fix if you send us a "developer friendly" bug report that lets
14406 us fix it fast. </P
14407 ><P
14408 >Do not assume that if you post the bug to the comp.protocols.smb
14409 newsgroup or the mailing list that we will read it. If you suspect that your 
14410 problem is not a bug but a configuration problem then it is better to send 
14411 it to the Samba mailing list, as there are (at last count) 5000 other users on
14412 that list that may be able to help you.</P
14413 ><P
14414 >You may also like to look though the recent mailing list archives,
14415 which are conveniently accessible on the Samba web pages
14416 at http://samba.org/samba/ </P
14417 ></DIV
14418 ><DIV
14419 CLASS="SECT1"
14420 ><HR><H2
14421 CLASS="SECT1"
14422 ><A
14423 NAME="AEN3118"
14424 ></A
14425 >20.2. General info</H2
14426 ><P
14427 >Before submitting a bug report check your config for silly
14428 errors. Look in your log files for obvious messages that tell you that
14429 you've misconfigured something and run testparm to test your config
14430 file for correct syntax.</P
14431 ><P
14432 >Have you run through the <A
14433 HREF="Diagnosis.html"
14434 TARGET="_top"
14435 >diagnosis</A
14436 >? 
14437 This is very important.</P
14438 ><P
14439 >If you include part of a log file with your bug report then be sure to
14440 annotate it with exactly what you were doing on the client at the
14441 time, and exactly what the results were.</P
14442 ></DIV
14443 ><DIV
14444 CLASS="SECT1"
14445 ><HR><H2
14446 CLASS="SECT1"
14447 ><A
14448 NAME="AEN3124"
14449 ></A
14450 >20.3. Debug levels</H2
14451 ><P
14452 >If the bug has anything to do with Samba behaving incorrectly as a
14453 server (like refusing to open a file) then the log files will probably
14454 be very useful. Depending on the problem a log level of between 3 and
14455 10 showing the problem may be appropriate. A higher level givesmore
14456 detail, but may use too much disk space.</P
14457 ><P
14458 >To set the debug level use <B
14459 CLASS="COMMAND"
14460 >log level =</B
14461 > in your 
14462 <TT
14463 CLASS="FILENAME"
14464 >smb.conf</TT
14465 >. You may also find it useful to set the log 
14466 level higher for just one machine and keep separate logs for each machine. 
14467 To do this use:</P
14468 ><P
14469 ><PRE
14470 CLASS="PROGRAMLISTING"
14471 >log level = 10
14472 log file = /usr/local/samba/lib/log.%m
14473 include = /usr/local/samba/lib/smb.conf.%m</PRE
14474 ></P
14475 ><P
14476 >then create a file 
14477 <TT
14478 CLASS="FILENAME"
14479 >/usr/local/samba/lib/smb.conf.machine</TT
14480 > where
14481 "machine" is the name of the client you wish to debug. In that file
14482 put any smb.conf commands you want, for example 
14483 <B
14484 CLASS="COMMAND"
14485 >log level=</B
14486 > may be useful. This also allows you to 
14487 experiment with different security systems, protocol levels etc on just 
14488 one machine.</P
14489 ><P
14490 >The <TT
14491 CLASS="FILENAME"
14492 >smb.conf</TT
14493 > entry <B
14494 CLASS="COMMAND"
14495 >log level =</B
14496
14497 is synonymous with the entry <B
14498 CLASS="COMMAND"
14499 >debuglevel =</B
14500 > that has been 
14501 used in older versions of Samba and is being retained for backwards 
14502 compatibility of smb.conf files.</P
14503 ><P
14504 >As the <B
14505 CLASS="COMMAND"
14506 >log level =</B
14507 > value is increased you will record 
14508 a significantly increasing level of debugging information. For most 
14509 debugging operations you may not need a setting higher than 3. Nearly 
14510 all bugs can be tracked at a setting of 10, but be prepared for a VERY 
14511 large volume of log data.</P
14512 ></DIV
14513 ><DIV
14514 CLASS="SECT1"
14515 ><HR><H2
14516 CLASS="SECT1"
14517 ><A
14518 NAME="AEN3141"
14519 ></A
14520 >20.4. Internal errors</H2
14521 ><P
14522 >If you get a "INTERNAL ERROR" message in your log files it means that
14523 Samba got an unexpected signal while running. It is probably a
14524 segmentation fault and almost certainly means a bug in Samba (unless
14525 you have faulty hardware or system software)</P
14526 ><P
14527 >If the message came from smbd then it will probably be accompanied by
14528 a message which details the last SMB message received by smbd. This
14529 info is often very useful in tracking down the problem so please
14530 include it in your bug report.</P
14531 ><P
14532 >You should also detail how to reproduce the problem, if
14533 possible. Please make this reasonably detailed.</P
14534 ><P
14535 >You may also find that a core file appeared in a "corefiles"
14536 subdirectory of the directory where you keep your samba log
14537 files. This file is the most useful tool for tracking down the bug. To
14538 use it you do this:</P
14539 ><P
14540 ><B
14541 CLASS="COMMAND"
14542 >gdb smbd core</B
14543 ></P
14544 ><P
14545 >adding appropriate paths to smbd and core so gdb can find them. If you
14546 don't have gdb then try "dbx". Then within the debugger use the
14547 command "where" to give a stack trace of where the problem
14548 occurred. Include this in your mail.</P
14549 ><P
14550 >If you known any assembly language then do a "disass" of the routine
14551 where the problem occurred (if its in a library routine then
14552 disassemble the routine that called it) and try to work out exactly
14553 where the problem is by looking at the surrounding code. Even if you
14554 don't know assembly then incuding this info in the bug report can be
14555 useful. </P
14556 ></DIV
14557 ><DIV
14558 CLASS="SECT1"
14559 ><HR><H2
14560 CLASS="SECT1"
14561 ><A
14562 NAME="AEN3151"
14563 ></A
14564 >20.5. Attaching to a running process</H2
14565 ><P
14566 >Unfortunately some unixes (in particular some recent linux kernels)
14567 refuse to dump a core file if the task has changed uid (which smbd
14568 does often). To debug with this sort of system you could try to attach
14569 to the running process using "gdb smbd PID" where you get PID from
14570 smbstatus. Then use "c" to continue and try to cause the core dump
14571 using the client. The debugger should catch the fault and tell you
14572 where it occurred.</P
14573 ></DIV
14574 ><DIV
14575 CLASS="SECT1"
14576 ><HR><H2
14577 CLASS="SECT1"
14578 ><A
14579 NAME="AEN3154"
14580 ></A
14581 >20.6. Patches</H2
14582 ><P
14583 >The best sort of bug report is one that includes a fix! If you send us
14584 patches please use <B
14585 CLASS="COMMAND"
14586 >diff -u</B
14587 > format if your version of 
14588 diff supports it, otherwise use <B
14589 CLASS="COMMAND"
14590 >diff -c4</B
14591 >. Make sure 
14592 your do the diff against a clean version of the source and let me know 
14593 exactly what version you used. </P
14594 ></DIV
14595 ></DIV
14596 ><DIV
14597 CLASS="CHAPTER"
14598 ><HR><H1
14599 ><A
14600 NAME="GROUPMAPPING"
14601 ></A
14602 >Chapter 21. Group mapping HOWTO</H1
14603 ><P
14604
14605 Starting with Samba 3.0 alpha 2, a new group mapping function is available. The
14606 current method (likely to change) to manage the groups is a new command called
14607 <B
14608 CLASS="COMMAND"
14609 >smbgroupedit</B
14610 >.</P
14611 ><P
14612 >The first immediate reason to use the group mapping on a PDC, is that
14613 the <B
14614 CLASS="COMMAND"
14615 >domain admin group</B
14616 > of <TT
14617 CLASS="FILENAME"
14618 >smb.conf</TT
14619 > is 
14620 now gone. This parameter was used to give the listed users local admin rights 
14621 on their workstations. It was some magic stuff that simply worked but didn't
14622 scale very well for complex setups.</P
14623 ><P
14624 >Let me explain how it works on NT/W2K, to have this magic fade away.
14625 When installing NT/W2K on a computer, the installer program creates some users
14626 and groups. Notably the 'Administrators' group, and gives to that group some
14627 privileges like the ability to change the date and time or to kill any process
14628 (or close too) running on the local machine. The 'Administrator' user is a
14629 member of the 'Administrators' group, and thus 'inherit' the 'Administrators'
14630 group privileges. If a 'joe' user is created and become a member of the
14631 'Administrator' group, 'joe' has exactly the same rights as 'Administrator'.</P
14632 ><P
14633 >When a NT/W2K machine is joined to a domain, during that phase, the "Domain
14634 Administrators' group of the PDC is added to the 'Administrators' group of the
14635 workstation. Every members of the 'Domain Administrators' group 'inherit' the
14636 rights of the 'Administrators' group when logging on the workstation.</P
14637 ><P
14638 >You are now wondering how to make some of your samba PDC users members of the
14639 'Domain Administrators' ? That's really easy.</P
14640 ><P
14641 ></P
14642 ><OL
14643 TYPE="1"
14644 ><LI
14645 ><P
14646 >create a unix group (usually in <TT
14647 CLASS="FILENAME"
14648 >/etc/group</TT
14649 >), let's call it domadm</P
14650 ></LI
14651 ><LI
14652 ><P
14653 >add to this group the users that must be Administrators. For example if you want joe,john and mary, your entry in <TT
14654 CLASS="FILENAME"
14655 >/etc/group</TT
14656 > will look like:</P
14657 ><P
14658 ><PRE
14659 CLASS="PROGRAMLISTING"
14660 >domadm:x:502:joe,john,mary</PRE
14661 ></P
14662 ></LI
14663 ><LI
14664 ><P
14665 >Map this domadm group to the <B
14666 CLASS="COMMAND"
14667 >domain admins</B
14668 > group by running the command:</P
14669 ><P
14670 ><B
14671 CLASS="COMMAND"
14672 >smbgroupedit -c "Domain Admins" -u domadm</B
14673 ></P
14674 ></LI
14675 ></OL
14676 ><P
14677 >You're set, joe, john and mary are domain administrators !</P
14678 ><P
14679 >Like the Domain Admins group, you can map any arbitrary Unix group to any NT
14680 group. You can also make any Unix group a domain group. For example, on a domain
14681 member machine (an NT/W2K or a samba server running winbind), you would like to
14682 give access to a certain directory to some users who are member of a group on
14683 your samba PDC. Flag that group as a domain group by running:</P
14684 ><P
14685 ><B
14686 CLASS="COMMAND"
14687 >smbgroupedit -a unixgroup -td</B
14688 ></P
14689 ><P
14690 >You can list the various groups in the mapping database like this</P
14691 ><P
14692 ><B
14693 CLASS="COMMAND"
14694 >smbgroupedit -v</B
14695 ></P
14696 ></DIV
14697 ><DIV
14698 CLASS="CHAPTER"
14699 ><HR><H1
14700 ><A
14701 NAME="PORTABILITY"
14702 ></A
14703 >Chapter 22. Portability</H1
14704 ><P
14705 >Samba works on a wide range of platforms but the interface all the 
14706 platforms provide is not always compatible. This chapter contains 
14707 platform-specific information about compiling and using samba.</P
14708 ><DIV
14709 CLASS="SECT1"
14710 ><HR><H2
14711 CLASS="SECT1"
14712 ><A
14713 NAME="AEN3201"
14714 ></A
14715 >22.1. HPUX</H2
14716 ><P
14717 >HP's implementation of supplementary groups is, er, non-standard (for
14718 hysterical reasons).  There are two group files, /etc/group and
14719 /etc/logingroup; the system maps UIDs to numbers using the former, but
14720 initgroups() reads the latter.  Most system admins who know the ropes
14721 symlink /etc/group to /etc/logingroup (hard link doesn't work for reasons
14722 too stupid to go into here).  initgroups() will complain if one of the
14723 groups you're in in /etc/logingroup has what it considers to be an invalid
14724 ID, which means outside the range [0..UID_MAX], where UID_MAX is (I think)
14725 60000 currently on HP-UX.  This precludes -2 and 65534, the usual 'nobody'
14726 GIDs.</P
14727 ><P
14728 >If you encounter this problem, make sure that the programs that are failing 
14729 to initgroups() be run as users not in any groups with GIDs outside the 
14730 allowed range.</P
14731 ><P
14732 >This is documented in the HP manual pages under setgroups(2) and passwd(4).</P
14733 ></DIV
14734 ><DIV
14735 CLASS="SECT1"
14736 ><HR><H2
14737 CLASS="SECT1"
14738 ><A
14739 NAME="AEN3206"
14740 ></A
14741 >22.2. SCO Unix</H2
14742 ><P
14743
14744 If you run an old version of  SCO Unix then you may need to get important 
14745 TCP/IP patches for Samba to work correctly. Without the patch, you may 
14746 encounter corrupt data transfers using samba.</P
14747 ><P
14748 >The patch you need is UOD385 Connection Drivers SLS. It is available from
14749 SCO (ftp.sco.com, directory SLS, files uod385a.Z and uod385a.ltr.Z).</P
14750 ></DIV
14751 ><DIV
14752 CLASS="SECT1"
14753 ><HR><H2
14754 CLASS="SECT1"
14755 ><A
14756 NAME="AEN3210"
14757 ></A
14758 >22.3. DNIX</H2
14759 ><P
14760 >DNIX has a problem with seteuid() and setegid(). These routines are
14761 needed for Samba to work correctly, but they were left out of the DNIX
14762 C library for some reason.</P
14763 ><P
14764 >For this reason Samba by default defines the macro NO_EID in the DNIX
14765 section of includes.h. This works around the problem in a limited way,
14766 but it is far from ideal, some things still won't work right.</P
14767 ><P
14768
14769 To fix the problem properly you need to assemble the following two
14770 functions and then either add them to your C library or link them into
14771 Samba.</P
14772 ><P
14773
14774 put this in the file <TT
14775 CLASS="FILENAME"
14776 >setegid.s</TT
14777 >:</P
14778 ><P
14779 ><PRE
14780 CLASS="PROGRAMLISTING"
14781 >        .globl  _setegid
14782 _setegid:
14783         moveq   #47,d0
14784         movl    #100,a0
14785         moveq   #1,d1
14786         movl    4(sp),a1
14787         trap    #9
14788         bccs    1$
14789         jmp     cerror
14790 1$:
14791         clrl    d0
14792         rts</PRE
14793 ></P
14794 ><P
14795 >put this in the file <TT
14796 CLASS="FILENAME"
14797 >seteuid.s</TT
14798 >:</P
14799 ><P
14800 ><PRE
14801 CLASS="PROGRAMLISTING"
14802 >        .globl  _seteuid
14803 _seteuid:
14804         moveq   #47,d0
14805         movl    #100,a0
14806         moveq   #0,d1
14807         movl    4(sp),a1
14808         trap    #9
14809         bccs    1$
14810         jmp     cerror
14811 1$:
14812         clrl    d0
14813         rts</PRE
14814 ></P
14815 ><P
14816 >after creating the above files you then assemble them using</P
14817 ><P
14818 ><B
14819 CLASS="COMMAND"
14820 >as seteuid.s</B
14821 ></P
14822 ><P
14823 ><B
14824 CLASS="COMMAND"
14825 >as setegid.s</B
14826 ></P
14827 ><P
14828 >that should produce the files <TT
14829 CLASS="FILENAME"
14830 >seteuid.o</TT
14831 > and 
14832 <TT
14833 CLASS="FILENAME"
14834 >setegid.o</TT
14835 ></P
14836 ><P
14837 >then you need to add these to the LIBSM line in the DNIX section of
14838 the Samba Makefile. Your LIBSM line will then look something like this:</P
14839 ><P
14840 ><PRE
14841 CLASS="PROGRAMLISTING"
14842 >LIBSM = setegid.o seteuid.o -ln</PRE
14843 ></P
14844 ><P
14845
14846 You should then remove the line:</P
14847 ><P
14848 ><PRE
14849 CLASS="PROGRAMLISTING"
14850 >#define NO_EID</PRE
14851 ></P
14852 ><P
14853 >from the DNIX section of <TT
14854 CLASS="FILENAME"
14855 >includes.h</TT
14856 ></P
14857 ></DIV
14858 ></DIV
14859 ></DIV
14860 ></BODY
14861 ></HTML
14862 >