File: Samba3-ByExample.tex

package info (click to toggle)
samba 2%3A3.2.5-4lenny15
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 124,704 kB
  • ctags: 69,181
  • sloc: ansic: 564,153; xml: 219,271; sh: 11,039; perl: 4,458; makefile: 4,301; python: 1,975; cpp: 1,224; exp: 1,147; yacc: 881; awk: 557; csh: 58; sed: 45
file content (18218 lines) | stat: -rw-r--r-- 1,093,329 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
16469
16470
16471
16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598
16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611
16612
16613
16614
16615
16616
16617
16618
16619
16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637
16638
16639
16640
16641
16642
16643
16644
16645
16646
16647
16648
16649
16650
16651
16652
16653
16654
16655
16656
16657
16658
16659
16660
16661
16662
16663
16664
16665
16666
16667
16668
16669
16670
16671
16672
16673
16674
16675
16676
16677
16678
16679
16680
16681
16682
16683
16684
16685
16686
16687
16688
16689
16690
16691
16692
16693
16694
16695
16696
16697
16698
16699
16700
16701
16702
16703
16704
16705
16706
16707
16708
16709
16710
16711
16712
16713
16714
16715
16716
16717
16718
16719
16720
16721
16722
16723
16724
16725
16726
16727
16728
16729
16730
16731
16732
16733
16734
16735
16736
16737
16738
16739
16740
16741
16742
16743
16744
16745
16746
16747
16748
16749
16750
16751
16752
16753
16754
16755
16756
16757
16758
16759
16760
16761
16762
16763
16764
16765
16766
16767
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777
16778
16779
16780
16781
16782
16783
16784
16785
16786
16787
16788
16789
16790
16791
16792
16793
16794
16795
16796
16797
16798
16799
16800
16801
16802
16803
16804
16805
16806
16807
16808
16809
16810
16811
16812
16813
16814
16815
16816
16817
16818
16819
16820
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
16833
16834
16835
16836
16837
16838
16839
16840
16841
16842
16843
16844
16845
16846
16847
16848
16849
16850
16851
16852
16853
16854
16855
16856
16857
16858
16859
16860
16861
16862
16863
16864
16865
16866
16867
16868
16869
16870
16871
16872
16873
16874
16875
16876
16877
16878
16879
16880
16881
16882
16883
16884
16885
16886
16887
16888
16889
16890
16891
16892
16893
16894
16895
16896
16897
16898
16899
16900
16901
16902
16903
16904
16905
16906
16907
16908
16909
16910
16911
16912
16913
16914
16915
16916
16917
16918
16919
16920
16921
16922
16923
16924
16925
16926
16927
16928
16929
16930
16931
16932
16933
16934
16935
16936
16937
16938
16939
16940
16941
16942
16943
16944
16945
16946
16947
16948
16949
16950
16951
16952
16953
16954
16955
16956
16957
16958
16959
16960
16961
16962
16963
16964
16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979
16980
16981
16982
16983
16984
16985
16986
16987
16988
16989
16990
16991
16992
16993
16994
16995
16996
16997
16998
16999
17000
17001
17002
17003
17004
17005
17006
17007
17008
17009
17010
17011
17012
17013
17014
17015
17016
17017
17018
17019
17020
17021
17022
17023
17024
17025
17026
17027
17028
17029
17030
17031
17032
17033
17034
17035
17036
17037
17038
17039
17040
17041
17042
17043
17044
17045
17046
17047
17048
17049
17050
17051
17052
17053
17054
17055
17056
17057
17058
17059
17060
17061
17062
17063
17064
17065
17066
17067
17068
17069
17070
17071
17072
17073
17074
17075
17076
17077
17078
17079
17080
17081
17082
17083
17084
17085
17086
17087
17088
17089
17090
17091
17092
17093
17094
17095
17096
17097
17098
17099
17100
17101
17102
17103
17104
17105
17106
17107
17108
17109
17110
17111
17112
17113
17114
17115
17116
17117
17118
17119
17120
17121
17122
17123
17124
17125
17126
17127
17128
17129
17130
17131
17132
17133
17134
17135
17136
17137
17138
17139
17140
17141
17142
17143
17144
17145
17146
17147
17148
17149
17150
17151
17152
17153
17154
17155
17156
17157
17158
17159
17160
17161
17162
17163
17164
17165
17166
17167
17168
17169
17170
17171
17172
17173
17174
17175
17176
17177
17178
17179
17180
17181
17182
17183
17184
17185
17186
17187
17188
17189
17190
17191
17192
17193
17194
17195
17196
17197
17198
17199
17200
17201
17202
17203
17204
17205
17206
17207
17208
17209
17210
17211
17212
17213
17214
17215
17216
17217
17218
17219
17220
17221
17222
17223
17224
17225
17226
17227
17228
17229
17230
17231
17232
17233
17234
17235
17236
17237
17238
17239
17240
17241
17242
17243
17244
17245
17246
17247
17248
17249
17250
17251
17252
17253
17254
17255
17256
17257
17258
17259
17260
17261
17262
17263
17264
17265
17266
17267
17268
17269
17270
17271
17272
17273
17274
17275
17276
17277
17278
17279
17280
17281
17282
17283
17284
17285
17286
17287
17288
17289
17290
17291
17292
17293
17294
17295
17296
17297
17298
17299
17300
17301
17302
17303
17304
17305
17306
17307
17308
17309
17310
17311
17312
17313
17314
17315
17316
17317
17318
17319
17320
17321
17322
17323
17324
17325
17326
17327
17328
17329
17330
17331
17332
17333
17334
17335
17336
17337
17338
17339
17340
17341
17342
17343
17344
17345
17346
17347
17348
17349
17350
17351
17352
17353
17354
17355
17356
17357
17358
17359
17360
17361
17362
17363
17364
17365
17366
17367
17368
17369
17370
17371
17372
17373
17374
17375
17376
17377
17378
17379
17380
17381
17382
17383
17384
17385
17386
17387
17388
17389
17390
17391
17392
17393
17394
17395
17396
17397
17398
17399
17400
17401
17402
17403
17404
17405
17406
17407
17408
17409
17410
17411
17412
17413
17414
17415
17416
17417
17418
17419
17420
17421
17422
17423
17424
17425
17426
17427
17428
17429
17430
17431
17432
17433
17434
17435
17436
17437
17438
17439
17440
17441
17442
17443
17444
17445
17446
17447
17448
17449
17450
17451
17452
17453
17454
17455
17456
17457
17458
17459
17460
17461
17462
17463
17464
17465
17466
17467
17468
17469
17470
17471
17472
17473
17474
17475
17476
17477
17478
17479
17480
17481
17482
17483
17484
17485
17486
17487
17488
17489
17490
17491
17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
17502
17503
17504
17505
17506
17507
17508
17509
17510
17511
17512
17513
17514
17515
17516
17517
17518
17519
17520
17521
17522
17523
17524
17525
17526
17527
17528
17529
17530
17531
17532
17533
17534
17535
17536
17537
17538
17539
17540
17541
17542
17543
17544
17545
17546
17547
17548
17549
17550
17551
17552
17553
17554
17555
17556
17557
17558
17559
17560
17561
17562
17563
17564
17565
17566
17567
17568
17569
17570
17571
17572
17573
17574
17575
17576
17577
17578
17579
17580
17581
17582
17583
17584
17585
17586
17587
17588
17589
17590
17591
17592
17593
17594
17595
17596
17597
17598
17599
17600
17601
17602
17603
17604
17605
17606
17607
17608
17609
17610
17611
17612
17613
17614
17615
17616
17617
17618
17619
17620
17621
17622
17623
17624
17625
17626
17627
17628
17629
17630
17631
17632
17633
17634
17635
17636
17637
17638
17639
17640
17641
17642
17643
17644
17645
17646
17647
17648
17649
17650
17651
17652
17653
17654
17655
17656
17657
17658
17659
17660
17661
17662
17663
17664
17665
17666
17667
17668
17669
17670
17671
17672
17673
17674
17675
17676
17677
17678
17679
17680
17681
17682
17683
17684
17685
17686
17687
17688
17689
17690
17691
17692
17693
17694
17695
17696
17697
17698
17699
17700
17701
17702
17703
17704
17705
17706
17707
17708
17709
17710
17711
17712
17713
17714
17715
17716
17717
17718
17719
17720
17721
17722
17723
17724
17725
17726
17727
17728
17729
17730
17731
17732
17733
17734
17735
17736
17737
17738
17739
17740
17741
17742
17743
17744
17745
17746
17747
17748
17749
17750
17751
17752
17753
17754
17755
17756
17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
17772
17773
17774
17775
17776
17777
17778
17779
17780
17781
17782
17783
17784
17785
17786
17787
17788
17789
17790
17791
17792
17793
17794
17795
17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
17806
17807
17808
17809
17810
17811
17812
17813
17814
17815
17816
17817
17818
17819
17820
17821
17822
17823
17824
17825
17826
17827
17828
17829
17830
17831
17832
17833
17834
17835
17836
17837
17838
17839
17840
17841
17842
17843
17844
17845
17846
17847
17848
17849
17850
17851
17852
17853
17854
17855
17856
17857
17858
17859
17860
17861
17862
17863
17864
17865
17866
17867
17868
17869
17870
17871
17872
17873
17874
17875
17876
17877
17878
17879
17880
17881
17882
17883
17884
17885
17886
17887
17888
17889
17890
17891
17892
17893
17894
17895
17896
17897
17898
17899
17900
17901
17902
17903
17904
17905
17906
17907
17908
17909
17910
17911
17912
17913
17914
17915
17916
17917
17918
17919
17920
17921
17922
17923
17924
17925
17926
17927
17928
17929
17930
17931
17932
17933
17934
17935
17936
17937
17938
17939
17940
17941
17942
17943
17944
17945
17946
17947
17948
17949
17950
17951
17952
17953
17954
17955
17956
17957
17958
17959
17960
17961
17962
17963
17964
17965
17966
17967
17968
17969
17970
17971
17972
17973
17974
17975
17976
17977
17978
17979
17980
17981
17982
17983
17984
17985
17986
17987
17988
17989
17990
17991
17992
17993
17994
17995
17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
18024
18025
18026
18027
18028
18029
18030
18031
18032
18033
18034
18035
18036
18037
18038
18039
18040
18041
18042
18043
18044
18045
18046
18047
18048
18049
18050
18051
18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065
18066
18067
18068
18069
18070
18071
18072
18073
18074
18075
18076
18077
18078
18079
18080
18081
18082
18083
18084
18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098
18099
18100
18101
18102
18103
18104
18105
18106
18107
18108
18109
18110
18111
18112
18113
18114
18115
18116
18117
18118
18119
18120
18121
18122
18123
18124
18125
18126
18127
18128
18129
18130
18131
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
18142
18143
18144
18145
18146
18147
18148
18149
18150
18151
18152
18153
18154
18155
18156
18157
18158
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
18170
18171
18172
18173
18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
18214
18215
18216
18217
18218
% ------------------------------------------------------------	
% Autogenerated LaTeX file for books	
% ------------------------------------------------------------	
\ifx\pdfoutput\undefined
\documentclass[,letterpaper,11pt,openright,twoside,]{sambadoc}
\else
\documentclass[pdftex,,letterpaper,11pt,openright,twoside,]{sambadoc}
\fi
\label{S3bE}\usepackage{ifthen}
% --------------------------------------------
% Check for PDFLaTeX/LaTeX 
% --------------------------------------------
\newif\ifpdf
\ifx\pdfoutput\undefined
\pdffalse % we are not running PDFLaTeX
\else
\pdfoutput=1 % we are running PDFLaTeX
\pdftrue
\fi
% --------------------------------------------
% Load graphicx package with pdf if needed 
% --------------------------------------------
\ifpdf
\usepackage[pdftex]{graphicx}
\pdfcompresslevel=9
\else
\usepackage{graphicx}
\fi

\makeatletter
% redefine the listoffigures and listoftables so that the name of the chapter
% is printed whenever there are figures or tables from that chapter. encourage
% pagebreak prior to the name of the chapter (discourage orphans).
\let\save@@chapter\@chapter
\let\save@@l@figure\l@figure
\let\the@l@figure@leader\relax
\def\@chapter[#1]#2{\save@@chapter[{#1}]{#2}%
\addtocontents{lof}{\protect\def\the@l@figure@leader{\protect\pagebreak[0]\protect\contentsline{chapter}{\protect\numberline{\thechapter}#1}{}{\thepage}}}%
\addtocontents{lot}{\protect\def\the@l@figure@leader{\protect\pagebreak[0]\protect\contentsline{chapter}{\protect\numberline{\thechapter}#1}{}{\thepage}}}%
}
\renewcommand*\l@figure{\the@l@figure@leader\let\the@l@figure@leader\relax\save@@l@figure}
\let\l@table\l@figure
\makeatother
% ---------------------- 
% Most Common Packages   
% ---------------------- 
\usepackage{latexsym}         
\usepackage{enumerate}         
\usepackage{fancybox}      
\usepackage{float}       
\usepackage{ragged2e}       
\usepackage{fancyvrb}         
\makeatletter\@namedef{FV@fontfamily@default}{\def\FV@FontScanPrep{}\def\FV@FontFamily{}}\makeatother
\fvset{obeytabs=true,tabsize=3}
\usepackage{parskip}         
\usepackage{rotating}         
\usepackage{subfigure}         
\usepackage{tabularx}         
\usepackage{url}         
% --------------------------------------------
% Math support                                
% --------------------------------------------
\usepackage{amsmath,amsthm, amsfonts, amssymb, amsxtra,amsopn}
%\newtheorem{thm}{Theorem}[section]
%\newtheorem{cor}[section]{Corollary}
%\newtheorem{lem}[section]{Lemma}
%\newtheorem{defn}[section]{Definition}
%\newtheorem{prop}[section]{Proposition}
%\newtheorem{ax}{Axiom}
%\newtheorem{theorem}[section]{Theorem}
%\newtheorem{corollary}{Corollary}
%\newtheorem{lemma}{Lemma}
%\newtheorem{proposition}{Proposition}
%\theoremstyle{definition}
%\newtheorem{definition}{Definition}
%\theoremstyle{remark}
%\newtheorem{rem}{Remark}
%\newtheorem*{notation}{Notation}
%\newcommand{\ntt}{\normalfont\ttfamily}
%\newcommand{\thmref}[1]{Theorem~\ref{#1}}
%\newcommand{\secref}[1]{\S\ref{#1}}
%\newcommand{\lemref}[1]{Lemma~\ref{#1}}
 \newcommand{\bysame}{\mbox{\rule{3em}{.4pt}}\,}
 \newcommand{\A}{\mathcal{A}}
 \newcommand{\B}{\mathcal{B}}
 \newcommand{\XcY}{{(X,Y)}}
 \newcommand{\SX}{{S_X}}
 \newcommand{\SY}{{S_Y}}
 \newcommand{\SXY}{{S_{X,Y}}}
 \newcommand{\SXgYy}{{S_{X|Y}(y)}}
 \newcommand{\Cw}[1]{{\hat C_#1(X|Y)}}
 \newcommand{\G}{{G(X|Y)}}
 \newcommand{\PY}{{P_{\mathcal{Y}}}}
 \newcommand{\X}{\mathcal{X}}
 \newcommand{\wt}{\widetilde}
 \newcommand{\wh}{\widehat}
 % --------------------------------------------
 %\DeclareMathOperator{\per}{per}
 \DeclareMathOperator{\cov}{cov}
 \DeclareMathOperator{\non}{non}
 \DeclareMathOperator{\cf}{cf}
 \DeclareMathOperator{\add}{add}
 \DeclareMathOperator{\Cham}{Cham}
 \DeclareMathOperator{\IM}{Im}
 \DeclareMathOperator{\esssup}{ess\,sup}
 \DeclareMathOperator{\meas}{meas}
 \DeclareMathOperator{\seg}{seg}
% --------------------------------------------
% --------------------------------------------
% Load hyperref package with pdf if needed 
% --------------------------------------------
\ifpdf
\usepackage[pdftex,bookmarksnumbered,colorlinks,backref,bookmarks,breaklinks,linktocpage,plainpages=false,hyperfigures,hyperindex,citecolor=black,urlcolor=black,filecolor=black,linkcolor=black,menucolor=red,pagecolor=black]{hyperref}
\else
\usepackage[bookmarksnumbered,colorlinks,backref,bookmarks,breaklinks,linktocpage,plainpages=false,]{hyperref}
\fi
% --------------------------------------------
% ----------------------------------------------
% Define a new LaTeX environment (adminipage)
% ----------------------------------------------
\newenvironment{admminipage}%
{ % this code corresponds to the \begin{adminipage} command
 \begin{Sbox}%
 \begin{minipage}%
} %done
{ % this code corresponds to the \end{adminipage} command
 \end{minipage}
 \end{Sbox}
 \fbox{\TheSbox}
} %done
% ----------------------------------------------
% Define a new LaTeX length (admlength)
% ----------------------------------------------
\newlength{\admlength}
% ----------------------------------------------
% Define a new LaTeX environment (admonition)
% With 2 parameters:
% #1 The file (e.g. note.pdf)
% #2 The caption
% ----------------------------------------------
\newenvironment{admonition}[2] 
{ % this code corresponds to the \begin{admonition} command
 \hspace{0mm}\newline\hspace*\fill\newline
 \noindent
 \setlength{\fboxsep}{5pt}
 \setlength{\admlength}{\linewidth}
 \addtolength{\admlength}{-10\fboxsep}
 \addtolength{\admlength}{-10\fboxrule}
 \admminipage{\admlength}
 {\bfseries \sc\large{#2}} \newline
 \\[1mm]
 \sffamily
 \includegraphics[width=1cm]{#1}
 \addtolength{\admlength}{-1cm}
 \addtolength{\admlength}{-20pt}
 \begin{minipage}[lt]{\admlength}
 \parskip=0.5\baselineskip \advance\parskip by 0pt plus 2pt
} %done
{ % this code corresponds to the \end{admonition} command
 \vspace{5mm} 
 \end{minipage}
 \endadmminipage
 \vspace{.5em}
 \par
}
% --------------------------------------------
% Commands to manage/style/create floats      
% figures, tables, algorithms, examples, eqn  
% --------------------------------------------
 \floatstyle{ruled}
 \restylefloat{figure}
 \floatstyle{ruled}
 \restylefloat{table}
 \floatstyle{ruled}
 \newfloat{program}{ht}{lop}[section]
 \floatstyle{ruled}
 \newfloat{example}{ht}{loe}[section]
 \floatname{example}{Example}
 \floatstyle{ruled}
 \newfloat{dbequation}{ht}{loe}[section]
 \makeatletter\def\toclevel@dbequation{0}\makeatother
 \floatname{dbequation}{Equation}
 \floatstyle{boxed}
 \newfloat{algorithm}{ht}{loa}[section]
 \floatname{algorithm}{Algorithm}
\ifpdf
\DeclareGraphicsExtensions{.pdf,.png,.jpg}
\else
\DeclareGraphicsExtensions{.eps}
\fi
% --------------------------------------------
% $latex.caption.swapskip enabled for $formal.title.placement support
\newlength{\docbooktolatextempskip}
\newcommand{\captionswapskip}{\setlength{\docbooktolatextempskip}{\abovecaptionskip}\setlength{\abovecaptionskip}{\belowcaptionskip}\setlength{\belowcaptionskip}{\docbooktolatextempskip}}
% --------------------------------------------
% Better linebreaks
\newcommand{\docbookhyphenatedot}[1]{{\hyphenchar\font=`\.\relax #1\hyphenchar\font=`\-}}
\newcommand{\docbookhyphenatefilename}[1]{{\hyphenchar\font=`\.\relax #1\hyphenchar\font=`\-}}
\newcommand{\docbookhyphenateurl}[1]{{\hyphenchar\font=`\/\relax #1\hyphenchar\font=`\-}}
\usepackage[english]{babel} 
% Guard against a problem with old package versions.
\makeatletter
\AtBeginDocument{
\DeclareRobustCommand\ref{\@refstar}
\DeclareRobustCommand\pageref{\@pagerefstar}
}
\makeatother
% --------------------------------------------
\makeatletter
\newcommand{\dbz}{\penalty \z@}
\newcommand{\docbooktolatexpipe}{\ensuremath{|}\dbz}
\newskip\docbooktolatexoldparskip
\newcommand{\docbooktolatexnoparskip}{\docbooktolatexoldparskip=\parskip\parskip=0pt plus 1pt}
\newcommand{\docbooktolatexrestoreparskip}{\parskip=\docbooktolatexoldparskip}
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else\hbox{}\thispagestyle{empty}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\usepackage[]{ucs}
\usepackage[utf8]{inputenc}

\ifx\dblatex@chaptersmark\@undefined\def\dblatex@chaptersmark#1{\markboth{\MakeUppercase{#1}}{}}\fi
\let\save@makeschapterhead\@makeschapterhead
\def\dblatex@makeschapterhead#1{\vspace*{-80pt}\save@makeschapterhead{#1}}
\def\@makeschapterhead#1{\dblatex@makeschapterhead{#1}\dblatex@chaptersmark{#1}}

			
\AtBeginDocument{\ifx\refname\@undefined\let\docbooktolatexbibname\bibname\def\docbooktolatexbibnamex{\bibname}\else\let\docbooktolatexbibname\refname\def\docbooktolatexbibnamex{\refname}\fi}
% Facilitate use of \cite with \label
\newcommand{\docbooktolatexbibaux}[2]{%
  \protected@write\@auxout{}{\string\global\string\@namedef{docbooktolatexcite@#1}{#2}}
}
% Provide support for bibliography `subsection' environments with titles
\newenvironment{docbooktolatexbibliography}[3]{
   \begingroup
   \let\save@@chapter\chapter
   \let\save@@section\section
   \let\save@@@mkboth\@mkboth
   \let\save@@bibname\bibname
   \let\save@@refname\refname
   \let\@mkboth\@gobbletwo
   \def\@tempa{#3}
   \def\@tempb{}
   \ifx\@tempa\@tempb
      \let\chapter\@gobbletwo
      \let\section\@gobbletwo
      \let\bibname\relax
   \else
      \let\chapter#2
      \let\section#2
      \let\bibname\@tempa
   \fi
   \let\refname\bibname
   \begin{thebibliography}{#1}
}{
   \end{thebibliography}
   \let\chapter\save@@chapter
   \let\section\save@@section
   \let\@mkboth\save@@@mkboth
   \let\bibname\save@@bibname
   \let\refname\save@@refname
   \endgroup
}

		
			
%\usepackage{cite}
%\renewcommand\citeleft{(}  % parentheses around list
%\renewcommand\citeright{)} % parentheses around list
\newcommand{\docbooktolatexcite}[2]{%
  \@ifundefined{docbooktolatexcite@#1}%
  {\cite{#1}}%
  {\def\@docbooktolatextemp{#2}\ifx\@docbooktolatextemp\@empty%
   \cite{\@nameuse{docbooktolatexcite@#1}}%
   \else\cite[#2]{\@nameuse{docbooktolatexcite@#1}}%
   \fi%
  }%
}
\newcommand{\docbooktolatexbackcite}[1]{%
  \ifx\Hy@backout\@undefined\else%
    \@ifundefined{docbooktolatexcite@#1}{%
      % emit warning?
    }{%
      \ifBR@verbose%
        \PackageInfo{backref}{back cite \string`#1\string' as \string`\@nameuse{docbooktolatexcite@#1}\string'}%
      \fi%
      \Hy@backout{\@nameuse{docbooktolatexcite@#1}}%
    }%
  \fi%
}

		
			
% --------------------------------------------
% A way to honour <footnoteref>s
% Blame j-devenish (at) users.sourceforge.net
% In any other LaTeX context, this would probably go into a style file.
\newcommand{\docbooktolatexusefootnoteref}[1]{\@ifundefined{@fn@label@#1}%
  {\hbox{\@textsuperscript{\normalfont ?}}%
    \@latex@warning{Footnote label `#1' was not defined}}%
  {\@nameuse{@fn@label@#1}}}
\newcommand{\docbooktolatexmakefootnoteref}[1]{%
  \protected@write\@auxout{}%
    {\global\string\@namedef{@fn@label@#1}{\@makefnmark}}%
  \@namedef{@fn@label@#1}{\hbox{\@textsuperscript{\normalfont ?}}}%
  }

		\newcommand{\dbglossary}[1]{\chapter*{#1}%
\markboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}%
\newcommand{\dbglossdiv}[1]{\section*{#1}}%

			
% index labeling helper
\newif\ifdocbooktolatexprintindex\docbooktolatexprintindextrue
\let\dbtolatex@@theindex\theindex
\let\dbtolatex@@endtheindex\endtheindex
\def\theindex{\relax}
\def\endtheindex{\relax}
\newenvironment{dbtolatexindex}[1]
   {
\if@openright\cleardoublepage\else\clearpage\fi
\let\dbtolatex@@indexname\indexname
\def\dbtolatex@indexlabel{%
 \ifnum \c@secnumdepth >\m@ne \refstepcounter{chapter}\fi%
 \label{#1}\hypertarget{#1}{\dbtolatex@@indexname}%
 \global\docbooktolatexprintindexfalse}
\def\indexname{\ifdocbooktolatexprintindex\dbtolatex@indexlabel\else\dbtolatex@@indexname\fi}
\dbtolatex@@theindex
   }
   {
\dbtolatex@@endtheindex\let\indexname\dbtolatex@@indexname
   }

\newlength\saveparskip \newlength\saveparindent
\newlength\tempparskip \newlength\tempparindent

		
\def\docbooktolatexgobble{\expandafter\@gobble}
% Prevent multiple openings of the same aux file
% (happens when backref is used with multiple bibliography environments)
\ifx\AfterBeginDocument\undefined\let\AfterBeginDocument\AtBeginDocument\fi
\AfterBeginDocument{
   \let\latex@@starttoc\@starttoc
   \def\@starttoc#1{%
      \@ifundefined{docbooktolatex@aux#1}{%
         \global\@namedef{docbooktolatex@aux#1}{}%
         \latex@@starttoc{#1}%
      }{}
   }
}
% --------------------------------------------
% Hacks for honouring row/entry/@align
% (\hspace not effective when in paragraph mode)
% Naming convention for these macros is:
% 'docbooktolatex' 'align' {alignment-type} {position-within-entry}
% where r = right, l = left, c = centre
\newcommand{\docbooktolatex@align}[2]{\protect\ifvmode#1\else\ifx\LT@@tabarray\@undefined#2\else#1\fi\fi}
\newcommand{\docbooktolatexalignll}{\docbooktolatex@align{\raggedright}{}}
\newcommand{\docbooktolatexalignlr}{\docbooktolatex@align{}{\hspace*\fill}}
\newcommand{\docbooktolatexaligncl}{\docbooktolatex@align{\centering}{\hfill}}
\newcommand{\docbooktolatexaligncr}{\docbooktolatex@align{}{\hspace*\fill}}
\newcommand{\docbooktolatexalignrl}{\protect\ifvmode\raggedleft\else\hfill\fi}
\newcommand{\docbooktolatexalignrr}{}
\ifx\captionswapskip\@undefined\newcommand{\captionswapskip}{}\fi
\makeatother
\title{\bfseries Samba-3 by Example\\[12pt]\normalsize Practical Exercises in Successful Samba Deployment}
\author{John H. Terpstra}
% --------------------------------------------
\makeindex
\makeglossary
% --------------------------------------------

\setcounter{tocdepth}{4}

\setcounter{secnumdepth}{4}
\begin{document}
{\maketitle\pagestyle{plain}
\thispagestyle{empty}}
\clearpage \setcounter{page}{7} % -------------------------------------------------------------
% Preface 
% -------------------------------------------------------------
\chapter*{About the Cover Artwork}%
\label{id2429008}\hypertarget{id2429008}{}%

The cover artwork of this book continues the freedom theme of the first edition of {``}Samba-3 by Example{''}. The history of civilization demonstrates the fragile nature of freedom. It can be lost in a moment, and once lost, the cost of recovering liberty can be incredible. The last edition cover featured Alfred the Great who liberated England from the constant assault of Vikings and Norsemen. Events in England that finally liberated the common people came about in small steps, but the result should not be under-estimated. Today, as always, freedom and liberty are seldom appreciated until they are lost. If we can not quantify what is the value of freedom, we shall be little motivated to protect it.

{\em{Samba-3 by Example Cover Artwork:}} The British houses of parliament are a symbol of the Westminster system of government. This form of government permits the people to govern themselves at the lowest level, yet it provides for courts of appeal that are designed to protect freedom and to hold back all forces of tyranny. The clock is a pertinent symbol of the importance of time and place.

The information technology industry is being challenged by the imposition of new laws, hostile litigation, and the imposition of significant constraint of practice that threatens to remove the freedom to develop and deploy open source software solutions. Samba is a software solution that epitomizes freedom of choice in network interoperability for Microsoft Windows clients.

I hope you will take the time needed to deploy it well, and that you may realize the greatest benefits that may be obtained. You are free to use it in ways never considered, but in doing so there may be some obstacles. Every obstacle that is overcome adds to the freedom you can enjoy. Use Samba well, and it will serve you well.
% -------------------------------------------------------------
% Preface 
% -------------------------------------------------------------
\chapter*{Acknowledgments}%
\label{id2444099}\hypertarget{id2444099}{}%

{\em{Samba-3 by Example}} would not have been written except as a result of feedback provided by reviewers and readers of the book {\em{The Official Samba-3 HOWTO and Reference Guide.}} This second edition was made possible by generous feedback from Samba users. I hope this book more than answers the challenge and needs of many more networks that are languishing for a better networking solution.

I am deeply indebted to a large group of diligent people. Space prevents me from listing all of them, but a few stand out as worthy of mention. Jelmer Vernooij made the notable contribution of building the XML production environment and thereby made possible the typesetting of this book.

Samba would not have come into existence if Andrew Tridgell had not taken the first steps. He continues to lead the project. Under the shadow of his mantle are some great folks who never give up and are always ready to help. Thank you to: Jeremy Allison, Jerry Carter, Andrew Bartlett, Jelmer Vernooij, Alexander Bokovoy, Volker Lendecke, and other team members who answered my continuous stream of questions ---  all of which resulted in improved content in this book.

My heartfelt thanks go out also to a small set of reviewers (alphabetically listed) who gave substantial feedback and significant suggestions for improvement: Tony Earnshaw, William Enestvedt, Eric Hines, Roland Gruber, Gavin Henry, Steven Henry, Luke Howard, Tarjei Huse, Jon Johnston, Alan Munter, Mike MacIsaac, Scott Mann, Ed Riddle, Geoff Scott, Santos Soler, Misty Stanley-Jones, Mark Taylor, and Jérôme Tournier.

My appreciation is extended to a team of more than 30 additional reviewers who helped me to find my way around dark corners.

Particular mention is due to Lyndell, Amos, and Melissa who gave me the latitude necessary to spend nearly an entire year writing Samba documentation, and then gave more so this second edition could be created.
\cleardoublepage 
\docbooktolatexnoparskip

\makeatletter
\def\dbtolatex@contentsid{id2408022}
\let\dbtolatex@@contentsname\contentsname
\newif\ifdocbooktolatexcontentsname\docbooktolatexcontentsnametrue
\def\dbtolatex@contentslabel{%
 \label{\dbtolatex@contentsid}\hypertarget{\dbtolatex@contentsid}{\dbtolatex@@contentsname}%
 \global\docbooktolatexcontentsnamefalse}
\def\contentsname{\ifdocbooktolatexcontentsname\dbtolatex@contentslabel\else\dbtolatex@@contentsname\fi}
\tableofcontents
\let\contentsname\dbtolatex@@contentsname
\Hy@writebookmark{}{\dbtolatex@@contentsname}{\dbtolatex@contentsid}{0}{toc}%
\makeatother
				\docbooktolatexrestoreparskip
\cleardoublepage \listofexamples \cleardoublepage \docbooktolatexnoparskip
\listoffigures
\listoftables
\docbooktolatexrestoreparskip
\cleardoublepage % -------------------------------------------------------------
% Preface 
% -------------------------------------------------------------
\chapter*{Foreword}%
\label{id2404480}\hypertarget{id2404480}{}%

% ------------------------   
% Section 
\section*{By John M. Weathersby, Executive Director, OSSI}
\label{id2468094}\hypertarget{id2468094}{}%
\begin{quote}

The Open Source Software Institute (OSSI) is comprised of representatives from a broad spectrum of business and non-business organizations that share a common interest in the promotion of development and implementation of open source software solutions globally, and in particular within the United States of America.

The OSSI has global affiliations with like-minded organizations. Our affiliate in the United Kingdom is the Open Source Consortium (OSC). Both the OSSI and the OSC share a common objective to expand the use of open source software in federal, state, and municipal government agencies; and in academic institutions. We represent businesses that provide professional support services that answer the needs of our target organizational information technology consumers in an effective and cost-efficient manner.

Open source software has matured greatly over the past five years with the result that an increasing number of people who hold key decisionmaking positions want to know how the business model works. They want to understand how problems get resolved, how questions get answered, and how the development model is sustained. Information and communications technology directors in defense organizations, and in other government agencies that deal with sensitive information, want to become familiar with development road-maps and, in particular, seek to evaluate the track record of the mainstream open source project teams.

Wherever the OSSI gains entrance to new opportunities we find that Microsoft Windows technologies are the benchmark against which open source software solutions are measured. Two open source software projects are key to our ability to present a structured and convincing proposition that there are alternatives to the incumbent proprietary means of meeting information technology needs. They are the Apache Web Server and Samba.

Just as the Apache Web Server is the standard in web serving technology, Samba is the definitive standard for providing interoperability with UNIX systems and other non-Microsoft operating system platforms. Both open source applications have a truly remarkable track record that extends for more than a decade. Both have demonstrated the unique capacity to innovate and maintain a level of development that has not only kept pace with demands, but, in many areas, each project has also proven to be an industry leader.

One of the areas in which the Samba project has demonstrated key leadership is in documentation. The OSSI was delighted when we saw the Samba Team, and John H. Terpstra in particular, release two amazingly well-written books to help Samba software users deploy, maintain, and troubleshoot Windows networking installations. We were concerned that, given the large volume of documentation, the challenge to maintain it and keep it current might prove difficult.

This second edition of the book, {\em{Samba-3 by Example}}, barely one year following the release of the first edition, has removed all concerns and is proof that open source solutions are a compelling choice. The first edition was released shortly following the release of Samba version 3.0 itself, and has become the authoritative instrument for training and for guiding deployment.

I am personally aware of how much effort has gone into this second edition. John Terpstra has worked with government bodies and with large organizations that have deployed Samba-3 since it was released. He also worked to ensure that this book gained community following. He asked those who have worked at the coalface of large and small organizations alike, to contribute their experiences. He has captured that in this book and has succeeded yet again. His recipe is persistence, intuition, and a high level of respect for the people who use Samba.

This book is the first source you should turn to before you deploy Samba and as you are mastering its deployment. I am proud and excited to be associated in a small way with such a useful tool. This book has reached maturity that is demonstrated by reiteration that every step in deployment must be validated. This book makes it easy to succeed, and difficult to fail, to gain a stable network environment.

I recommend this book for use by all IT managers and network administrators.
\end{quote}
% -------------------------------------------------------------
% Preface 
% -------------------------------------------------------------
\chapter*{Preface}%
\label{preface}\hypertarget{preface}{}%

Network administrators live busy lives. We face distractions and pressures that drive us to seek proven, working case scenarios that can be easily implemented. Often this approach lands us in trouble. There is a saying that, geometrically speaking, the shortest distance between two points is a straight line, but practically we find that the quickest route to a stable network solution is the long way around.

This book is your means to the straight path. It provides step-by-step, proven, working examples of Samba deployments. If you want to deploy Samba-3 with the least effort, or if you want to become an expert at deploying Samba-3 without having to search through lots of documentation, this book is the ticket to your destination.

Samba is software that can be run on a platform other than Microsoft Windows, for example, UNIX, Linux, IBM System 390, OpenVMS, and other operating systems. Samba uses the TCP/IP protocol that is installed on the host server. When correctly configured, it allows that host to interact with a Microsoft Windows client or server as if it is a Windows file and print server. This book will help you to implement Windows-compatible file and print services.

The examples presented in this book are typical of various businesses and reflect the problems and challenges they face. Care has been taken to preserve attitudes, perceptions, practices, and demands from real network case studies. The maximum benefit may be obtained from this book by working carefully through each exercise. You may be in a hurry to satisfy a specific need, so feel free to locate the example that most closely matches your need, copy it, and innovate as much as you like. Above all, enjoy the process of learning the secrets of MS Windows networking that is truly liberated by Samba.

The focus of attention in this book is Samba-3. Specific notes are made in respect of how Samba may be made secure. This book does not attempt to provide detailed information regarding secure operation and configuration of peripheral services and applications such as OpenLDAP, DNS and DHCP, the need for which can be met from other resources that are dedicated to the subject.

% ------------------------   
% Section 
\section*{Why Is This Book Necessary?}
\label{id2502097}\hypertarget{id2502097}{}%

This book is the result of observations and feedback. The feedback from the Samba-HOWTO-Collection has been positive and complimentary. There have been requests for far more worked examples, a {``}Samba Cookbook,{''} and for training materials to help kick-start the process of mastering Samba.

The Samba mailing lists users have asked for sample configuration files that work. It is natural to question one's own ability to correctly configure a complex tool such as Samba until a minimum necessary knowledge level has been attained.

The Samba-HOWTO-Collection ---  as does {\em{The Official Samba-3 HOWTO and Reference Guide}} ---  documents Samba features and functionality in a topical context. This book takes a completely different approach. It walks through Samba network configurations that are working within particular environmental contexts, providing documented step-by-step implementations. All example case configuration files, scripts, and other tools are provided on the CD-ROM. This book is descriptive, provides detailed diagrams, and makes deployment of Samba-3 a breeze.
\subsection*{Samba 3.0.20 Update Edition}
\label{id2502078}\hypertarget{id2502078}{}%

The Samba 3.0.x series has been remarkably popular. At the time this book first went to print samba-3.0.2 was being released. There have been significant modifications and enhancements between samba-3.0.2 and samba-3.0.14 (the current release) that necessitate this documentation update. This update has the specific intent to refocus this book so that its guidance can be followed for samba-3.0.20 and beyond. Further changes are expected as Samba-3 matures further and will be reflected in future updates.

The changes shown in \hyperlink{pref-new}{Table {\ref{pref-new}}} are incorporated in this update.

% table ------------------------------------------------------
\begin{table}[htb]
\begin{center}%
\hypertarget{pref-new}{}%
\captionswapskip{}{{\caption{Samba Changes ---  3.0.2 to 3.0.20}\label{pref-new}}}
\captionswapskip{}\begin{tabularx}{\linewidth}{|l|X|}
\hline 
\docbooktolatexalignll {{{\bfseries New Feature}}} & \docbooktolatexalignll {{{\bfseries Description}}} \tabularnewline
 \hline 
{{Winbind Case Handling}} & {{User and group names returned by {\bfseries{winbindd}} are now converted to lower case for better consistency. Samba implementations that depend on the case of information returned by winbind (such as \%u and \%U) must now convert the dependency to expecting lower case values. This affects mail spool files, home directories, valid user lines in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file, etc.}} \tabularnewline
 \hline 
{{Schema Changes}} & {{Addition of code to handle password aging, password uniqueness controls, bad password instances at logon time, have made necessary extensions to the SambaSAM schema. This change affects all sites that use LDAP and means that the directory schema must be updated.}} \tabularnewline
 \hline 
{{Username Map Handling}} & {{Samba-3.0.8 redefined the behavior: Local authentication results in a username map file lookup before authenticating the connection. All authentication via an external domain controller will result in the use of the fully qualified name (i.e.: DOMAIN\textbackslash username) after the user has been successfully authenticated.}} \tabularnewline
 \hline 
{{UNIX Extension Handling}} & {{Symbolically linked files and directories on the UNIX host to absolute paths will now be followed. This can be turned off using {``}wide links = No{''} in the share stanza in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file. Turning off {``}wide links{''} support will degrade server performance because each path must be checked.}} \tabularnewline
 \hline 
{{Privileges Support}} & {{Versions of Samba prior to samba-3.0.11 required the use of the UNIX {\texttt{\docbookhyphenatedot{root}}} account from network Windows clients. The new {``}enable privileges = Yes{''} capability means that functions such as adding machines to the domain, managing printers, etc. can now be delegated to normal user accounts or to groups of users.}} \tabularnewline
\hline 
\end{tabularx}
\end{center}
\end{table}


% ------------------------   
% Section 
\section*{Prerequisites}
\label{id2501413}\hypertarget{id2501413}{}%

This book is not a tutorial on UNIX or Linux administration. UNIX and Linux training is best obtained from books dedicated to the subject. This book assumes that you have at least the basic skill necessary to use these operating systems, and that you can use a basic system editor to edit and configure files. It has been written with the assumption that you have experience with Samba, have read {\em{The Official Samba-3 HOWTO and Reference Guide}} and the Samba-HOWTO-Collection, or that you have familiarity with Microsoft Windows.

If you do not have this experience, you can follow the examples in this book but may find yourself at times intimidated by assumptions made. In this situation, you may need to refer to administrative guides or manuals for your operating system platform to find what is the best method to achieve what the text of this book describes.

% ------------------------   
% Section 
\section*{Approach}
\label{id2501446}\hypertarget{id2501446}{}%

The first chapter deals with some rather thorny network analysis issues. Do not be put off by this. The information you glean, even without a detailed understanding of network protocol analysis, can help you understand how Windows networking functions.

Each following chapter of this book opens with the description of a networking solution sought by a hypothetical site. Bob Jordan is a hypothetical decision maker for an imaginary company, {\texttt{\docbookhyphenatedot{Abmas Biz NL}}}. We will use the non-existent domain name {\texttt{\docbookhyphenatedot{abmas.biz}}}. All {\em{facts}} presented regarding this company are fictitious and have been drawn from a variety of real business scenarios over many years. Not one of these reveal the identify of the real-world company from which the scenario originated.

In any case, Mr. Jordan likes to give all his staff nasty little assignments. Stanley Saroka is one of his proteges; Christine Roberson is the network administrator Bob trusts. Jordan is inclined to treat other departments well because they finance Abmas IT operations.

Each chapter presents a summary of the network solution we have chosen to demonstrate together with a rationale to help you to understand the thought process that drove that solution. The chapter then documents in precise detail all configuration files and steps that must be taken to implement the example solution. Anyone wishing to gain serious value from this book will do well to take note of the implications of points made, so watch out for the {\em{this means that}} notations.

Each chapter has a set of questions and answers to help you to to understand and digest key attributes of the solutions presented.

% ------------------------   
% Section 
\section*{Summary of Topics}
\label{id2501454}\hypertarget{id2501454}{}%

The contents of this second edition of {\em{Samba-3 by Example}} have been rearranged based on feedback from purchasers of the first edition.

Clearly the first edition contained most of what was needed and that was missing from other books that cover this difficult subject. The new arrangement adds additional material to meet consumer requests and includes changes that originated as suggestions for improvement.

Chapter 1 now dives directly into the heart of the implementation of Windows file and print server networks that use Samba at the heart.

\begin{description}
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 1 ---  No Frills Samba Servers.}]\null{}
Here you design a solution for three different business scenarios, each for a company called Abmas. There are two simple networking problems and one slightly more complex networking challenge. In the first two cases, Abmas has a small simple office, and they want to replace a Windows 9x peer-to-peer network. The third example business uses Windows 2000 Professional. This must be simple, so let's see how far we can get. If successful, Abmas grows quickly and soon needs to replace all servers and workstations.

{\em{TechInfo}} ---  This chapter demands: 
\begin{itemize}
%--- Item
\item 
Case 1: The simplest {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file that may reasonably be used. Works with Samba-2.x also. This configuration uses Share Mode security. Encrypted passwords are not used, so there is no {\texttt{\docbookhyphenatefilename{smbpasswd}}} file.


%--- Item
\item 
Case 2: Another simple {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file that adds WINS support and printing support. This case deals with a special requirement that demonstrates how to deal with purpose-built software that has a particular requirement for certain share names and printing demands. This configuration uses Share Mode security and also works with Samba-2.x. Encrypted passwords are not used, so there is no {\texttt{\docbookhyphenatefilename{smbpasswd}}} file.


%--- Item
\item 
Case 3: This {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} configuration uses User Mode security. The file share configuration demonstrates the ability to provide master access to an administrator while restricting all staff to their own work areas. Encrypted passwords are used, so there is an implicit {\texttt{\docbookhyphenatefilename{smbpasswd}}} file.

\end{itemize}

% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 2 ---  Small Office Networking.}]\null{}
Abmas is a successful company now. They have 50 network users and want a little more varoom from the network. This is a typical small office and they want better systems to help them to grow. This is your chance to really give advanced users a bit more functionality and usefulness.

{\em{TechInfo}} ---  This {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file makes use of encrypted passwords, so there is an {\texttt{\docbookhyphenatefilename{smbpasswd}}} file. It also demonstrates use of the {\ttfamily\itshape{\docbookhyphenatedot{valid users}}} and {\ttfamily\itshape{\docbookhyphenatedot{valid groups}}} to restrict share access. The Windows clients access the server as Domain members. Mobile users log onto the Domain while in the office, but use a local machine account while on the road. The result is an environment that answers mobile computing user needs.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 3 ---  Secure Office Networking.}]\null{}
Abmas is growing rapidly now. Money is a little tight, but with 130 network users, security has become a concern. They have many new machines to install and the old equipment will be retired. This time they want the new network to scale and grow for at least two years. Start with a sufficient system and allow room for growth. You are now implementing an Internet connection and have a few reservations about user expectations.

{\em{TechInfo}} ---  This {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file makes use of encrypted passwords, and you can use a {\texttt{\docbookhyphenatefilename{tdbsam}}} password backend. Domain logons are introduced. Applications are served from the central server. Roaming profiles are mandated. Access to the server is tightened up so that only domain members can access server resources. Mobile computing needs still are catered to.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 4 ---  The 500 User Office.}]\null{}
The two-year projections were met. Congratulations, you are a star. Now Abmas needs to replace the network. Into the existing user base, they need to merge a 280-user company they just acquired. It is time to build a serious network. There are now three buildings on one campus and your assignment is to keep everyone working while a new network is rolled out. Oh, isn't it nice to roll out brand new clients and servers! Money is no longer tight, you get to buy and install what you ask for. You will install routers and a firewall. This is exciting!

{\em{TechInfo}} ---  This {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file makes use of encrypted passwords, and a {\texttt{\docbookhyphenatefilename{tdbsam}}} password backend is used. You are not ready to launch into LDAP yet, so you accept the limitation of having one central Domain Controller with a Domain Member server in two buildings on your campus. A number of clever techniques are used to demonstrate some of the smart options built into Samba.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 5 ---  Making Happy Users.}]\null{}
Congratulations again. Abmas is happy with your services and you have been given another raise. Your users are becoming much more capable and are complaining about little things that need to be fixed. Are you up to the task? Mary says it takes her 20 minutes to log onto the network and it is killing her productivity. Email is a bit {\em{unreliable}} ---  have you been sleeping on the job? We do not discuss the technology of email but when the use of mail clients breaks because of networking problems, you had better get on top of it. It's time for a change.

{\em{TechInfo}} ---  This {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file makes use of encrypted passwords; a distributed {\texttt{\docbookhyphenatefilename{ldapsam}}} password backend is used. Roaming profiles are enabled. Desktop profile controls are introduced. Check out the techniques that can improve the user experience of network performance. As a special bonus, this chapter documents how to configure smart downloading of printer drivers for drag-and-drop printing support. And, yes, the secret of configuring CUPS is clearly documented. Go for it; this one will tease you, too.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 6 ---  A Distributed 2000 User Network.}]\null{}
Only eight months have passed, and Abmas has acquired another company. You now need to expand the network further. You have to deal with a network that spans several countries. There are three new networks in addition to the original three buildings at the head-office campus. The head office is in New York and you have branch offices in Washington, Los Angeles, and London. Your desktop standard is Windows XP Professional. In many ways, everything has changed and yet it must remain the same. Your team is primed for another roll-out. You know there are further challenges ahead.

{\em{TechInfo}} ---  Slave LDAP servers are introduced. Samba is configured to use multiple LDAP backends. This is a brief chapter; it assumes that the technology has been mastered and gets right down to concepts and how to deploy them.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 7 ---  Adding UNIX/Linux Servers and Clients.}]\null{}
Well done, Bob, your team has achieved much. Now help Abmas integrate the entire network. You want central control and central support and you need to cut costs. How can you reduce administrative overheads and yet get better control of the network?

This chapter has been contributed by Mark Taylor mark.\dbz{}taylor@siriusit.\dbz{}co.\dbz{}uk\label{id2530567}\begingroup\catcode`\#=12\footnote{ {\textless}\url{mailto:mark.taylor@siriusit.co.uk}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2530567} and is based on a live site. For further information regarding this example case, please contact Mark directly.

{\em{TechInfo}} ---  It is time to consider how to add Samba servers and UNIX and Linux network clients. Users who convert to Linux want to be able to log on using Windows network accounts. You explore nss\_ldap, pam\_ldap, winbind, and a few neat techniques for taking control. Are you ready for this?
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 8 ---  Updating Samba-3.}]\null{}
This chapter is the result of repeated requests for better documentation of the steps that must be followed when updating or upgrading a Samba server. It attempts to cover the entire subject in broad-brush but at the same time provides detailed background information that is not covered elsewhere in the Samba documentation.

{\em{TechInfo}} ---  Samba stores a lot of essential network information in a large and growing collection of files. This chapter documents the essentials of where those files may be located and how to find them. It also provides an insight into inter-related matters that affect a Samba installation.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 9 ---  Migrating NT4 Domain to Samba-3.}]\null{}
Another six months have passed. Abmas has acquired yet another company. You will find a way to migrate all users off the old network onto the existing network without loss of passwords and will effect the change-over during one weekend. May the force (and caffeine) be with you, may you keep your back to the wind and may the sun shine on your face.

{\em{TechInfo}} ---  This chapter demonstrates the use of the {\bfseries{net rpc migrate}} facility using an LDAP ldapsam backend, and also using a tdbsam passdb backend. Both are much-asked-for examples of NT4 Domain migration.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 10 ---  Migrating NetWare 4.11 Server to Samba.}]\null{}
Misty Stanley-Jones has contributed information that summarizes her experience at migration from a NetWare server to Samba-3.

{\em{TechInfo}} ---  The documentation provided demonstrates how one site migrated from NetWare to Samba. Some alternatives tools are mentioned. These could be used to provide another pathway to a successful migration.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 11 ---  Active Directory, Kerberos and Security.}]\null{}
Abmas has acquired another company that has just migrated to running Windows Server 2003 and Active Directory. One of your staff makes offhand comments that land you in hot water. A network security auditor is hired by the head of the new business and files a damning report, and you must address the {\em{defects}} reported. You have hired new network engineers who want to replace Microsoft Active Directory with a pure Kerberos solution. How will you handle this?

{\em{TechInfo}} ---  This chapter is your answer. Learn about share access controls, proper use of UNIX/Linux file system access controls, and Windows 200x Access Control Lists. Follow these steps to beat the critics.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 12 ---  Integrating Additional Services.}]\null{}
The battle is almost over, Samba-3 has won the day. Your team are delighted and now you find yourself at yet another cross-roads. Abmas have acquired a snack food business, you made promises you must keep. IT costs must be reduced, you have new resistance, but you will win again. This time you choose to install the Squid proxy server to validate the fact that Samba is far more than just a file and print server. SPNEGO authentication support means that your Microsoft Windows clients gain transparent proxy access.

{\em{TechInfo}} ---  Samba provides the {\bfseries{ntlm\_auth}} module that makes it possible for MS Windows Internet Explorer to connect via the Squid Web and FTP proxy server. You will configure Samba-3 as well as Squid to deliver authenticated access control using the Active Directory Domain user security credentials.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 13 ---  Performance, Reliability and Availability.}]\null{}
Bob, are you sure the new Samba server is up to the load? Your network is serving many users who risk becoming unproductive. What can you do to keep ahead of demand? Can you keep the cost under control also? What can go wrong?

{\em{TechInfo}} ---  Hot tips that put chili into your network. Avoid name resolution problems, identify potential causes of network collisions, avoid Samba configuration options that will weigh the server down. MS distributed file services to make your network fly and much more. This chapter contains a good deal of {``}Did I tell you about this...?{''} type of hints to help keep your name on the top performers list.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 14 ---  Samba Support.}]\null{}
This chapter has been added specifically to help those who are seeking professional paid support for Samba. The critics of Open Source Software often assert that there is no support for free software. Some critics argue that free software undermines the service that proprietary commercial software vendors depend on. This chapter explains what are the support options for Samba and the fact that a growing number of businesses make money by providing commercial paid-for Samba support.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 15 ---  A Collection of Useful Tid-bits.}]\null{}
Sometimes it seems that there is not a good place for certain odds and ends that impact Samba deployment. Some readers would argue that everyone can be expected to know this information, or at least be able to find it easily. So to avoid offending a reader's sensitivities, the tid-bits have been placed in this chapter. Do check out the contents, you may find something of value among the loose ends.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Chapter 16 ---  Windows Networking Primer.}]\null{}
Here we cover practical exercises to help us to understand how MS Windows network protocols function. A network protocol analyzer helps you to appreciate the fact that Windows networking is highly dependent on broadcast messaging. Additionally, you can look into network packets that a Windows client sends to a network server to set up a network connection. On completion, you should have a basic understanding of how network browsing functions and have seen some of the information a Windows client sends to a file and print server to create a connection over which file and print operations may take place.
\end{description}

% ------------------------   
% Section 
\section*{Conventions Used}
\label{id2521129}\hypertarget{id2521129}{}%

The following notation conventions are used throughout this book:

\begin{itemize}
%--- Item
\item 
TOSHARG2 is used as an abbreviation for the book, {``}The Official Samba-3 HOWTO and Reference Guide, Second Edition{''} Editors: John H. Terpstra and Jelmer R. Vernooij, Publisher: Prentice Hall, ISBN: 0131882228.


%--- Item
\item 
S3bE2 is used as an abbreviation for the book, {``}Samba-3 by Example, Second Edition{''} Editors: John H. Terpstra, Publisher: Prentice Hall, ISBN: 013188221X.


%--- Item
\item 
Directories and filenames appear in mono-font. For example, {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}pam.\dbz{}conf}}}.


%--- Item
\item 
Executable names are bolded. For example, {\bfseries{smbd}}.


%--- Item
\item 
Menu items and buttons appear in bold. For example, click {\sffamily \bfseries Next}.


%--- Item
\item 
Selecting a menu item is indicated as: {\sffamily \bfseries Start} $\to$ {\sffamily \bfseries Control Panel} $\to$ {\sffamily \bfseries Administrative Tools} $\to$ {\sffamily \bfseries Active Directory Users and Computers}

\end{itemize}
% ------------------------------------------------------------- 
% 
% PART Example Network Configurations
% 
% ------------------------------------------------------------- 
\part{Example Network Configurations}
\label{ExNetworks}\hypertarget{ExNetworks}{}%

% -------------------------------------------------------------
% PartIntro Example Network Configurations 
% ------------------------------------------------------------- 	
\chapter*{Example Network Configurations}
\label{id2408312}\hypertarget{id2408312}{}%
\pagenumbering{arabic} 
This section of {\em{Samba-3 by Example}} provides example network configurations that can be copied, or modified as needed, and deployed as-is. The contents have been marginally updated to reflect changes made in Samba=3.0.23.

Best use can be made of this book by finding in this section the network design and layout that best approximates your estimated needs. It is recommended that you will implement the design pattern exactly as it appears, then after the installation has been proven to work make any changes or modifications needed at your site.

The examples have been tested with Red Hat Fedora Core 2, Novell SUSE Linux Professional 9.3 and Novell SUSE Linux Enterprise Server (SLES) 9. The principals of implementation apply to all Linux and UNIX systems in general, though some system files and tools will be different and the location of some Samba file locations will be different since these are determined by the person who packages Samba for each platform.

If you are deploying Samba is a mission-critical environment, or if you simply want to save time and get your Samba network operational with minimal fuss, there is the option to purchase commercial, professional, Samba support. Information regarding commercial support options may be obtained from the commercial support\label{id2408366}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.samba.org/samba/support/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2408366} pages from the Samba web site.
\cleardoublepage 
% -------------------------------------------------------------
% Chapter No-Frills Samba Servers 
% ------------------------------------------------------------- 	
\chapter{No-Frills Samba Servers}
\label{simple}\hypertarget{simple}{}%

This is the start of the real journey toward the successful deployment of Samba. For some this chapter is the end of the road because their needs will have been adequately met. For others, this chapter is the beginning of a journey that will take them well past the contents of this book. This book provides example configurations of, for the greater part, complete networking solutions. The intent of this book is to help you to get your Samba installation working with the least amount of pain and aggravation.

% ------------------------   
% Section 
\section{Introduction}
\label{id2456206}\hypertarget{id2456206}{}%

This chapter lays the groundwork for understanding the basics of Samba operation. Instead of a bland technical discussion, each principle is demonstrated by way of a real-world scenario for which a working solution\label{id2483390}\begingroup\catcode`\#=12\footnote{
The examples given mirror those documented in The Official Samba-3 HOWTO and Reference Guide, Second Edition (TOSHARG2) Chapter 2, Section 2.3.1. You may gain additional insight from the standalone server configurations covered in TOSHARG2, sections 2.3.1.2 through 2.3.1.4.
}\endgroup\docbooktolatexmakefootnoteref{id2483390} is fully described.

The practical exercises take you on a journey through a drafting office, a charity administration office, and an accounting office. You may choose to apply any or all of these exercises to your own environment.

Every assignment case can be implemented far more creatively, but remember that the solutions you create are designed to demonstrate a particular solution possibility. With experience, you should find much improved solutions compared with those presented here. By the time you complete this book, you should aim to be a Samba expert, so do attempt to find better solutions and try them as you work your way through the examples.

% ------------------------   
% Section 
\section{Assignment Tasks}
\label{id2479870}\hypertarget{id2479870}{}%

Each case presented highlights different aspects of Windows networking for which a simple Samba-based solution can be provided. Each has subtly different requirements taken from real-world cases. The cases are briefly reviewed to cover important points. Instructions are based on the assumption that the official Samba Team RPM package has been installed.

This chapter has three assignments built around fictitious companies:


\begin{itemize}
%--- Item
\item 
A drafting office


%--- Item
\item 
A charity administration office


%--- Item
\item 
An accounting office

\end{itemize}


Let's get started.
\subsection{Drafting Office}
\label{id2499820}\hypertarget{id2499820}{}%

Our fictitious company is called {\em{Abmas Design, Inc.}} This is a three-person computer-aided design (CAD) business that often has more work than can be handled. The business owner hires contract draftspeople from wherever he can. They bring their own notebook computers into the office. There are four permanent drafting machines. Abmas has a collection of over 10 years of plans that must be available for all draftsmen to reference. Abmas hires the services of an experienced network engineer to update the plans that are stored on a central server one day per month. She knows how to upload plans from each machine. The files available from the server must remain read-only. Anyone should be able to access the plans at any time and without barriers or difficulty.

\index{Red Hat} \index{Fedora} Mr. Bob Jordan has asked you to install the new server as economically as possible. The central server has a Pentium-IV 1.6GHz CPU, 768MB RAM, a 20GB IDE boot drive, a 160GB IDE second disk to store plans, and a 100-base-T Ethernet card. You have already installed Red Hat Fedora CoreX and have upgraded Samba to version 3.0.20 using the RPM package that is provided from the Samba FTP\label{id2474511}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.samba.org}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2474511} sites. (Note: Fedora CoreX indicates your favorite version.)

\index{consultant} The four permanent drafting machines (Microsoft Windows workstations) have attached printers and plotters that are shared on a peer-to-peer basis by any and all network users. The intent is to continue to share printers in this manner. The three permanent staff work together with all contractors to store all new work on one PC. A daily copy is made of the work storage area to another PC for safekeeping. When the network consultant arrives, the weekly work area is copied to the central server and the files are removed from the main weekly storage machine. The office works best with this arrangement and does not want to change anything. Old habits are too ingrained.
\subsubsection{Dissection and Discussion}
\label{id2461929}\hypertarget{id2461929}{}%

\index{file server!read-only} The requirements for this server installation demand simplicity. An anonymous read-only file server adequately meets all needs. The network consultant determines how to upload all files from the weekly storage area to the server. This installation should focus only on critical aspects of the installation.

It is not necessary to have specific users on the server. The site has a method for storing all design files (plans). Each plan is stored in a directory that is named YYYYWW,\label{id2499891}\begingroup\catcode`\#=12\footnote{
This information is given purely as an example of how data may be stored in such a way that it will be easy to locate records at a later date. The example is not meant to imply any instructions that may be construed as essential to the design of the solution; this is something you will almost certainly want to determine for yourself.
}\endgroup\docbooktolatexmakefootnoteref{id2499891} where YYYY is the year, and WW is the week of the year. This arrangement allows work to be stored by week of year to preserve the filing technique the site is familiar with. There is also a customer directory that is alphabetically listed. At the top level are 26 directories (A-Z), in each is a second-level of directory for the first plus second letters of the name (A-Z); inside each is a directory by the customers' name. Inside each directory is a symbolic link to each design drawing or plan. This way of storing customer data files permits all plans to be located both by customer name and by the date the work was performed, without demanding the disk space that would be needed if a duplicate file copy were to be stored. The share containing the plans is called {\em{Plans}}.
\subsubsection{Implementation}
\label{id2480135}\hypertarget{id2480135}{}%

It is assumed that the server is fully installed and ready for installation and configuration of Samba 3.0.20 and any support files needed. All TCP/IP addresses have been hard-coded. In our case the IP address of the Samba server is {\texttt{\docbookhyphenatedot{192.168.1.1}}} and the netmask is {\texttt{\docbookhyphenatedot{255.255.255.0}}}. The hostname of the server used is {\texttt{\docbookhyphenatedot{server}}}.
Samba Server Configuration\begin{enumerate}

\item{Download the Samba-3 RPM packages for Red Hat Fedora Core2 from the Samba FTP servers.\label{id2461120}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.samba.org}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2461120}}

\item{\index{RPM!install} \index{package} Install the RPM package using either the Red Hat Linux preferred GUI tool or the {\bfseries{rpm}}: 
\begin{Verbatim}[]

root#  rpm -Uvh samba-3.0.20-1.i386.rpm

\end{Verbatim}
}

\item{Create a mount point for the file system that will be used to store all data files. You can create a directory called {\texttt{\docbookhyphenatefilename{/\dbz{}plans}}}: 
\begin{Verbatim}[]

root#  mkdir /plans
root#  chmod 755 /plans

\end{Verbatim}
 The 755 permissions on this directory (mount point) permit the owner to read, write, and execute, and the group and everyone else to read and execute only.  \index{file system!Ext3} Use Red Hat Linux system tools (refer to Red Hat instructions) to format the 160GB hard drive with a suitable file system. An Ext3 file system is suitable. Configure this drive to automatically mount using the {\texttt{\docbookhyphenatefilename{/\dbz{}plans}}} directory as the mount point.}

\item{Install the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file shown in \hyperlink{draft-smbconf}{Example {\ref{draft-smbconf}}} in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba}}} directory. 
\begin{example}%
\hypertarget{draft-smbconf}{}%
\captionswapskip{}{{\caption{Drafting Office smb.\dbz{}conf File}\label{draft-smbconf}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global Parameters
 [global]
 	workgroup = MIDEARTH
 	security = SHARE
 [Plans]
 	path = /plans
 	read only = Yes
 	guest ok = Yes
\end{lstlisting}
\end{example}

}

\item{\index{/etc/hosts} Verify that the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}} file contains the following entry: 
\begin{Verbatim}[]

192.168.1.1	server

\end{Verbatim}
}

\item{\index{samba!starting samba} \index{chkconfig} \index{starting samba} Use the standard system tool to start Samba and to configure it to restart automatically at every system reboot. For example, 
\begin{Verbatim}[]

root#  chkconfig smb on
root#  /etc/rc.d/init.d/smb restart

\end{Verbatim}
}
\end{enumerate}
Windows Client Configuration\begin{enumerate}

\item{Make certain that all clients are set to the same network address range as used for the Samba server. For example, one client might have an IP address 192.168.1.10.}

\item{\index{netmask} Ensure that the netmask used on the Windows clients matches that used for the Samba server. All clients must have the same netmask, such as 255.255.255.0.}

\item{\index{workgroup} Set the workgroup name on all clients to {\texttt{\docbookhyphenatedot{MIDEARTH}}}.}

\item{Verify on each client that the machine called {\texttt{\docbookhyphenatedot{SERVER}}} is visible in the {\sffamily \bfseries Network Neighborhood}, that it is possible to connect to it and see the share {\sffamily \bfseries Plans}, and that it is possible to open that share to reveal its contents.}
\end{enumerate}
\subsubsection{Validation}
\label{validate1}\hypertarget{validate1}{}%

\index{validation} The first priority in validating the new Samba configuration should be to check that Samba answers on the loop-back interface. Then it is time to check that Samba answers its own name correctly. Last, check that a client can connect to the Samba server.
\begin{enumerate}

\item{\index{smbd} \index{daemon} \index{smbclient} To check the ability to access the {\bfseries{smbd}} daemon services, execute the following: 
\begin{Verbatim}[]

root#  smbclient -L localhost -U%
        Sharename     Type     Comment
        ---------     ----     -------
        Plans         Disk
        IPC$          IPC      IPC Service (Samba 3.0.20)
        ADMIN$        IPC      IPC Service (Samba 3.0.20)

        Server             Comment
        ---------          -------
        SERVER             Samba 3.0.20

        Workgroup          Master
        ---------          --------
        MIDEARTH           SERVER 

\end{Verbatim}
 \index{loopback} \index{NULL connection} This indicates that Samba is able to respond on the loopback interface to a NULL connection. The {\ttfamily\itshape{\docbookhyphenatedot{-U\%}}} means send an empty username and an empty password. This command should be repeated after Samba has been running for 15 minutes.}

\item{Now verify that Samba correctly handles being passed a username and password, and that it answers its own name. Execute the following: 
\begin{Verbatim}[]

root#  smbclient -L server -Uroot%password

\end{Verbatim}
 The output should be identical to the previous response. Samba has been configured to ignore all usernames given; instead it uses the {\ttfamily\itshape{\docbookhyphenatedot{guest account}}} for all connections.}

\item{\index{Windows Explorer} \index{Network Neighborhood} From the Windows 9x/Me client, launch Windows Explorer: {\sffamily \bfseries [Desktop: right-click] Network Neighborhood}+{\sffamily \bfseries Explore} $\to$ {\sffamily \bfseries [Left Panel] [+] Entire Network} $\to$ {\sffamily \bfseries [Left Panel] [+] Server} $\to$ {\sffamily \bfseries [Left Panel] [+] Plans}. In the right panel you should see the files and directories (folders) that are in the {\sffamily \bfseries Plans} share.}
\end{enumerate}
\subsection{Charity Administration Office}
\label{id2501893}\hypertarget{id2501893}{}%

The fictitious charity organization is called {\em{Abmas Vision NL}}. This office has five networked computers. Staff are all volunteers, staff changes are frequent. Ms. Amy May, the director of operations, wants a no-hassle network. Anyone should be able to use any PC. Only two Windows applications are used: a custom funds tracking and management package that stores all files on the central server and Microsoft Word. The office prepares mail-out letters, invitations, and thank-you notes. All files must be stored in perpetuity. The custom funds tracking and management (FTM) software is configured to use a server named {\texttt{\docbookhyphenatedot{SERVER}}}, a share named {\texttt{\docbookhyphenatedot{FTMFILES}}}, and a printer queue named {\texttt{\docbookhyphenatedot{PRINTQ}}} that uses preprinted stationery, thus demanding a dedicated printer. This printer does not need to be mapped to a local printer on the workstations.

The FTM software has been in use since the days of Windows 3.11. The software was configured by the vendor who has since gone out of business. The identities of the file server and the printer are hard-coded in a configuration file that was created using a setup tool that the vendor did not provide to Abmas Vision NL or to its predecessors. The company that produced the software is no longer in business. In order to avoid risk of any incompatibilities, the share name and the name of the target print queue must be set precisely as the application expects. In fact, share names and print queue names should be treated as case insensitive (i.e., case does not matter), but Abmas Vision advises that if the share name is not in lowercase, the application claims it cannot find the file share.

\index{print queue} \index{print spooler} Printer handling in Samba results in a significant level of confusion. Samba presents to the MS Windows client only a print queue. The Samba {\bfseries{smbd}} process passes a print job sent to it from the Windows client to the native UNIX printing system. The native UNIX printing system (spooler) places the job in a print queue from which it is delivered to the printer. In this book, network diagrams refer to a printer by the name of the print queue that services that printer. It does not matter what the fully qualified name (or the hostname) of a network-attached printer is. The UNIX print spooler is configured to correctly deliver all jobs to the printer.

This organization has a policy forbidding use of privately owned computers on site as a measure to prevent leakage of confidential information. Only the five PCs owned by Abmas Vision NL are used on this network.

\index{SUSE Enterprise Linux Server} The central server was donated by a local computer store. It is a dual processor Pentium-III server, has 1GB RAM, a 3-Ware IDE RAID Controller that has four 200GB IDE hard drives, and a 100-base-T network card. The office has 100-base-T permanent network connections that go to a central hub, and all equipment is new. The five network computers all are equipped with Microsoft Windows Me. Funding is limited, so the server has no operating system on it. You have approval to install Samba on Linux, provided it works without problems. There are two HP LaserJet 5 PS printers that are network connected. The second printer is to be used for general office and letter printing. Your recommendation to allow only the Linux server to print directly to the printers was accepted. You have supplied SUSE Enterprise Linux Server 9 and have upgraded Samba to version 3.0.20.
\subsubsection{Dissection and Discussion}
\label{id2502001}\hypertarget{id2502001}{}%

\index{force user} \index{nt acl support} \index{UID} \index{Posix} This installation demands simplicity. Frequent turnover of volunteer staff indicates that a network environment that requires users to logon might be problematic. It is suggested that the best solution for this office would be one where the user can log onto any PC with any username and password. Samba can accommodate an office like this by using the {\ttfamily\itshape{\docbookhyphenatedot{force user}}} parameter in share and printer definitions. Using the {\ttfamily\itshape{\docbookhyphenatedot{force user}}} parameter ensures that all files are owned by same user identifier (UID) and thus that there will never be a problem with file access due to file access permissions. Additionally, you elect to use the {\ttfamily\itshape{\docbookhyphenatedot{nt acl support = No}}} option to ensure that access control lists (Posix type) cannot be written to any file or directory. This prevents an inadvertent ACL from overriding actual file permissions.

\index{SUID} \index{SGID} \index{security!share mode} This organization is a prime candidate for Share Mode security. The {\ttfamily\itshape{\docbookhyphenatedot{force user}}} allows all files to be owned by the same user and group. In addition, it would not hurt to set SUID and set SGID shared directories. This means that all new files that are created, no matter who creates it, are owned by the owner or group of the directory in which they are created. For further information regarding the significance of the SUID/SGID settings, see \hyperlink{appendix}{Chapter {\ref{appendix}}, {``}A Collection of Useful Tidbits{''}}, \hyperlink{ch12-SUIDSGID}{Section {\ref{ch12-SUIDSGID}}}.

\index{CUPS} \index{printing!raw} \index{Red Hat Linux} \index{SUSE Linux} All client workstations print to a print queue on the server. This ensures that print jobs continue to print in the event that a user shuts down the workstation immediately after sending a job to the printer. Today, both Red Hat Linux and SUSE Linux use CUPS-based printing. Older Linux systems offered a choice between the LPRng printing system or CUPS. It appears, however, that CUPS has become the leading UNIX printing technology.

\index{print queue} The print queues are set up as {\texttt{\docbookhyphenatedot{Raw}}} devices, which means that CUPS will not do intelligent print processing, and vendor-supplied drivers must be installed locally on the Windows clients.

The hypothetical software, FTM, is representative of custom-built software that directly uses a NetBIOS interface. Most such software originated in the days of MS/PC DOS. NetBIOS names are uppercase (and functionally are case insensitive), so some old software applications would permit only uppercase names to be entered. Some such applications were later ported to MS Windows but retain the uppercase network resource naming conventions because customers are familiar with that. We made the decision to name shares and print queues for this application in uppercase for the same reason. Nothing would break if we were to use lowercase names, but that decision might create a need to retrain staff ---  something well avoided at this time.

NetBIOS networking does not print directly to a printer. Instead, all printing is done to a print queue. The print spooling system is responsible for communicating with the physical printer. In this example, therefore, the resource called {\texttt{\docbookhyphenatedot{PRINTQ}}} really is just a print queue. The name of the print queue is representative of the device to which the print spooler delivers print jobs.
\subsubsection{Implementation}
\label{id2475500}\hypertarget{id2475500}{}%

It is assumed that the server is fully installed and ready for configuration of Samba 3.0.20 and for necessary support files. All TCP/IP addresses should be hard-coded. In our case, the IP address of the Samba server is 192.168.1.1 and the netmask is 255.255.255.0. The hostname of the server used is {\texttt{\docbookhyphenatedot{server}}}. The office network is built as shown in \hyperlink{charitynet}{Figure {\ref{charitynet}}}.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{charitynet}{}%
\includegraphics[scale=0.8]{Samba3-ByExample/images/Charity-Network}
{{\caption[{Charity Administration Office Network}]{{{Charity Administration Office Network}}}\label{charitynet}}}
\end{center}
\end{figure}

Samba Server Configuration\begin{enumerate}

\item{\index{groupadd} Create a group account for office file storage: 
\begin{Verbatim}[]

root#  groupadd office

\end{Verbatim}
}

\item{\index{useradd} \index{passwd} Create a user account for office file storage: 
\begin{Verbatim}[]

root#  useradd -m abmas 
root#  passwd abmas 
Changing password for abmas.
New password: XXXXXXXX
Re-enter new password: XXXXXXXX
Password changed

\end{Verbatim}
 where XXXXXXXX is a secret password.}

\item{Use the 3-Ware IDE RAID Controller firmware utilities to configure the four 200GB drives as a single RAID level 5 drive, with one drive set aside as the hot spare. (Refer to the 3-Ware RAID Controller Manual for the manufacturer's preferred procedure.) The resulting drive has a capacity of approximately 500GB of usable space.}

\item{\index{permissions} Create a mount point for the file system that can be used to store all data files. Create a directory called {\texttt{\docbookhyphenatefilename{/\dbz{}data}}}: 
\begin{Verbatim}[]

root#  mkdir /data
root#  chmod 755 /data

\end{Verbatim}
 The 755 permissions on this directory (mount point) permit the owner to read, write, and execute, and the group and everyone else to read and execute only.}

\item{Use SUSE Linux system tools (refer to the SUSE Administrators Guide for correct procedures) to format the partition with a suitable file system. The reiserfs file system is suitable. Configure this drive to automount using the {\texttt{\docbookhyphenatefilename{/\dbz{}data}}} directory as the mount point. It must be mounted before proceeding.}

\item{Under the directory called {\texttt{\docbookhyphenatefilename{/\dbz{}data}}}, create two directories named {\texttt{\docbookhyphenatefilename{ftmfiles}}} and {\texttt{\docbookhyphenatefilename{officefiles}}}, and set ownership and permissions: 
\begin{Verbatim}[]

root#  mkdir -p /data/{ftmfiles,officefiles/{letters,invitations,misc}}
root#  chown -R abmas:office /data
root#  chmod -R ug+rwxs,o-w,o+rx /data

\end{Verbatim}
 These demonstrate compound operations. The {\bfseries{mkdir}} command creates in one step these directories: 
\begin{Verbatim}[]

/data/fmtfiles
/data/officefiles
/data/officefiles/letters
/data/officefiles/invitations
/data/officefiles/misc

\end{Verbatim}
 \index{TOSHARG2} The {\bfseries{chown}} operation sets the owner to the user {\texttt{\docbookhyphenatedot{abmas}}} and the group to {\texttt{\docbookhyphenatedot{office}}} on all directories just created. It recursively sets the permissions so that the owner and group have SUID/SGID with read, write, and execute permission, and everyone else has read and execute permission. This means that all files and directories are created with the same owner and group as the directory in which they are created. Any new directories created still have the same owner, group, and permissions as the directory they are in. This should eliminate all permissions-based file access problems. For more information on this subject, refer to TOSHARG2\label{id2494363}\begingroup\catcode`\#=12\footnote{The Official Samba-3 HOWTO and Reference Guide, Chapter 15, File, Directory and Share Access Controls.}\endgroup\docbooktolatexmakefootnoteref{id2494363} or refer to the UNIX man page for the {\bfseries{chmod}} and the {\bfseries{chown}} commands.}

\item{Install the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file shown in \hyperlink{charity-smbconfnew}{Example {\ref{charity-smbconfnew}}} in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba}}} directory. This newer {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file uses user-mode security and is more suited to the mode of operation of Samba-3 than the older share-mode security configuration that was shown in the first edition of this book.  Note: If you want to use the older-style configuration that uses share-mode security, you can install the file shown in \hyperlink{charity-smbconf}{Example {\ref{charity-smbconf}}} in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba}}} directory.}

\item{\index{smbd} We must ensure that the {\bfseries{smbd}} can resolve the name of the Samba server to its IP address. Verify that the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}} file contains the following entry: 
\begin{Verbatim}[]

192.168.1.1	server

\end{Verbatim}
}

\item{Configure the printers with the IP address as shown in \hyperlink{charitynet}{Figure {\ref{charitynet}}}. Follow the instructions in the manufacturer's manual to permit printing to port 9100 so that the CUPS spooler can print using raw mode protocols.}

\item{\index{lpadmin} Configure the CUPS Print Queues: 
\begin{Verbatim}[]

root#  lpadmin -p PRINTQ -v socket://192.168.1.20:9100 -E
root#  lpadmin -p hplj5 -v socket://192.168.1.30:9100 -E

\end{Verbatim}
 This creates the necessary print queues with no assigned print filter.}

\item{\index{mime type} \index{/etc/cups/mime.convs} \index{application/octet-stream} Edit the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}cups/\dbz{}mime.\dbz{}convs}}} to uncomment the line: 
\begin{Verbatim}[]

application/octet-stream     application/vnd.cups-raw      0     -

\end{Verbatim}
}

\item{\index{/etc/cups/mime.types} Edit the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}cups/\dbz{}mime.\dbz{}types}}} to uncomment the line: 
\begin{Verbatim}[]

application/octet-stream

\end{Verbatim}
}

\item{\index{starting samba} Use the standard system tool to start Samba and CUPS to configure them to restart automatically at every system reboot. For example,  \index{starting samba} \index{starting CUPS} \index{chkconfig} 
\begin{Verbatim}[]

root#  chkconfig smb on
root#  chkconfig cups on
root#  /etc/rc.d/init.d/smb restart
root#  /etc/rc.d/init.d/cups restart

\end{Verbatim}
}
\end{enumerate}

\begin{example}%
\hypertarget{charity-smbconfnew}{}%
\captionswapskip{}{{\caption{Charity Administration Office smb.\dbz{}conf New-style File}\label{charity-smbconfnew}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global Parameters - Newer Configuration
 [global]
 	workgroup = MIDEARTH
 	printing = CUPS
 	printcap name = CUPS
 	map to guest = Bad User
 	show add printer wizard = No
 	wins support = yes
 [FTMFILES]
 	comment = Funds Tracking & Management Files
 	path = /data/ftmfiles
 	read only = No
 	force user = abmas
 	force group = office
 	guest ok = Yes
 	nt acl support = No
 [office]
 	comment = General Office Files
 	path = /data/officefiles
 	read only = No
 	force user = abmas
 	force group = office
 	guest ok = Yes
 	nt acl support = No
 [printers]
 	comment = Print Temporary Spool Configuration
 	path = /var/spool/samba
 	printable = Yes
 	guest ok = Yes
 	use client driver = Yes
 	browseable = No
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{charity-smbconf}{}%
\captionswapskip{}{{\caption{Charity Administration Office smb.\dbz{}conf Old-style File}\label{charity-smbconf}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global Parameters - Older Style Configuration
 [global]
 	workgroup = MIDEARTH
 	security = SHARE
 	printing = CUPS
 	printcap name = CUPS
 	disable spoolss = Yes
 	show add printer wizard = No
 	wins support = yes
 [FTMFILES]
 	comment = Funds Tracking & Management Files
 	path = /data/ftmfiles
 	read only = No
 	force user = abmas
 	force group = office
 	guest ok = Yes
 	nt acl support = No
 [office]
 	comment = General Office Files
 	path = /data/officefiles
 	read only = No
 	force user = abmas
 	force group = office
 	guest ok = Yes
 	nt acl support = No
 [printers]
 	comment = Print Temporary Spool Configuration
 	path = /var/spool/samba
 	printable = Yes
 	guest ok = Yes
 	use client driver = Yes
 	browseable = No
\end{lstlisting}
\end{example}

Windows Client Configuration\begin{enumerate}

\item{Configure clients to the network settings shown in \hyperlink{charitynet}{Figure {\ref{charitynet}}}.}

\item{Ensure that the netmask used on the Windows clients matches that used for the Samba server. All clients must have the same netmask, such as {\texttt{\docbookhyphenatedot{255.255.255.0}}}.}

\item{\index{WINS} On all Windows clients, set the WINS Server address to {\texttt{\docbookhyphenatedot{192.168.1.1}}}, the IP address of the server.}

\item{Set the workgroup name on all clients to {\texttt{\docbookhyphenatedot{MIDEARTH}}}.}

\item{\index{!logon} Install the {``}Client for Microsoft Networks.{''} Ensure that the only option enabled in its properties is the option {``}Logon and restore network connections.{''}}

\item{Click {\sffamily \bfseries OK} when you are prompted to reboot the system. Reboot the system, then log on using any username and password you choose.}

\item{\index{My Network Places} Verify on each client that the machine called {\texttt{\docbookhyphenatedot{SERVER}}} is visible in {\sffamily \bfseries My Network Places}, that it is possible to connect to it and see the share {\sffamily \bfseries office}, and that it is possible to open that share to reveal its contents.}

\item{\index{password caching} \index{regedit} Disable password caching on all Windows 9x/Me machines using the registry change file shown in \hyperlink{MEreg}{Example {\ref{MEreg}}}. Be sure to remove all files that have the {\texttt{\docbookhyphenatefilename{PWL}}} extension that are in the {\texttt{\docbookhyphenatefilename{C:\docbooktolatexgobble\string\\WINDOWS}}} directory. 
\begin{example}%
\hypertarget{MEreg}{}%
\captionswapskip{}{{\caption{Windows Me ---  Registry Edit File: Disable Password Caching}\label{MEreg}}}
\captionswapskip{}
\begin{Verbatim}[]

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
	Windows\CurrentVersion\Policies\Network]
	"DisablePwdCaching"=dword:00000001

\end{Verbatim}
\end{example}

 The best way to apply this change is to save the patch in a file called {\texttt{\docbookhyphenatefilename{ME-\dbz{}dpwc.\dbz{}reg}}} and then execute: 
\begin{Verbatim}[]

C:\WINDOWS: regedit ME-dpwc.reg

\end{Verbatim}
}

\item{Instruct all users to log onto the workstation using a name and password of their own choosing. The Samba server has been configured to ignore the username and password given.}

\item{On each Windows Me workstation, configure a network drive mapping to drive {\texttt{\docbookhyphenatefilename{G:}}} that redirects to the uniform naming convention (UNC) resource {\texttt{\docbookhyphenatefilename{\docbooktolatexgobble\string\\\docbooktolatexgobble\string\\server\docbooktolatexgobble\string\\office}}}. Make this a permanent drive connection: \begin{enumerate}

\item{{\sffamily \bfseries My Network} $\to$ {\sffamily \bfseries Map Network Drive...}}

\item{In the box labeled {``}Drive:{''}, type G.}

\item{In the box labeled {``}Path:{''}, enter {\texttt{\docbookhyphenatefilename{\docbooktolatexgobble\string\\\docbooktolatexgobble\string\\server\docbooktolatexgobble\string\\officefiles}}}.}

\item{Click {\sffamily \bfseries Reconnect at logon}. Click {\sffamily \bfseries OK}.}
\end{enumerate}
}

\item{On each workstation, install the FTM software following the manufacturer's instructions. \begin{enumerate}

\item{During installation, you are prompted for the name of the Windows 98 server. Enter the name {\texttt{\docbookhyphenatedot{SERVER}}}.}

\item{You are prompted for the name of the data share. The prompt defaults to {\texttt{\docbookhyphenatedot{FTMFILES}}}. Press enter to accept the default value.}

\item{You are now prompted for the print queue name. The default prompt is the name of the server you entered ({\texttt{\docbookhyphenatedot{SERVER}}} as follows: {\texttt{\docbookhyphenatedot{\textbackslash \textbackslash SERVER\textbackslash PRINTQ}}}). Simply accept the default and press enter to continue. The software now completes the installation.}
\end{enumerate}
}

\item{Install an office automation software package of the customer's choice. Either Microsoft Office 2003 Standard or OpenOffice 1.1.0 suffices for any functions the office may need to perform. Repeat this on each workstation.}

\item{Install a printer on each workstation using the following steps: \begin{enumerate}

\item{Click {\sffamily \bfseries Start} $\to$ {\sffamily \bfseries Settings} $\to$ {\sffamily \bfseries Printers}+{\sffamily \bfseries Add Printer}+{\sffamily \bfseries Next}. Do not click {\sffamily \bfseries Network printer}. Ensure that {\sffamily \bfseries Local printer} is selected.}

\item{Click {\sffamily \bfseries Next}. In the Manufacturer: panel, select {\texttt{\docbookhyphenatedot{HP}}}. In the Printers: panel, select the printer called {\texttt{\docbookhyphenatedot{HP LaserJet 5/5M Postscript}}}. Click {\sffamily \bfseries Next}.}

\item{In the Available ports: panel, select {\texttt{\docbookhyphenatedot{FILE:}}}. Accept the default printer name by clicking {\sffamily \bfseries Next}. When asked, {``}Would you like to print a test page?{''}, click {\sffamily \bfseries No}. Click {\sffamily \bfseries Finish}.}

\item{You may be prompted for the name of a file to print to. If so, close the dialog panel. Right-click {\sffamily \bfseries HP LaserJet 5/5M Postscript} $\to$ {\sffamily \bfseries Properties} $\to$ {\sffamily \bfseries Details (Tab)} $\to$ {\sffamily \bfseries Add Port}.}

\item{In the Network panel, enter the name of the print queue on the Samba server as follows: {\texttt{\docbookhyphenatedot{\textbackslash \textbackslash SERVER\textbackslash hplj5}}}. Click {\sffamily \bfseries OK}+{\sffamily \bfseries OK} to complete the installation.}

\item{It is a good idea to test the functionality of the complete installation before handing the newly configured network over to the Charity Administration Office for production use.}
\end{enumerate}
}
\end{enumerate}
\subsubsection{Validation}
\label{id2495666}\hypertarget{id2495666}{}%

Use the same validation process as was followed in \hyperlink{validate1}{Section {\ref{validate1}}}.
\subsection{Accounting Office}
\label{AccountingOffice}\hypertarget{AccountingOffice}{}%

Abmas Accounting is a 40-year-old family-run business. There are nine permanent computer users. The network clients were upgraded two years ago. All computers run Windows 2000 Professional. This year the server will be upgraded from an old Windows NT4 server (actually running Windows NT4 Workstation, which worked fine for fewer than 10 users) that has run in workgroup (standalone) mode, to a new Linux server running Samba.

The office does not want a Domain Server. Mr. Alan Meany wants to keep the Windows 2000 Professional clients running as workgroup machines so that any staff member can take a machine home and keep working. It has worked well so far, and your task is to replace the old server. All users have their own workstation logon (you configured it that way when the machines were installed). Mr. Meany wants the new system to operate the same way as the old Windows NT4 server ---  users cannot access each others' files, but he can access everyone's files. Each person's work files are in a separate share on the server. Users log on to their Windows workstation with their username and enter an assigned password; they do not need to enter a password when accessing their files on the server.

\index{Red Hat Linux} The new server will run Red Hat Fedora Core2. You should install Samba-3.0.20 and copy all files from the old system to the new one. The existing Windows NT4 server has a parallel port HP LaserJet 4 printer that is shared by all. The printer driver is installed on each workstation. You must not change anything on the workstations. Mr. Meany gave instructions to replace the server, {``}but leave everything else alone to avoid staff unrest.{''}

You have tried to educate Mr. Meany and found that he has no desire to understand networking. He believes that Windows for Workgroups 3.11 was {``}the best server Microsoft ever sold{''} and that Windows NT and 2000 are {``}too fang-dangled complex!{''}
\subsubsection{Dissection and Discussion}
\label{id2495759}\hypertarget{id2495759}{}%

\index{security!user mode} The requirements of this network installation are not unusual. The staff are not interested in the details of networking. Passwords are never changed. In this example solution, we demonstrate the use of User Mode security in a simple context. Directories should be set SGID to ensure that members of a common group can access the contents. Each user has his or her own share to which only they can connect. Mr. Meany's share will be a top-level directory above the share point for each employee. Mr. Meany is a member of the same group as his staff and can access their work files. The well-used HP LaserJet 4 is available as a service called {\texttt{\docbookhyphenatedot{hplj}}}.

You have finished configuring the new hardware and have just completed installation of Red Hat Fedora Core2. Roll up your sleeves and let's get to work.
\subsubsection{Implementation}
\label{AcctgNet}\hypertarget{AcctgNet}{}%

The workstations have fixed IP addresses. The old server runs Windows NT4 Workstation, so it cannot be running as a WINS server. It is best that the new configuration preserves the same configuration. The office does not use Internet access, so security really is not an issue.

The core information regarding the users, their passwords, the directory share point, and the share name is given in \hyperlink{acctingnet}{Table {\ref{acctingnet}}}. The overall network topology is shown in \hyperlink{acctingnet2}{Figure {\ref{acctingnet2}}}. All machines have been configured as indicated prior to the start of Samba configuration. The following prescriptive steps may now commence.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{acctingnet2}{}%
\includegraphics[scale=0.85]{Samba3-ByExample/images/AccountingNetwork}
{{\caption[{Accounting Office Network Topology}]{{{Accounting Office Network Topology}}}\label{acctingnet2}}}
\end{center}
\end{figure}


% table ------------------------------------------------------
\begin{table}[htb]
\begin{center}%
\hypertarget{acctingnet}{}%
\captionswapskip{}{{\caption{Accounting Office Network Information}\label{acctingnet}}}
\captionswapskip{}\begin{tabular}{|l|l|l|l|l|l|}
\hline 
{{{\bfseries User}}} & {{{\bfseries Login-ID}}} & {{{\bfseries Password}}} & {{{\bfseries Share Name}}} & {{{\bfseries Directory}}} & {{{\bfseries Wkst}}} \tabularnewline
 \hline 
{{Alan Meany}} & {{alan}} & {{alm1961}} & {{alan}} & {{/data}} & {{PC1}} \tabularnewline
 \hline 
{{James Meany}} & {{james}} & {{jimm1962}} & {{james}} & {{/data/james}} & {{PC2}} \tabularnewline
 \hline 
{{Jeannie Meany}} & {{jeannie}} & {{jema1965}} & {{jeannie}} & {{/data/jeannie}} & {{PC3}} \tabularnewline
 \hline 
{{Suzy Millicent}} & {{suzy}} & {{suzy1967}} & {{suzy}} & {{/data/suzy}} & {{PC4}} \tabularnewline
 \hline 
{{Ursula Jenning}} & {{ujen}} & {{ujen1974}} & {{ursula}} & {{/data/ursula}} & {{PC5}} \tabularnewline
 \hline 
{{Peter Pan}} & {{peter}} & {{pete1984}} & {{peter}} & {{/data/peter}} & {{PC6}} \tabularnewline
 \hline 
{{Dale Roland}} & {{dale}} & {{dale1986}} & {{dale}} & {{/data/dale}} & {{PC7}} \tabularnewline
 \hline 
{{Bertrand E Paoletti}} & {{eric}} & {{eric1993}} & {{eric}} & {{/data/eric}} & {{PC8}} \tabularnewline
 \hline 
{{Russell Lewis}} & {{russ}} & {{russ2001}} & {{russell}} & {{/data/russell}} & {{PC9}} \tabularnewline
\hline 
\end{tabular}
\end{center}
\end{table}

Migration from Windows NT4 Workstation System to Samba-3\begin{enumerate}

\item{\index{migration} Rename the old server from {\texttt{\docbookhyphenatedot{CASHPOOL}}} to {\texttt{\docbookhyphenatedot{STABLE}}} by logging onto the console as the {\texttt{\docbookhyphenatedot{Administrator}}}. Restart the machine following system prompts.}

\item{Name the new server {\texttt{\docbookhyphenatedot{CASHPOOL}}} using the standard configuration method. Restart the machine following system prompts.}

\item{Install the latest Samba-3 binary Red Hat Linux RPM that is available from the Samba FTP site.}

\item{\index{group account} \index{groupadd} Add a group account for the office to use. Execute the following: 
\begin{Verbatim}[]

root#  groupadd accts

\end{Verbatim}
}

\item{Install the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file shown\label{id2496272}\begingroup\catcode`\#=12\footnote{
This example uses the {\ttfamily\itshape{\docbookhyphenatedot{smbpasswd}}} file in an obtuse way, since the use of the {\ttfamily\itshape{\docbookhyphenatedot{passdb backend}}} has not been specified in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file. This means that you are depending on correct default behavior.
}\endgroup\docbooktolatexmakefootnoteref{id2496272} in \hyperlink{acctconf}{Example {\ref{acctconf}}}.}

\item{\index{useradd} \index{passwd} \index{smbpasswd} For each user who uses this system (see \hyperlink{acctingnet}{Table {\ref{acctingnet}}}), execute the following: 
\begin{Verbatim}[]

root#  useradd -m -G accts -c "Name of User" "LoginID"
root#  passwd "LoginID"
Changing password for user "LoginID"
New Password: XXXXXXXXX	<-- the password from the table
Retype new password: XXXXXXXXX
root#  smbpasswd -a "LoginID"
New SMB password: XXXXXXXXX <-- the password from the table
Retype new SMB password: XXXXXXXXX
Added user "LoginID"

\end{Verbatim}
}

\item{\index{data storage} Create the directory structure for the file shares by executing the following: 
\begin{Verbatim}[]

root#  mkdir -p /data
root#  chown alan /data
root#  for i in james suzy ujen peter dale eric jeannie russ
> do
> 	mkdir -p /data/$i
> 	chown $i /data/$i
> done
root#  chgrp -R accts /data
root#  chmod -R ug+rwxs,o-r+x /data

\end{Verbatim}
 The data storage structure is now prepared for use.}

\item{\index{lpadmin} Configure the CUPS Print Queues: 
\begin{Verbatim}[]

root#  lpadmin -p hplj -v parallel:/dev/lp0 -E

\end{Verbatim}
 This creates the necessary print queues with no assigned print filter.}

\item{\index{mime types} \index{/etc/cups/mime.convs} Edit the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}cups/\dbz{}mime.\dbz{}convs}}} to uncomment the line: 
\begin{Verbatim}[]

application/octet-stream     application/vnd.cups-raw      0     -

\end{Verbatim}
}

\item{\index{/etc/cups/mime.types} \index{application/octet-stream} Edit the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}cups/\dbz{}mime.\dbz{}types}}} to uncomment the line: 
\begin{Verbatim}[]

application/octet-stream

\end{Verbatim}
}

\item{\index{starting samba} Use the standard system tool to start Samba and CUPS to configure them to restart automatically at every system reboot. For example,  \index{starting samba} \index{startingCUPS} \index{chkconfig} 
\begin{Verbatim}[]

root#  chkconfig smb on
root#  chkconfig cups on
root#  /etc/rc.d/init.d/smb restart
root#  /etc/rc.d/init.d/cups restart

\end{Verbatim}
}

\item{On Alan's workstation, use Windows Explorer to migrate the files from the old server to the new server. The new server should appear in the {\sffamily \bfseries Network Neighborhood} with the name of the old server ({\texttt{\docbookhyphenatedot{CASHPOOL}}}). \begin{enumerate}

\item{Log on to Alan's workstation as the user {\texttt{\docbookhyphenatedot{alan}}}.}

\item{Launch a second instance of Windows Explorer and navigate to the share called {\sffamily \bfseries files} on the server called {\sffamily \bfseries STABLE}.}

\item{Click in the right panel, and press {\sffamily \bfseries Ctrl-A} to select all files and directories. Press {\sffamily \bfseries Ctrl-C} to instruct Windows that you wish to copy all selected items.}

\item{Launch the Windows Explorer, and navigate to the share called {\sffamily \bfseries files} on the server called {\sffamily \bfseries CASHPOOL}. Click in the right panel, and then press {\sffamily \bfseries Ctrl-V} to commence the copying process.}
\end{enumerate}
}

\item{Verify that the files are being copied correctly from the Windows NT4 machine to the Samba-3 server. This is best done on the Samba-3 server. Check the contents of the directory tree under {\texttt{\docbookhyphenatefilename{/\dbz{}data}}} by executing the following command: 
\begin{Verbatim}[]

root#  ls -aR /data

\end{Verbatim}
 Make certain to check the ownership and permissions on all files. If in doubt, execute the following: 
\begin{Verbatim}[]

root#  chown alan /data
root#  for i in james suzy ujen peter dale eric jeannie russ
> do
> 	chown $i /data/$i
> done
root#  chgrp -R accts /data
root#  chmod -R ug+rwxs,o-r+x /data

\end{Verbatim}
}

\item{The migration of all data should now be complete. It is time to validate the installation. For this, you should make sure all applications, including printing, work before asking the customer to test drive the new network.}
\end{enumerate}

\begin{example}%
\hypertarget{acctconf}{}%
\captionswapskip{}{{\caption{Accounting Office Network smb.\dbz{}conf Old Style Configuration File}\label{acctconf}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	workgroup = BILLMORE
 	printcap name = CUPS
 	disable spoolss = Yes
 	show add printer wizard = No
 	printing = cups
 [files]
 	comment = Work area files
 	path = /data/%U
 	read only = No
 [master]
 	comment = Master work area files
 	path = /data
 	valid users = alan
 	read only = No
 [printers]
 	comment = Print Temporary Spool Configuration
 	path = /var/spool/samba
 	printable = Yes
 	guest ok = Yes
 	use client driver = Yes
 	browseable = No
\end{lstlisting}
\end{example}


% ------------------------   
% Section 
\section{Questions and Answers}
\label{id2513063}\hypertarget{id2513063}{}%

The following questions and answers draw from the examples in this chapter. Many design decisions are impacted by the configurations chosen. The intent is to expose some of the hidden implications.
% -------------------------------------------------------------
% QandASet                                                     
% -------------------------------------------------------------
\subsection*{F.A.Q.}
\label{id2513076}
\vspace{1em}
\noindent{}1.~\textbf{Q:}~\textit{What makes an anonymous Samba server more simple than a non-anonymous Samba server?}
\newline
\noindent\textbf{A:}~
In the anonymous server, the only account used is the {\texttt{\docbookhyphenatedot{guest}}} account. In a non-anonymous configuration, it is necessary to add real user accounts to both the UNIX system and to the Samba configuration. Non-anonymous servers require additional administration.


\vspace{1em}
\vspace{1em}
\noindent{}2.~\textbf{Q:}~\textit{How is the operation of the parameter {\ttfamily\itshape{\docbookhyphenatedot{force user}}} different from setting the root directory of the share SUID?}
\newline
\noindent\textbf{A:}~
The parameter {\ttfamily\itshape{\docbookhyphenatedot{force user}}} causes all operations on the share to assume the UID of the forced user. The new default GID that applies is the primary GID of the forced user. This gives all users of this resource the actual privilege of the forced user.

When a directory is set SUID, the operating system forces files that are written within it to be owned by the owner of the directory. While this happens, the user who is using the share has only the level of privilege he or she is assigned within the operating system context.

The parameter {\ttfamily\itshape{\docbookhyphenatedot{force user}}} has potential security implications that go beyond the actual share root directory. Be careful and wary of using this parameter.


\vspace{1em}
\vspace{1em}
\noindent{}3.~\textbf{Q:}~\textit{When would you both use the per share parameter {\ttfamily\itshape{\docbookhyphenatedot{force user}}} and set the share root directory SUID?}
\newline
\noindent\textbf{A:}~
You would use both parameters when it is necessary to guarantee that all share handling operations are conducted as the forced user, while all file and directory creation are done as the SUID directory owner.


\vspace{1em}
\vspace{1em}
\noindent{}4.~\textbf{Q:}~\textit{What is better about CUPS printing than LPRng printing?}
\newline
\noindent\textbf{A:}~
CUPS is a print spooling system that has integrated remote management facilities, provides completely automated print processing/preprocessing, and can be configured to automatically apply print preprocessing filters to ensure that a print job submitted is correctly rendered for the target printer. CUPS includes an image file RIP that supports printing of image files to non-PostScript printers. CUPS has lots of bells and whistles and is more like a supercharged MS Windows NT/200x print monitor and processor. Its complexity can be eliminated or turbocharged to suit any fancy.

The LPRng software is an enhanced, extended, and portable implementation of the Berkeley LPR print spooler functionality. It provides the same interface and meets RFC1179 requirements. LPRng can be configured to act like CUPS, but it is in principle a replacement for the old Berkeley lpr/lpd spooler. LPRng is generally preferred by those who are familiar with Berkeley lpr/lpd.

Which spooling system is better is a matter of personal taste. It depends on what you want to do and how you want to do it and manage it. Most modern Linux systems ship with CUPS as the default print management system.


\vspace{1em}
\vspace{1em}
\noindent{}5.~\textbf{Q:}~\textit{When should Windows client IP addresses be hard-coded?}
\newline
\noindent\textbf{A:}~
When there are few MS Windows clients, little client change, no mobile users, and users are not inclined to tamper with network settings, it is a safe and convenient matter to hard-code Windows client TCP/IP settings. Given that it is possible to lock down the Windows desktop and remove user ability to access network configuration controls, fixed configuration eliminates the need for a DHCP server. This reduces maintenance overheads and eliminates a possible point of network failure.


\vspace{1em}
\vspace{1em}
\noindent{}6.~\textbf{Q:}~\textit{Under what circumstances is it best to use a DHCP server?}
\newline
\noindent\textbf{A:}~
In network configurations where there are mobile users, or where Windows client PCs move around (particularly between offices or between subnets), it makes complete sense to control all Windows client configurations using a DHCP server. Additionally, when users do tamper with the network settings, DHCP can be used to normalize all client settings.

One underappreciated benefit of using a DHCP server to assign all network client device TCP/IP settings is that it makes it a pain-free process to change network TCP/IP settings, change network addressing, or enhance the ability of client devices to benefit from new network services.

Another benefit of modern DHCP servers is their ability to register dynamically assigned IP addresses with the DNS server. The benefits of Dynamic DNS (DDNS) are considerable in a large Windows network environment.


\vspace{1em}
\vspace{1em}
\noindent{}7.~\textbf{Q:}~\textit{What is the purpose of setting the parameter {\ttfamily\itshape{\docbookhyphenatedot{guest ok}}} on a share?}
\newline
\noindent\textbf{A:}~
If this parameter is set to yes for a service, then no password is required to connect to the service. Privileges are those of the guest account.


\vspace{1em}
\vspace{1em}
\noindent{}8.~\textbf{Q:}~\textit{When would you set the global parameter {\ttfamily\itshape{\docbookhyphenatedot{disable spoolss}}}?}
\newline
\noindent\textbf{A:}~
Setting this parameter to {\texttt{\docbookhyphenatedot{Yes}}} disables Samba's support for the SPOOLSS set of MS-RPCs and yields behavior identical to Samba 2.0.x. Windows NT/2000 clients can downgrade to using LanMan style printing commands. Windows 9x/Me are unaffected by the parameter. However, this disables the ability to upload printer drivers to a Samba server via the Windows NT/200x Add Printer Wizard or by using the NT printer properties dialog window. It also disables the capability of Windows NT/200x clients to download print drivers from the Samba host on demand. Be extremely careful about setting this parameter.

The alternate parameter {\ttfamily\itshape{\docbookhyphenatedot{use client driver}}} applies only to Windows NT/200x clients. It has no effect on Windows 95/98/Me clients. When serving a printer to Windows NT/200x clients without first installing a valid printer driver on the Samba host, the client is required to install a local printer driver. From this point on, the client treats the printer as a local printer and not a network printer connection. This is much the same behavior that occurs when {\ttfamily\itshape{\docbookhyphenatedot{disable spoolss = yes}}}.

Under normal circumstances, the NT/200x client attempts to open the network printer using MS-RPC. Because the client considers the printer to be local, it attempts to issue the {\ttfamily\itshape{\docbookhyphenatedot{OpenPrinterEx()}}} call requesting access rights associated with the logged on user. If the user possesses local administrator rights but not root privilege on the Samba host (often the case), the {\ttfamily\itshape{\docbookhyphenatedot{OpenPrinterEx()}}} call fails. The result is that the client now displays an {``}Access Denied; Unable to connect{''} message in the printer queue window (even though jobs may be printed successfully). This parameter MUST not be enabled on a print share that has a valid print driver installed on the Samba server.


\vspace{1em}
\vspace{1em}
\noindent{}9.~\textbf{Q:}~\textit{Why would you disable password caching on Windows 9x/Me clients?}
\newline
\noindent\textbf{A:}~
Windows 9x/Me workstations that are set at default (password caching enabled) store the username and password in files located in the Windows master directory. Such files can be scavenged (read off a client machine) and decrypted, thus revealing the user's access credentials for all systems the user may have accessed. It is most insecure to allow any Windows 9x/Me client to operate with password caching enabled.


\vspace{1em}
\vspace{1em}
\noindent{}10.~\textbf{Q:}~\textit{The example of Abmas Accounting uses User Mode security. How does this provide anonymous access?}
\newline
\noindent\textbf{A:}~
The example used does not provide anonymous access. Since the clients are all Windows 2000 Professional, and given that users are logging onto their machines, by default the client attempts to connect to a remote server using currently logged in user credentials. By ensuring that the user's login ID and password are the same as those set on the Samba server, access is transparent and does not require separate user authentication.


\vspace{1em}
\cleardoublepage 
% -------------------------------------------------------------
% Chapter Small Office Networking 
% ------------------------------------------------------------- 	
\chapter{Small Office Networking}
\label{small}\hypertarget{small}{}%

\hyperlink{simple}{Chapter {\ref{simple}}, {``}No-Frills Samba Servers{''}} focused on the basics of simple yet effective network solutions. Network administrators who take pride in their work (that's most of us, right?) take care to deliver what our users want, but not too much more. If we make things too complex, we confound our users and increase costs of network ownership. A professional network manager avoids the temptation to put too much pizazz into the way that the network operates. Some creativity is helpful, but keep it under control ---  good advice that the following two scenarios illustrate.

\index{Netware} In one case the network administrator of a mid-sized company spent three months building a new network to replace an old Netware server. What he delivered had all the bells and whistles he could muster. There were a few teething problems during the changeover, nothing serious but a little disruptive all the same. Users were exposed to many changes at once. The network administrator was asked to resign two months after implementing the new system because so many staff complained they had lost time and were not happy with the new network. Everything was automated, and he delivered more features than any advanced user could think of. He was just too smart for his own good.

In the case of the other company, a new network manager was appointed to oversee the replacement of a LanTastic network with an MS Windows NT 4.0 network. He had the replacement installed and operational within two weeks. Before installation and changeover, he called a meeting to explain to all users what was going to happen, how it would affect them, and that he would be available 24 hours a day to help them transition. One week after conversion, he held another meeting asking for cooperation in the introduction of a few new features that would help to make life easier. Network users were thrilled with the help he provided. The network he implemented was nowhere near as complex as in the first example, had fewer features, and yet he had happy users. Months later he was still adding new innovations. He always asked the users if a particular feature was what they wanted. He asked his boss for a raise and got it. He often told me, {``}Always keep a few new tricks up your sleeves for when you need them.{''} Was he smart? You decide. Let's get on with our next exercise.

% ------------------------   
% Section 
\section{Introduction}
\label{id2472592}\hypertarget{id2472592}{}%

Abmas Accounting has grown. Mr. Meany likes you and says he knew you were the right person for the job. That's why he asked you to install the new server. The past few months have been hard work. You advised Mr. Meany that it is time for a change. Abmas now has 52 users, having acquired an investment consulting business recently. The new users were added to the network without any problems.

Some of the Windows clients are nearly past their use-by date. You found damaged and unusable software on some of the workstations that came with the acquired business and found some machines in need of both hardware and software maintenance.
\subsection{Assignment Tasks}
\label{id2466266}\hypertarget{id2466266}{}%

\index{Windows XP} Mr. Meany is retiring in 12 months. Before he goes, he wants you to help ensure that the business is running efficiently. Many of the new staff want notebook computers. They visit customer business premises and need to use local network facilities; these users are technically competent. The company uses a business application that requires Windows XP Professional. In short, a complete client upgrade is about to happen. Mr. Meany told you that he is working on another business acquisition and that by the time he retires there will be 80 to 100 users.

Mr. Meany is not concerned about security. He wants to make it easier for staff to do their work. He has hired you to help him appoint a full-time network manager before he retires. Above all, he says he is investing in the ability to grow. He is determined to live his lifelong dream and hand the business over to a bright and capable executive who can make things happen. This means your network design must cope well with growth.

In a few months, Abmas will require an Internet connection for email and so that staff can easily obtain software updates. Mr. Meany is warming up to the installation of antivirus software but is not yet ready to approve this expense. He told you to spend the money a virus scanner costs on better quality notebook computers for mobile users.

One of Mr. Meany's golfing partners convinced him to buy new laser printers, one black only, the other a color laser printer. Staff support the need for a color printer so they can present more attractive proposals and reports.

Mr. Meany also asked if it would be possible for one of the staff to manage user accounts from the Windows desktop. That person will be responsible for basic operations.

% ------------------------   
% Section 
\section{Dissection and Discussion}
\label{id2478800}\hypertarget{id2478800}{}%

What are the key requirements in this business example? A quick review indicates a need for

\begin{itemize}
%--- Item
\item 
Scalability, from 52 to over 100 users in 12 months


%--- Item
\item 
Mobile computing capability \index{mobile computing}


%--- Item
\item 
Improved reliability and usability


%--- Item
\item 
Easier administration

\end{itemize}

In this instance the installed Linux system is assumed to be a Red Hat Linux Fedora Core2 server (as in \hyperlink{AccountingOffice}{Section {\ref{AccountingOffice}}}).
\subsection{Technical Issues}
\label{id2473224}\hypertarget{id2473224}{}%

\index{smbpasswd} \index{DHCP} \index{DNS} \index{WINS} \index{Domain} It is time to implement a domain security environment. You will use the {\texttt{\docbookhyphenatedot{smbpasswd}}} (default) backend. You should implement a DHCP server. There is no need to run DNS at this time, but the system will use WINS. The domain name will be {\texttt{\docbookhyphenatedot{BILLMORE}}}. This time, the name of the server will be {\texttt{\docbookhyphenatedot{SLEETH}}}.

All printers will be configured as DHCP clients. The DHCP server will assign the printer a fixed IP address by way of its Ethernet interface (MAC) address. See \hyperlink{dhcp01}{Example {\ref{dhcp01}}}.

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

The {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file you are creating in this exercise can be used with equal effectiveness with Samba-2.2.x series releases. This is deliberate so that in the next chapter it is possible to start with the installation that you have created here, migrate it to a Samba-3 configuration, and then secure the system further. Configurations following this one utilize features that may not be supported in Samba-2.2.x releases. However, you should note that the examples in each chapter start with the assumption that a fresh new installation is being effected.
\end{admonition}


Later on, when the Internet connection is implemented, you will add DNS as well as other enhancements. It is important that you plan accordingly.

\index{Ethernet switch} You have split the network into two separate areas. Each has its own Ethernet switch. There are 20 users on the accounting network and 32 users on the financial services network. The server has two network interfaces, one serving each network. The network printers will be located in a central area. You plan to install the new printers and keep the old printer in use also.

You will provide separate file storage areas for each business entity. The old system will go away, accounting files will be handled under a single directory, and files will be stored under customer name, not under a personal work area. Staff will be made responsible for file location, so the old share point must be maintained.

Given that DNS will not be used, you will configure WINS name resolution for UNIX hostname name resolution.

\index{Domain!groups} \index{UNIX!groups} It is necessary to map Windows Domain Groups to UNIX groups. It is advisable to also map Windows Local Groups to UNIX groups. Additionally, the two key staff groups in the firm are accounting staff and financial services staff. For these, it is necessary to create UNIX groups as well as Windows Domain Groups.

In the sample {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file, you have configured Samba to call the UNIX {\bfseries{groupadd}} to add group entries. This utility does not permit the addition of group names that contain uppercase characters or spaces. This is considered a bug. The {\bfseries{groupadd}} is part of the {\bfseries{shadow-utils}} open source software package. A later release of this package may have been patched to resolve this bug. If your operating platform has this bug, it means that attempts to add a Windows Domain Group that has either a space or uppercase characters in it will fail. See {\em{TOSHARG2}}, Chapter 11, Section 11.3.1, Example 11.1, for more information.

\index{CUPS} Vendor-supplied printer drivers will be installed on each client. The CUPS print spooler on the UNIX host will be operated in {\texttt{\docbookhyphenatedot{raw}}} mode.
\subsection{Political Issues}
\label{id2487531}\hypertarget{id2487531}{}%

Mr. Meany is an old-school manager. He sets the rules and wants to see compliance. He is willing to spend money on things he believes are of value. You need more time to convince him of real priorities.

Go ahead, buy better notebooks. Wouldn't it be neat if they happened to be supplied with antivirus software? Above all, demonstrate good purchase value and remember to make your users happy.

% ------------------------   
% Section 
\section{Implementation}
\label{id2487554}\hypertarget{id2487554}{}%

\index{migration} In this example, the assumption is made that this server is being configured from a clean start. The alternate approach could be to demonstrate the migration of the system that is documented in \hyperlink{AcctgNet}{Section {\ref{AcctgNet}}} to meet the new requirements. The decision to treat this case, as with future examples, as a new installation is based on the premise that you can determine the migration steps from the information provided in \hyperlink{ntmigration}{Chapter {\ref{ntmigration}}, {``}Migrating NT4 Domain to Samba-3{''}}. Additionally, a fresh installation makes the example easier to follow.

\index{group membership} Each user will be given a home directory on the UNIX system, which will be available as a private share. Two additional shares will be created, one for the accounting department and the other for the financial services department. Network users will be given access to these shares by way of group membership.

\index{UNIX!groups} UNIX group membership is the primary mechanism by which Windows Domain users will be granted rights and privileges within the Windows environment.

\index{sticky bit} The user {\bfseries{alanm}} will be made the owner of all files. This will be preserved by setting the sticky bit (set UID/GID) on the top-level directories.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{acct2net}{}%
\includegraphics[scale=1]{Samba3-ByExample/images/acct2net}
{{\caption[{Abmas Accounting ---  52-User Network Topology}]{{{Abmas Accounting ---  52-User Network Topology}}}\label{acct2net}}}
\end{center}
\end{figure}

Server Installation Steps\begin{enumerate}

\item{Using UNIX/Linux system tools, name the server {\texttt{\docbookhyphenatedot{sleeth}}}.}

\item{\index{/etc/hosts} Place an entry for the machine {\texttt{\docbookhyphenatedot{sleeth}}} in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}}. The printers are network attached, so there should be entries for the network printers also. An example {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}} file is shown here: 
\begin{Verbatim}[]

192.168.1.1     sleeth sleeth1
192.168.2.1     sleeth2
192.168.1.10    hplj6
192.168.1.11    hplj4
192.168.2.10    qms

\end{Verbatim}
}

\item{Install the Samba-3 binary RPM from the Samba-Team FTP site.}

\item{Install the ISC DHCP server using the UNIX/Linux system tools available to you.}

\item{\index{/etc/rc.d/rc.local} \index{IP forwarding} \index{router} \index{/proc/sys/net/ipv4/ip\_forward} Because Samba will be operating over two network interfaces and clients on each side may want to be able to reach clients on the other side, it is imperative that IP forwarding is enabled. Use the system tool of your choice to enable IP forwarding. In the absence of such a tool on the Linux system, add to the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}rc.\dbz{}d/\dbz{}rc.\dbz{}local}}} file an entry as follows: 
\begin{Verbatim}[]

echo 1 > /proc/sys/net/ipv4/ip_forward

\end{Verbatim}
 This causes the Linux kernel to forward IP packets so that it acts as a router.}

\item{Install the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file as shown in \hyperlink{acct2conf}{Example {\ref{acct2conf}}} and \hyperlink{acct3conf}{Example {\ref{acct3conf}}}. Combine these two examples to form a single {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}smb.\dbz{}conf}}} file.}

\item{\index{smbpasswd} Add the user {\bfseries{root}} to the Samba password backend: 
\begin{Verbatim}[]

root#  smbpasswd -a root
New SMB password: XXXXXXX
Retype new SMB password: XXXXXXX
root# 

\end{Verbatim}
 \index{administrator} This is the Windows Domain Administrator password. Never delete this account from the password backend after Windows Domain Groups have been initialized. If you delete this account, your system is crippled. You cannot restore this account, and your Samba server can no longer be administered.}

\item{\index{username map} Create the username map file to permit the {\texttt{\docbookhyphenatedot{root}}} account to be called {\texttt{\docbookhyphenatedot{Administrator}}} from the Windows network environment. To do this, create the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}smbusers}}} with the following contents: 
\begin{Verbatim}[]

####
# User mapping file
####
# File Format
# -----------
# Unix_ID = Windows_ID
#
# Examples:
# root = Administrator
# janes = "Jane Smith"
# jimbo = Jim Bones
#
# Note: If the name contains a space it must be double quoted.
#       In the example above the name 'jimbo' will be mapped to Windows
#       user names 'Jim' and 'Bones' because the space was not quoted.
#######################################################################
root = Administrator
####
# End of File
####

\end{Verbatim}
}

\item{\index{initGrps.sh} Create and map Windows Domain Groups to UNIX groups. A sample script is provided in \hyperlink{initGrps}{Example {\ref{initGrps}}}. Create a file containing this script. We called ours {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}initGrps.\dbz{}sh}}}. Set this file so it can be executed, and then execute the script. Sample output should be as follows: 
\begin{example}%
\hypertarget{initGrps}{}%
\captionswapskip{}{{\caption{Script to Map Windows NT Groups to UNIX Groups}\label{initGrps}}}
\captionswapskip{}\index{initGrps.sh}
\begin{Verbatim}[]

#!/bin/bash
#
# initGrps.sh
#

# Create UNIX groups
groupadd acctsdep
groupadd finsrvcs

# Map Windows Domain Groups to UNIX groups
net groupmap add ntgroup="Domain Admins"  unixgroup=root type=d
net groupmap add ntgroup="Domain Users"   unixgroup=users type=d
net groupmap add ntgroup="Domain Guests"  unixgroup=nobody type=d

# Add Functional Domain Groups
net groupmap add ntgroup="Accounts Dept"  unixgroup=acctsdep type=d
net groupmap add ntgroup="Financial Services" unixgroup=finsrvcs type=d

\end{Verbatim}
\end{example}

 
\begin{Verbatim}[]

root#  chmod 755 initGrps.sh
root#  cd /etc/samba
root#  ./initGrps.sh
Updated mapping entry for Domain Admins
Updated mapping entry for Domain Users
Updated mapping entry for Domain Guests
No rid or sid specified, choosing algorithmic mapping
Successfully added group Accounts Dept to the mapping db
No rid or sid specified, choosing algorithmic mapping
Successfully added group Domain Guests to the mapping db

root#  cd /etc/samba
root#  net groupmap list | sort
Account Operators (S-1-5-32-548) -> -1
Accounts Dept (S-1-5-21-194350-25496802-3394589-2003) -> acctsdep
Administrators (S-1-5-32-544) -> -1
Backup Operators (S-1-5-32-551) -> -1
Domain Admins (S-1-5-21-194350-25496802-3394589-512) -> root
Domain Guests (S-1-5-21-194350-25496802-3394589-514) -> nobody
Domain Users (S-1-5-21-194350-25496802-3394589-513) -> users
Financial Services (S-1-5-21-194350-25496802-3394589-2005) -> finsrvcs
Guests (S-1-5-32-546) -> -1
Power Users (S-1-5-32-547) -> -1
Print Operators (S-1-5-32-550) -> -1
Replicators (S-1-5-32-552) -> -1
System Operators (S-1-5-32-549) -> -1
Users (S-1-5-32-545) -> -1

\end{Verbatim}
}

\item{\index{/etc/passwd} \index{password!backend} \index{smbpasswd} For each user who needs to be given a Windows Domain account, make an entry in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} file as well as in the Samba password backend. Use the system tool of your choice to create the UNIX system accounts, and use the Samba {\bfseries{smbpasswd}} program to create the Domain user accounts.  \index{useradd} \index{adduser} \index{user!management} There are a number of tools for user management under UNIX, such as {\bfseries{useradd}} and {\bfseries{adduser}}, as well as a plethora of custom tools. With the tool of your choice, create a home directory for each user.}

\item{Using the preferred tool for your UNIX system, add each user to the UNIX groups created previously, as necessary. File system access control will be based on UNIX group membership.}

\item{Create the directory mount point for the disk subsystem that is mounted to provide data storage for company files. In this case the mount point is indicated in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file is {\texttt{\docbookhyphenatefilename{/\dbz{}data}}}. Format the file system as required, mount the formatted file system partition using {\bfseries{mount}}, and make the appropriate changes in {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}fstab}}}.}

\item{Create the top-level file storage directories are follows: 
\begin{Verbatim}[]

root#  mkdir -p /data/{accounts,finsvcs}
root#  chown -R root:root /data
root#  chown -R alanm:accounts /data/accounts
root#  chown -R alanm:finsvcs /data/finsvcs
root#  chmod -R ug+rwx,o+rx-w /data

\end{Verbatim}
 Each department is responsible for creating its own directory structure within its share. The directory root of the {\bfseries{accounts}} share is {\texttt{\docbookhyphenatefilename{/\dbz{}data/\dbz{}accounts}}}. The directory root of the {\bfseries{finsvcs}} share is {\texttt{\docbookhyphenatefilename{/\dbz{}data/\dbz{}finsvcs}}}.}

\item{Configure the printers with the IP addresses as shown in \hyperlink{acct2net}{Figure {\ref{acct2net}}}. Follow the instructions in the manufacturers' manuals to permit printing to port 9100. This allows the CUPS spooler to print using raw mode protocols. \index{CUPS} \index{raw printing}}

\item{\index{CUPS!queue} \index{lpadmin} Configure the CUPS Print Queues as follows: 
\begin{Verbatim}[]

root#  lpadmin -p hplj4 -v socket://192.168.1.11:9100 -E
root#  lpadmin -p hplj6 -v socket://192.168.1.10:9100 -E
root#  lpadmin -p qms -v socket://192.168.2.10:9100 -E

\end{Verbatim}
 \index{print filter} This creates the necessary print queues with no assigned print filter.}

\item{\index{mime type} \index{/etc/mime.convs} \index{application/octet-stream} Edit the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}cups/\dbz{}mime.\dbz{}convs}}} to uncomment the line: 
\begin{Verbatim}[]

application/octet-stream     application/vnd.cups-raw      0     -

\end{Verbatim}
}

\item{\index{/etc/mime.types} Edit the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}cups/\dbz{}mime.\dbz{}types}}} to uncomment the line: 
\begin{Verbatim}[]

application/octet-stream

\end{Verbatim}
}

\item{\index{DHCP Server} Using your favorite system editor, create an {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}dhcpd.\dbz{}conf}}} with the contents as shown in \hyperlink{dhcp01}{Example {\ref{dhcp01}}}. 
\begin{example}%
\hypertarget{dhcp01}{}%
\captionswapskip{}{{\caption{Abmas Accounting DHCP Server Configuration File ---  /\dbz{}etc/\dbz{}dhcpd.\dbz{}conf}\label{dhcp01}}}
\captionswapskip{}\index{/etc/dhcpd.conf}
\begin{Verbatim}[]

default-lease-time 86400;
max-lease-time 172800;
default-lease-time 86400;

option ntp-servers 192.168.1.1;
option domain-name "abmas.biz";
option domain-name-servers 192.168.1.1, 192.168.2.1;
option netbios-name-servers 192.168.1.1, 192.168.2.1;
option netbios-node-type 8;
### NOTE ###
# netbios-node-type=8 means set clients to Hybrid Mode
#   so they will use Unicast communication with the WINS
#   server and thus reduce the level of UDP broadcast
#   traffic by up to 90%.
############

subnet 192.168.1.0 netmask 255.255.255.0 {
	range dynamic-bootp 192.168.1.128 192.168.1.254;
	option subnet-mask 255.255.255.0;
	option routers 192.168.1.1;
	allow unknown-clients;
	host hplj4 {
		hardware ethernet 08:00:46:7a:35:e4;
		fixed-address 192.168.1.10;
		}
	host hplj6 {
		hardware ethernet 00:03:47:cb:81:e0;
		fixed-address 192.168.1.11;
		}
	}
subnet 192.168.2.0 netmask 255.255.255.0 {
	range dynamic-bootp 192.168.2.128 192.168.2.254;
	option subnet-mask 255.255.255.0;
	option routers 192.168.2.1;
	allow unknown-clients;
	host qms {
		hardware ethernet 01:04:31:db:e1:c0;
		fixed-address 192.168.1.10;
		}
	}
subnet 127.0.0.0 netmask 255.0.0.0 {
	}

\end{Verbatim}
\end{example}

}

\item{Use the standard system tool to start Samba and CUPS and configure them to start automatically at every system reboot. For example,  \index{chkconfig} \index{starting dhcpd} \index{starting samba} \index{starting CUPS} \index{chkconfig} 
\begin{Verbatim}[]

root#  chkconfig dhcp on
root#  chkconfig smb on
root#  chkconfig cups on
root#  /etc/rc.d/init.d/dhcp restart
root#  /etc/rc.d/init.d/smb restart
root#  /etc/rc.d/init.d/cups restart

\end{Verbatim}
}

\item{\index{name service switch} \index{NSS|textit{see} {same service switch} } \index{DNS} \index{DNS server} \index{WINS} \index{/etc/nsswitch.conf} Configure the name service switch (NSS) to handle WINS-based name resolution. Since this system does not use a DNS server, it is safe to remove this option from the NSS configuration. Edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file so that the {\texttt{\docbookhyphenatedot{hosts:}}} entry looks like this: 
\begin{Verbatim}[]

hosts:	files wins

\end{Verbatim}
}
\end{enumerate}

\begin{example}%
\hypertarget{acct2conf}{}%
\captionswapskip{}{{\caption{Accounting Office Network smb.\dbz{}conf File ---  [globals] Section}\label{acct2conf}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	workgroup = BILLMORE
 	passwd chat = *New*Password* %n\n*Re-enter*new*password* %n\n *Password*changed*
 	username map = /etc/samba/smbusers
 	syslog = 0
 	name resolve order = wins bcast hosts
 	printcap name = CUPS
 	show add printer wizard = No
 	add user script = /usr/sbin/useradd -m -G users '%u'
 	delete user script = /usr/sbin/userdel -r '%u'
 	add group script = /usr/sbin/groupadd '%g'
 	delete group script = /usr/sbin/groupdel '%g'
 	add user to group script = /usr/sbin/usermod -A '%g' '%u'
 	add machine script = /usr/sbin/useradd -s /bin/false -d /var/lib/nobody '%u'
 	logon script = scripts\login.bat
 	logon path =  
 	logon drive = X:
 	domain logons = Yes
 	preferred master = Yes
 	wins support = Yes
 	printing = CUPS
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{acct3conf}{}%
\captionswapskip{}{{\caption{Accounting Office Network smb.\dbz{}conf File ---  Services and Shares Section}\label{acct3conf}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[homes]
 	comment = Home Directories
 	valid users = %S
 	read only = No
 	browseable = No
 [printers]
 	comment = SMB Print Spool
 	path = /var/spool/samba
 	printable = Yes
 	guest ok = Yes
 	use client driver = Yes
 	browseable = No
 [netlogon]
 	comment = Network Logon Service
 	path = /data/%U
 	valid users = %S
 	read only = No
 [accounts]
 	comment = Accounting Files
 	path = /data/accounts
 	valid users = %G
 	read only = No
 [finsvcs]
 	comment = Financial Service Files
 	path = /data/finsvcs
 	valid users = %G
 	read only = No
\end{lstlisting}
\end{example}

\subsection{Validation}
\label{id2514180}\hypertarget{id2514180}{}%

Does everything function as it ought? That is the key question at this point. Here are some simple steps to validate your Samba server configuration.
Validation Steps\begin{enumerate}

\item{\index{testparm} If your {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file has bogus options or parameters, this may cause Samba to refuse to start. The first step should always be to validate the contents of this file by running: 
\begin{Verbatim}[]

root#  testparm -s
Load smb config files from smb.conf
Processing section "[homes]"
Processing section "[printers]"
Processing section "[netlogon]"
Processing section "[accounts]"
Processing section "[service]"
Loaded services file OK.
# Global parameters
[global]
        workgroup = BILLMORE
        passwd chat = *New*Password* \
		%n\n *Re-enter*new*password* %n\n *Password*changed*
        username map = /etc/samba/smbusers
        syslog = 0
        name resolve order = wins bcast hosts
        printcap name = CUPS
        show add printer wizard = No
        add user script = /usr/sbin/useradd -m -G users '%u'
        delete user script = /usr/sbin/userdel -r '%u'
        add group script = /usr/sbin/groupadd '%g'
        delete group script = /usr/sbin/groupdel '%g'
        add user to group script = /usr/sbin/usermod -A '%g' '%u'
        add machine script = /usr/sbin/useradd
				-s /bin/false -d /var/lib/nobody '%u'
        logon script = scripts\logon.bat
        logon path =
        logon drive = X:
        domain logons = Yes
        preferred master = Yes
        wins support = Yes
...
### Remainder cut to save space ###

\end{Verbatim}
 The inclusion of an invalid parameter (say one called dogbert) would generate an error as follows: 
\begin{Verbatim}[]

Unknown parameter encountered: "dogbert"
Ignoring unknown parameter "dogbert"

\end{Verbatim}
 Clear away all errors before proceeding, and start or restart samba as necessary.}

\item{\index{check samba daemons} \index{nmbd} \index{smbd} \index{winbindd} Check that the Samba server is running: 
\begin{Verbatim}[]

root#  ps ax | grep mbd
14244 ?        S      0:00 /usr/sbin/nmbd -D
14245 ?        S      0:00 /usr/sbin/nmbd -D
14290 ?        S      0:00 /usr/sbin/smbd -D

$rootprompt; ps ax | grep winbind
14293 ?        S     0:00 /usr/sbin/winbindd -B
14295 ?        S     0:00 /usr/sbin/winbindd -B

\end{Verbatim}
 The {\bfseries{winbindd}} daemon is running in split mode (normal), so there are also two instances of it. For more information regarding {\bfseries{winbindd}}, see {\em{TOSHARG2}}, Chapter 23, Section 23.3. The single instance of {\bfseries{smbd}} is normal.}

\item{\index{anonymous connection} Check that an anonymous connection can be made to the Samba server: 
\begin{Verbatim}[]

root#  smbclient -L localhost -U%

        Sharename      Type      Comment
        ---------      ----      -------
        netlogon       Disk      Network Logon Service
        accounts       Disk      Accounting Files
        finsvcs        Disk      Financial Service Files
        IPC$           IPC       IPC Service (Samba3)
        ADMIN$         IPC       IPC Service (Samba3)
        hplj4          Printer   Hewlett-Packard LaserJet 4
        hplj6          Printer   Hewlett-Packard LaserJet 6
        qms            Printer   QMS Magicolor Laser Printer XXXX

        Server               Comment
        ---------            -------
        SLEETH               Samba 3.0.20

        Workgroup            Master
        ---------            -------
        BILLMORE             SLEETH

\end{Verbatim}
 This demonstrates that an anonymous listing of shares can be obtained. This is the equivalent of browsing the server from a Windows client to obtain a list of shares on the server. The {\texttt{\docbookhyphenatedot{-U\%}}} argument means to send a {\texttt{\docbookhyphenatedot{NULL}}} username and a {\texttt{\docbookhyphenatedot{NULL}}} password.}

\item{\index{dhcp client validation} \index{printer validation} \index{/etc/dhcpd.conf} Verify that the printers have the IP addresses assigned in the DHCP server configuration file. The easiest way to do this is to ping the printer name. Immediately after the ping response has been received, execute {\bfseries{arp -a}} to find the MAC address of the printer that has responded. Now you can compare the IP address and the MAC address of the printer with the configuration information in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}dhcpd.\dbz{}conf}}} file. They should, of course, match. For example, 
\begin{Verbatim}[]

root#  ping hplj4
PING hplj4 (192.168.1.11) 56(84) bytes of data.
64 bytes from hplj4 (192.168.1.11): icmp_seq=1 ttl=64 time=0.113 ms

root#  arp -a
hplj4 (192.168.1.11) at 08:00:46:7A:35:E4 [ether] on eth0

\end{Verbatim}
 The MAC address {\texttt{\docbookhyphenatedot{08:00:46:7A:35:E4}}} matches that specified for the IP address from which the printer has responded and the entry for it in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}dhcpd.\dbz{}conf}}} file.}

\item{\index{authenticated connection} Make an authenticated connection to the server using the {\bfseries{smbclient}} tool: 
\begin{Verbatim}[]

root#  smbclient //sleeth/accounts -U alanm
Password: XXXXXXX
smb: \> dir
  .                          D        0  Sun Nov  9 01:28:34 2003
  ..                         D        0  Sat Aug 16 17:24:26 2003
  .mc                       DH        0  Sat Nov  8 21:57:38 2003
  .qt                       DH        0  Fri Sep  5 00:48:25 2003
  SMB                        D        0  Sun Oct 19 23:04:30 2003
  Documents                  D        0  Sat Nov  1 00:31:51 2003
  xpsp1a_en_x86.exe           131170400  Sun Nov  2 01:25:44 2003

           65387 blocks of size 65536. 28590 blocks available
smb: \> q

\end{Verbatim}
}
\end{enumerate}
Windows XP Professional Client Configuration\begin{enumerate}

\item{Configure clients to the network settings shown in \hyperlink{acct2net}{Figure {\ref{acct2net}}}. All clients use DHCP for TCP/IP protocol stack configuration. \index{WINS} \index{DHCP} DHCP configures all Windows clients to use the WINS Server address {\texttt{\docbookhyphenatedot{192.168.1.1}}}.}

\item{Join the Windows Domain called {\texttt{\docbookhyphenatedot{BILLMORE}}}. Use the Domain Administrator username {\texttt{\docbookhyphenatedot{root}}} and the SMB password you assigned to this account. A detailed step-by-step procedure for joining a Windows 200x/XP Professional client to a Windows Domain is given in \hyperlink{appendix}{Chapter {\ref{appendix}}, {``}A Collection of Useful Tidbits{''}}, \hyperlink{domjoin}{Section {\ref{domjoin}}}. Reboot the machine as prompted and then log on using a Domain User account.}

\item{Verify on each client that the machine called {\texttt{\docbookhyphenatedot{SLEETH}}} is visible in {\sffamily \bfseries My Network Places}, that it is possible to connect to it and see the shares {\sffamily \bfseries accounts} and {\sffamily \bfseries finsvcs}, and that it is possible to open that share to reveal its contents.}

\item{Instruct all users to log onto the workstation using their assigned username and password.}

\item{Install a printer on each using the following steps: \begin{enumerate}

\item{Click {\sffamily \bfseries Start} $\to$ {\sffamily \bfseries Settings} $\to$ {\sffamily \bfseries Printers}+{\sffamily \bfseries Add Printer}+{\sffamily \bfseries Next}. Do not click {\sffamily \bfseries Network printer}. Ensure that {\sffamily \bfseries Local printer} is selected.}

\item{Click {\sffamily \bfseries Next}. In the {\sffamily \bfseries Manufacturer:} panel, select {\texttt{\docbookhyphenatedot{HP}}}. In the {\sffamily \bfseries Printers:} panel, select the printer called {\texttt{\docbookhyphenatedot{HP LaserJet 4}}}. Click {\sffamily \bfseries Next}.}

\item{In the {\sffamily \bfseries Available ports:} panel, select {\texttt{\docbookhyphenatedot{FILE:}}}. Accept the default printer name by clicking {\sffamily \bfseries Next}. When asked, {``}Would you like to print a test page?{''}, click {\sffamily \bfseries No}. Click {\sffamily \bfseries Finish}.}

\item{You may be prompted for the name of a file to print to. If so, close the dialog panel. Right-click {\sffamily \bfseries HP LaserJet 4} $\to$ {\sffamily \bfseries Properties} $\to$ {\sffamily \bfseries Details (Tab)} $\to$ {\sffamily \bfseries Add Port}.}

\item{In the {\sffamily \bfseries Network} panel, enter the name of the print queue on the Samba server as follows: {\texttt{\docbookhyphenatedot{\textbackslash \textbackslash SERVER\textbackslash hplj4}}}. Click {\sffamily \bfseries OK}+{\sffamily \bfseries OK} to complete the installation.}

\item{Repeat the printer installation steps above for the HP LaserJet 6 printer as well as for the QMS Magicolor XXXX laser printer.}
\end{enumerate}
}
\end{enumerate}
\subsection{Notebook Computers: A Special Case}
\label{id2514861}\hypertarget{id2514861}{}%

As a network administrator, you already know how to create local machine accounts for Windows 200x/XP Professional systems. This is the preferred solution to provide continuity of work for notebook users so that absence from the office network environment does not become a barrier to productivity.

By creating a local machine account that has the same username and password as you create for that user in the Windows Domain environment, the user can log onto the machine locally and still transparently access network resources as if logged onto the domain itself. There are some trade-offs that mean that as the network is more tightly secured, it becomes necessary to modify Windows client configuration somewhat.
\subsection{Key Points Learned}
\label{id2514888}\hypertarget{id2514888}{}%

In this network design and implementation exercise, you created a Windows NT4-style Domain Controller using Samba-3.0.20. Following these guidelines, you experienced and implemented several important aspects of Windows networking. In the next chapter, you build on the experience. These are the highlights from this chapter:

\begin{itemize}
%--- Item
\item 
\index{DHCP} You implemented a DHCP server, and Microsoft Windows clients were able to obtain all necessary network configuration settings from this server.


%--- Item
\item 
\index{Domain Controller} You created a Windows Domain Controller. You were able to use the network logon service and successfully joined Windows 200x/XP Professional clients to the Domain.


%--- Item
\item 
\index{CUPS} You created raw print queues in the CUPS printing system. You maintained a simple printing system so that all users can share centrally managed printers. You installed native printer drivers on the Windows clients.


%--- Item
\item 
You experienced the benefits of centrally managed user accounts on the server.


%--- Item
\item 
You offered Mobile notebook users a solution that allows them to continue to work while away from the office and not connected to the corporate network.

\end{itemize}

% ------------------------   
% Section 
\section{Questions and Answers}
\label{id2514968}\hypertarget{id2514968}{}%

Your new Domain Controller is ready to serve you. What does it mean? Here are some questions and answers that may help.
% -------------------------------------------------------------
% QandASet                                                     
% -------------------------------------------------------------
\subsection*{F.A.Q.}
\label{id2514980}
\vspace{1em}
\noindent{}1.~\textbf{Q:}~\textit{What is the key benefit of using DHCP to configure Windows client TCP/IP stacks?}
\newline
\noindent\textbf{A:}~
First and foremost, portability. It means that notebook users can move between the Abmas office and client offices (so long as they, too, use DHCP) without having to manually reconfigure their machines. It also means that when they work from their home environments either using DHCP assigned addressing or when using dial-up networking, settings such as default routes and DNS server addresses that apply only to the Abmas office environment do not interfere with remote operations. This is an extremely important feature of DHCP.


\vspace{1em}
\vspace{1em}
\noindent{}2.~\textbf{Q:}~\textit{Are there any DHCP server configuration parameters in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}dhcpd.\dbz{}conf}}} that should be noted in particular?}
\newline
\noindent\textbf{A:}~
Yes. The configuration you created automatically provides each client with the IP address of your WINS server. It also configures the client to preferentially register NetBIOS names with the WINS server, and then instructs the client to first query the WINS server when a NetBIOS machine name needs to be resolved to an IP Address. This configuration results in far lower UDP broadcast traffic than would be the case if WINS was not used.


\vspace{1em}
\vspace{1em}
\noindent{}3.~\textbf{Q:}~\textit{Is it possible to create a Windows Domain account that is specifically called {\texttt{\docbookhyphenatedot{Administrator}}}?}
\newline
\noindent\textbf{A:}~
You can surely create a Windows Domain account called {\texttt{\docbookhyphenatedot{Administrator}}}. It is also possible to map that account so that it has the effective UNIX UID of 0. This way it isn't necessary to use the {\ttfamily\itshape{\docbookhyphenatedot{username map}}} facility to map this account to the UNIX account called {\texttt{\docbookhyphenatedot{root}}}.


\vspace{1em}
\vspace{1em}
\noindent{}4.~\textbf{Q:}~\textit{Why is it necessary to give the Windows Domain {\texttt{\docbookhyphenatedot{Administrator}}} a UNIX UID of 0?}
\newline
\noindent\textbf{A:}~
The Windows Domain {\texttt{\docbookhyphenatedot{Administrator}}} account is the most privileged account that exists on the Windows platform. This user can change any setting, add, delete, or modify user accounts, and completely reconfigure the system. The equivalent to this account in the UNIX environment is the {\texttt{\docbookhyphenatedot{root}}} account. If you want to permit the Windows Domain Administrator to manage accounts as well as permissions, privileges, and security settings within the Domain and on the Samba server, equivalent rights must be assigned. This is achieved with the {\texttt{\docbookhyphenatedot{root}}} UID equal to 0.


\vspace{1em}
\vspace{1em}
\noindent{}5.~\textbf{Q:}~\textit{One of my junior staff needs the ability to add machines to the Domain, but I do not want to give him {\texttt{\docbookhyphenatedot{root}}} access. How can we do this?}
\newline
\noindent\textbf{A:}~
Users who are members of the {\texttt{\docbookhyphenatedot{Domain Admins}}} group can add machines to the Domain. This group is mapped to the UNIX group account called {\texttt{\docbookhyphenatedot{root}}} (or the equivalent {\texttt{\docbookhyphenatedot{wheel}}} on some UNIX systems) that has a GID of 0. This must be the primary GID of the account of the user who is a member of the Windows {\texttt{\docbookhyphenatedot{Domain Admins}}} account.


\vspace{1em}
\vspace{1em}
\noindent{}6.~\textbf{Q:}~\textit{Why must I map Windows Domain Groups to UNIX groups?}
\newline
\noindent\textbf{A:}~
Samba-3 does not permit a Domain Group to become visible to Domain network clients unless the account has a UNIX group account equivalent. The Domain groups that should be given UNIX equivalents are {\sffamily \bfseries Domain Guests}, {\sffamily \bfseries Domain Users}, and {\sffamily \bfseries Domain Admins}.


\vspace{1em}
\vspace{1em}
\noindent{}7.~\textbf{Q:}~\textit{I deleted my {\texttt{\docbookhyphenatedot{root}}} account and now I cannot add it back! What can I do?}
\newline
\noindent\textbf{A:}~
This is a nasty problem. Fortunately, there is a solution.
\begin{enumerate}

\item{Back up your existing configuration files in case you need to restore them.}

\item{Rename the {\texttt{\docbookhyphenatefilename{group\_\dbz{}mapping.\dbz{}tdb}}} file.}

\item{Use the {\bfseries{smbpasswd}} to add the root account.}

\item{Restore the {\texttt{\docbookhyphenatefilename{group\_\dbz{}mapping.\dbz{}tdb}}} file.}
\end{enumerate}


\vspace{1em}
\vspace{1em}
\noindent{}8.~\textbf{Q:}~\textit{When I run {\bfseries{net groupmap list}}, it reports a group called {\sffamily \bfseries Administrators} as well as {\sffamily \bfseries Domain Admins}. What is the difference between them?}
\newline
\noindent\textbf{A:}~
The group called {\sffamily \bfseries Administrators} is representative of the same account that would be present as the Local Group account on a Domain Member server or workstation. Samba uses only Domain Groups at this time. A Workstation or Server Local Group has no meaning in a Samba context. This may change at some later date. These accounts are provided only so that security objects are correctly shown.


\vspace{1em}
\vspace{1em}
\noindent{}9.~\textbf{Q:}~\textit{What is the effect of changing the name of a Samba server or of changing the Domain name?}
\newline
\noindent\textbf{A:}~
If you elect to change the name of the Samba server, on restarting {\bfseries{smbd}}, Windows security identifiers are changed. In the case of a standalone server or a Domain Member server, the machine SID is changed. This may break Domain membership. In the case of a change of the Domain name (Workgroup name), the Domain SID is changed. This affects all Domain memberships.

If it becomes necessary to change either the server name or the Domain name, be sure to back up the respective SID before the change is made. You can back up the SID using the {\bfseries{net getlocalsid}} (Samba-3) or the {\bfseries{smbpasswd}} (Samba-2.2.x). To change the SID, you use the same tool. Be sure to check the man page for this command for detailed instructions regarding the steps involved.


\vspace{1em}
\vspace{1em}
\noindent{}10.~\textbf{Q:}~\textit{How can I manage user accounts from my Windows XP Professional workstation?}
\newline
\noindent\textbf{A:}~
Samba-3 implements a Windows NT4-style security domain architecture. This type of Domain cannot be managed using tools present on a Windows XP Professional installation. You may download from the Microsoft Web site the SRVTOOLS.EXE package. Extract it into the directory from which you wish to use it. This package extracts the tools: {\bfseries{User Manager for Domains}}, {\bfseries{Server Manager}}, and {\bfseries{Event Viewer}}. You may use the {\sffamily \bfseries User Manager for Domains} to manage your Samba-3 Domain user and group accounts. Of course, you do need to be logged on as the {\texttt{\docbookhyphenatedot{Administrator}}} for the Samba-3 Domain. It may help to log on as the {\texttt{\docbookhyphenatedot{root}}} account.


\vspace{1em}
\cleardoublepage 
% -------------------------------------------------------------
% Chapter Secure Office Networking 
% ------------------------------------------------------------- 	
\chapter{Secure Office Networking}
\label{secure}\hypertarget{secure}{}%

Congratulations, your Samba networking skills are developing nicely. You started out with three simple networks in \hyperlink{simple}{Chapter {\ref{simple}}, {``}No-Frills Samba Servers{''}}, and then in \hyperlink{small}{Chapter {\ref{small}}, {``}Small Office Networking{''}} you designed and built a network that provides a high degree of flexibility, integrity, and dependability. It was enough for the basic needs each was designed to fulfill. In this chapter you address a more complex set of needs. The solution you explore introduces you to basic features that are specific to Samba-3.

You should note that a working and secure solution could be implemented using Samba-2.2.x. In the exercises presented here, you are gradually using more Samba-3-specific features, so caution is advised for anyone who tries to use Samba-2.2.x with the guidance here given. To avoid confusion, this book is all about Samba-3. Let's get the exercises in this chapter underway.

% ------------------------   
% Section 
\section{Introduction}
\label{id2478985}\hypertarget{id2478985}{}%

You have made Mr. Meany a very happy man. Recently he paid you a fat bonus for work well done. It is one year since the last network upgrade. You have been quite busy. Two months ago Mr. Meany gave approval to hire Christine Roberson, who has taken over general network management. Soon she will provide primary user support. You have demonstrated that you can delegate responsibility and can plan and execute according to that plan. Above all, you have shown Mr. Meany that you are a responsible person. Today is a big day. Mr. Meany called you to his office at 9 a.m. for news you never expected: You are going to take charge of business operations. Mr. Meany is retiring and has entrusted the business to your capable hands.

Mr. Meany may be retiring from this company, but not from work. He is taking the opportunity to develop Abmas Accounting into a larger and more substantial company. He says that it took him many years to learn that there is no future in just running a business. He now realizes there is great personal satisfaction in the creation of career opportunities for people in the local community. He wants to do more for others, as he is doing for you. Today he spent a lot of time talking about his grand plan for growth, which you will deal with in the chapters ahead.

Over the past year, the growth projections were exceeded. The network has grown to meet the needs of 130 users. Along with growth, the demand for improved services and better functionality has also developed. You are about to make an interim improvement and then hand over all Help desk and network maintenance to Christine. Christine has professional certifications in Microsoft Windows as well as in Linux; she is a hard worker and quite likable. Christine does not want to manage the department (although she manages well). She gains job satisfaction when left to sort things out. Occasionally she wants to work with you on a challenging problem. When you told her about your move, she almost resigned, although she was reassured that a new manager would be hired to run Information Technology, and she would be responsible only for operations.
\subsection{Assignment Tasks}
\label{id2482216}\hypertarget{id2482216}{}%

You promised the staff Internet services including Web browsing, electronic mail, virus protection, and a company Web site. Christine is eager to help turn the vision into reality. Let's see how close you can get to the promises made.

The network you are about to deliver will service 130 users today. Within a year, Abmas will aquire another company. Mr. Meany claims that within 2 years there will be well over 500 users on the network. You have bought into the big picture, so prepare for growth. You have purchased a new server and will implement a new network infrastructure.

You have decided to not recycle old network components. The only items that will be carried forward are notebook computers. You offered staff new notebooks, but not one person wanted the disruption for what was perceived as a marginal update. You decided to give everyone, even the notebook user, a new desktop computer.

You procured a DSL Internet connection that provides 1.5 Mb/sec (bidirectional) and a 10 Mb/sec ethernet port. You registered the domain {\texttt{\docbookhyphenatedot{abmas.us}}}, and the Internet Service Provider (ISP) is supplying secondary DNS. Information furnished by your ISP is shown in \hyperlink{chap4netid}{Table {\ref{chap4netid}}}.

It is of paramount priority that under no circumstances will Samba offer service access from an Internet connection. You are paying an ISP to give, as part of its value-added services, full firewall protection for your connection to the outside world. The only services allowed in from the Internet side are the following destination ports: {\texttt{\docbookhyphenatedot{http/https (ports 80 and 443), email (port 25), DNS (port 53)}}}. All Internet traffic will be allowed out after network address translation (NAT). No internal IP addresses are permitted through the NAT filter because complete privacy of internal network operations must be assured.

% table ------------------------------------------------------
\begin{table}[htb]
\begin{center}%
\hypertarget{chap4netid}{}%
\captionswapskip{}{{\caption{Abmas.US ISP Information}\label{chap4netid}}}
\captionswapskip{}\begin{tabular}{|l|c|}
\hline 
{{{\bfseries Parameter}}} & {{{\bfseries Value}}} \tabularnewline
 \hline 
{{Server IP Address}} & {{123.45.67.66}} \tabularnewline
 \hline 
{{DSL Device IP Address}} & {{123.45.67.65}} \tabularnewline
 \hline 
{{Network Address}} & {{123.45.67.64/30}} \tabularnewline
 \hline 
{{Gateway Address}} & {{123.45.54.65}} \tabularnewline
 \hline 
{{Primary DNS Server}} & {{123.45.54.65}} \tabularnewline
 \hline 
{{Secondary DNS Server}} & {{123.45.54.32}} \tabularnewline
 \hline 
{{Forwarding DNS Server}} & {{123.45.12.23}} \tabularnewline
\hline 
\end{tabular}
\end{center}
\end{table}


% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{ch04net}{}%
\includegraphics[scale=0.65]{Samba3-ByExample/images/chap4-net}
{{\caption[{Abmas Network Topology ---  130 Users}]{{{Abmas Network Topology ---  130 Users}}}\label{ch04net}}}
\end{center}
\end{figure}


Christine recommended that desktop systems should be installed from a single cloned master system that has a minimum of locally installed software and loads all software off a central application server. The benefit of having the central application server is that it allows single-point maintenance of all business applications, a more efficient way to manage software. She further recommended installation of antivirus software on workstations as well as on the Samba server. Christine knows the dangers of potential virus infection and insists on a comprehensive approach to detective as well as corrective action to protect network operations.

A significant concern is the problem of managing company growth. Recently, a number of users had to share a PC while waiting for new machines to arrive. This presented some problems with desktop computers and software installation into the new users' desktop profiles.

% ------------------------   
% Section 
\section{Dissection and Discussion}
\label{id2456405}\hypertarget{id2456405}{}%

Many of the conclusions you draw here are obvious. Some requirements are not very clear or may simply be your means of drawing the most out of Samba-3. Much can be done more simply than you will demonstrate here, but keep in mind that the network must scale to at least 500 users. This means that some functionality will be overdesigned for the current 130-user environment.
\subsection{Technical Issues}
\label{id2456421}\hypertarget{id2456421}{}%

In this exercise we use a 24-bit subnet mask for the two local networks. This, of course, limits our network to a maximum of 253 usable IP addresses. The network address range chosen is one assigned by RFC1918 for private networks. When the number of users on the network begins to approach the limit of usable addresses, it is a good idea to switch to a network address specified in RFC1918 in the 172.16.0.0/16 range. This is done in subsequent chapters.

\index{tdbsam} \index{smbpasswd} The high growth rates projected are a good reason to use the {\texttt{\docbookhyphenatedot{tdbsam}}} passdb backend. The use of {\texttt{\docbookhyphenatedot{smbpasswd}}} for the backend may result in performance problems. The {\texttt{\docbookhyphenatedot{tdbsam}}} passdb backend offers features that are not available with the older, flat ASCII-based {\texttt{\docbookhyphenatedot{smbpasswd}}} database.

\index{risk} The proposed network design uses a single server to act as an Internet services host for electronic mail, Web serving, remote administrative access via SSH, Samba-based file and print services. This design is often chosen by sites that feel they cannot afford or justify the cost or overhead of having separate servers. It must be realized that if security of this type of server should ever be violated (compromised), the whole network and all data is at risk. Many sites continue to choose this type of solution; therefore, this chapter provides detailed coverage of key implementation aspects.

Samba will be configured to specifically not operate on the Ethernet interface that is directly connected to the Internet.

\index{iptables} \index{NAT} \index{Network Address Translation|textit{see} {NAT} } \index{firewall} You know that your ISP is providing full firewall services, but you cannot rely on that. Always assume that human error will occur, so be prepared by using Linux firewall facilities based on {\bfseries{iptables}} to effect NAT. Block all incoming traffic except to permitted well-known ports. You must also allow incoming packets to establish outgoing connections. You will permit all internal outgoing requests.

The configuration of Web serving, Web proxy services, electronic mail, and the details of generic antivirus handling are beyond the scope of this book and therefore are not covered except insofar as this affects Samba-3.

\index{login} Notebook computers are configured to use a network login when in the office and a local account to log in while away from the office. Users store all work done in transit (away from the office) by using a local share for work files. Standard procedures dictate that on completion of the work that necessitates mobile file access, all work files are moved back to secure storage on the office server. Staff is instructed to not carry on any company notebook computer any files that are not absolutely required. This is a preventative measure to protect client information as well as private business records.

\index{application server} All applications are served from the central server from a share called {\texttt{\docbookhyphenatedot{apps}}}. Microsoft Office XP Professional and OpenOffice 1.1.0 will be installed using a network (or administrative) installation. Accounting and financial management software can also be run only from the central application server. Notebook users are provided with locally installed applications on a need-to-have basis only.

\index{roaming profiles} The introduction of roaming profiles support means that users can move between desktop computer systems without constraint while retaining full access to their data. The desktop travels with them as they move.

\index{DNS} The DNS server implementation must now address both internal and external needs. You forward DNS lookups to your ISP-provided server as well as the {\texttt{\docbookhyphenatedot{abmas.us}}} external secondary DNS server.

\index{dynamic DNS} \index{DDNS|textit{see} {dynamic DNS} } \index{DHCP server} Compared with the DHCP server configuration in \hyperlink{small}{Chapter {\ref{small}}, {``}Small Office Networking{''}}, \hyperlink{dhcp01}{Example {\ref{dhcp01}}}, the configuration used in this example has to deal with the presence of an Internet connection. The scope set for it ensures that no DHCP services will be offered on the external connection. All printers are configured as DHCP clients so that the DHCP server assigns the printer a fixed IP address by way of the Ethernet interface (MAC) address. One additional feature of this DHCP server configuration file is the inclusion of parameters to allow dynamic DNS (DDNS) operation.

This is the first implementation that depends on a correctly functioning DNS server. Comprehensive steps are included to provide for a fully functioning DNS server that also is enabled for DDNS operation. This means that DHCP clients can be autoregistered with the DNS server.

You are taking the opportunity to manually set the netbios name of the Samba server to a name other than what will be automatically resolved. You are doing this to ensure that the machine has the same NetBIOS name on both network segments.

As in the previous network configuration, printing in this network configuration uses direct raw printing (i.e., no smart printing and no print driver autodownload to Windows clients). Printer drivers are installed on the Windows client manually. This is not a problem because Christine is to install and configure one single workstation and then clone that configuration, using Norton Ghost, to all workstations. Each machine is identical, so this should pose no problem.
\subsubsection{Hardware Requirements}
\label{id2477141}\hypertarget{id2477141}{}%

\index{memory requirements} This server runs a considerable number of services. From similarly configured Linux installations, the approximate calculated memory requirements are as shown in \hyperlink{ch4memoryest}{Example {\ref{ch4memoryest}}}. 
\begin{example}%
\hypertarget{ch4memoryest}{}%
\captionswapskip{}{{\caption{Estimation of Memory Requirements}\label{ch4memoryest}}}
\captionswapskip{}
\begin{Verbatim}[]

Application  Memory per User    130 Users      500 Users
   Name        (MBytes)       Total MBytes   Total MBytes
-----------  ---------------  ------------   ------------
DHCP              2.5               3              3
DNS              16.0              16             16
Samba (nmbd)     16.0              16             16
Samba (winbind)  16.0              16             16
Samba (smbd)      4.0             520           2000
Apache           10.0 (20 User)   200            200
CUPS              3.5              16             32
Basic OS        256.0             256            256
                              -------------- --------------
    Total:                       1043 MBytes    2539 MBytes
                              -------------- --------------

\end{Verbatim}
\end{example}

 You should add a safety margin of at least 50\% to these estimates. The minimum system memory recommended for initial startup 1 GB, but to permit the system to scale to 500 users, it makes sense to provision the machine with 4 GB memory. An initial configuration with only 1 GB memory would lead to early performance complaints as the system load builds up. Given the low cost of memory, it does not make sense to compromise in this area.

\index{bandwidth calculations} Aggregate input/output loads should be considered for sizing network configuration as well as disk subsystems. For network bandwidth calculations, one would typically use an estimate of 0.1 MB/sec per user. This suggests that 100-Base-T (approx. 10 MB/sec) would deliver below acceptable capacity for the initial user load. It is therefore a good idea to begin with 1 Gb Ethernet cards for the two internal networks, each attached to a 1 Gb Ethernet switch that provides connectivity to an expandable array of 100-Base-T switched ports.

\index{network segments} \index{RAID} Considering the choice of 1 Gb Ethernet interfaces for the two local network segments, the aggregate network I/O capacity will be 2100 Mb/sec (about 230 MB/sec), an I/O demand that would require a fast disk storage I/O capability. Peak disk throughput is limited by the disk subsystem chosen. It is desirable to provide the maximum I/O bandwidth affordable. If a low-cost solution must be chosen, 3Ware IDE RAID Controllers are a good choice. These controllers can be fitted into a 64-bit, 66 MHz PCI-X slot. They appear to the operating system as a high-speed SCSI controller that can operate at the peak of the PCI-X bandwidth (approximately 450 MB/sec). Alternative SCSI-based hardware RAID controllers should also be considered. Alternately, it makes sense to purchase well-known, branded hardware that has appropriate performance specifications. As a minimum, one should attempt to provide a disk subsystem that can deliver I/O rates of at least 100 MB/sec.

Disk storage requirements may be calculated as shown in \hyperlink{ch4diskest}{Example {\ref{ch4diskest}}}. 
\begin{example}%
\hypertarget{ch4diskest}{}%
\captionswapskip{}{{\caption{Estimation of Disk Storage Requirements}\label{ch4diskest}}}
\captionswapskip{}
\begin{Verbatim}[]

Corporate Data: 100 MBytes/user per year
Email Storage:  500 MBytes/user per year
Applications:   5000 MBytes
Safety Buffer:  At least 50%

Given 500 Users and 2 years:
-----------------------------
        Corporate Data:  2 x 100 x 500 = 100000 MBytes = 100 GBytes
        Email Storage:   2 x 500 x 500 = 500000 MBytes = 500 GBytes
        Applications:                      5000 MBytes =   5 GBytes
                                       ----------------------------
                             Total:                      605 GBytes
             Add 50% buffer                              303 GBytes
                       Recommended Storage:              908 GBytes

\end{Verbatim}
\end{example}

 \index{storage capacity} The preferred storage capacity should be approximately 1 Terabyte. Use of RAID level 5 with two hot spare drives would require an 8-drive by 200 GB capacity per drive array.
\subsection{Political Issues}
\label{id2457862}\hypertarget{id2457862}{}%

Your industry is coming under increasing accountability pressures. Increased paranoia is necessary so you can demonstrate that you have acted with due diligence. You must not trust your Internet connection.

Apart from permitting more efficient management of business applications through use of an application server, your primary reason for the decision to implement this is that it gives you greater control over software licensing.

\index{Outlook Express} You are well aware that the current configuration results in some performance issues as the size of the desktop profile grows. Given that users use Microsoft Outlook Express, you know that the storage implications of the {\texttt{\docbookhyphenatedot{.PST}}} file is something that needs to be addressed later.

% ------------------------   
% Section 
\section{Implementation}
\label{id2457905}\hypertarget{id2457905}{}%

\hyperlink{ch04net}{Figure {\ref{ch04net}}} demonstrates the overall design of the network that you will implement.

The information presented here assumes that you are already familiar with many basic steps. As this stands, the details provided already extend well beyond just the necessities of Samba configuration. This decision is deliberate to ensure that key determinants of a successful installation are not overlooked. This is the last case that documents the finite minutiae of DHCP and DNS server configuration. Beyond the information provided here, there are many other good reference books on these subjects.

The {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file has the following noteworthy features:

\begin{itemize}
%--- Item
\item 
The NetBIOS name of the Samba server is set to {\texttt{\docbookhyphenatedot{DIAMOND}}}.


%--- Item
\item 
The Domain name is set to {\texttt{\docbookhyphenatedot{PROMISES}}}.


%--- Item
\item 
\index{broadcast messages} \index{interfaces} \index{bind interfaces only} Ethernet interface {\texttt{\docbookhyphenatedot{eth0}}} is attached to the Internet connection and is externally exposed. This interface is explicitly not available for Samba to use. Samba listens on this interface for broadcast messages but does not broadcast any information on {\texttt{\docbookhyphenatedot{eth0}}}, nor does it accept any connections from it. This is achieved by way of the {\ttfamily\itshape{\docbookhyphenatedot{interfaces}}} parameter and the {\ttfamily\itshape{\docbookhyphenatedot{bind interfaces only}}} entry.


%--- Item
\item 
\index{passdb backend} \index{tdbsam} \index{binary database} The {\ttfamily\itshape{\docbookhyphenatedot{passdb backend}}} parameter specifies the creation and use of the {\texttt{\docbookhyphenatedot{tdbsam}}} password backend. This is a binary database that has excellent scalability for a large number of user account entries.


%--- Item
\item 
\index{WINS serving} \index{wins support} \index{name resolve order} WINS serving is enabled by the \smbconfoption{wins support} = Yes, and name resolution is set to use it by means of the \smbconfoption{name resolve order} = wins bcast hosts entry.


%--- Item
\item 
\index{time server} The Samba server is configured for use by Windows clients as a time server.


%--- Item
\item 
\index{CUPS} \index{printing} \index{printcap name} Samba is configured to directly interface with CUPS via the direct internal interface that is provided by CUPS libraries. This is achieved with the \smbconfoption{printing} = CUPS as well as the \smbconfoption{printcap name} = CUPS entries.


%--- Item
\item 
\index{user management} \index{group management} \index{SRVTOOLS.EXE} External interface scripts are provided to enable Samba to interface smoothly to essential operating system functions for user and group management. This is important to enable workstations to join the Domain and is also important so that you can use the Windows NT4 Domain User Manager as well as the Domain Server Manager. These tools are provided as part of the {\texttt{\docbookhyphenatefilename{SRVTOOLS.\dbz{}EXE}}} toolkit that can be downloaded from the Microsoft FTP site\label{id2482872}\begingroup\catcode`\#=12\footnote{ {\textless}\url{ftp://ftp.microsoft.com/Softlib/MSLFILES/SRVTOOLS.EXE}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2482872}.


%--- Item
\item 
\index{User Mode} The {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file specifies that the Samba server will operate in (default) {\ttfamily\itshape{\docbookhyphenatedot{security = user}}} mode\label{id2482903}\begingroup\catcode`\#=12\footnote{
See {\em{TOSHARG2}}, Chapter 3. This is necessary so that Samba can act as a Domain Controller (PDC); see {\em{TOSHARG2}}, Chapter 4, for additional information.
}\endgroup\docbooktolatexmakefootnoteref{id2482903} (User Mode).


%--- Item
\item 
\index{logon services} \index{logon script} Domain logon services as well as a Domain logon script are specified. The logon script will be used to add robustness to the overall network configuration.


%--- Item
\item 
\index{roaming profiles} \index{logon path} \index{profile share} Roaming profiles are enabled through the specification of the parameter, \smbconfoption{logon path} = \textbackslash \textbackslash \%L\textbackslash profiles\textbackslash \%U. The value of this parameter translates the {\texttt{\docbookhyphenatedot{\%L}}} to the name by which the Samba server is called by the client (for this configuration, it translates to the name {\texttt{\docbookhyphenatedot{DIAMOND}}}), and the {\texttt{\docbookhyphenatedot{\%U}}} will translate to the name of the user within the context of the connection made to the profile share. It is the administrator's responsibility to ensure there is a directory in the root of the profile share for each user. This directory must be owned by the user also. An exception to this requirement is when a profile is created for group use.


%--- Item
\item 
\index{virus} \index{opportunistic locking} Precautionary veto is effected for particular Windows file names that have been targeted by virus-related activity. Additionally, Microsoft Office files are vetoed from opportunistic locking controls. This should help to prevent lock contention-related file access problems.


%--- Item
\item 
Every user has a private home directory on the UNIX/Linux host. This is mapped to a network drive that is the same for all users.

\end{itemize}

The configuration of the server is the most complex so far. The following steps are used:

\begin{enumerate}[1]
%--- Item
\item 
Basic System Configuration


%--- Item
\item 
Samba Configuration


%--- Item
\item 
DHCP and DNS Server Configuration


%--- Item
\item 
Printer Configuration


%--- Item
\item 
Process Start-up Configuration


%--- Item
\item 
Validation


%--- Item
\item 
Application Share Configuration


%--- Item
\item 
Windows Client Configuration

\end{enumerate}

The following sections cover each step in logical and defined detail.
\subsection{Basic System Configuration}
\label{ch4bsc}\hypertarget{ch4bsc}{}%

\index{SUSE Enterprise Linux Server} The preparation in this section assumes that your SUSE Enterprise Linux Server 8.0 system has been freshly installed. It prepares basic files so that the system is ready for comprehensive operation in line with the network diagram shown in \hyperlink{ch04net}{Figure {\ref{ch04net}}}.
Server Configuration Steps\begin{enumerate}

\item{\index{hostname} Using the UNIX/Linux system tools, name the server {\texttt{\docbookhyphenatedot{server.abmas.us}}}. Verify that your hostname is correctly set by running: 
\begin{Verbatim}[]

root#  uname -n
server

\end{Verbatim}
 An alternate method to verify the hostname is: 
\begin{Verbatim}[]

root#  hostname -f
server.abmas.us

\end{Verbatim}
}

\item{\index{/etc/hosts} \index{localhost} Edit your {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}} file to include the primary names and addresses of all network interfaces that are on the host server. This is necessary so that during startup the system can resolve all its own names to the IP address prior to startup of the DNS server. An example of entries that should be in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}} file is: 
\begin{Verbatim}[]

127.0.0.1       localhost
192.168.1.1     sleeth1.abmas.biz sleeth1 diamond
192.168.2.1     sleeth2.abmas.biz sleeth2
123.45.67.66    server.abmas.us server

\end{Verbatim}
 You should check the startup order of your system. If the CUPS print server is started before the DNS server ({\bfseries{named}}), you should also include an entry for the printers in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}} file, as follows: 
\begin{Verbatim}[]

192.168.1.20    qmsa.abmas.biz qmsa
192.168.1.30    hplj6a.abmas.biz hplj6a
192.168.2.20    qmsf.abmas.biz qmsf
192.168.2.30    hplj6f.abmas.biz hplj6f

\end{Verbatim}
 \index{named} \index{cupsd} \index{daemon} The printer entries are not necessary if {\bfseries{named}} is started prior to startup of {\bfseries{cupsd}}, the CUPS daemon.}

\item{\index{/etc/rc.d/boot.local} \index{IP forwarding} \index{/proc/sys/net/ipv4/ip\_forward} The host server is acting as a router between the two internal network segments as well as for all Internet access. This necessitates that IP forwarding be enabled. This can be achieved by adding to the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}rc.\dbz{}d/\dbz{}boot.\dbz{}local}}} an entry as follows: 
\begin{Verbatim}[]

echo 1 > /proc/sys/net/ipv4/ip_forward

\end{Verbatim}
 To ensure that your kernel is capable of IP forwarding during configuration, you may wish to execute that command manually also. This setting permits the Linux system to act as a router.\label{id2523109}\begingroup\catcode`\#=12\footnote{
You may want to do the echo command last and include "0" in the init scripts, since it opens up your network for a short time.
}\endgroup\docbooktolatexmakefootnoteref{id2523109}}

\item{\index{firewall} \index{abmas-netfw.sh} Installation of a basic firewall and NAT facility is necessary. The following script can be installed in the {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}local/\dbz{}sbin}}} directory. It is executed from the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}rc.\dbz{}d/\dbz{}boot.\dbz{}local}}} startup script. In your case, this script is called {\texttt{\docbookhyphenatefilename{abmas-\dbz{}netfw.\dbz{}sh}}}. The script contents are shown in \hyperlink{ch4natfw}{Example {\ref{ch4natfw}}}. 
\begin{example}%
\hypertarget{ch4natfw}{}%
\captionswapskip{}{{\caption{NAT Firewall Configuration Script}\label{ch4natfw}}}
\captionswapskip{}
\begin{Verbatim}[]

#!/bin/sh
echo -e "\n\nLoading NAT firewall.\n"
IPTABLES=/usr/sbin/iptables
EXTIF="eth0"
INTIFA="eth1"
INTIFB="eth2"

/sbin/depmod -a
/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe iptable_nat
/sbin/modprobe ip_nat_ftp
$IPTABLES -P INPUT DROP
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD

$IPTABLES -A INPUT -i lo -j ACCEPT
$IPTABLES -A INPUT -i $INTIFA -j ACCEPT
$IPTABLES -A INPUT -i $INTIFB -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
# Enable incoming traffic for: SSH, SMTP, DNS(tcp), HTTP, HTTPS
for i in 22 25 53 80 443
do
        $IPTABLES -A INPUT -i $EXTIF -p tcp --dport $i  -j ACCEPT
done
# Allow DNS(udp)
$IPTABLES -A INPUT -i $EXTIF -p udp -dport 53  -j ACCEPT
echo "Allow all connections OUT and only existing and specified ones IN"
$IPTABLES -A FORWARD -i $EXTIF -o $INTIFA -m state \
                                  --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $EXTIF -o $INTIFB -m state \
                                  --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIFA -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -i $INTIFB -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -j LOG
echo "   Enabling SNAT (MASQUERADE) functionality on $EXTIF"
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
echo "1" > /proc/sys/net/ipv4/ip_forward
echo -e "\nNAT firewall done.\n"

\end{Verbatim}
\end{example}

}

\item{Execute the following to make the script executable: 
\begin{Verbatim}[]

root#  chmod 755 /usr/local/sbin/abmas-natfw.sh

\end{Verbatim}
 You must now edit {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}rc.\dbz{}d/\dbz{}boot.\dbz{}local}}} to add an entry that runs your {\bfseries{abmas-natfw.sh}} script. The following entry works for you: 
\begin{Verbatim}[]

#! /bin/sh
#
# Copyright (c) 2002 SUSE Linux AG Nuernberg, Germany. 
# All rights reserved.
#
# Author: Werner Fink, 1996
#         Burchard Steinbild, 1996
#
# /etc/init.d/boot.local
#
# script with local commands to be executed from init on system startup
#
# Here you should add things that should happen directly after booting
# before we're going to the first run level.
#
/usr/local/sbin/abmas-natfw.sh

\end{Verbatim}
}
\end{enumerate}

\index{/etc/hosts} The server is now ready for Samba configuration. During the validation step, you remove the entry for the Samba server {\texttt{\docbookhyphenatedot{diamond}}} from the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}} file. This is done after you are satisfied that DNS-based name resolution is functioning correctly.
\subsection{Samba Configuration}
\label{id2523278}\hypertarget{id2523278}{}%

When you have completed this section, the Samba server is ready for testing and validation; however, testing and validation have to wait until DHCP, DNS, and printing (CUPS) services have been configured.
Samba Configuration Steps\begin{enumerate}

\item{Install the Samba-3 binary RPM from the Samba-Team FTP site. Assuming that the binary RPM file is called {\texttt{\docbookhyphenatefilename{samba-\dbz{}3.\dbz{}0.\dbz{}20-\dbz{}1.\dbz{}i386.\dbz{}rpm}}}, one way to install this file is as follows: 
\begin{Verbatim}[]

root#  rpm -Uvh samba-3.0.20-1.i386.rpm

\end{Verbatim}
 This operation must be performed while logged in as the {\bfseries{root}} user. Successful operation is clearly indicated. If this installation should fail for any reason, refer to the operating system manufacturer's documentation for guidance.}

\item{Install the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file shown in \hyperlink{promisnet}{Example {\ref{promisnet}}}, \hyperlink{promisnetsvca}{Example {\ref{promisnetsvca}}}, and \hyperlink{promisnetsvcb}{Example {\ref{promisnetsvcb}}}. Concatenate (join) all three files to make a single {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file. The final, fully qualified path for this file should be {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}smb.\dbz{}conf}}}. 
\begin{example}%
\hypertarget{promisnet}{}%
\captionswapskip{}{{\caption{130 User Network with {\em{tdbsam}} ---  [globals] Section}\label{promisnet}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	workgroup = PROMISES
 	netbios name = DIAMOND
 	interfaces = eth1, eth2, lo
 	bind interfaces only = Yes
 	passdb backend = tdbsam
 	pam password change = Yes
 	passwd program = /usr/bin/passwd %u
 	passwd chat = *New*Password* %n\n *Re-enter*new*password*%n\n *Password*changed*
 	username map = /etc/samba/smbusers
 	unix password sync = Yes
 	log level = 1
 	syslog = 0
 	log file = /var/log/samba/%m
 	max log size = 50
 	smb ports = 139
 	name resolve order = wins bcast hosts
 	time server = Yes
 	printcap name = CUPS
 	show add printer wizard = No
 	add user script = /usr/sbin/useradd -m '%u'
 	delete user script = /usr/sbin/userdel -r '%u'
 	add group script = /usr/sbin/groupadd '%g'
 	delete group script = /usr/sbin/groupdel '%g'
 	add user to group script = /usr/sbin/usermod -G '%g' '%u'
 	add machine script = /usr/sbin/useradd -s /bin/false -d /tmp '%u'
 	shutdown script = /var/lib/samba/scripts/shutdown.sh
 	abort shutdown script = /sbin/shutdown -c
 	logon script = scripts\logon.bat
 	logon path = \\%L\profiles\%U
 	logon drive = X:
 	logon home = \\%L\%U
 	domain logons = Yes
 	preferred master = Yes
 	wins support = Yes
 	utmp = Yes
 	map acl inherit = Yes
 	printing = cups
 	cups options = Raw
 	veto files = /*.eml/*.nws/*.{*}/
 	veto oplock files = /*.doc/*.xls/*.mdb/
\end{lstlisting}
\end{example}

 
\begin{example}%
\hypertarget{promisnetsvca}{}%
\captionswapskip{}{{\caption{130 User Network with {\em{tdbsam}} ---  Services Section Part A}\label{promisnetsvca}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[homes]
 	comment = Home Directories
 	valid users = %S
 	read only = No
 	browseable = No
 [printers]
 	comment = SMB Print Spool
 	path = /var/spool/samba
 	guest ok = Yes
 	printable = Yes
 	use client driver = Yes
 	default devmode = Yes
 	browseable = No
 [netlogon]
 	comment = Network Logon Service
 	path = /var/lib/samba/netlogon
 	guest ok = Yes
 	locking = No
 [profiles]
 	comment = Profile Share
 	path = /var/lib/samba/profiles
 	read only = No
 	profile acls = Yes
 [accounts]
 	comment = Accounting Files
 	path = /data/accounts
 	read only = No
\end{lstlisting}
\end{example}

 
\begin{example}%
\hypertarget{promisnetsvcb}{}%
\captionswapskip{}{{\caption{130 User Network with {\em{tdbsam}} ---  Services Section Part B}\label{promisnetsvcb}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[service]
 	comment = Financial Services Files
 	path = /data/service
 	read only = No
 [pidata]
 	comment = Property Insurance Files
 	path = /data/pidata
 	read only = No
 [apps]
 	comment = Application Files
 	path = /apps
 	read only = Yes
 	admin users = bjordan
\end{lstlisting}
\end{example}

}

\item{\index{administrator}\index{smbpasswd} Add the {\texttt{\docbookhyphenatedot{root}}} user to the password backend as follows: 
\begin{Verbatim}[]

root#  smbpasswd -a root
New SMB password: XXXXXXXX
Retype new SMB password: XXXXXXXX
root# 

\end{Verbatim}
 The {\texttt{\docbookhyphenatedot{root}}} account is the UNIX equivalent of the Windows Domain Administrator. This account is essential in the regular maintenance of your Samba server. It must never be deleted. If for any reason the account is deleted, you may not be able to recreate this account without considerable trouble.}

\item{\index{username map} Create the username map file to permit the {\texttt{\docbookhyphenatedot{root}}} account to be called {\texttt{\docbookhyphenatedot{Administrator}}} from the Windows network environment. To do this, create the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}smbusers}}} with the following contents: 
\begin{Verbatim}[]

####
# User mapping file
####
# File Format
# -----------
# Unix_ID = Windows_ID
#
# Examples:
# root = Administrator
# janes = "Jane Smith"
# jimbo = Jim Bones
#
# Note: If the name contains a space it must be double quoted.
#       In the example above the name 'jimbo' will be mapped to Windows
#       user names 'Jim' and 'Bones' because the space was not quoted.
#######################################################################
root = Administrator
####
# End of File
####

\end{Verbatim}
}

\item{\index{initGrps.sh} \index{net!groupmap!add} \index{net!groupmap!modify} \index{net!groupmap!list} Create and map Windows Domain Groups to UNIX groups. A sample script is provided in \hyperlink{small}{Chapter {\ref{small}}, {``}Small Office Networking{''}}, \hyperlink{initGrps}{Example {\ref{initGrps}}}. Create a file containing this script. We called ours {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}initGrps.\dbz{}sh}}}. Set this file so it can be executed, and then execute the script. Sample output should be as follows: 
\begin{example}%
\hypertarget{ch4initGrps}{}%
\captionswapskip{}{{\caption{Script to Map Windows NT Groups to UNIX Groups}\label{ch4initGrps}}}
\captionswapskip{}\index{initGrps.sh}
\begin{Verbatim}[]

#!/bin/bash
#
# initGrps.sh
#

# Create UNIX groups
groupadd acctsdep
groupadd finsrvcs

# Map Windows Domain Groups to UNIX groups
net groupmap add ntgroup="Domain Admins"  unixgroup=root type=d
net groupmap add ntgroup="Domain Users"   unixgroup=users type=d
net groupmap add ntgroup="Domain Guests"  unixgroup=nobody type=d

# Add Functional Domain Groups
net groupmap add ntgroup="Accounts Dept"  unixgroup=acctsdep type=d
net groupmap add ntgroup="Financial Services" unixgroup=finsrvcs type=d
net groupmap add ntgroup="Insurance Group"     unixgroup=piops type=d

# Map Windows NT machine local groups to local UNIX groups
# Mapping of local groups is not necessary and not functional
# for this installation.

\end{Verbatim}
\end{example}

 
\begin{Verbatim}[]

root#  chmod 755 initGrps.sh
root#  /etc/samba # ./initGrps.sh
Updated mapping entry for Domain Admins
Updated mapping entry for Domain Users
Updated mapping entry for Domain Guests
No rid or sid specified, choosing algorithmic mapping
Successfully added group Accounts Dept to the mapping db
No rid or sid specified, choosing algorithmic mapping
Successfully added group Domain Guests to the mapping db

root#  /etc/samba # net groupmap list | sort
Account Operators (S-1-5-32-548) -> -1
Accounts Dept (S-1-5-21-179504-2437109-488451-2003) -> acctsdep
Administrators (S-1-5-32-544) -> -1
Backup Operators (S-1-5-32-551) -> -1
Domain Admins (S-1-5-21-179504-2437109-488451-512) -> root
Domain Guests (S-1-5-21-179504-2437109-488451-514) -> nobody
Domain Users (S-1-5-21-179504-2437109-488451-513) -> users
Financial Services (S-1-5-21-179504-2437109-488451-2005) -> finsrvcs
Guests (S-1-5-32-546) -> -1
Power Users (S-1-5-32-547) -> -1
Print Operators (S-1-5-32-550) -> -1
Replicators (S-1-5-32-552) -> -1
System Operators (S-1-5-32-549) -> -1
Users (S-1-5-32-545) -> -1

\end{Verbatim}
}

\item{\index{useradd} \index{adduser} \index{passwd} \index{smbpasswd} \index{/etc/passwd} \index{password!backend} \index{user!management} There is one preparatory step without which you will not have a working Samba network environment. You must add an account for each network user. For each user who needs to be given a Windows Domain account, make an entry in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} file as well as in the Samba password backend. Use the system tool of your choice to create the UNIX system account, and use the Samba {\bfseries{smbpasswd}} to create a Domain user account. There are a number of tools for user management under UNIX, such as {\bfseries{useradd}}, and {\bfseries{adduser}}, as well as a plethora of custom tools. You also want to create a home directory for each user. You can do this by executing the following steps for each user: 
\begin{Verbatim}[]

root#  useradd -m username
root#  passwd username
Changing password for username.
New password: XXXXXXXX
Re-enter new password: XXXXXXXX
Password changed
root#  smbpasswd -a username
New SMB password: XXXXXXXX
Retype new SMB password: XXXXXXXX
Added user username.

\end{Verbatim}
 You do of course use a valid user login ID in place of {\ttfamily\itshape{\docbookhyphenatedot{username}}}.}

\item{\index{file system!access control} \index{file system!permissions} \index{group membership} Using the preferred tool for your UNIX system, add each user to the UNIX groups created previously as necessary. File system access control will be based on UNIX group membership.}

\item{Create the directory mount point for the disk subsystem that can be mounted to provide data storage for company files. In this case the mount point is indicated in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file is {\texttt{\docbookhyphenatefilename{/\dbz{}data}}}. Format the file system as required, and mount the formatted file system partition using appropriate system tools.}

\item{\index{file system!permissions} Create the top-level file storage directories for data and applications as follows: 
\begin{Verbatim}[]

root#  mkdir -p /data/{accounts,finsrvcs}
root#  mkdir -p /apps
root#  chown -R root:root /data
root#  chown -R root:root /apps
root#  chown -R bjordan:acctsdep /data/accounts
root#  chown -R bjordan:finsrvcs /data/finsrvcs
root#  chmod -R ug+rwxs,o-rwx /data
root#  chmod -R ug+rwx,o+rx-w /apps

\end{Verbatim}
 Each department is responsible for creating its own directory structure within the departmental share. The directory root of the {\bfseries{accounts}} share is {\texttt{\docbookhyphenatefilename{/\dbz{}data/\dbz{}accounts}}}. The directory root of the {\bfseries{finsvcs}} share is {\texttt{\docbookhyphenatefilename{/\dbz{}data/\dbz{}finsvcs}}}. The {\texttt{\docbookhyphenatefilename{/\dbz{}apps}}} directory is the root of the {\texttt{\docbookhyphenatedot{apps}}} share that provides the application server infrastructure.}

\item{The {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file specifies an infrastructure to support roaming profiles and network logon services. You can now create the file system infrastructure to provide the locations on disk that these services require. Adequate planning is essential, since desktop profiles can grow to be quite large. For planning purposes, a minimum of 200 MB of storage should be allowed per user for profile storage. The following commands create the directory infrastructure needed: 
\begin{Verbatim}[]

root#  mkdir -p /var/spool/samba 
root#  mkdir -p /var/lib/samba/{netlogon/scripts,profiles}
root#  chown -R root:root /var/spool/samba
root#  chown -R root:root /var/lib/samba
root#  chmod a+rwxt /var/spool/samba
root#  chmod 2775 /var/lib/samba/profiles
root#  chgrp users /var/lib/samba/profiles

\end{Verbatim}
 For each user account that is created on the system, the following commands should be executed: 
\begin{Verbatim}[]

root#  mkdir /var/lib/samba/profiles/'username'
root#  chown 'username':users /var/lib/samba/profiles/'username'
root#  chmod ug+wrx,o+rx,-w /var/lib/samba/profiles/'username'

\end{Verbatim}
}

\item{\index{logon scrip} \index{unix2dos} \index{dos2unix} Create a logon script. It is important that each line is correctly terminated with a carriage return and line-feed combination (i.e., DOS encoding). The following procedure works if the right tools ({\texttt{\docbookhyphenatedot{unix2dos}}} and {\texttt{\docbookhyphenatedot{dos2unix}}}) are installed. First, create a file called {\texttt{\docbookhyphenatefilename{/\dbz{}var/\dbz{}lib/\dbz{}samba/\dbz{}netlogon/\dbz{}scripts/\dbz{}logon.\dbz{}bat.\dbz{}unix}}} with the following contents: 
\begin{Verbatim}[]

net time \\diamond /set /yes
net use h: /home
net use p: \\diamond\apps

\end{Verbatim}
 Convert the UNIX file to a DOS file using the {\bfseries{unix2dos}} as shown here: 
\begin{Verbatim}[]

root#  unix2dos < /var/lib/samba/netlogon/scripts/logon.bat.unix \
	> /var/lib/samba/netlogon/scripts/logon.bat

\end{Verbatim}
}
\end{enumerate}
\subsection{Configuration of DHCP and DNS Servers}
\label{ch4dhcpdns}\hypertarget{ch4dhcpdns}{}%

DHCP services are a basic component of the entire network client installation. DNS operation is foundational to Internet access as well as to trouble-free operation of local networking. When you have completed this section, the server should be ready for solid duty operation.
DHCP and DNS Server Configuration Steps\begin{enumerate}

\item{\index{/etc/dhcpd.conf} Create a file called {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}dhcpd.\dbz{}conf}}} with the contents as shown in \hyperlink{prom-dhcp}{Example {\ref{prom-dhcp}}}. 
\begin{example}%
\hypertarget{prom-dhcp}{}%
\captionswapskip{}{{\caption{DHCP Server Configuration File ---  /\dbz{}etc/\dbz{}dhcpd.\dbz{}conf}\label{prom-dhcp}}}
\captionswapskip{}
\begin{Verbatim}[]

# Abmas Accounting Inc.
default-lease-time 86400;
max-lease-time 172800;
default-lease-time 86400;
option ntp-servers 192.168.1.1;
option domain-name "abmas.biz";
option domain-name-servers 192.168.1.1, 192.168.2.1;
option netbios-name-servers 192.168.1.1, 192.168.2.1;
option netbios-node-type 8;       ### Node type = Hybrid ###
ddns-updates on;                  ### Dynamic DNS enabled ###
ddns-update-style interim;

subnet 192.168.1.0 netmask 255.255.255.0 {
        range dynamic-bootp 192.168.1.128 192.168.1.254;
        option subnet-mask 255.255.255.0;
        option routers 192.168.1.1;
        allow unknown-clients;
        host qmsa {
                hardware ethernet 08:00:46:7a:35:e4;
                fixed-address 192.168.1.20;
                }
        host hplj6a {
                hardware ethernet 00:03:47:cb:81:e0;
                fixed-address 192.168.1.30;
                }
        }
subnet 192.168.2.0 netmask 255.255.255.0 {
        range dynamic-bootp 192.168.2.128 192.168.2.254;
        option subnet-mask 255.255.255.0;
        option routers 192.168.2.1;
        allow unknown-clients;
        host qmsf {
                hardware ethernet 01:04:31:db:e1:c0;
                fixed-address 192.168.1.20;
        	}
        host hplj6f {
                hardware ethernet 00:03:47:cf:83:e2;
                fixed-address 192.168.2.30;
                }
	}
subnet 127.0.0.0 netmask 255.0.0.0 {
        }
subnet 123.45.67.64 netmask 255.255.255.252 {
        }

\end{Verbatim}
\end{example}

}

\item{\index{/etc/named.conf} Create a file called {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}named.\dbz{}conf}}} that has the combined contents of the \hyperlink{ch4namedcfg}{Example {\ref{ch4namedcfg}}}, \hyperlink{ch4namedvarfwd}{Example {\ref{ch4namedvarfwd}}}, and \hyperlink{ch4namedvarrev}{Example {\ref{ch4namedvarrev}}} files that are concatenated (merged) in this specific order.}

\item{Create the files shown in their respective directories as shown in \hyperlink{namedrscfiles}{Table {\ref{namedrscfiles}}}. 
% table ------------------------------------------------------
\begin{table}[htb]
\begin{center}%
\hypertarget{namedrscfiles}{}%
\captionswapskip{}{{\caption{DNS (named) Resource Files}\label{namedrscfiles}}}
\captionswapskip{}\begin{tabular}{|l|l|}
\hline 
{{{\bfseries Reference}}} & {{{\bfseries File Location}}} \tabularnewline
 \hline 
{{\hyperlink{loopback}{Example {\ref{loopback}}}}} & {{/var/lib/named/localhost.zone}} \tabularnewline
 \hline 
{{\hyperlink{dnsloopy}{Example {\ref{dnsloopy}}}}} & {{/var/lib/named/127.0.0.zone}} \tabularnewline
 \hline 
{{\hyperlink{roothint}{Example {\ref{roothint}}}}} & {{/var/lib/named/root.hint}} \tabularnewline
 \hline 
{{\hyperlink{abmasbiz}{Example {\ref{abmasbiz}}}}} & {{/var/lib/named/master/abmas.biz.hosts}} \tabularnewline
 \hline 
{{\hyperlink{abmasus}{Example {\ref{abmasus}}}}} & {{/var/lib/named/abmas.us.hosts}} \tabularnewline
 \hline 
{{\hyperlink{eth1zone}{Example {\ref{eth1zone}}}}} & {{/var/lib/named/192.168.1.0.rev}} \tabularnewline
 \hline 
{{\hyperlink{eth2zone}{Example {\ref{eth2zone}}}}} & {{/var/lib/named/192.168.2.0.rev}} \tabularnewline
\hline 
\end{tabular}
\end{center}
\end{table}

 
\begin{example}%
\hypertarget{ch4namedcfg}{}%
\captionswapskip{}{{\caption{DNS Master Configuration File ---  /\dbz{}etc/\dbz{}named.\dbz{}conf Master Section}\label{ch4namedcfg}}}
\captionswapskip{}\index{/etc/named.conf}
\begin{Verbatim}[]

###
# Abmas Biz DNS Control File
###
# Date: November 15, 2003
###
options {
	directory "/var/lib/named";
	forwarders {
		123.45.12.23;
		};
	forward first;
	listen-on {
		mynet;
		};
	auth-nxdomain yes;
	multiple-cnames yes;
	notify no;
};

zone "." in {
	type hint;
	file "root.hint";
};

zone "localhost" in {
	type master;
	file "localhost.zone";
};

zone "0.0.127.in-addr.arpa" in {
	type master;
	file "127.0.0.zone";
};

acl mynet {
	192.168.1.0/24;
	192.168.2.0/24;
	127.0.0.1;
};

acl seconddns {
	123.45.54.32;
};


\end{Verbatim}
\end{example}

 
\begin{example}%
\hypertarget{ch4namedvarfwd}{}%
\captionswapskip{}{{\caption{DNS Master Configuration File ---  /\dbz{}etc/\dbz{}named.\dbz{}conf Forward Lookup Definition Section}\label{ch4namedvarfwd}}}
\captionswapskip{}
\begin{Verbatim}[]

zone "abmas.biz" {
	type master;
	file "/var/lib/named/master/abmas.biz.hosts";
	allow-query {
		mynet;
	};
	allow-transfer {
		mynet;
	};
	allow-update {
		mynet;
	};
};

zone "abmas.us" {
	type master;
	file "/var/lib/named/master/abmas.us.hosts";
	allow-query {
		any;
	};
	allow-transfer {
		seconddns;
	};
};

\end{Verbatim}
\end{example}

 
\begin{example}%
\hypertarget{ch4namedvarrev}{}%
\captionswapskip{}{{\caption{DNS Master Configuration File ---  /\dbz{}etc/\dbz{}named.\dbz{}conf Reverse Lookup Definition Section}\label{ch4namedvarrev}}}
\captionswapskip{}
\begin{Verbatim}[]

zone "1.168.192.in-addr.arpa" {
	type master;
	file "/var/lib/named/master/192.168.1.0.rev";
	allow-query {
		mynet;
	};
	allow-transfer {
		mynet;
	};
	allow-update {
		mynet;
	};
};

zone "2.168.192.in-addr.arpa" {
	type master;
	file "/var/lib/named/master/192.168.2.0.rev";
	allow-query {
		mynet;
	};
	allow-transfer {
		mynet;
	};
	allow-update {
		mynet;
	};
};

\end{Verbatim}
\end{example}

 
\begin{example}%
\hypertarget{eth1zone}{}%
\captionswapskip{}{{\caption{DNS 192.168.1 Reverse Zone File}\label{eth1zone}}}
\captionswapskip{}
\begin{Verbatim}[]

$ORIGIN .
$TTL 38400	; 10 hours 40 minutes
1.168.192.in-addr.arpa	IN SOA	sleeth.abmas.biz. root.abmas.biz. (
				2003021825 ; serial
				10800      ; refresh (3 hours)
				3600       ; retry (1 hour)
				604800     ; expire (1 week)
				38400      ; minimum (10 hours 40 minutes)
				)
			NS	sleeth1.abmas.biz.
$ORIGIN 1.168.192.in-addr.arpa.
1			PTR	sleeth1.abmas.biz.
20			PTR	qmsa.abmas.biz.
30			PTR	hplj6a.abmas.biz.

\end{Verbatim}
\end{example}

 
\begin{example}%
\hypertarget{eth2zone}{}%
\captionswapskip{}{{\caption{DNS 192.168.2 Reverse Zone File}\label{eth2zone}}}
\captionswapskip{}
\begin{Verbatim}[]

$ORIGIN .
$TTL 38400	; 10 hours 40 minutes
2.168.192.in-addr.arpa	IN SOA	sleeth.abmas.biz. root.abmas.biz. (
				2003021825 ; serial
				10800      ; refresh (3 hours)
				3600       ; retry (1 hour)
				604800     ; expire (1 week)
				38400      ; minimum (10 hours 40 minutes)
				)
			NS	sleeth2.abmas.biz.
$ORIGIN 2.168.192.in-addr.arpa.
1			PTR	sleeth2.abmas.biz.
20			PTR	qmsf.abmas.biz.
30			PTR	hplj6f.abmas.biz.

\end{Verbatim}
\end{example}

 
\begin{example}%
\hypertarget{abmasbiz}{}%
\captionswapskip{}{{\caption{DNS Abmas.biz Forward Zone File}\label{abmasbiz}}}
\captionswapskip{}
\begin{Verbatim}[]

$ORIGIN .
$TTL 38400      ; 10 hours 40 minutes
abmas.biz       IN SOA  sleeth1.abmas.biz. root.abmas.biz. (
                                2003021833 ; serial
                                10800      ; refresh (3 hours)
                                3600       ; retry (1 hour)
                                604800     ; expire (1 week)
                                38400      ; minimum (10 hours 40 minutes)
                                )
                        NS      dns.abmas.biz.
                        MX      10 mail.abmas.biz.
$ORIGIN abmas.biz.
sleeth1                 A       192.168.1.1
sleeth2                 A       192.168.2.1
qmsa                    A       192.168.1.20
hplj6a                  A       192.168.1.30
qmsf                    A       192.168.2.20
hplj6f                  A       192.168.2.30
dns                     CNAME   sleeth1
diamond                 CNAME   sleeth1
mail                    CNAME   sleeth1

\end{Verbatim}
\end{example}

 
\begin{example}%
\hypertarget{abmasus}{}%
\captionswapskip{}{{\caption{DNS Abmas.us Forward Zone File}\label{abmasus}}}
\captionswapskip{}
\begin{Verbatim}[]

$ORIGIN .
$TTL 38400      ; 10 hours 40 minutes
abmas.us        IN SOA  server.abmas.us. root.abmas.us. (
                                2003021833 ; serial
                                10800      ; refresh (3 hours)
                                3600       ; retry (1 hour)
                                604800     ; expire (1 week)
                                38400      ; minimum (10 hours 40 minutes)
                                )
                        NS      dns.abmas.us.
                        NS      dns2.abmas.us.
                        MX      10 mail.abmas.us.
$ORIGIN abmas.us.
server                  A       123.45.67.66
dns2                    A       123.45.54.32
gw                      A       123.45.67.65
www                     CNAME   server
mail                    CNAME   server
dns                     CNAME   server

\end{Verbatim}
\end{example}

}

\item{\index{/etc/resolv.conf}\index{name resolution} All DNS name resolution should be handled locally. To ensure that the server is configured correctly to handle this, edit {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}resolv.\dbz{}conf}}} to have the following content: 
\begin{Verbatim}[]

search abmas.us abmas.biz
nameserver 127.0.0.1
nameserver 123.45.54.23

\end{Verbatim}
 \index{DNS server} This instructs the name resolver function (when configured correctly) to ask the DNS server that is running locally to resolve names to addresses. In the event that the local name server is not available, ask the name server provided by the ISP. The latter, of course, does not resolve purely local names to IP addresses.}

\item{\index{/etc/nsswitch.conf} The final step is to edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file. This file controls the operation of the various resolver libraries that are part of the Linux Glibc libraries. Edit this file so that it contains the following entries: 
\begin{Verbatim}[]

hosts:      files dns wins

\end{Verbatim}
}
\end{enumerate}

The basic DHCP and DNS services are now ready for validation testing. Before you can proceed, there are a few more steps along the road. First, configure the print spooling and print processing system. Then you can configure the server so that all services start automatically on reboot. You must also manually start all services prior to validation testing.
\subsection{Printer Configuration}
\label{ch4ptrcfg}\hypertarget{ch4ptrcfg}{}%

Network administrators who are new to CUPS based-printing typically experience some difficulty mastering its powerful features. The steps outlined in this section are designed to navigate around the distractions of learning CUPS. Instead of implementing smart features and capabilities, our approach is to use it as a transparent print queue that performs no filtering, and only minimal handling of each print job that is submitted to it. In other words, our configuration turns CUPS into a raw-mode print queue. This means that the correct printer driver must be installed on all clients.
Printer Configuration Steps\begin{enumerate}

\item{Configure each printer to be a DHCP client, carefully following the manufacturer's guidelines.}

\item{Follow the instructions in the printer manufacturer's manuals to permit printing to port 9100. Use any other port the manufacturer specifies for direct-mode raw printing, and adjust the port as necessary in the following example commands. This allows the CUPS spooler to print using raw mode protocols. \index{CUPS} \index{raw printing}}

\item{\index{CUPS!queue}\index{lpadmin} Configure the CUPS Print Queues as follows: 
\begin{Verbatim}[]

root#  lpadmin -p qmsa -v socket://qmsa.abmas.biz:9100 -E
root#  lpadmin -p hplj6a -v socket://hplj6a.abmas.biz:9100 -E
root#  lpadmin -p qmsf -v socket://qmsf.abmas.biz:9100 -E
root#  lpadmin -p hplj6f -v socket://hplj6f.abmas.biz:9100 -E

\end{Verbatim}
 \index{print filter} This creates the necessary print queues with no assigned print filter.}

\item{\index{enable} Print queues may not be enabled at creation. Use {\bfseries{lpc stat}} to check the status of the print queues and, if necessary, make certain that the queues you have just created are enabled by executing the following: 
\begin{Verbatim}[]

root#  /usr/bin/enable qmsa
root#  /usr/bin/enable hplj6a
root#  /usr/bin/enable qmsf
root#  /usr/bin/enable hplj6f

\end{Verbatim}
}

\item{\index{accept} Even though your print queues may be enabled, it is still possible that they are not accepting print jobs. A print queue services incoming printing requests only when configured to do so. Ensure that your print queues are set to accept incoming jobs by executing the following commands: 
\begin{Verbatim}[]

root#  /usr/sbin/accept qmsa
root#  /usr/sbin/accept hplj6a
root#  /usr/sbin/accept qmsf
root#  /usr/sbin/accept hplj6f

\end{Verbatim}
}

\item{\index{mime type} \index{/etc/mime.convs} \index{application/octet-stream} Edit the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}cups/\dbz{}mime.\dbz{}convs}}} to uncomment the line: 
\begin{Verbatim}[]

application/octet-stream     application/vnd.cups-raw      0     -

\end{Verbatim}
}

\item{\index{/etc/mime.types} Edit the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}cups/\dbz{}mime.\dbz{}types}}} to uncomment the line: 
\begin{Verbatim}[]

application/octet-stream

\end{Verbatim}
}

\item{Printing drivers are installed on each network client workstation.}
\end{enumerate}

Note: If the parameter {\ttfamily\itshape{\docbookhyphenatedot{cups options = Raw}}} is specified in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file, the last two steps can be omitted with CUPS version 1.1.18, or later.

The UNIX system print queues have been configured and are ready for validation testing.
\subsection{Process Startup Configuration}
\label{procstart}\hypertarget{procstart}{}%

\index{chkconfig} There are two essential steps to process startup configuration. First, the process must be configured so that it automatically restarts each time the server is rebooted. This step involves use of the {\bfseries{chkconfig}} tool that creates the appropriate symbolic links from the master daemon control file that is located in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}rc.\dbz{}d}}} directory, to the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}rc'x'.\dbz{}d}}} directories. Links are created so that when the system run level is changed, the necessary start or kill script is run.

\index{/etc/xinetd.d} \index{inetd} \index{xinetd} \index{chkconfig} \index{super daemon} In the event that a service is not run as a daemon, but via the internetworking super daemon ({\bfseries{inetd}} or {\bfseries{xinetd}}), then the {\bfseries{chkconfig}} tool makes the necessary entries in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}xinetd.\dbz{}d}}} directory and sends a hang-up (HUP) signal to the the super daemon, thus forcing it to re-read its control files.

Last, each service must be started to permit system validation to proceed.
\begin{enumerate}

\item{Use the standard system tool to configure each service to restart automatically at every system reboot. For example, \index{chkconfig} 
\begin{Verbatim}[]

root#  chkconfig dhpcd on
root#  chkconfig named on
root#  chkconfig cups on
root#  chkconfig smb on

\end{Verbatim}
}

\item{\index{starting dhcpd} \index{starting samba} \index{starting CUPS} Now start each service to permit the system to be validated. Execute each of the following in the sequence shown: 
\begin{Verbatim}[]

root#  /etc/rc.d/init.d/dhcpd restart
root#  /etc/rc.d/init.d/named restart
root#  /etc/rc.d/init.d/cups restart
root#  /etc/rc.d/init.d/smb restart

\end{Verbatim}
}
\end{enumerate}
\subsection{Validation}
\label{ch4valid}\hypertarget{ch4valid}{}%

\index{validation} Complex networking problems are most often caused by simple things that are poorly or incorrectly configured. The validation process adopted here should be followed carefully; it is the result of the experience gained from years of making and correcting the most common mistakes. Shortcuts often lead to basic errors. You should refrain from taking shortcuts, from making basic assumptions, and from not exercising due process and diligence in network validation. By thoroughly testing and validating every step in the process of network installation and configuration, you can save yourself from sleepless nights and restless days. A well debugged network is a foundation for happy network users and network administrators. Later in this book you learn how to make users happier. For now, it is enough to learn to validate. Let's get on with it.
Server Validation Steps\begin{enumerate}

\item{\index{/etc/nsswitch.conf} One of the most important facets of Samba configuration is to ensure that name resolution functions correctly. You can check name resolution with a few simple tests. The most basic name resolution is provided from the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}} file. To test its operation, make a temporary edit to the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file. Using your favorite editor, change the entry for {\texttt{\docbookhyphenatedot{hosts}}} to read: 
\begin{Verbatim}[]

hosts:     files

\end{Verbatim}
 When you have saved this file, execute the following command: 
\begin{Verbatim}[]

root#  ping diamond
PING sleeth1.abmas.biz (192.168.1.1) 56(84) bytes of data.
64 bytes from sleeth1 (192.168.1.1): icmp_seq=1 ttl=64 time=0.131 ms
64 bytes from sleeth1 (192.168.1.1): icmp_seq=2 ttl=64 time=0.179 ms
64 bytes from sleeth1 (192.168.1.1): icmp_seq=3 ttl=64 time=0.192 ms
64 bytes from sleeth1 (192.168.1.1): icmp_seq=4 ttl=64 time=0.191 ms

--- sleeth1.abmas.biz ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3016ms
rtt min/avg/max/mdev = 0.131/0.173/0.192/0.026 ms

\end{Verbatim}
 This proves that name resolution via the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}} file is working.}

\item{\index{/etc/nsswitch.conf} So far, your installation is going particularly well. In this step we validate DNS server and name resolution operation. Using your favorite UNIX system editor, change the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file so that the {\texttt{\docbookhyphenatedot{hosts}}} entry reads: 
\begin{Verbatim}[]

hosts:        dns

\end{Verbatim}
}

\item{\index{named} Before you test DNS operation, it is a good idea to verify that the DNS server is running by executing the following: 
\begin{Verbatim}[]

root#  ps ax | grep named
  437 ?        S      0:00 /sbin/syslogd -a /var/lib/named/dev/log
  524 ?        S      0:00 /usr/sbin/named -t /var/lib/named -u named
  525 ?        S      0:00 /usr/sbin/named -t /var/lib/named -u named
  526 ?        S      0:00 /usr/sbin/named -t /var/lib/named -u named
  529 ?        S      0:00 /usr/sbin/named -t /var/lib/named -u named
  540 ?        S      0:00 /usr/sbin/named -t /var/lib/named -u named
 2552 pts/2    S      0:00 grep named

\end{Verbatim}
 This means that we are ready to check DNS operation. Do so by executing: \index{ping} 
\begin{Verbatim}[]

root#  ping diamond
PING sleeth1.abmas.biz (192.168.1.1) 56(84) bytes of data.
64 bytes from sleeth1 (192.168.1.1): icmp_seq=1 ttl=64 time=0.156 ms
64 bytes from sleeth1 (192.168.1.1): icmp_seq=2 ttl=64 time=0.183 ms

--- sleeth1.abmas.biz ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.156/0.169/0.183/0.018 ms

\end{Verbatim}
 You should take a few more steps to validate DNS server operation, as follows: 
\begin{Verbatim}[]

root#  host -f diamond.abmas.biz
sleeth1.abmas.biz has address 192.168.1.1

\end{Verbatim}
 \index{/etc/hosts} You may now remove the entry called {\texttt{\docbookhyphenatedot{diamond}}} from the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}} file. It does not hurt to leave it there, but its removal reduces the number of administrative steps for this name.}

\item{\index{/etc/nsswitch.conf} WINS is a great way to resolve NetBIOS names to their IP address. You can test the operation of WINS by starting {\bfseries{nmbd}} (manually or by way of the Samba startup method shown in \hyperlink{procstart}{Section {\ref{procstart}}}). You must edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file so that the {\texttt{\docbookhyphenatedot{hosts}}} entry is as follows: 
\begin{Verbatim}[]

hosts:        wins

\end{Verbatim}
 The next step is to make certain that Samba is running using {\bfseries{ps ax \docbooktolatexpipe{} grep mbd}}. The {\bfseries{nmbd}} daemon will provide the WINS name resolution service when the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file \smbconfsection{} parameter \smbconfoption{wins    support} = Yes has been specified. Having validated that Samba is operational, excute the following: 
\begin{Verbatim}[]

root#  ping diamond
PING diamond (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.094 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.479 ms

\end{Verbatim}
 \index{ping} Now that you can relax with the knowledge that all three major forms of name resolution to IP address resolution are working, edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} again. This time you add all three forms of name resolution to this file. Your edited entry for {\texttt{\docbookhyphenatedot{hosts}}} should now look like this: 
\begin{Verbatim}[]

hosts:       files dns wins

\end{Verbatim}
 The system is looking good. Let's move on.}

\item{It would give you peace of mind to know that the DHCP server is running and available for service. You can validate DHCP services by running: 
\begin{Verbatim}[]

root#  ps ax | grep dhcp
 2618 ?        S      0:00 /usr/sbin/dhcpd ...
 8180 pts/2    S      0:00 grep dhcp

\end{Verbatim}
 This shows that the server is running. The proof of whether or not it is working comes when you try to add the first DHCP client to the network.}

\item{\index{testparm} This is a good point at which to start validating Samba operation. You are content that name resolution is working for basic TCP/IP needs. Let's move on. If your {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file has bogus options or parameters, this may cause Samba to refuse to start. The first step should always be to validate the contents of this file by running: 
\begin{Verbatim}[]

root#  testparm -s
Load smb config files from smb.conf
Processing section "[homes]"
Processing section "[printers]"
Processing section "[netlogon]"
Processing section "[profiles]"
Processing section "[accounts]"
Processing section "[service]"
Processing section "[apps]"
Loaded services file OK.
# Global parameters
[global]
    workgroup = PROMISES
    netbios name = DIAMOND
    interfaces = eth1, eth2, lo
    bind interfaces only = Yes
    passdb backend = tdbsam
    pam password change = Yes
    passwd program = /usr/bin/passwd '%u'
    passwd chat = *New*Password* %n\n \
             *Re-enter*new*password* %n\n *Password*changed*
    username map = /etc/samba/smbusers
    unix password sync = Yes
    log level = 1
    syslog = 0
    log file = /var/log/samba/%m
    max log size = 50
    smb ports = 139
    name resolve order = wins bcast hosts
    time server = Yes
    printcap name = CUPS
    show add printer wizard = No
    add user script = /usr/sbin/useradd -m '%u'
    delete user script = /usr/sbin/userdel -r '%u'
    add group script = /usr/sbin/groupadd '%g'
    delete group script = /usr/sbin/groupdel '%g'
    add user to group script = /usr/sbin/usermod -G '%g' '%u'
    add machine script = /usr/sbin/useradd \
                              -s /bin/false -d /dev/null '%u'
    shutdown script = /var/lib/samba/scripts/shutdown.sh
    abort shutdown script = /sbin/shutdown -c
    logon script = scripts\logon.bat
    logon path = \\%L\profiles\%U
    logon drive = X:
    logon home = \\%L\%U
    domain logons = Yes
    preferred master = Yes
    wins support = Yes
    utmp = Yes
    winbind use default domain = Yes
    map acl inherit = Yes
    cups options = Raw
    veto files = /*.eml/*.nws/*.{*}/
    veto oplock files = /*.doc/*.xls/*.mdb/

[homes]
    comment = Home Directories
    valid users = %S
    read only = No
    browseable = No
...
### Remainder cut to save space ###

\end{Verbatim}
 Clear away all errors before proceeding.}

\item{\index{check samba daemons} \index{smbd} \index{nmbd} \index{winbindd} Check that the Samba server is running: 
\begin{Verbatim}[]

root#  ps ax | grep mbd
14244 ?        S      0:00 /usr/sbin/nmbd -D
14245 ?        S      0:00 /usr/sbin/nmbd -D
14290 ?        S      0:00 /usr/sbin/smbd -D

$rootprompt; ps ax | grep winbind
14293 ?        S     0:00 /usr/sbin/winbindd -B
14295 ?        S     0:00 /usr/sbin/winbindd -B

\end{Verbatim}
 The {\bfseries{winbindd}} daemon is running in split mode (normal), so there are also two instances\label{id2526354}\begingroup\catcode`\#=12\footnote{
For more information regarding winbindd, see {\em{TOSHARG2}}, Chapter 23, Section 23.3. The single instance of {\bfseries{smbd}} is normal. One additional {\bfseries{smbd}} slave process is spawned for each SMB/CIFS client connection.
}\endgroup\docbooktolatexmakefootnoteref{id2526354} of it.}

\item{\index{anonymous connection} \index{smbclient} Check that an anonymous connection can be made to the Samba server: 
\begin{Verbatim}[]

root#  smbclient -L localhost -U%

        Sharename      Type      Comment
        ---------      ----      -------
        IPC$           IPC       IPC Service (Samba 3.0.20)
        netlogon       Disk      Network Logon Service
        profiles       Disk      Profile Share
        accounts       Disk      Accounting Files
        service        Disk      Financial Services Files
        apps           Disk      Application Files
        ADMIN$         IPC       IPC Service (Samba 3.0.20)
        hplj6a         Printer   hplj6a
        hplj6f         Printer   hplj6f
        qmsa           Printer   qmsa
        qmsf           Printer   qmsf

        Server               Comment
        ---------            -------
        DIAMOND              Samba 3.0.20

        Workgroup            Master
        ---------            -------
        PROMISES             DIAMOND

\end{Verbatim}
 This demonstrates that an anonymous listing of shares can be obtained. This is the equivalent of browsing the server from a Windows client to obtain a list of shares on the server. The {\texttt{\docbookhyphenatedot{-U\%}}} argument means to send a {\texttt{\docbookhyphenatedot{NULL}}} username and a {\texttt{\docbookhyphenatedot{NULL}}} password.}

\item{\index{dhcp client validation} \index{printer validation} \index{arp} Verify that each printer has the IP address assigned in the DHCP server configuration file. The easiest way to do this is to ping the printer name. Immediately after the ping response has been received, execute {\bfseries{arp -a}} to find the MAC address of the printer that has responded. Now you can compare the IP address and the MAC address of the printer with the configuration information in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}dhcpd.\dbz{}conf}}} file. They should, of course, match. For example, 
\begin{Verbatim}[]

root#  ping hplj6
PING hplj6a (192.168.1.30) 56(84) bytes of data.
64 bytes from hplj6a (192.168.1.30): icmp_seq=1 ttl=64 time=0.113 ms

root#  arp -a
hplj6a (192.168.1.30) at 00:03:47:CB:81:E0 [ether] on eth0

\end{Verbatim}
 \index{/etc/dhcpd.conf} The MAC address {\texttt{\docbookhyphenatedot{00:03:47:CB:81:E0}}} matches that specified for the IP address from which the printer has responded and with the entry for it in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}dhcpd.\dbz{}conf}}} file. Repeat this for each printer configured.}

\item{\index{authenticated connection} Make an authenticated connection to the server using the {\bfseries{smbclient}} tool: 
\begin{Verbatim}[]

root#  smbclient //diamond/accounts -U gholmes
Password: XXXXXXX
smb: \> dir
  .                          D        0  Thu Nov 27 15:07:09 2003
  ..                         D        0  Sat Nov 15 17:40:50 2003
  zakadmin.exe                   161424  Thu Nov 27 15:06:52 2003
  zak.exe                       6066384  Thu Nov 27 15:06:52 2003
  dhcpd.conf                       1256  Thu Nov 27 15:06:52 2003
  smb.conf                         2131  Thu Nov 27 15:06:52 2003
  initGrps.sh                A     1089  Thu Nov 27 15:06:52 2003
  POLICY.EXE                      86542  Thu Nov 27 15:06:52 2003

                55974 blocks of size 65536. 33968 blocks available
smb: \> q

\end{Verbatim}
}

\item{\index{nmap} Your new server is connected to an Internet-accessible connection. Before you start your firewall, you should run a port scanner against your system. You should repeat that after the firewall has been started. This helps you understand to what extent the server may be vulnerable to external attack. One way you can do this is by using an external service, such as the DSL Reports\label{id2526598}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.dslreports.com/scan}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2526598} tools. Alternately, if you can gain root-level access to a remote UNIX/Linux system that has the {\bfseries{nmap}} tool, you can run the following: 
\begin{Verbatim}[]

root#  nmap -v -sT server.abmas.us

Starting nmap V. 3.00 ( www.insecure.org/nmap/ )
Host server.abmas.us (123.45.67.66) appears to be up ... good.
Initiating Connect() Scan against server.abmas.us (123.45.67.66)
Adding open port 6000/tcp
Adding open port 873/tcp
Adding open port 445/tcp
Adding open port 10000/tcp
Adding open port 901/tcp
Adding open port 631/tcp
Adding open port 25/tcp
Adding open port 111/tcp
Adding open port 32770/tcp
Adding open port 3128/tcp
Adding open port 53/tcp
Adding open port 80/tcp
Adding open port 443/tcp
Adding open port 139/tcp
Adding open port 22/tcp
The Connect() Scan took 0 seconds to scan 1601 ports.
Interesting ports on server.abmas.us (123.45.67.66):
(The 1587 ports scanned but not shown below are in state: closed)
Port       State       Service
22/tcp     open        ssh
25/tcp     open        smtp
53/tcp     open        domain
80/tcp     open        http
111/tcp    open        sunrpc
139/tcp    open        netbios-ssn
443/tcp    open        https
445/tcp    open        microsoft-ds
631/tcp    open        ipp
873/tcp    open        rsync
901/tcp    open        samba-swat
3128/tcp   open        squid-http
6000/tcp   open        X11
10000/tcp  open        snet-sensor-mgmt
32770/tcp  open        sometimes-rpc3

Nmap run completed -- 1 IP address (1 host up) scanned in 1 second

\end{Verbatim}
 The above scan was run before the external interface was locked down with the NAT-firewall script you created above. The following results are obtained after the firewall rules have been put into place: 
\begin{Verbatim}[]

root#  nmap -v -sT server.abmas.us

Starting nmap V. 3.00 ( www.insecure.org/nmap/ )
Host server.abmas.us (123.45.67.66) appears to be up ... good.
Initiating Connect() Scan against server.abmas.us (123.45.67.66)
Adding open port 53/tcp
Adding open port 22/tcp
The Connect() Scan took 168 seconds to scan 1601 ports.
Interesting ports on server.abmas.us (123.45.67.66):
(The 1593 ports scanned but not shown below are in state: filtered)
Port       State       Service
22/tcp     open        ssh
25/tcp     closed      smtp
53/tcp     open        domain
80/tcp     closed      http
443/tcp    closed      https

Nmap run completed -- 1 IP address (1 host up) scanned in 168 seconds

\end{Verbatim}
}
\end{enumerate}
\subsection{Application Share Configuration}
\label{ch4appscfg}\hypertarget{ch4appscfg}{}%

\index{application server} \index{administrative installation} The use of an application server is a key mechanism by which desktop administration overheads can be reduced. Check the application manual for your software to identify how best to create an administrative installation.

Some Windows software will only run locally on the desktop computer. Such software is typically not suited for administrative installation. Administratively installed software permits one or more of the following installation choices:

\begin{itemize}
%--- Item
\item 
Install software fully onto a workstation, storing data files on the same workstation.


%--- Item
\item 
Install software fully onto a workstation with central network data file storage.


%--- Item
\item 
Install software to run off a central application server with data files stored on the local workstation. This is often called a minimum installation, or a network client installation.


%--- Item
\item 
Install software to run off a central application server with data files stored on a central network share. This type of installation often prevents storage of work files on the local workstation.

\end{itemize}

\index{} A common application deployed in this environment is an office suite. Enterprise editions of Microsoft Office XP Professional can be administratively installed by launching the installation from a command shell. The command that achieves this is {\bfseries{setup /a}}. It results in a set of prompts through which various installation choices can be made. Refer to the Microsoft Office Resource SDK and Resource Kit for more information regarding this mode of installation of MS Office XP Professional. The full administrative installation of MS Office XP Professional requires approximately 650 MB of disk space.

When the MS Office XP Professional product has been installed to the administrative network share, the product can be installed onto a workstation by executing the normal setup program. The installation process now provides a choice to either perform a minimum installation or a full local installation. A full local installation takes over 100 MB of disk space. A network workstation (minimum) installation requires typically 10 MB to 15 MB of local disk space. In the latter case, when the applications are used, they load over the network.

\index{Service Packs} \index{Microsoft Office} Microsoft Office Service Packs can be unpacked to update an administrative share. This makes it possible to update MS Office XP Professional for all users from a single installation of the service pack and generally circumvents the need to run updates on each network Windows client.

The default location for MS Office XP Professional data files can be set through registry editing or by way of configuration options inside each Office XP Professional application.

\index{OpenOffice} OpenOffice.Org OpenOffice Version 1.1.0 can be installed locally. It can also be installed to run off a network share. The latter is a most desirable solution for office-bound network users and for administrative staff alike. It permits quick and easy updates to be rolled out to all users with a minimum of disruption and with maximum flexibility.

The process for installation of administrative shared OpenOffice involves download of the distribution ZIP file, followed by extraction of the ZIP file into a temporary disk area. When fully extracted using the unzipping tool of your choosing, change into the Windows installation files directory then execute {\bfseries{setup -net}}. You are prompted on screen for the target installation location. This is the administrative share point. The full administrative OpenOffice share takes approximately 150 MB of disk space.
\subsubsection{Comments Regarding Software Terms of Use}
\label{id2526850}\hypertarget{id2526850}{}%

Many single-user products can be installed into an administrative share, but personal versions of products such as Microsoft Office XP Professional do not permit this. Many people do not like terms of use typical with commercial products, so a few comments regarding software licensing seem important.

Please do not use an administrative installation of proprietary and commercially licensed software products to violate the copyright holders' property. All software is licensed, particularly software that is licensed for use free of charge. All software is the property of the copyright holder unless the author and/or copyright holder has explicitly disavowed ownership and has placed the software into the public domain.

Software that is under the GNU General Public License, like proprietary software, is licensed in a way that restricts use. For example, if you modify GPL software and then distribute the binary version of your modifications, you must offer to provide the source code as well. This restriction is designed to maintain the momentum of the diffusion of technology and to protect against the withholding of innovations.

Commercial and proprietary software generally restrict use to those who have paid the license fees and who comply with the licensee's terms of use. Software that is released under the GNU General Public License is restricted to particular terms and conditions also. Whatever the licensing terms may be, if you do not approve of the terms of use, please do not use the software.

\index{GPL} Samba is provided under the terms of the GNU GPL Version 2, a copy of which is provided with the source code.
\subsection{Windows Client Configuration}
\label{ch4wincfg}\hypertarget{ch4wincfg}{}%

Christine needs to roll out 130 new desktop systems. There is no doubt that she also needs to reinstall many of the notebook computers that will be recycled for use with the new network configuration. The smartest way to handle the challenge of the roll-out program is to build a staged system for each type of target machine, and then use an image replication tool such as Norton Ghost (enterprise edition) to replicate the staged machine to its target desktops. The same can be done with notebook computers as long as they are identical or sufficiently similar.
Windows Client Configuration Procedure\begin{enumerate}

\item{\index{WINS} \index{DHCP} Install MS Windows XP Professional. During installation, configure the client to use DHCP for TCP/IP protocol configuration. DHCP configures all Windows clients to use the WINS Server address that has been defined for the local subnet.}

\item{Join the Windows Domain {\texttt{\docbookhyphenatedot{PROMISES}}}. Use the Domain Administrator username {\texttt{\docbookhyphenatedot{root}}} and the SMB password you assigned to this account. A detailed step-by-step procedure for joining a Windows 200x/XP Professional client to a Windows Domain is given in \hyperlink{appendix}{Chapter {\ref{appendix}}, {``}A Collection of Useful Tidbits{''}}, \hyperlink{domjoin}{Section {\ref{domjoin}}}. Reboot the machine as prompted and then log on using the Domain Administrator account ({\texttt{\docbookhyphenatedot{root}}}).}

\item{Verify {\texttt{\docbookhyphenatedot{DIAMOND}}} is visible in {\sffamily \bfseries My Network Places}, that it is possible to connect to it and see the shares {\sffamily \bfseries accounts}, {\sffamily \bfseries apps}, and {\sffamily \bfseries finsvcs}, and that it is possible to open each share to reveal its contents.}

\item{Create a drive mapping to the {\texttt{\docbookhyphenatedot{apps}}} share on the server {\texttt{\docbookhyphenatedot{DIAMOND}}}.}

\item{Perform an administrative installation of each application to be used. Select the options that you wish to use. Of course, you can choose to run applications over the network, correct?}

\item{Now install all applications to be installed locally. Typical tools include Adobe Acrobat, NTP-based time synchronization software, drivers for specific local devices such as fingerprint scanners, and the like. Probably the most significant application for local installation is antivirus software.}

\item{Now install all four printers onto the staging system. The printers you install include the accounting department HP LaserJet 6 and Minolta QMS Magicolor printers. You will also configure identical printers that are located in the financial services department. Install printers on each machine following the steps shown in the Windows client printer preparation procedure below.}

\item{\index{defragmentation} When you are satisfied that the staging systems are complete, use the appropriate procedure to remove the client from the domain. Reboot the system and then log on as the local administrator and clean out all temporary files stored on the system. Before shutting down, use the disk defragmentation tool so that the file system is in optimal condition before replication.}

\item{Boot the workstation using the Norton (Symantec) Ghosting diskette (or CD-ROM) and image the machine to a network share on the server.}

\item{\index{Windows security identifier|textit{see} {SID} } \index{SID} You may now replicate the image to the target machines using the appropriate Norton Ghost procedure. Make sure to use the procedure that ensures each machine has a unique Windows security identifier (SID). When the installation of the disk image has completed, boot the PC.}

\item{Log on to the machine as the local Administrator (the only option), and join the machine to the Domain, following the procedure set out in \hyperlink{appendix}{Chapter {\ref{appendix}}, {``}A Collection of Useful Tidbits{''}}, \hyperlink{domjoin}{Section {\ref{domjoin}}}. The system is now ready for the user to log on, provided you have created a network logon account for that user, of course.}

\item{Instruct all users to log on to the workstation using their assigned username and password.}
\end{enumerate}
Windows Client Printer Preparation Procedure\begin{enumerate}

\item{Click {\sffamily \bfseries Start} $\to$ {\sffamily \bfseries Settings} $\to$ {\sffamily \bfseries Printers}+{\sffamily \bfseries Add Printer}+{\sffamily \bfseries Next}. Do not click {\sffamily \bfseries Network printer}. Ensure that {\sffamily \bfseries Local printer} is selected.}

\item{Click {\sffamily \bfseries Next}. In the {\sffamily \bfseries Manufacturer:} panel, select {\texttt{\docbookhyphenatedot{HP}}}. In the {\sffamily \bfseries Printers:} panel, select the printer called {\texttt{\docbookhyphenatedot{HP LaserJet 6}}}. Click {\sffamily \bfseries Next}.}

\item{In the {\sffamily \bfseries Available ports:} panel, select {\texttt{\docbookhyphenatedot{FILE:}}}. Accept the default printer name by clicking {\sffamily \bfseries Next}. When asked, {``}Would you like to print a test page?,{''} click {\sffamily \bfseries No}. Click {\sffamily \bfseries Finish}.}

\item{You may be prompted for the name of a file to print to. If so, close the dialog panel. Right-click {\sffamily \bfseries HP LaserJet 6} $\to$ {\sffamily \bfseries Properties} $\to$ {\sffamily \bfseries Details (Tab)} $\to$ {\sffamily \bfseries Add Port}.}

\item{In the {\sffamily \bfseries Network} panel, enter the name of the print queue on the Samba server as follows: {\texttt{\docbookhyphenatedot{\textbackslash \textbackslash DIAMOND\textbackslash hplj6a}}}. Click {\sffamily \bfseries OK}+{\sffamily \bfseries OK} to complete the installation.}

\item{Repeat the printer installation steps above for both HP LaserJet 6 printers as well as for both QMS Magicolor laser printers.}
\end{enumerate}
\subsection{Key Points Learned}
\label{id2527410}\hypertarget{id2527410}{}%

How do you feel? You have built a capable network, a truly ambitious project. Future network updates can be handled by your staff. You must be a satisfied manager. Let's review the achievements.

\begin{itemize}
%--- Item
\item 
A simple firewall has been configured to protect the server in the event that the ISP firewall service should fail.


%--- Item
\item 
The Samba configuration uses measures to ensure that only local network users can connect to SMB/CIFS services.


%--- Item
\item 
Samba uses the new {\texttt{\docbookhyphenatedot{tdbsam}}} passdb backend facility. Considerable complexity was added to Samba functionality.


%--- Item
\item 
A DHCP server was configured to implement dynamic DNS (DDNS) updates to the DNS server.


%--- Item
\item 
The DNS server was configured to permit DDNS only for local network clients. This server also provides primary DNS services for the company Internet presence.


%--- Item
\item 
You introduced an application server as well as the concept of cloning a Windows client in order to effect improved standardization of desktops and to reduce the costs of network management.

\end{itemize}

% ------------------------   
% Section 
\section{Questions and Answers}
\label{id2527475}\hypertarget{id2527475}{}%


% -------------------------------------------------------------
% QandASet                                                     
% -------------------------------------------------------------
\subsection*{F.A.Q.}
\label{id2527484}
\vspace{1em}
\noindent{}1.~\textbf{Q:}~\textit{What is the maximum number of account entries that the {\ttfamily\itshape{\docbookhyphenatedot{tdbsam}}} passdb backend can handle?}
\newline
\noindent\textbf{A:}~
The tdb data structure and support system can handle more entries than the number of accounts that are possible on most UNIX systems. A practical limit would come into play long before a performance boundary would be anticipated. That practical limit is controlled by the nature of Windows networking. There are few Windows file and print servers that can handle more than a few hundred concurrent client connections. The key limiting factors that predicate offloading of services to additional servers are memory capacity, the number of CPUs, network bandwidth, and disk I/O limitations. All of these are readily exhausted by just a few hundred concurrent active users. Such bottlenecks can best be removed by segmentation of the network (distributing network load across multiple networks).

As the network grows, it becomes necessary to provide additional authentication servers (domain controllers). The tdbsam is limited to a single machine and cannot be reliably replicated. This means that practical limits on network design dictate the point at which a distributed passdb backend is required; at this time, there is no real alternative other than ldapsam (LDAP).

The guideline provided in {\em{TOSHARG2}}, Chapter 10, Section 10.1.2, is to limit the number of accounts in the tdbsam backend to 250. This is the point at which most networks tend to want backup domain controllers (BDCs). Samba-3 does not provide a mechanism for replicating tdbsam data so it can be used by a BDC. The limitation of 250 users per tdbsam is predicated only on the need for replication, not on the limits\label{id2527551}\begingroup\catcode`\#=12\footnote{
Bench tests have shown that tdbsam is a very effective database technology. There is surprisingly little performance loss even with over 4000 users.
}\endgroup\docbooktolatexmakefootnoteref{id2527551} of the tdbsam backend itself.


\vspace{1em}
\vspace{1em}
\noindent{}2.~\textbf{Q:}~\textit{Would Samba operate any better if the OS level is set to a value higher than 35?}
\newline
\noindent\textbf{A:}~
No. MS Windows workstations and servers do not use a value higher than 33. Setting this to a value of 35 already assures Samba of precedence over MS Windows products in browser elections. There is no gain to be had from setting this higher.


\vspace{1em}
\vspace{1em}
\noindent{}3.~\textbf{Q:}~\textit{Why in this example have you provided UNIX group to Windows Group mappings for only Domain Groups?}
\newline
\noindent\textbf{A:}~
At this time, Samba has the capacity to use only Domain Groups mappings. It is possible that at a later date Samba may make use of Windows Local Groups, as well as of the Active Directory special Groups. Proper operation requires Domain Groups to be mapped to valid UNIX groups.


\vspace{1em}
\vspace{1em}
\noindent{}4.~\textbf{Q:}~\textit{Why has a path been specified in the {\ttfamily\itshape{\docbookhyphenatedot{IPC\$}}} share?}
\newline
\noindent\textbf{A:}~
This is done so that in the event that a software bug may permit a client connection to the IPC\$ share to obtain access to the file system, it does so at a location that presents least risk. Under normal operation this type of paranoid step should not be necessary. The use of this parameter should not be necessary.


\vspace{1em}
\vspace{1em}
\noindent{}5.~\textbf{Q:}~\textit{Why does the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file in this exercise include an entry for \smbconfoption{smb ports}?}
\newline
\noindent\textbf{A:}~
The default order by which Samba-3 attempts to communicate with MS Windows clients is via port 445 (the TCP port used by Windows clients when NetBIOS-less SMB over TCP/IP is in use). TCP port 139 is the primary port used for NetBIOS over TCP/IP. In this configuration Windows network operations are predicated around NetBIOS over TCP/IP. By specifying the use of only port 139, the intent is to reduce unsuccessful service connection attempts. The result of this is improved network performance. Where Samba-3 is installed as an Active Directory Domain member, the default behavior is highly beneficial and should not be changed.


\vspace{1em}
\vspace{1em}
\noindent{}6.~\textbf{Q:}~\textit{What is the difference between a print queue and a printer?}
\newline
\noindent\textbf{A:}~
A printer is a physical device that is connected either directly to the network or to a computer via a serial, parallel, or USB connection so that print jobs can be submitted to it to create a hard copy printout. Network-attached printers that use TCP/IP-based printing generally accept a single print data stream and block all secondary attempts to dispatch jobs concurrently to the same device. If many clients were to concurrently print directly via TCP/IP to the same printer, it would result in a huge amount of network traffic through continually failing connection attempts.

A print server (like CUPS or LPR/LPD) accepts multiple concurrent input streams or print requests. When the data stream has been fully received, the input stream is closed, and the job is then submitted to a sequential print queue where the job is stored until the printer is ready to receive the job.


\vspace{1em}
\vspace{1em}
\noindent{}7.~\textbf{Q:}~\textit{Can all MS Windows application software be installed onto an application server share?}
\newline
\noindent\textbf{A:}~
Much older Windows software is not compatible with installation to and execution from an application server. Enterprise versions of Microsoft Office XP Professional can be installed to an application server. Retail consumer versions of Microsoft Office XP Professional do not permit installation to an application server share and can be installed and used only to/from a local workstation hard disk.


\vspace{1em}
\vspace{1em}
\noindent{}8.~\textbf{Q:}~\textit{Why use dynamic DNS (DDNS)?}
\newline
\noindent\textbf{A:}~
When DDNS records are updated directly from the DHCP server, it is possible for network clients that are not NetBIOS-enabled, and thus cannot use WINS, to locate Windows clients via DNS.


\vspace{1em}
\vspace{1em}
\noindent{}9.~\textbf{Q:}~\textit{Why would you use WINS as well as DNS-based name resolution?}
\newline
\noindent\textbf{A:}~
WINS is to NetBIOS names as DNS is to fully qualified domain names (FQDN). The FQDN is a name like {``}myhost.mydomain.tld{''} where {\ttfamily\itshape{\docbookhyphenatedot{tld}}} means {\texttt{\docbookhyphenatedot{top-level domain}}}. A FQDN is a longhand but easy-to-remember expression that may be up to 1024 characters in length and that represents an IP address. A NetBIOS name is always 16 characters long. The 16$^\text{th}$ character is a name type indicator. A specific name type is registered\label{id2527809}\begingroup\catcode`\#=12\footnote{
See {\em{TOSHARG2}}, Chapter 9, for more information.
}\endgroup\docbooktolatexmakefootnoteref{id2527809} for each type of service that is provided by the Windows server or client and that may be registered where a WINS server is in use.

WINS is a mechanism by which a client may locate the IP Address that corresponds to a NetBIOS name. The WINS server may be queried to obtain the IP Address for a NetBIOS name that includes a particular registered NetBIOS name type. DNS does not provide a mechanism that permits handling of the NetBIOS name type information.

DNS provides a mechanism by which TCP/IP clients may locate the IP address of a particular hostname or service name that has been registered in the DNS database for a particular domain. A DNS server has limited scope of control and is said to be authoritative for the zone over which it has control.

Windows 200x Active Directory requires the registration in the DNS zone for the domain it controls of service locator\label{id2527844}\begingroup\catcode`\#=12\footnote{
See TOSHARG2, Chapter 9, Section 9.3.3.
}\endgroup\docbooktolatexmakefootnoteref{id2527844} records that Windows clients and servers will use to locate Kerberos and LDAP services. ADS also requires the registration of special records that are called global catalog (GC) entries and site entries by which domain controllers and other essential ADS servers may be located.


\vspace{1em}
\vspace{1em}
\noindent{}10.~\textbf{Q:}~\textit{What are the major benefits of using an application server?}
\newline
\noindent\textbf{A:}~
The use of an application server can significantly reduce application update maintenance. By providing a centralized application share, software updates need be applied to only one location for all major applications used. This results in faster update roll-outs and significantly better application usage control.


\vspace{1em}
\cleardoublepage 
% -------------------------------------------------------------
% Chapter The 500-User Office 
% ------------------------------------------------------------- 	
\chapter{The 500-User Office}
\label{Big500users}\hypertarget{Big500users}{}%

The Samba-3 networking you explored in \hyperlink{secure}{Chapter {\ref{secure}}, {``}Secure Office Networking{''}} covers the finer points of configuration of peripheral services such as DHCP and DNS, and WINS. You experienced implementation of a simple configuration of the services that are important adjuncts to successful deployment of Samba.

An analysis of the history of postings to the Samba mailing list easily demonstrates that the two most prevalent Samba problem areas are

\begin{itemize}
%--- Item
\item 
Defective resolution of a NetBIOS name to its IP address


%--- Item
\item 
Printing problems

\end{itemize}

The exercises so far in this book have focused on implementation of the simplest printing processes involving no print job processing intelligence. In this chapter, you maintain that same approach to printing, but \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}} presents an opportunity to make printing more complex for the administrator while making it easier for the user.

\index{WINS server} \index{tdbsam} \index{passdb backend} \hyperlink{secure}{Chapter {\ref{secure}}, {``}Secure Office Networking{''}} demonstrates operation of a DHCP server and a DNS server as well as a central WINS server. You validated the operation of these services and saw an effective implementation of a Samba domain controller using the {\ttfamily\itshape{\docbookhyphenatedot{tdbsam}}} passdb backend.

The objective of this chapter is to introduce more complex techniques that can be used to improve manageability of Samba as networking needs grow. In this chapter, you implement a distributed DHCP server environment, a distributed DNS server arrangement, a centralized WINS server, and a centralized Samba domain controller.

A note of caution is important regarding the Samba configuration that is used in this chapter. The use of a single domain controller on a routed, multisegment network is a poor design choice that leads to potential network user complaints. This chapter demonstrates some successful techniques in deployment and configuration management. This should be viewed as a foundation chapter for complex Samba deployments.

As you master the techniques presented here, you may find much better methods to improve network management and control while reducing human resource overheads. You should take the opportunity to innovate and expand on the methods presented here and explore them to the fullest.

% ------------------------   
% Section 
\section{Introduction}
\label{id2500806}\hypertarget{id2500806}{}%

Business continues to go well for Abmas. Mr. Meany is driving your success and the network continues to grow thanks to the hard work Christine has done. You recently hired Stanley Soroka as manager of information systems. Christine recommended Stan to the role. She told you Stan is so good at handling Samba that he can make a cast iron rocking horse that is embedded in concrete kick like a horse at a rodeo. You need skills like his. Christine and Stan get along just fine. Let's see what you can get out of this pair as they plot the next-generation networks.

Ten months ago Abmas closed an acquisition of a property insurance business. The founder lost interest in the business and decided to sell it to Mr. Meany. Because they were former university classmates, the purchase was concluded with mutual assent. The acquired business is located at the other end of town in much larger facilities. The old Abmas building has become too small. Located on the same campus as the newly acquired business are two empty buildings that are ideal to provide Abmas with opportunity for growth.

Abmas has now completed the purchase of the two empty buildings, and you are to install a new network and relocate staff in nicely furnished new facilities. The new network is to be used to fully integrate company operations. You have decided to locate the new network operations control center in the larger building in which the insurance group is located to take advantage of an ideal floor space and to allow Stan and Christine to fully stage the new network and test it before it is rolled out. Your strategy is to complete the new network so that it is ready for operation when the old office moves into the new premises.
\subsection{Assignment Tasks}
\label{id2482092}\hypertarget{id2482092}{}%

The acquired business had 280 network users. The old Abmas building housed 220 network users in unbelievably cramped conditions. The network that initially served 130 users now handles 220 users quite well.

The two businesses will be fully merged to create a single campus company. The Property Insurance Group (PIG) houses 300 employees, the new Accounting Services Group (ASG) will be in a small building (BLDG1) that houses 50 employees, and the Financial Services Group (FSG) will be housed in a large building that has capacity for growth (BLDG2). Building 2 houses 150 network users.

You have decided to connect the building using fiber optic links between new routers. As a backup, the buildings are interconnected using line-of-sight high-speed infrared facilities. The infrared connection provides a secondary route to be used during periods of high demand for network bandwidth.

The Internet gateway is upgraded to 15 Mb/sec service. Your ISP provides on your premises a fully managed Cisco PIX firewall. You no longer need to worry about firewall facilities on your network.

Stanley and Christine have purchased new server hardware. Christine wants to roll out a network that has whistles and bells. Stan wants to start off with a simple to manage, not-too-complex network. He believes that network users need to be gradually introduced to new features and capabilities and not rushed into an environment that may cause disorientation and loss of productivity.

Your intrepid network team has decided to implement a network configuration that closely mirrors the successful system you installed in the old Abmas building. The new network infrastructure is owned by Abmas, but all desktop systems are being procured through a new out-source services and leasing company. Under the terms of a deal with Mr. M. Proper (CEO), DirectPointe, Inc., provides all desktop systems and includes full level-one help desk support for a flat per-machine monthly fee. The deal allows you to add workstations on demand. This frees Stan and Christine to deal with deeper issues as they emerge and permits Stan to work on creating new future value-added services.

DirectPointe Inc. receives from you a new standard desktop configuration every four months. They automatically roll that out to each desktop system. You must keep DirectPointe informed of all changes.

\index{PDC} The new network has a single Samba Primary Domain Controller (PDC) located in the Network Operation Center (NOC). Buildings 1 and 2 each have a local server for local application servicing. It is a domain member. The new system uses the {\ttfamily\itshape{\docbookhyphenatedot{tdbsam}}} passdb backend.

Printing is based on raw pass-through facilities just as it has been used so far. All printer drivers are installed on the desktop and notebook computers.

% ------------------------   
% Section 
\section{Dissection and Discussion}
\label{id2456240}\hypertarget{id2456240}{}%

\index{network load factors} The example you are building in this chapter is of a network design that works, but this does not make it a design that is recommended. As a general rule, there should be at least one Backup Domain Controller (BDC) per 150 Windows network clients. The principle behind this recommendation is that correct operation of MS Windows clients requires rapid network response to all SMB/CIFS requests. The same rule says that if there are more than 50 clients per domain controller, they are too busy to service requests. Let's put such rules aside and recognize that network load affects the integrity of domain controller responsiveness. This network will have 500 clients serviced by one central domain controller. This is not a good omen for user satisfaction. You, of course, address this very soon (see \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}}).
\subsection{Technical Issues}
\label{id2479263}\hypertarget{id2479263}{}%

Stan has talked you into a horrible compromise, but it is addressed. Just make certain that the performance of this network is well validated before going live.

Design decisions made in this design include the following:

\begin{itemize}
%--- Item
\item 
\index{PDC} \index{LDAP} \index{identity management} A single PDC is being implemented. This limitation is based on the choice not to use LDAP. Many network administrators fear using LDAP because of the perceived complexity of implementation and management of an LDAP-based backend for all user identity management as well as to store network access credentials.


%--- Item
\item 
\index{BDC} \index{machine secret password} Because of the refusal to use an LDAP (ldapsam) passdb backend at this time, the only choice that makes sense with 500 users is to use the tdbsam passwd backend. This type of backend is not receptive to replication to BDCs. If the tdbsam {\texttt{\docbookhyphenatefilename{passdb.\dbz{}tdb}}} file is replicated to BDCs using {\bfseries{rsync}}, there are two potential problems: (1) data that is in memory but not yet written to disk will not be replicated, and (2) domain member machines periodically change the secret machine password. When this happens, there is no mechanism to return the changed password to the PDC.


%--- Item
\item 
All domain user, group, and machine accounts are managed on the PDC. This makes for a simple mode of operation but has to be balanced with network performance and integrity of operations considerations.


%--- Item
\item 
\index{WINS} A single central WINS server is being used. The PDC is also the WINS server. Any attempt to operate a routed network without a WINS server while using NetBIOS over TCP/IP protocols does not work unless on each client the name resolution entries for the PDC are added to the {\texttt{\docbookhyphenatefilename{LMHOSTS}}}. This file is normally located on the Windows XP Professional client in the {\texttt{\docbookhyphenatefilename{C:\docbooktolatexgobble\string\\WINDOWS\docbooktolatexgobble\string\\SYSTEM32\docbooktolatexgobble\string\\ETC\docbooktolatexgobble\string\\DRIVERS}}} directory.


%--- Item
\item 
At this time the Samba WINS database cannot be replicated. That is why a single WINS server is being implemented. This should work without a problem.


%--- Item
\item 
\index{winbindd} BDCs make use of {\bfseries{winbindd}} to provide access to domain security credentials for file system access and object storage.


%--- Item
\item 
\index{DHCP!relay} \index{DHCP!requests} Configuration of Windows XP Professional clients is achieved using DHCP. Each subnet has its own DHCP server. Backup DHCP serving is provided by one alternate DHCP server. This necessitates enabling of the DHCP Relay agent on all routers. The DHCP Relay agent must be programmed to pass DHCP Requests from the network directed at the backup DHCP server.


%--- Item
\item 
All network users are granted the ability to print to any printer that is network-attached. All printers are available from each server. Print jobs that are spooled to a printer that is not on the local network segment are automatically routed to the print spooler that is in control of that printer. The specific details of how this might be done are demonstrated for one example only.


%--- Item
\item 
The network address and subnetmask chosen provide 1022 usable IP addresses in each subnet. If in the future more addresses are required, it would make sense to add further subnets rather than change addressing.

\end{itemize}
\subsection{Political Issues}
\label{id2489871}\hypertarget{id2489871}{}%

This case gets close to the real world. You and I know the right way to implement domain control. Politically, we have to navigate a minefield. In this case, the need is to get the PDC rolled out in compliance with expectations and also to be ready to save the day by having the real solution ready before it is needed. That real solution is presented in \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}}.

% ------------------------   
% Section 
\section{Implementation}
\label{id2489894}\hypertarget{id2489894}{}%

The following configuration process begins following installation of Red Hat Fedora Core2 on the three servers shown in the network topology diagram in \hyperlink{chap05net}{Figure {\ref{chap05net}}}. You have selected hardware that is appropriate to the task.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{chap05net}{}%
\includegraphics[scale=0.5]{Samba3-ByExample/images/chap5-net}
{{\caption[{Network Topology ---  500 User Network Using tdbsam passdb backend.}]{{{Network Topology ---  500 User Network Using tdbsam passdb backend.}}}\label{chap05net}}}
\end{center}
\end{figure}

\subsection{Installation of DHCP, DNS, and Samba Control Files}
\label{ch5-dnshcp-setup}\hypertarget{ch5-dnshcp-setup}{}%

Carefully install the configuration files into the correct locations as shown in \hyperlink{ch5-filelocations}{Table {\ref{ch5-filelocations}}}. You should validate that the full file path is correct as shown.

The abbreviation shown in this table as {\texttt{\docbookhyphenatedot{\{VLN\}}}} refers to the directory location beginning with {\texttt{\docbookhyphenatefilename{/\dbz{}var/\dbz{}lib/\dbz{}named}}}.

% table ------------------------------------------------------
\begin{table}[htb]
\begin{center}%
\hypertarget{ch5-filelocations}{}%
\captionswapskip{}{{\caption{Domain: MEGANET, File Locations for Servers}\label{ch5-filelocations}}}
\captionswapskip{}\begin{tabular}{|l|l|c|c|c|}
\hline 
\multicolumn{2}{|c|}{{{\bfseries File Information}}} & \multicolumn{3}{|c|}{{{\bfseries Server Name}}} \tabularnewline
 \hline 
\docbooktolatexaligncl {{{\bfseries Source}}} & \docbooktolatexaligncl {{{\bfseries Target Location}}} & \docbooktolatexaligncl {{{\bfseries MASSIVE}}} & \docbooktolatexaligncl {{{\bfseries BLDG1}}} & \docbooktolatexaligncl {{{\bfseries BLDG2}}} \tabularnewline
 \hline 
{{\hyperlink{ch5-massivesmb}{Example {\ref{ch5-massivesmb}}}}} & {{{\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}smb.\dbz{}conf}}}}} & {{Yes}} & {{No}} & {{No}} \tabularnewline
 \hline 
{{\hyperlink{ch5-dc-common}{Example {\ref{ch5-dc-common}}}}} & {{{\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}dc-\dbz{}common.\dbz{}conf}}}}} & {{Yes}} & {{No}} & {{No}} \tabularnewline
 \hline 
{{\hyperlink{ch5-commonsmb}{Example {\ref{ch5-commonsmb}}}}} & {{{\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}common.\dbz{}conf}}}}} & {{Yes}} & {{Yes}} & {{Yes}} \tabularnewline
 \hline 
{{\hyperlink{ch5-bldg1-smb}{Example {\ref{ch5-bldg1-smb}}}}} & {{{\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}smb.\dbz{}conf}}}}} & {{No}} & {{Yes}} & {{No}} \tabularnewline
 \hline 
{{\hyperlink{ch5-bldg2-smb}{Example {\ref{ch5-bldg2-smb}}}}} & {{{\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}smb.\dbz{}conf}}}}} & {{No}} & {{No}} & {{Yes}} \tabularnewline
 \hline 
{{\hyperlink{ch5-dommem-smb}{Example {\ref{ch5-dommem-smb}}}}} & {{{\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}dommem.\dbz{}conf}}}}} & {{No}} & {{Yes}} & {{Yes}} \tabularnewline
 \hline 
{{\hyperlink{massive-dhcp}{Example {\ref{massive-dhcp}}}}} & {{{\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}dhcpd.\dbz{}conf}}}}} & {{Yes}} & {{No}} & {{No}} \tabularnewline
 \hline 
{{\hyperlink{bldg1dhcp}{Example {\ref{bldg1dhcp}}}}} & {{{\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}dhcpd.\dbz{}conf}}}}} & {{No}} & {{Yes}} & {{No}} \tabularnewline
 \hline 
{{\hyperlink{bldg2dhcp}{Example {\ref{bldg2dhcp}}}}} & {{{\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}dhcpd.\dbz{}conf}}}}} & {{No}} & {{No}} & {{Yes}} \tabularnewline
 \hline 
{{\hyperlink{massive-nameda}{Example {\ref{massive-nameda}}}}} & {{{\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}named.\dbz{}conf (\dbz{}part A)\dbz{}}}}}} & {{Yes}} & {{No}} & {{No}} \tabularnewline
 \hline 
{{\hyperlink{massive-namedb}{Example {\ref{massive-namedb}}}}} & {{{\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}named.\dbz{}conf (\dbz{}part B)\dbz{}}}}}} & {{Yes}} & {{No}} & {{No}} \tabularnewline
 \hline 
{{\hyperlink{massive-namedc}{Example {\ref{massive-namedc}}}}} & {{{\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}named.\dbz{}conf (\dbz{}part C)\dbz{}}}}}} & {{Yes}} & {{No}} & {{No}} \tabularnewline
 \hline 
{{\hyperlink{abmasbizdns}{Example {\ref{abmasbizdns}}}}} & {{{\texttt{\docbookhyphenatefilename{\docbooktolatexgobble\string\{VLN\docbooktolatexgobble\string\}/\dbz{}master/\dbz{}abmas.\dbz{}biz.\dbz{}hosts}}}}} & {{Yes}} & {{No}} & {{No}} \tabularnewline
 \hline 
{{\hyperlink{abmasusdns}{Example {\ref{abmasusdns}}}}} & {{{\texttt{\docbookhyphenatefilename{\docbooktolatexgobble\string\{VLN\docbooktolatexgobble\string\}/\dbz{}master/\dbz{}abmas.\dbz{}us.\dbz{}hosts}}}}} & {{Yes}} & {{No}} & {{No}} \tabularnewline
 \hline 
{{\hyperlink{bldg12nameda}{Example {\ref{bldg12nameda}}}}} & {{{\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}named.\dbz{}conf (\dbz{}part A)\dbz{}}}}}} & {{No}} & {{Yes}} & {{Yes}} \tabularnewline
 \hline 
{{\hyperlink{bldg12namedb}{Example {\ref{bldg12namedb}}}}} & {{{\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}named.\dbz{}conf (\dbz{}part B)\dbz{}}}}}} & {{No}} & {{Yes}} & {{Yes}} \tabularnewline
 \hline 
{{\hyperlink{loopback}{Example {\ref{loopback}}}}} & {{{\texttt{\docbookhyphenatefilename{\docbooktolatexgobble\string\{VLN\docbooktolatexgobble\string\}/\dbz{}localhost.\dbz{}zone}}}}} & {{Yes}} & {{Yes}} & {{Yes}} \tabularnewline
 \hline 
{{\hyperlink{dnsloopy}{Example {\ref{dnsloopy}}}}} & {{{\texttt{\docbookhyphenatefilename{\docbooktolatexgobble\string\{VLN\docbooktolatexgobble\string\}/\dbz{}127.\dbz{}0.\dbz{}0.\dbz{}zone}}}}} & {{Yes}} & {{Yes}} & {{Yes}} \tabularnewline
 \hline 
{{\hyperlink{roothint}{Example {\ref{roothint}}}}} & {{{\texttt{\docbookhyphenatefilename{\docbooktolatexgobble\string\{VLN\docbooktolatexgobble\string\}/\dbz{}root.\dbz{}hint}}}}} & {{Yes}} & {{Yes}} & {{Yes}} \tabularnewline
\hline 
\end{tabular}
\end{center}
\end{table}

\subsection{Server Preparation: All Servers}
\label{id2488695}\hypertarget{id2488695}{}%

The following steps apply to all servers. Follow each step carefully.
Server Preparation Steps\begin{enumerate}

\item{Using the UNIX/Linux system tools, set the name of the server as shown in the network topology diagram in \hyperlink{chap05net}{Figure {\ref{chap05net}}}. For SUSE Linux products, the tool that permits this is called {\bfseries{yast2}}; for Red Hat Linux products, you can use the {\bfseries{netcfg}} tool. Verify that your hostname is correctly set by running: 
\begin{Verbatim}[]

root#  uname -n

\end{Verbatim}
 An alternate method to verify the hostname is: 
\begin{Verbatim}[]

root#  hostname -f

\end{Verbatim}
}

\item{\index{/etc/hosts} \index{named} Edit your {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}} file to include the primary names and addresses of all network interfaces that are on the host server. This is necessary so that during startup the system is able to resolve all its own names to the IP address prior to startup of the DNS server. You should check the startup order of your system. If the CUPS print server is started before the DNS server ({\bfseries{named}}), you should also include an entry for the printers in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}} file.}

\item{\index{/etc/resolv.conf} All DNS name resolution should be handled locally. To ensure that the server is configured correctly to handle this, edit {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}resolv.\dbz{}conf}}} so it has the following content: 
\begin{Verbatim}[]

search abmas.us abmas.biz
nameserver 127.0.0.1

\end{Verbatim}
 This instructs the name resolver function (when configured correctly) to ask the DNS server that is running locally to resolve names to addresses.}

\item{\index{administrator} \index{smbpasswd} Add the {\texttt{\docbookhyphenatedot{root}}} user to the password backend: 
\begin{Verbatim}[]

root#  smbpasswd -a root
New SMB password: XXXXXXXX
Retype new SMB password: XXXXXXXX
root# 

\end{Verbatim}
 The {\texttt{\docbookhyphenatedot{root}}} account is the UNIX equivalent of the Windows domain administrator. This account is essential in the regular maintenance of your Samba server. It must never be deleted. If for any reason the account is deleted, you may not be able to recreate this account without considerable trouble.}

\item{\index{username map} \index{/etc/samba/smbusers} Create the username map file to permit the {\texttt{\docbookhyphenatedot{root}}} account to be called {\texttt{\docbookhyphenatedot{Administrator}}} from the Windows network environment. To do this, create the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}smbusers}}} with the following contents: 
\begin{Verbatim}[]

####
# User mapping file
####
# File Format
# -----------
# Unix_ID = Windows_ID
#
# Examples:
# root = Administrator
# janes = "Jane Smith"
# jimbo = Jim Bones
#
# Note: If the name contains a space it must be double quoted.
#       In the example above the name 'jimbo' will be mapped to Windows
#       user names 'Jim' and 'Bones' because the space was not quoted.
#######################################################################
root = Administrator
####
# End of File
####

\end{Verbatim}
}

\item{Configure all network-attached printers to have a fixed IP address.}

\item{Create an entry in the DNS database on the server {\texttt{\docbookhyphenatedot{MASSIVE}}} in both the forward lookup database for the zone {\texttt{\docbookhyphenatedot{abmas.biz.hosts}}} and in the reverse lookup database for the network segment that the printer is located in. Example configuration files for similar zones were presented in \hyperlink{secure}{Chapter {\ref{secure}}, {``}Secure Office Networking{''}}, \hyperlink{abmasbiz}{Example {\ref{abmasbiz}}} and \hyperlink{eth2zone}{Example {\ref{eth2zone}}}.}

\item{Follow the instructions in the printer manufacturer's manuals to permit printing to port 9100. Use any other port the manufacturer specifies for direct mode, raw printing. This allows the CUPS spooler to print using raw mode protocols. \index{CUPS} \index{raw printing}}

\item{\index{CUPS!queue} Only on the server to which the printer is attached configure the CUPS Print Queues as follows: 
\begin{Verbatim}[]

root#  lpadmin -p printque -v socket://printer-name.abmas.biz:9100 -E

\end{Verbatim}
 \index{print filter} This step creates the necessary print queue to use no assigned print filter. This is ideal for raw printing, that is, printing without use of filters. The name {\ttfamily\itshape{\docbookhyphenatedot{printque}}} is the name you have assigned for the particular printer.}

\item{Print queues may not be enabled at creation. Make certain that the queues you have just created are enabled by executing the following: 
\begin{Verbatim}[]

root#  /usr/bin/enable printque

\end{Verbatim}
}

\item{Even though your print queue may be enabled, it is still possible that it does not accept print jobs. A print queue services incoming printing requests only when configured to do so. Ensure that your print queue is set to accept incoming jobs by executing the following command: 
\begin{Verbatim}[]

root#  /usr/bin/accept printque

\end{Verbatim}
}

\item{\index{mime type} \index{/etc/mime.convs} \index{application/octet-stream} This step, as well as the next one, may be omitted where CUPS version 1.1.18 or later is in use. Although it does no harm to follow it anyway, and may help to avoid time spent later trying to figure out why print jobs may be disappearing without a trace. Look at these two steps as {\em{insurance}} against lost time. Edit file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}cups/\dbz{}mime.\dbz{}convs}}} to uncomment the line: 
\begin{Verbatim}[]

application/octet-stream     application/vnd.cups-raw      0     -

\end{Verbatim}
}

\item{\index{/etc/mime.types} Edit the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}cups/\dbz{}mime.\dbz{}types}}} to uncomment the line: 
\begin{Verbatim}[]

application/octet-stream

\end{Verbatim}
}

\item{Refer to the CUPS printing manual for instructions regarding how to configure CUPS so that print queues that reside on CUPS servers on remote networks route print jobs to the print server that owns that queue. The default setting on your CUPS server may automatically discover remotely installed printers and may permit this functionality without requiring specific configuration.}

\item{As part of the roll-out program, you need to configure the application's server shares. This can be done once on the central server and may then be replicated using a tool such as {\bfseries{rsync}}. Refer to the man page for {\bfseries{rsync}} for details regarding use. The notes in \hyperlink{ch4appscfg}{Section {\ref{ch4appscfg}}} may help in your decisions to use an application server facility.}
\end{enumerate}

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

Logon scripts that are run from a domain controller (PDC or BDC) are capable of using semi-intelligent processes to automap Windows client drives to an application server that is nearest to the client. This is considerably more difficult when a single PDC is used on a routed network. It can be done, but not as elegantly as you see in the next chapter.
\end{admonition}

\subsection{Server-Specific Preparation}
\label{id2528294}\hypertarget{id2528294}{}%

There are some steps that apply to particular server functionality only. Each step is critical to correct server operation. The following step-by-step installation guidance will assist you in working through the process of configuring the PDC and then both BDC's.
\subsubsection{Configuration for Server: MASSIVE}
\label{id2528308}\hypertarget{id2528308}{}%

The steps presented here attempt to implement Samba installation in a generic manner. While some steps are clearly specific to Linux, it should not be too difficult to apply them to your platform of choice.
Primary Domain Controller Preparation\begin{enumerate}

\item{\index{/etc/rc.d/boot.local} \index{IP forwarding} The host server acts as a router between the two internal network segments as well as for all Internet access. This necessitates that IP forwarding be enabled. This can be achieved by adding to the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}rc.\dbz{}d/\dbz{}boot.\dbz{}local}}} an entry as follows: 
\begin{Verbatim}[]

echo 1 > /proc/sys/net/ipv4/ip_forward

\end{Verbatim}
 To ensure that your kernel is capable of IP forwarding during configuration, you may wish to execute that command manually also. This setting permits the Linux system to act as a router.}

\item{This server is dual hosted (i.e., has two network interfaces) ---  one goes to the Internet and the other to a local network that has a router that is the gateway to the remote networks. You must therefore configure the server with route table entries so that it can find machines on the remote networks. You can do this using the appropriate system tools for your Linux server or using static entries that you place in one of the system startup files. It is best to always use the tools that the operating system vendor provided. In the case of SUSE Linux, the best tool to do this is YaST (refer to SUSE Administration Manual); in the case of Red Hat, this is best done using the graphical system configuration tools (see the Red Hat documentation). An example of how this may be done manually is as follows: 
\begin{Verbatim}[]

root#  route add net 172.16.4.0 netmask 255.255.252.0 gw 172.16.0.128
root#  route add net 172.16.8.0 netmask 255.255.252.0 gw 172.16.0.128

\end{Verbatim}
 If you just execute these commands manually, the route table entries you have created are not persistent across system reboots. You may add these commands directly to the local startup files as follows: (SUSE) {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}rc.\dbz{}d/\dbz{}boot.\dbz{}local}}}, (Red Hat) {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}rc.\dbz{}d/\dbz{}init.\dbz{}d/\dbz{}rc.\dbz{}local}}}.}

\item{\index{/etc/nsswitch.conf} The final step that must be completed is to edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file. This file controls the operation of the various resolver libraries that are part of the Linux Glibc libraries. Edit this file so that it contains the following entries: 
\begin{Verbatim}[]

hosts:      files dns wins

\end{Verbatim}
}

\item{\index{initGrps.sh} Create and map Windows domain groups to UNIX groups. A sample script is provided in \hyperlink{ch5-initgrps}{Example {\ref{ch5-initgrps}}}. Create a file containing this script. You called yours {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}initGrps.\dbz{}sh}}}. Set this file so it can be executed and then execute the script. An example of the execution of this script as well as its validation are shown in Section 4.3.2, Step 5.}

\item{\index{/etc/passwd} \index{password!backend} \index{smbpasswd} For each user who needs to be given a Windows domain account, make an entry in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} file as well as in the Samba password backend. Use the system tool of your choice to create the UNIX system account, and use the Samba {\bfseries{smbpasswd}} to create a domain user account.  \index{useradd} \index{adduser} \index{user!management} There are a number of tools for user management under UNIX, such as {\bfseries{useradd}}, {\bfseries{adduser}}, as well as a plethora of custom tools. With the tool of your choice, create a home directory for each user.}

\item{Using the preferred tool for your UNIX system, add each user to the UNIX groups created previously as necessary. File system access control is based on UNIX group membership.}

\item{Create the directory mount point for the disk subsystem that is to be mounted to provide data storage for company files, in this case, the mount point indicated in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file is {\texttt{\docbookhyphenatefilename{/\dbz{}data}}}. Format the file system as required and mount the formatted file system partition using appropriate system tools.}

\item{\index{file system!permissions} Create the top-level file storage directories for data and applications as follows: 
\begin{Verbatim}[]

root#  mkdir -p /data/{accounts,finsvcs,pidata}
root#  mkdir -p /apps
root#  chown -R root:root /data
root#  chown -R root:root /apps
root#  chown -R bjordan:accounts /data/accounts
root#  chown -R bjordan:finsvcs /data/finsvcs
root#  chown -R bjordan:finsvcs /data/pidata
root#  chmod -R ug+rwxs,o-rwx /data
root#  chmod -R ug+rwx,o+rx-w /apps

\end{Verbatim}
 Each department is responsible for creating its own directory structure within the departmental share. The directory root of the {\bfseries{accounts}} share is {\texttt{\docbookhyphenatefilename{/\dbz{}data/\dbz{}accounts}}}. The directory root of the {\bfseries{finsvcs}} share is {\texttt{\docbookhyphenatefilename{/\dbz{}data/\dbz{}finsvcs}}}. The {\texttt{\docbookhyphenatefilename{/\dbz{}apps}}} directory is the root of the {\texttt{\docbookhyphenatedot{apps}}} share that provides the application server infrastructure.}

\item{The {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file specifies an infrastructure to support roaming profiles and network logon services. You can now create the file system infrastructure to provide the locations on disk that these services require. Adequate planning is essential because desktop profiles can grow to be quite large. For planning purposes, a minimum of 200 MB of storage should be allowed per user for profile storage. The following commands create the directory infrastructure needed: 
\begin{Verbatim}[]

root#  mkdir -p /var/spool/samba
root#  mkdir -p /var/lib/samba/{netlogon/scripts,profiles}
root#  chown -R root:root /var/spool/samba
root#  chown -R root:root /var/lib/samba
root#  chmod a+rwxt /var/spool/samba

\end{Verbatim}
 For each user account that is created on the system, the following commands should be executed: 
\begin{Verbatim}[]

root#  mkdir /var/lib/samba/profiles/'username'
root#  chown 'username':users /var/lib/samba/profiles/'username'
root#  chmod ug+wrx,o+rx,-w /var/lib/samba/profiles/'username'

\end{Verbatim}
}

\item{\index{unix2dos} \index{dos2unix} Create a logon script. It is important that each line is correctly terminated with a carriage return and line-feed combination (i.e., DOS encoding). The following procedure works if the right tools ({\texttt{\docbookhyphenatedot{unxi2dos}}} and {\texttt{\docbookhyphenatedot{dos2unix}}}) are installed. First, create a file called {\texttt{\docbookhyphenatefilename{/\dbz{}var/\dbz{}lib/\dbz{}samba/\dbz{}netlogon/\dbz{}scripts/\dbz{}logon.\dbz{}bat.\dbz{}unix}}} with the following contents: 
\begin{Verbatim}[]

net time \\massive /set /yes
net use h: /home

\end{Verbatim}
 Convert the UNIX file to a DOS file: 
\begin{Verbatim}[]

root#  dos2unix < /var/lib/samba/netlogon/scripts/logon.bat.unix \
        > /var/lib/samba/netlogon/scripts/logon.bat

\end{Verbatim}
}

\item{There is one preparatory step without which you cannot have a working Samba network environment. You must add an account for each network user. You can do this by executing the following steps for each user: 
\begin{Verbatim}[]

root#  useradd -m username
root#  passwd username
Changing password for username.
New password: XXXXXXXX
Re-enter new password: XXXXXXXX
Password changed
root#  smbpasswd -a username
New SMB password: XXXXXXXX
Retype new SMB password: XXXXXXXX
Added user username.

\end{Verbatim}
 You do, of course, use a valid user login ID in place of {\ttfamily\itshape{\docbookhyphenatedot{username}}}.}

\item{Follow the processes shown in \hyperlink{ch5-procstart}{Section {\ref{ch5-procstart}}} to start all services.}

\item{Your server is ready for validation testing. Do not proceed with the steps in \hyperlink{ch5-domsvrspec}{Section {\ref{ch5-domsvrspec}}} until after the operation of the server has been validated following the same methods as outlined in \hyperlink{secure}{Chapter {\ref{secure}}, {``}Secure Office Networking{''}}, \hyperlink{ch4valid}{Section {\ref{ch4valid}}}.}
\end{enumerate}
\subsubsection{Configuration Specific to Domain Member Servers: BLDG1, BLDG2}
\label{ch5-domsvrspec}\hypertarget{ch5-domsvrspec}{}%

The following steps will guide you through the nuances of implementing BDCs for the broadcast isolated network segments. Remember that if the target installation platform is not Linux, it may be necessary to adapt some commands to the equivalent on the target platform.
Backup Domain Controller Configuration Steps\begin{enumerate}

\item{\index{/etc/nsswitch.conf} The final step that must be completed is to edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file. This file controls the operation of the various resolver libraries that are part of the Linux Glibc libraries. Edit this file so that it contains the following entries: 
\begin{Verbatim}[]

passwd:     files winbind
group:      files winbind
hosts:      files dns wins

\end{Verbatim}
}

\item{Follow the steps outlined in \hyperlink{ch5-procstart}{Section {\ref{ch5-procstart}}} to start all services. Do not start Samba at this time. Samba is controlled by the process called {\bfseries{smb}}.}

\item{\index{net!rpc!join} You must now attempt to join the domain member servers to the domain. The following instructions should be executed to effect this: 
\begin{Verbatim}[]

root#  net rpc join 

\end{Verbatim}
}

\item{\index{service!smb!start} You now start the Samba services by executing: 
\begin{Verbatim}[]

root#  service smb start

\end{Verbatim}
}

\item{Your server is ready for validation testing. Do not proceed with the steps in \hyperlink{ch5-domsvrspec}{Section {\ref{ch5-domsvrspec}}} until after the operation of the server has been validated following the same methods as outlined in \hyperlink{ch4valid}{Section {\ref{ch4valid}}}.}
\end{enumerate}

\begin{example}%
\hypertarget{ch5-massivesmb}{}%
\captionswapskip{}{{\caption{Server: MASSIVE (PDC), File: /\dbz{}etc/\dbz{}samba/\dbz{}smb.\dbz{}conf}\label{ch5-massivesmb}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	workgroup = MEGANET
 	netbios name = MASSIVE
 	interfaces = eth1, lo
 	bind interfaces only = Yes
 	passdb backend = tdbsam
 	smb ports = 139
 	add user script = /usr/sbin/useradd -m '%u'
 	delete user script = /usr/sbin/userdel -r '%u'
 	add group script = /usr/sbin/groupadd '%g'
 	delete group script = /usr/sbin/groupdel '%g'
 	add user to group script = /usr/sbin/usermod -G '%g' '%u'
 	add machine script = /usr/sbin/useradd -s /bin/false -d /var/lib/nobody '%u'
 	preferred master = Yes
 	wins support = Yes
 	include = /etc/samba/dc-common.conf
 [accounts]
 	comment = Accounting Files
 	path = /data/accounts
 	read only = No
 [service]
 	comment = Financial Services Files
 	path = /data/service
 	read only = No
 [pidata]
 	comment = Property Insurance Files
 	path = /data/pidata
 	read only = No
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch5-dc-common}{}%
\captionswapskip{}{{\caption{Server: MASSIVE (PDC), File: /\dbz{}etc/\dbz{}samba/\dbz{}dc-\dbz{}common.\dbz{}conf}\label{ch5-dc-common}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	shutdown script = /var/lib/samba/scripts/shutdown.sh
 	abort shutdown script = /sbin/shutdown -c
 	logon script = scripts\logon.bat
 	logon path = \%L\profiles\%U
 	logon drive = X:
 	logon home = \%L\%U
 	domain logons = Yes
 	preferred master = Yes
 	include = /etc/samba/common.conf
 [homes]
 	comment = Home Directories
 	valid users = %S
 	read only = No
 	browseable = No
 [netlogon]
 	comment = Network Logon Service
 	path = /var/lib/samba/netlogon
 	guest ok = Yes
 	locking = No
 [profiles]
 	comment = Profile Share
 	path = /var/lib/samba/profiles
 	read only = No
 	profile acls = Yes
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch5-commonsmb}{}%
\captionswapskip{}{{\caption{Common Samba Configuration File: /\dbz{}etc/\dbz{}samba/\dbz{}common.\dbz{}conf}\label{ch5-commonsmb}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[global]
 	username map = /etc/samba/smbusers
 	log level = 1
 	syslog = 0
 	log file = /var/log/samba/%m
 	max log size = 50
 	smb ports = 139
 	name resolve order = wins bcast hosts
 	time server = Yes
 	printcap name = CUPS
 	show add printer wizard = No
 	shutdown script = /var/lib/samba/scripts/shutdown.sh
 	abort shutdown script = /sbin/shutdown -c
 	utmp = Yes
 	map acl inherit = Yes
 	printing = cups
 	veto files = /*.eml/*.nws/*.{*}/
 	veto oplock files = /*.doc/*.xls/*.mdb/
 	include =  
 # Share and Service Definitions are common to all servers
 [printers]
 	comment = SMB Print Spool
 	path = /var/spool/samba
 	guest ok = Yes
 	printable = Yes
 	use client driver = Yes
 	default devmode = Yes
 	browseable = No
 [apps]
 	comment = Application Files
 	path = /apps
 	admin users = bjordan
 	read only = No
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch5-bldg1-smb}{}%
\captionswapskip{}{{\caption{Server: BLDG1 (Member), File: smb.conf}\label{ch5-bldg1-smb}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	workgroup = MEGANET
 	netbios name = BLDG1
 	include = /etc/samba/dom-mem.conf
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch5-bldg2-smb}{}%
\captionswapskip{}{{\caption{Server: BLDG2 (Member), File: smb.conf}\label{ch5-bldg2-smb}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	workgroup = MEGANET
 	netbios name = BLDG2
 	include = /etc/samba/dom-mem.conf
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch5-dommem-smb}{}%
\captionswapskip{}{{\caption{Common Domain Member Include File: dom-mem.conf}\label{ch5-dommem-smb}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	shutdown script = /var/lib/samba/scripts/shutdown.sh
 	abort shutdown script = /sbin/shutdown -c
 	preferred master = Yes
 	wins server = 172.16.0.1
 	idmap uid = 15000-20000
 	idmap gid = 15000-20000
 	include = /etc/samba/common.conf
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{massive-dhcp}{}%
\captionswapskip{}{{\caption{Server: MASSIVE, File: dhcpd.conf}\label{massive-dhcp}}}
\captionswapskip{}
\begin{Verbatim}[]

# Abmas Accounting Inc.

default-lease-time 86400;
max-lease-time 172800;
default-lease-time 86400;
ddns-updates on;
ddns-update-style interim;

option ntp-servers 172.16.0.1;
option domain-name "abmas.biz";
option domain-name-servers 172.16.0.1, 172.16.4.1;
option netbios-name-servers 172.16.0.1;
option netbios-node-type 8;

subnet 172.16.1.0 netmask 255.255.252.0 {
        range dynamic-bootp 172.16.1.0 172.16.2.255;
        option subnet-mask 255.255.252.0;
        option routers 172.16.0.1, 172.16.0.128;
        allow unknown-clients;
	}
subnet 172.16.4.0 netmask 255.255.252.0 {
        range dynamic-bootp 172.16.7.0 172.16.7.254;
        option subnet-mask 255.255.252.0;
        option routers 172.16.4.128;
        allow unknown-clients;
	}
subnet 172.16.8.0 netmask 255.255.252.0 {
        range dynamic-bootp 172.16.11.0 172.16.11.254;
        option subnet-mask 255.255.252.0;
        option routers 172.16.4.128;
        allow unknown-clients;
	}
subnet 127.0.0.0 netmask 255.0.0.0 {
        }
subnet 123.45.67.64 netmask 255.255.255.252 {
        }

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{bldg1dhcp}{}%
\captionswapskip{}{{\caption{Server: BLDG1, File: dhcpd.conf}\label{bldg1dhcp}}}
\captionswapskip{}
\begin{Verbatim}[]

# Abmas Accounting Inc.

default-lease-time 86400;
max-lease-time 172800;
default-lease-time 86400;
ddns-updates on;
ddns-update-style ad-hoc;

option ntp-servers 172.16.0.1;
option domain-name "abmas.biz";
option domain-name-servers 172.16.0.1, 172.16.4.1;
option netbios-name-servers 172.16.0.1;
option netbios-node-type 8;

subnet 172.16.1.0 netmask 255.255.252.0 {
        range dynamic-bootp 172.16.3.0 172.16.3.255;
        option subnet-mask 255.255.252.0;
        option routers 172.16.0.1, 172.16.0.128;
        allow unknown-clients;
	}
subnet 172.16.4.0 netmask 255.255.252.0 {
        range dynamic-bootp 172.16.5.0 172.16.6.255;
        option subnet-mask 255.255.252.0;
        option routers 172.16.4.128;
        allow unknown-clients;
	}
subnet 127.0.0.0 netmask 255.0.0.0 {
        }

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{bldg2dhcp}{}%
\captionswapskip{}{{\caption{Server: BLDG2, File: dhcpd.conf}\label{bldg2dhcp}}}
\captionswapskip{}
\begin{Verbatim}[]

# Abmas Accounting Inc.

default-lease-time 86400;
max-lease-time 172800;
default-lease-time 86400;
ddns-updates on;
ddns-update-style interim;

option ntp-servers 172.16.0.1;
option domain-name "abmas.biz";
option domain-name-servers 172.16.0.1, 172.16.4.1;
option netbios-name-servers 172.16.0.1;
option netbios-node-type 8;

subnet 172.16.8.0 netmask 255.255.252.0 {
        range dynamic-bootp 172.16.9.0 172.16.10.255;
        option subnet-mask 255.255.252.0;
        option routers 172.16.8.128;
        allow unknown-clients;
	}
subnet 127.0.0.0 netmask 255.0.0.0 {
        }

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{massive-nameda}{}%
\captionswapskip{}{{\caption{Server: MASSIVE, File: named.conf, Part: A}\label{massive-nameda}}}
\captionswapskip{}
\begin{Verbatim}[]

###
# Abmas Biz DNS Control File
###
# Date: November 15, 2003
###
options {
	directory "/var/lib/named";
	forwarders {
		123.45.12.23;
		123.45.54.32;
		};
	forward first;
	listen-on {
		mynet;
		};
	auth-nxdomain yes;
	multiple-cnames yes;
	notify no;
};

zone "." in {
	type hint;
	file "root.hint";
};

zone "localhost" in {
	type master;
	file "localhost.zone";
};

zone "0.0.127.in-addr.arpa" in {
	type master;
	file "127.0.0.zone";
};

acl mynet {
	172.16.0.0/24;
	172.16.4.0/24;
	172.16.8.0/24;
	127.0.0.1;
};

acl seconddns {
        123.45.54.32;
};

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{massive-namedb}{}%
\captionswapskip{}{{\caption{Server: MASSIVE, File: named.conf, Part: B}\label{massive-namedb}}}
\captionswapskip{}
\begin{Verbatim}[]

zone "abmas.biz" {
	type master;
	file "/var/lib/named/master/abmas.biz.hosts";
	allow-query {
		mynet;
	};
	allow-transfer {
		mynet;
	};
	allow-update {
		mynet;
	};
};

zone "abmas.us" {
        type master;
        file "/var/lib/named/master/abmas.us.hosts";
        allow-query {
                all;
        };
        allow-transfer {
                seconddns;
        };
};

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{massive-namedc}{}%
\captionswapskip{}{{\caption{Server: MASSIVE, File: named.conf, Part: C}\label{massive-namedc}}}
\captionswapskip{}
\begin{Verbatim}[]

zone "0.16.172.in-addr.arpa" {
	type master;
	file "/var/lib/named/master/172.16.0.0.rev";
	allow-query {
		mynet;
	};
	allow-transfer {
		mynet;
	};
	allow-update {
		mynet;
	};
};

zone "4.16.172.in-addr.arpa" {
	type master;
	file "/var/lib/named/master/172.16.4.0.rev";
	allow-query {
		mynet;
	};
	allow-transfer {
		mynet;
	};
	allow-update {
		mynet;
	};
};

zone "8.16.172.in-addr.arpa" {
	type master;
	file "/var/lib/named/master/172.16.8.0.rev";
	allow-query {
		mynet;
	};
	allow-transfer {
		mynet;
	};
	allow-update {
		mynet;
	};
};

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{abmasbizdns}{}%
\captionswapskip{}{{\caption{Forward Zone File: abmas.biz.hosts}\label{abmasbizdns}}}
\captionswapskip{}
\begin{Verbatim}[]

$ORIGIN .
$TTL 38400	; 10 hours 40 minutes
abmas.biz	IN SOA	massive.abmas.biz. root.abmas.biz. (
				2003021833 ; serial
				10800      ; refresh (3 hours)
				3600       ; retry (1 hour)
				604800     ; expire (1 week)
				38400      ; minimum (10 hours 40 minutes)
				)
			NS	massive.abmas.biz.
			NS	bldg1.abmas.biz.
			NS	bldg2.abmas.biz.
			MX	10 massive.abmas.biz.
$ORIGIN abmas.biz.
massive			A	172.16.0.1
router0                 A       172.16.0.128
bldg1                   A       172.16.4.1
router4                 A       172.16.4.128
bldg2                   A       172.16.8.1
router8                 A       172.16.8.128

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{abmasusdns}{}%
\captionswapskip{}{{\caption{Forward Zone File: abmas.biz.hosts}\label{abmasusdns}}}
\captionswapskip{}
\begin{Verbatim}[]

$ORIGIN .
$TTL 38400	; 10 hours 40 minutes
abmas.us	IN SOA	server.abmas.us. root.abmas.us. (
				2003021833 ; serial
				10800      ; refresh (3 hours)
				3600       ; retry (1 hour)
				604800     ; expire (1 week)
				38400      ; minimum (10 hours 40 minutes)
				)
			NS	dns.abmas.us.
			NS	dns2.abmas.us.
			MX	10 mail.abmas.us.
$ORIGIN abmas.us.
server			A	123.45.67.66
dns2			A	123.45.54.32
gw			A	123.45.67.65
www			CNAME	server
mail			CNAME	server
dns			CNAME	server

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{bldg12nameda}{}%
\captionswapskip{}{{\caption{Servers: BLDG1/BLDG2, File: named.conf, Part: A}\label{bldg12nameda}}}
\captionswapskip{}
\begin{Verbatim}[]

###
# Abmas Biz DNS Control File
###
# Date: November 15, 2003
###
options {
	directory "/var/lib/named";
	forwarders {
		172.16.0.1;
		};
	forward first;
	listen-on {
		mynet;
		};
	auth-nxdomain yes;
	multiple-cnames yes;
	notify no;
};

zone "." in {
	type hint;
	file "root.hint";
};

zone "localhost" in {
	type master;
	file "localhost.zone";
};

zone "0.0.127.in-addr.arpa" in {
	type master;
	file "127.0.0.zone";
};

acl mynet {
	172.16.0.0/24;
	172.16.4.0/24;
	172.16.8.0/24;
	127.0.0.1;
};

acl seconddns {
        123.45.54.32;
};

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{bldg12namedb}{}%
\captionswapskip{}{{\caption{Servers: BLDG1/BLDG2, File: named.conf, Part: B}\label{bldg12namedb}}}
\captionswapskip{}
\begin{Verbatim}[]

zone "abmas.biz" {
	type slave;
	file "/var/lib/named/slave/abmas.biz.hosts";
	allow-query {
		mynet;
	};
	allow-transfer {
		mynet;
	};
};

zone "0.16.172.in-addr.arpa" {
	type slave;
	file "/var/lib/slave/master/172.16.0.0.rev";
	allow-query {
		mynet;
	};
	allow-transfer {
		mynet;
	};
};

zone "4.16.172.in-addr.arpa" {
	type slave;
	file "/var/lib/named/slave/172.16.4.0.rev";
	allow-query {
		mynet;
	};
	allow-transfer {
		mynet;
	};
};

zone "8.16.172.in-addr.arpa" {
	type slave;
	file "/var/lib/named/slave/172.16.8.0.rev";
	allow-query {
		mynet;
	};
	allow-transfer {
		mynet;
	};
};

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{ch5-initgrps}{}%
\captionswapskip{}{{\caption{Initialize Groups Script, File: /etc/samba/initGrps.sh}\label{ch5-initgrps}}}
\captionswapskip{}
\begin{Verbatim}[]

#!/bin/bash

# Create UNIX groups
groupadd acctsdep
groupadd finsrvcs
groupadd piops

# Map Windows Domain Groups to UNIX groups
net groupmap add ntgroup="Domain Admins"  unixgroup=root type=d
net groupmap add ntgroup="Domain Users"   unixgroup=users type=d
net groupmap add ntgroup="Domain Guests"  unixgroup=nobody type=d

# Add Functional Domain Groups
net groupmap add ntgroup="Accounts Dept"       unixgroup=acctsdep type=d
net groupmap add ntgroup="Financial Services"  unixgroup=finsrvcs type=d
net groupmap add ntgroup="Insurance Group"     unixgroup=piops type=d

\end{Verbatim}
\end{example}

\subsection{Process Startup Configuration}
\label{ch5-procstart}\hypertarget{ch5-procstart}{}%

\index{chkconfig} \index{daemon control} There are two essential steps to process startup configuration. A process must be configured so that it is automatically restarted each time the server is rebooted. This step involves use of the {\bfseries{chkconfig}} tool that created appropriate symbolic links from the master daemon control file that is located in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}rc.\dbz{}d}}} directory to the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}rc'x'.\dbz{}d}}} directories. Links are created so that when the system run-level is changed, the necessary start or kill script is run.

\index{/etc/xinetd.d} In the event that a service is provided not as a daemon but via the internetworking super daemon ({\bfseries{inetd}} or {\bfseries{xinetd}}), then the {\bfseries{chkconfig}} tool makes the necessary entries in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}xinetd.\dbz{}d}}} directory and sends a hang-up (HUP) signal to the super daemon, thus forcing it to re-read its control files.

Last, each service must be started to permit system validation to proceed. The following steps are for a Red Hat Linux system, please adapt them to suit the target OS platform on which you are installing Samba.
Process Startup Configuration Steps\begin{enumerate}

\item{Use the standard system tool to configure each service to restart automatically at every system reboot. For example, \index{chkconfig} 
\begin{Verbatim}[]

root#  chkconfig dhpc on
root#  chkconfig named on
root#  chkconfig cups on
root#  chkconfig smb on
root#  chkconfig swat on

\end{Verbatim}
}

\item{\index{starting dhcpd} \index{starting samba} \index{starting CUPS} Now start each service to permit the system to be validated. Execute each of the following in the sequence shown: 
\begin{Verbatim}[]

root#  service dhcp restart
root#  service named restart
root#  service cups restart
root#  service smb restart
root#  service swat restart

\end{Verbatim}
}
\end{enumerate}
\subsection{Windows Client Configuration}
\label{ch5wincfg}\hypertarget{ch5wincfg}{}%

The procedure for desktop client configuration for the network in this chapter is similar to that used for the previous one. There are a few subtle changes that should be noted.
Windows Client Configuration Steps\begin{enumerate}

\item{Install MS Windows XP Professional. During installation, configure the client to use DHCP for TCP/IP protocol configuration. \index{WINS} \index{DHCP} DHCP configures all Windows clients to use the WINS Server address that has been defined for the local subnet.}

\item{Join the Windows domain {\texttt{\docbookhyphenatedot{MEGANET}}}. Use the domain administrator username {\texttt{\docbookhyphenatedot{root}}} and the SMB password you assigned to this account. A detailed step-by-step procedure for joining a Windows 200x/XP Professional client to a Windows domain is given in \hyperlink{appendix}{Chapter {\ref{appendix}}, {``}A Collection of Useful Tidbits{''}}, \hyperlink{domjoin}{Section {\ref{domjoin}}}. Reboot the machine as prompted and then log on using the domain administrator account ({\texttt{\docbookhyphenatedot{root}}}).}

\item{Verify that the server called {\texttt{\docbookhyphenatedot{MEGANET}}} is visible in {\sffamily \bfseries My Network Places}, that it is possible to connect to it and see the shares {\sffamily \bfseries accounts}, {\sffamily \bfseries apps}, and {\sffamily \bfseries finsvcs}, and that it is possible to open each share to reveal its contents.}

\item{Create a drive mapping to the {\texttt{\docbookhyphenatedot{apps}}} share on a server. At this time, it does not particularly matter which application server is used. It is necessary to manually set a persistent drive mapping to the local applications server on each workstation at the time of installation. This step is avoided by the improvements to the design of the network configuration in the next chapter.}

\item{Perform an administrative installation of each application to be used. Select the options that you wish to use. Of course, you choose to run applications over the network, correct?}

\item{Now install all applications to be installed locally. Typical tools include Adobe Acrobat, NTP-based time synchronization software, drivers for specific local devices such as fingerprint scanners, and the like. Probably the most significant application to be locally installed is antivirus software.}

\item{Now install all four printers onto the staging system. The printers you install include the accounting department HP LaserJet 6 and Minolta QMS Magicolor printers, and you also configure use of the identical printers that are located in the financial services department. Install printers on each machine using the following steps: Steps to Install Printer Drivers on Windows Clients\begin{enumerate}

\item{Click {\sffamily \bfseries Start} $\to$ {\sffamily \bfseries Settings} $\to$ {\sffamily \bfseries Printers}+{\sffamily \bfseries Add Printer}+{\sffamily \bfseries Next}. Do not click {\sffamily \bfseries Network printer}. Ensure that {\sffamily \bfseries Local printer} is selected.}

\item{Click {\sffamily \bfseries Next}. In the {\sffamily \bfseries Manufacturer:} panel, select {\texttt{\docbookhyphenatedot{HP}}}. In the {\sffamily \bfseries Printers:} panel, select the printer called {\texttt{\docbookhyphenatedot{HP LaserJet 6}}}. Click {\sffamily \bfseries Next}.}

\item{In the {\sffamily \bfseries Available ports:} panel, select {\texttt{\docbookhyphenatedot{FILE:}}}. Accept the default printer name by clicking {\sffamily \bfseries Next}. When asked, {``}Would you like to print a test page?{''}, click {\sffamily \bfseries No}. Click {\sffamily \bfseries Finish}.}

\item{You may be prompted for the name of a file to print to. If so, close the dialog panel. Right-click {\sffamily \bfseries HP LaserJet 6} $\to$ {\sffamily \bfseries Properties}.}

\item{In the {\sffamily \bfseries Network} panel, enter the name of the print queue on the Samba server as follows: {\texttt{\docbookhyphenatedot{\textbackslash \textbackslash BLDG1\textbackslash hplj6a}}}. Click {\sffamily \bfseries OK}+{\sffamily \bfseries OK} to complete the installation.}

\item{Repeat the printer installation steps above for both HP LaserJet 6 printers as well as for both QMS Magicolor laser printers. Remember to install all printers but to set the destination port for each to the server on the local network. For example, a workstation in the accounting group should have all printers directed at the server {\texttt{\docbookhyphenatedot{BLDG1}}}. You may elect to point all desktop workstation configurations at the server called {\texttt{\docbookhyphenatedot{MASSIVE}}} and then in your deployment procedures, it would be wise to document the need to redirect the printer configuration (as well as the applications server drive mapping) to the server on the network segment on which the workstation is to be located.}
\end{enumerate}
}

\item{When you are satisfied that the staging systems are complete, use the appropriate procedure to remove the client from the domain. Reboot the system, and then log on as the local administrator and clean out all temporary files stored on the system. Before shutting down, use the disk defragmentation tool so that the file system is in optimal condition before replication.}

\item{Boot the workstation using the Norton (Symantec) Ghosting disk (or CD-ROM) and image the machine to a network share on the server.}

\item{You may now replicate the image using the appropriate Norton Ghost procedure to the target machines. Make sure to use the procedure that ensures each machine has a unique Windows security identifier (SID). When the installation of the disk image is complete, boot the PC.}

\item{Log onto the machine as the local Administrator (the only option), and join the machine to the domain following the procedure set out in \hyperlink{appendix}{Chapter {\ref{appendix}}, {``}A Collection of Useful Tidbits{''}}, \hyperlink{domjoin}{Section {\ref{domjoin}}}. You must now set the persistent drive mapping to the applications server that the user is to use. The system is now ready for the user to log on, provided you have created a network logon account for that user, of course.}

\item{Instruct all users to log onto the workstation using their assigned username and password.}
\end{enumerate}
\subsection{Key Points Learned}
\label{id2503047}\hypertarget{id2503047}{}%

The network you have just deployed has been a valuable exercise in forced constraint. You have deployed a network that works well, although you may soon start to see performance problems, at which time the modifications demonstrated in \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}} bring the network to life. The following key learning points were experienced:

\begin{itemize}
%--- Item
\item 
The power of using {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} include files


%--- Item
\item 
Use of a single PDC over a routed network


%--- Item
\item 
Joining a Samba-3 domain member server to a Samba-3 domain


%--- Item
\item 
Configuration of winbind to use domain users and groups for Samba access to resources on the domain member servers


%--- Item
\item 
The introduction of roaming profiles

\end{itemize}

% ------------------------   
% Section 
\section{Questions and Answers}
\label{id2503108}\hypertarget{id2503108}{}%


% -------------------------------------------------------------
% QandASet                                                     
% -------------------------------------------------------------
\subsection*{F.A.Q.}
\label{id2503117}
\vspace{1em}
\noindent{}1.~\textbf{Q:}~\textit{The example {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} files in this chapter make use of the {\ttfamily\itshape{\docbookhyphenatedot{include}}} facility. How may I get to see what the actual working {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} settings are?}
\newline
\noindent\textbf{A:}~
You may readily see the net compound effect of the included files by running: 
\begin{Verbatim}[]

root#  testparm -s | less

\end{Verbatim}



\vspace{1em}
\vspace{1em}
\noindent{}2.~\textbf{Q:}~\textit{Why does the include file {\texttt{\docbookhyphenatefilename{common.\dbz{}conf}}} have an empty include statement?}
\newline
\noindent\textbf{A:}~
The use of the empty include statement nullifies further includes. For example, let's say you desire to have just an smb.conf file that is built from the array of include files of which the master control file is called {\texttt{\docbookhyphenatefilename{master.\dbz{}conf}}}. The following command produces a compound {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file. 
\begin{Verbatim}[]

root#  testparm -s /etc/samba/master.conf > /etc/samba/smb.conf

\end{Verbatim}
 If the include parameter was not in the common.conf file, the final {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file leaves the include in place, even though the file it points to has already been included. This is a bug that will be fixed at a future date.


\vspace{1em}
\vspace{1em}
\noindent{}3.~\textbf{Q:}~\textit{I accept that the simplest configuration necessary to do the job is the best. The use of {\ttfamily\itshape{\docbookhyphenatedot{tdbsam}}} passdb backend is much simpler than having to manage an LDAP-based {\ttfamily\itshape{\docbookhyphenatedot{ldapsam}}} passdb backend. I tried using {\bfseries{rsync}} to replicate the {\texttt{\docbookhyphenatefilename{passdb.\dbz{}tdb}}}, and it seems to work fine! So what is the problem?}
\newline
\noindent\textbf{A:}~
Replication of the {\ttfamily\itshape{\docbookhyphenatedot{tdbsam}}} database file can result in loss of currency in its contents between the PDC and BDCs. The most notable symptom is that workstations may not be able to log onto the network following a reboot and may have to rejoin the domain to recover network access capability.


\vspace{1em}
\vspace{1em}
\noindent{}4.~\textbf{Q:}~\textit{You are using DHCP Relay enabled on the routers as well as a local DHCP server. Will this cause a clash?}
\newline
\noindent\textbf{A:}~
No. It is possible to have as many DHCP servers on a network segment as makes sense. A DHCP server offers an IP address lease, but it is the client that determines which offer is accepted, no matter how many offers are made. Under normal operation, the client accepts the first offer it receives.

The only exception to this rule is when the client makes a directed request from a specific DHCP server for renewal of the lease it has. This means that under normal circumstances there is no risk of a clash.


\vspace{1em}
\vspace{1em}
\noindent{}5.~\textbf{Q:}~\textit{How does the Windows client find the PDC?}
\newline
\noindent\textbf{A:}~
The Windows client obtains the WINS server address from the DHCP lease information. It also obtains from the DHCP lease information the parameter that causes it to use directed UDP (UDP Unicast) to register itself with the WINS server and to obtain enumeration of vital network information to enable it to operate successfully.


\vspace{1em}
\vspace{1em}
\noindent{}6.~\textbf{Q:}~\textit{Why did you enable IP forwarding (routing) only on the server called {\texttt{\docbookhyphenatedot{MASSIVE}}}?}
\newline
\noindent\textbf{A:}~
The server called {\texttt{\docbookhyphenatedot{MASSIVE}}} is acting as a router to the Internet. No other server (BLDG1 or BLDG2) has any need for IP forwarding because they are attached only to their own network. Route table entries are needed to direct MASSIVE to send all traffic intended for the remote network segments to the router that is its gateway to them.


\vspace{1em}
\vspace{1em}
\noindent{}7.~\textbf{Q:}~\textit{You did nothing special to implement roaming profiles. Why?}
\newline
\noindent\textbf{A:}~
Unless configured to do otherwise, the default behavior with Samba-3 and Windows XP Professional clients is to use roaming profiles.


\vspace{1em}
\vspace{1em}
\noindent{}8.~\textbf{Q:}~\textit{On the domain member computers, you configured winbind in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file. You did not configure any PAM settings. Is this an omission?}
\newline
\noindent\textbf{A:}~
PAM is needed only for authentication. When Samba is using Microsoft encrypted passwords, it makes only marginal use of PAM. PAM configuration handles only authentication. If you want to log onto the domain member servers using Windows networking usernames and passwords, it is necessary to configure PAM to enable the use of winbind. Samba makes use only of the identity resolution facilities of the name service switch (NSS).


\vspace{1em}
\vspace{1em}
\noindent{}9.~\textbf{Q:}~\textit{You are starting SWAT up on this example but have not discussed that anywhere. Why did you do this?}
\newline
\noindent\textbf{A:}~
Oh, I did not think you would notice that. It is there so that it can be used. This is more fully discussed in {\em{TOSHARG2}}, which has a full chapter dedicated to the subject. While we are on the subject, it should be noted that you should definitely not use SWAT on any system that makes use of {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} {\ttfamily\itshape{\docbookhyphenatedot{include}}} files because SWAT optimizes them out into an aggregated file but leaves in place a broken reference to the top-layer include file. SWAT was not designed to handle this functionality gracefully.


\vspace{1em}
\vspace{1em}
\noindent{}10.~\textbf{Q:}~\textit{The domain controller has an auto-shutdown script. Isn't that dangerous?}
\newline
\noindent\textbf{A:}~
Well done, you spotted that! I guess it is dangerous. It is good to know that you can do this, though.


\vspace{1em}
\cleardoublepage 
% -------------------------------------------------------------
% Chapter Making Happy Users 
% ------------------------------------------------------------- 	
\chapter{Making Happy Users}
\label{happy}\hypertarget{happy}{}%

It is said that {``}a day that is without troubles is not fulfilling. Rather, give me a day of troubles well handled so that I can be content with my achievements.{''}

In the world of computer networks, problems are as varied as the people who create them or experience them. The design of the network implemented in \hyperlink{Big500users}{Chapter {\ref{Big500users}}, {``}The 500-User Office{''}} may create problems for some network users. The following lists some of the problems that may occur:
\index{PDC}\index{network bandwidth!utilization}\index{BDC}\index{user account}\index{PDC/BDC ratio}
\begin{admonition}{xslt/figures/caution}{Caution}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

A significant number of network administrators have responded to the guidance given here. It should be noted that there are sites that have a single PDC for many hundreds of concurrent network clients. Network bandwidth, network bandwidth utilization, and server load are among the factors that determine the maximum number of Windows clients that can be served by a single domain controller (PDC or BDC) on a network segment. It is possible to operate with only a single PDC over a routed network. What is possible is not necessarily {\em{best practice}}. When Windows client network logons begin to fail with the message that the domain controller cannot be found or that the user account cannot be found (when you know it exists), that may be an indication that the domain controller is overloaded or network bandwidth is overloaded. The guidance given for PDC/BDC ratio to Windows clients is conservative and if followed will minimize problems ---  but it is not absolute.
\end{admonition}


\begin{description}
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Users experiencing difficulty logging onto the network}]\null{}
\index{network!logon} \index{multiple domain controllers} When a Windows client logs onto the network, many data packets are exchanged between the client and the server that is providing the network logon services. Each request between the client and the server must complete within a specific time limit. This is one of the primary factors that govern the installation of multiple domain controllers (usually called secondary or backup controllers). As a rough rule, there should be one such backup controller for every 30 to 150 clients. The actual limits are determined by network operational characteristics.

\index{PDC} \index{BDC} \index{clients per DC} If the domain controller provides only network logon services and all file and print activity is handled by domain member servers, one domain controller per 150 clients on a single network segment may suffice. In any case, it is highly recommended to have a minimum of one domain controller (PDC or BDC) per network segment. It is better to have at least one BDC on the network segment that has a PDC. If the domain controller is also used as a file and print server, the number of clients it can service reliably is reduced, and generally for low powered hardware should not exceed 30 machines (Windows workstations plus domain member servers) per domain controller. Many sites are able to operate with more clients per domain controller, the number of clients that can be supported is limited by the CPU speed, memory and the workload on the Samba server as well as network bandwidth utilization.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Slow logons and log-offs}]\null{}
\index{slow logon} Slow logons and log-offs may be caused by many factors that include: 
\begin{itemize}
%--- Item
\item 
\index{NetBIOS!name resolution!delays} \index{WINS!server} Excessive delays in the resolution of a NetBIOS name to its IP address. This may be observed when an overloaded domain controller is also the WINS server. Another cause may be the failure to use a WINS server (this assumes that there is a single network segment).


%--- Item
\item 
\index{traffic collisions} \index{HUB} \index{ethernet switch} Network traffic collisions due to overloading of the network segment. One short-term workaround to this may be to replace network HUBs with Ethernet switches.


%--- Item
\item 
\index{networking hardware!defective} Defective networking hardware. Over the past few years, we have seen on the Samba mailing list a significant increase in the number of problems that were traced to a defective network interface controller, a defective HUB or Ethernet switch, or defective cabling. In most cases, it was the erratic nature of the problem that ultimately pointed to the cause of the problem.


%--- Item
\item 
\index{profile!roaming} \index{MS Outlook!PST file} Excessively large roaming profiles. This type of problem is typically the result of poor user education as well as poor network management. It can be avoided by users not storing huge quantities of email in MS Outlook PST files as well as by not storing files on the desktop. These are old bad habits that require much discipline and vigilance on the part of network management.


%--- Item
\item 
\index{WebClient} You should verify that the Windows XP WebClient service is not running. The use of the WebClient service has been implicated in many Windows networking-related problems.

\end{itemize}

% \null and \mbox are tricks to induce different typesetting decisions
\item[{Loss of access to network drives and printer resources}]\null{}
Loss of access to network resources during client operation may be caused by a number of factors, including:

\begin{itemize}
%--- Item
\item 
\index{network!overload} Network overload (typically indicated by a high network collision rate)


%--- Item
\item 
Server overload


%--- Item
\item 
\index{network!timeout} Timeout causing the client to close a connection that is in use but has been latent (no traffic) for some time (5 minutes or more)


%--- Item
\item 
\index{network hardware!defective} Defective networking hardware

\end{itemize}

\index{data!corruption} No matter what the cause, a sudden loss of access to network resources can result in BSOD (blue screen of death) situations that necessitate rebooting of the client workstation. In the case of a mild problem, retrying to access the network drive of the printer may restore operations, but in any case this is a serious problem that may lead to the next problem, data corruption.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Potential data corruption}]\null{}
\index{data!corruption} Data corruption is one of the most serious problems. It leads to uncertainty, anger, and frustration, and generally precipitates immediate corrective demands. Management response to this type of problem may be rational, as well as highly irrational. There have been cases where management has fired network staff for permitting this situation to occur without immediate correction. There have been situations where perfectly functional hardware was thrown out and replaced, only to find the problem caused by a low-cost network hardware item. There have been cases where server operating systems were replaced, or where Samba was updated, only to later isolate the problem due to defective client software.
\end{description}

In this chapter, you can work through a number of measures that significantly arm you to anticipate and combat network performance issues. You can work through complex and thorny methods to improve the reliability of your network environment, but be warned that all such steps demand the price of complexity.

% ------------------------   
% Section 
\section{Regarding LDAP Directories and Windows Computer Accounts}
\label{id2515552}\hypertarget{id2515552}{}%

\index{LDAP!directory} Computer (machine) accounts can be placed wherever you like in an LDAP directory subject to some constraints that are described in this section.

\index{POSIX} \index{SambaSAMAccount} \index{machine account} \index{trust account} The POSIX and SambaSAMAccount components of computer (machine) accounts are both used by Samba. That is, machine accounts are treated inside Samba in the same way that Windows NT4/200X treats them. A user account and a machine account are indistinguishable from each other, except that the machine account ends in a \$ character, as do trust accounts.

\index{account} \index{UID} The need for Windows user, group, machine, trust, and other such accounts to be tied to a valid UNIX UID is a design decision that was made a long way back in the history of Samba development. It is unlikely that this decision will be reversed or changed during the remaining life of the Samba-3.x series.

\index{SID} \index{NSS} The resolution of a UID from the Windows SID is achieved within Samba through a mechanism that must refer back to the host operating system on which Samba is running. The name service switch (NSS) is the preferred mechanism that shields applications (like Samba) from the need to know everything about every host OS it runs on.

Samba asks the host OS to provide a UID via the {``}passwd{''}, {``}shadow{''} and {``}group{''} facilities in the NSS control (configuration) file. The best tool for achieving this is left up to the UNIX administrator to determine. It is not imposed by Samba. Samba provides winbindd together with its support libraries as one method. It is possible to do this via LDAP, and for that Samba provides the appropriate hooks so that all account entities can be located in an LDAP directory.

\index{nss\_ldap} For many the weapon of choice is to use the PADL nss\_ldap utility. This utility must be configured so that computer accounts can be resolved to a POSIX/UNIX account UID. That is fundamentally an LDAP design question. The information provided on the Samba list and in the documentation is directed at providing working examples only. The design of an LDAP directory is a complex subject that is beyond the scope of this documentation.

% ------------------------   
% Section 
\section{Introduction}
\label{id2515701}\hypertarget{id2515701}{}%

You just opened an email from Christine that reads:

Good morning, \begin{quote}

A few months ago we sat down to design the network. We discussed the challenges ahead and we all agreed to compromise our design to keep it simple. We knew there would be problems, but anticipated that we would have some time to resolve any issues that might be encountered.

As you now know, we started off on the wrong foot. We have a lot of unhappy users. One of them resigned yesterday afternoon because she was under duress to complete some critical projects. She suffered a blue screen of death situation just as she was finishing four hours of intensive work, all of which was lost. She has a unique requirement that involves storing large files on her desktop. Mary's desktop profile is nearly 1 GB in size. As a result of her desktop configuration, it takes her nearly 15 minutes just to log onto her workstation. But that is not enough. Because all network logon traffic passes over the network links between our buildings, logging on may take three or four attempts due to blue screen problems associated with network timeouts.

A few of us worked to help her out of trouble. We convinced her to stay and promised to fully resolve the difficulties she is facing. We have no choice. We must implement LDAP and set hard limits on what our users can do with their desktops. Otherwise, we face staff losses that can surely do harm to our growth as well as to staff morale. I am sure we can better deal with the consequences of what we know we must do than we can with the unrest we have now.

Stan and I have discussed the current situation. We are resolved to help our users and protect the well being of Abmas. Please acknowledge this advice with consent to proceed as required to regain control of our vital IT operations.

\hspace*\fill---Christine\end{quote}


\index{compromise} \index{network!multi-segment} Every compromise has consequences. Having a large routed (i.e., multisegment) network with only a single domain controller is a poor design that has obvious operational effects that may frustrate users. Here is your reply:
\begin{quote}

Christine, Your diligence and attention to detail are much valued. Stan and I fully support your proposals to resolve the issues. I am confident that your plans fully realized will significantly boost staff morale. Please go ahead with your plans. If you have any problems, please let me know. Please let Stan know what the estimated cost will be so I can approve the expense. Do not wait for approval; I appreciate the urgency.

\hspace*\fill---Bob\end{quote}
\subsection{Assignment Tasks}
\label{id2497659}\hypertarget{id2497659}{}%

The priority of assigned tasks in this chapter is:

\begin{enumerate}
%--- Item
\item 
\index{Backup Domain Controller|textit{see} {BDC} } \index{BDC} \index{tdbsam} \index{LDAP}\index{migration} Implement Backup Domain Controllers (BDCs) in each building. This involves a change from a {\em{tdbsam}} backend that was used in the previous chapter to an LDAP-based backend.

You can implement a single central LDAP server for this purpose.


%--- Item
\item 
\index{logon time} \index{network share} \index{default profile} \index{profile!default} Rectify the problem of excessive logon times. This involves redirection of folders to network shares as well as modification of all user desktops to exclude the redirected folders from being loaded at login time. You can also create a new default profile that can be used for all new users.

\end{enumerate}

\index{disk image} You configure a new MS Windows XP Professional workstation disk image that you roll out to all desktop users. The instructions you have created are followed on a staging machine from which all changes can be carefully tested before inflicting them on your network users.

\index{CUPS} This is the last network example in which specific mention of printing is made. The example again makes use of the CUPS printing system.

% ------------------------   
% Section 
\section{Dissection and Discussion}
\label{id2497802}\hypertarget{id2497802}{}%

\index{BDC} \index{LDAP} \index{OpenLDAP} The implementation of Samba BDCs necessitates the installation and configuration of LDAP. For this site, you use OpenLDAP, the open source software LDAP server platform. Commercial LDAP servers in current use with Samba-3 include:

\begin{itemize}
%--- Item
\item 
\index{eDirectory} Novell eDirectory\label{id2497849}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.novell.com/products/edirectory/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2497849} is being successfully used by some sites. Information on how to use eDirectory can be obtained from the Samba mailing lists or from Novell.


%--- Item
\item 
\index{Tivoli Directory Server} IBM Tivoli Directory Server\label{id2497869}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www-306.ibm.com/software/tivoli/products/directory-server/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2497869} can be used to provide the Samba LDAP backend. Example schema files are provided in the Samba source code tarball under the directory {\texttt{\docbookhyphenatefilename{\textasciitilde{}samba/\dbz{}example/\dbz{}LDAP.\dbz{}}}}


%--- Item
\item 
\index{Sun ONE Identity Server} Sun ONE Identity Server product suite\label{id2497895}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.sun.com/software/software/products/identity_srvr/home_identity.xml}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2497895} provides an LDAP server that can be used for Samba. Example schema files are provided in the Samba source code tarball under the directory {\texttt{\docbookhyphenatefilename{\textasciitilde{}samba/\dbz{}example/\dbz{}LDAP.\dbz{}}}}

\end{itemize}

A word of caution is fully in order. OpenLDAP is purely an LDAP server, and unlike commercial offerings, it requires that you manually edit the server configuration files and manually initialize the LDAP directory database. OpenLDAP itself has only command-line tools to help you to get OpenLDAP and Samba-3 running as required, albeit with some learning curve challenges.

\index{Active Directory} For most sites, the deployment of Microsoft Active Directory from the shrink-wrapped installation is quite adequate. If you are migrating from Microsoft Active Directory, be warned that OpenLDAP does not include GUI-based directory management tools. Even a simple task such as adding users to the OpenLDAP database requires an understanding of what you are doing, why you are doing it, and the tools that you must use.

\index{Identity Management} \index{high availability} \index{directory!replication} \index{directory!synchronization} \index{performance} \index{directory!management} \index{directory!schema} When installed and configured, an OpenLDAP Identity Management backend for Samba functions well. High availability operation may be obtained through directory replication/synchronization and master/slave server configurations. OpenLDAP is a mature platform to host the organizational directory infrastructure that can include all UNIX accounts, directories for electronic mail, and much more. The price paid through learning how to design an LDAP directory schema in implementation and configuration of management tools is well rewarded by performance and flexibility and the freedom to manage directory contents with greater ability to back up, restore, and modify the directory than is generally possible with Microsoft Active Directory.

\index{comparison!Active Directory \& OpenLDAP} \index{ADAM} \index{Active Directory} \index{OpenLDAP} A comparison of OpenLDAP with Microsoft Active Directory does not do justice to either. OpenLDAP is an LDAP directory tool-set. Microsoft Active Directory Server is an implementation of an LDAP server that is largely preconfigured for a specific task orientation. It comes with a set of administrative tools that is entirely customized for the purpose of running MS Windows applications that include file and print services, Microsoft Exchange server, Microsoft SQL server, and more. The complexity of OpenLDAP is highly valued by the UNIX administrator who wants to build a custom directory solution. Microsoft provides an application called MS ADAM\label{id2491718}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.microsoft.com/windowsserver2003/adam/default.mspx}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2491718} that provides more generic LDAP services, yet it does not have the vanilla-like services of OpenLDAP.

\index{directory!schema} \index{passdb backend} You may wish to consider outsourcing the development of your OpenLDAP directory to an expert, particularly if you find the challenge of learning about LDAP directories, schemas, configuration, and management tools and the creation of shell and Perl scripts a bit challenging. OpenLDAP can be easily customized, though it includes many ready-to-use schemas. Samba-3 provides an OpenLDAP schema file that is required for use as a passdb backend.

\index{interoperability} For those who are willing to brave the process of installing and configuring LDAP and Samba-3 interoperability, there are a few nice Web-based tools that may help you to manage your users and groups more effectively. The Web-based tools you might like to consider include the LDAP Account Manager\label{id2491770}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://lam.sourceforge.net/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2491770} (LAM) and the Webmin-based Webmin\label{id2491776}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.webmin.com}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2491776} Idealx CGI tools\label{id2491781}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://webmin.idealx.org/index.en.html}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2491781}.

Some additional LDAP tools should be mentioned. Every so often a Samba user reports using one of these, so it may be useful to them: GQ\label{id2491793}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://biot.com/gq}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2491793}, a GTK-based LDAP browser; LDAP Browser/Editor\label{id2491799}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.iit.edu/~gawojar/ldap/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2491799} ; JXplorer\label{id2491805}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.jxplorer.org/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2491805} (by Computer Associates); and phpLDAPadmin\label{id2491810}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://phpldapadmin.sourceforge.net/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2491810}.

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

The following prescriptive guidance is not an LDAP tutorial. The LDAP implementation expressly uses minimal security controls. No form of secure LDAP communications is attempted. The LDAP configuration information provided is considered to consist of the barest essentials only. You are strongly encouraged to learn more about LDAP before attempting to deploy it in a business-critical environment.
\end{admonition}


Information to help you get started with OpenLDAP is available from the OpenLDAP web site\label{id2491833}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.openldap.org/pub/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2491833}. Many people have found the book {\em{LDAP System Administration}},\label{id2491839}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.oreilly.com/catalog/ldapsa/index.html}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2491839} by Jerry Carter quite useful.

\index{BDC} \index{network!segment} \index{performance} \index{network!wide-area} Mary's problems are due to two factors. First, the absence of a domain controller on the local network is the main cause of the errors that result in blue screen crashes. Second, Mary has a large profile that must be loaded over the WAN connection. The addition of BDCs on each network segment significantly improves overall network performance for most users, but it is not enough. You must gain control over user desktops, and this must be done in a way that wins their support and does not cause further loss of staff morale. The following procedures solve this problem.

\index{smart printing} There is also an opportunity to implement smart printing features. You add this to the Samba configuration so that future printer changes can be managed without need to change desktop configurations.

You add the ability to automatically download new printer drivers, even if they are not installed in the default desktop profile. Only one example of printing configuration is given. It is assumed that you can extrapolate the principles and use them to install all printers that may be needed.
\subsection{Technical Issues}
\label{id2512001}\hypertarget{id2512001}{}%

\index{identity!management} \index{directory!server} \index{Posix} The solution provided is a minimal approach to getting OpenLDAP running as an identity management directory server for UNIX system accounts as well as for Samba. From the OpenLDAP perspective, UNIX system accounts are stored POSIX schema extensions. Samba provides its own schema to permit storage of account attributes Samba needs. Samba-3 can use the LDAP backend to store:

\begin{itemize}
%--- Item
\item 
Windows Networking User Accounts


%--- Item
\item 
Windows NT Group Accounts


%--- Item
\item 
Mapping Information between UNIX Groups and Windows NT Groups


%--- Item
\item 
ID Mappings for SIDs to UIDs (also for foreign Domain SIDs)

\end{itemize}

\index{UNIX accounts} \index{Windows accounts} \index{PADL LDAP tools} \index{/etc/group} \index{LDAP} \index{name service switch|textit{see} {NSS} } \index{NSS} \index{UID} \index{nss\_ldap} The use of LDAP with Samba-3 makes it necessary to store UNIX accounts as well as Windows Networking accounts in the LDAP backend. This implies the need to use the PADL LDAP tools\label{id2512139}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.padl.com/Contents/OpenSourceSoftware.html}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2512139}. The resolution of the UNIX group name to its GID must be enabled from either the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}group}}} or from the LDAP backend. This requires the use of the PADL {\texttt{\docbookhyphenatefilename{nss\_\dbz{}ldap}}} tool-set that integrates with the NSS. The same requirements exist for resolution of the UNIX username to the UID. The relationships are demonstrated in \hyperlink{sbehap-LDAPdiag}{Figure {\ref{sbehap-LDAPdiag}}}.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{sbehap-LDAPdiag}{}%
\includegraphics[scale=0.5]{Samba3-ByExample/images/UNIX-Samba-and-LDAP}
{{\caption[{The Interaction of LDAP, UNIX Posix Accounts and Samba Accounts}]{{{The Interaction of LDAP, UNIX Posix Accounts and Samba Accounts}}}\label{sbehap-LDAPdiag}}}
\end{center}
\end{figure}


\index{security} \index{LDAP!secure} You configure OpenLDAP so that it is operational. Before deploying the OpenLDAP, you really ought to learn how to configure secure communications over LDAP so that site security is not at risk. This is not covered in the following guidance.

\index{PDC} \index{LDAP Interchange Format|textit{see} {LDIF} } \index{LDIF} \index{secrets.tdb} When OpenLDAP has been made operative, you configure the PDC called {\texttt{\docbookhyphenatedot{MASSIVE}}}. You initialize the Samba {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb$_\text{}$}}} file. Then you create the LDAP Interchange Format (LDIF) file from which the LDAP database can be initialized. You need to decide how best to create user and group accounts. A few hints are, of course, provided. You can also find on the enclosed CD-ROM, in the {\texttt{\docbookhyphenatefilename{Chap06}}} directory, a few tools that help to manage user and group configuration.

\index{folder redirection} \index{default profile} \index{roaming profile} In order to effect folder redirection and to add robustness to the implementation, create a network default profile. All network users workstations are configured to use the new profile. Roaming profiles will automatically be deleted from the workstation when the user logs off.

\index{mandatory profile} The profile is configured so that users cannot change the appearance of their desktop. This is known as a mandatory profile. You make certain that users are able to use their computers efficiently.

\index{logon script} A network logon script is used to deliver flexible but consistent network drive connections.
\subsubsection{Addition of Machines to the Domain}
\label{sbehap-ppc}\hypertarget{sbehap-ppc}{}%

\index{} \index{} \index{} \index{} Samba versions prior to 3.0.11 necessitated the use of a domain administrator account that maps to the UNIX UID=0. The UNIX operating system permits only the {\texttt{\docbookhyphenatedot{root}}} user to add user and group accounts. Samba 3.0.11 introduced a new facility known as {\texttt{\docbookhyphenatedot{Privileges}}}, which provides five new privileges that can be assigned to users and/or groups; see Table 5.1.

% table ------------------------------------------------------
\begin{table}[htb]
\begin{center}%
\hypertarget{sbehap-privs}{}%
\captionswapskip{}{{\caption{Current Privilege Capabilities}\label{sbehap-privs}}}
\captionswapskip{}\begin{tabular}{|l|l|}
\hline 
\docbooktolatexalignll {{{\bfseries Privilege}}} & \docbooktolatexalignll {{{\bfseries Description}}} \tabularnewline
 \hline 
{{SeMachineAccountPrivilege}} & {{Add machines to domain}} \tabularnewline
 \hline 
{{SePrintOperatorPrivilege}} & {{Manage printers}} \tabularnewline
 \hline 
{{SeAddUsersPrivilege}} & {{Add users and groups to the domain}} \tabularnewline
 \hline 
{{SeRemoteShutdownPrivilege}} & {{Force shutdown from a remote system}} \tabularnewline
 \hline 
{{SeDiskOperatorPrivilege}} & {{Manage disk share}} \tabularnewline
\hline 
\end{tabular}
\end{center}
\end{table}


In this network example use is made of one of the supported privileges purely to demonstrate how any user can now be given the ability to add machines to the domain using a normal user account that has been given the appropriate privileges.
\subsubsection{Roaming Profile Background}
\label{id2533040}\hypertarget{id2533040}{}%

As XP roaming profiles grow, so does the amount of time it takes to log in and out.

\index{roaming profile} \index{HKEY\_CURRENT\_USER} \index{NTUSER.DAT} \index{\%USERNAME\%} An XP roaming profile consists of the {\texttt{\docbookhyphenatedot{HKEY\_CURRENT\_USER}}} hive file {\texttt{\docbookhyphenatefilename{NTUSER.\dbz{}DAT}}} and a number of folders (My Documents, Application Data, Desktop, Start Menu, Templates, NetHood, Favorites, and so on). When a user logs onto the network with the default configuration of MS Windows NT/200x/XPP, all this data is copied to the local machine under the {\texttt{\docbookhyphenatefilename{C:\docbooktolatexgobble\string\\Documents and Settings\docbooktolatexgobble\string\\\%USERNAME\%}}} directory. While the user is logged in, any changes made to any of these folders or to the {\texttt{\docbookhyphenatedot{HKEY\_CURRENT\_USER}}} branch of the registry are made to the local copy of the profile. At logout the profile data is copied back to the server. This behavior can be changed through appropriate registry changes and/or through changes to the default user profile. In the latter case, it updates the registry with the values that are set in the profile {\texttt{\docbookhyphenatefilename{NTUSER.\dbz{}DAT}}} file.

The first challenge is to reduce the amount of data that must be transferred to and from the profile server as roaming profiles are processed. This includes removing all the shortcuts in the Recent directory, making sure the cache used by the Web browser is not being dumped into the {\texttt{\docbookhyphenatefilename{Application Data}}} folder, removing the Java plug-ins cache (the .jpi\_cache directory in the profile), as well as training the user to not place large files on the desktop and to use his or her mapped home directory instead of the {\texttt{\docbookhyphenatefilename{My Documents}}} folder for saving documents.

\index{My Documents} Using a folder other than {\texttt{\docbookhyphenatefilename{My Documents}}} is a nuisance for some users, since many applications use it by default.

\index{roaming profiles} \index{Local Group Policy} \index{NTUSER.DAT} The secret to rapid loading of roaming profiles is to prevent unnecessary data from being copied back and forth, without losing any functionality. This is not difficult; it can be done by making changes to the Local Group Policy on each client as well as changing some paths in each user's {\texttt{\docbookhyphenatefilename{NTUSER.\dbz{}DAT}}} hive.

\index{Network Default Profile} \index{redirected folders} Every user profile has its own {\texttt{\docbookhyphenatefilename{NTUSER.\dbz{}DAT}}} file. This means you need to edit every user's profile, unless a better method can be followed. Fortunately, with the right preparations, this is not difficult. It is possible to remove the {\texttt{\docbookhyphenatefilename{NTUSER.\dbz{}DAT}}} file from each user's profile. Then just create a Network Default Profile. Of course, it is necessary to copy all files from redirected folders to the network share to which they are redirected.
\subsubsection{The Local Group Policy}
\label{sbehap-locgrppol}\hypertarget{sbehap-locgrppol}{}%

\index{Group Policy Objects} \index{Active Directory} \index{PDC} \index{Group Policy editor} Without an Active Directory PDC, you cannot take full advantage of Group Policy Objects. However, you can still make changes to the Local Group Policy by using the Group Policy editor ({\bfseries{gpedit.msc}}).

The {\em{Exclude directories in roaming profile}} settings can be found under {\sffamily \bfseries User Configuration} $\to$ {\sffamily \bfseries Administrative Templates} $\to$ {\sffamily \bfseries System} $\to$ {\sffamily \bfseries User Profiles}. By default this setting contains {``}Local Settings; Temporary Internet Files; History; Temp{''}.

Simply add the folders you do not wish to be copied back and forth to this semicolon-separated list. Note that this change must be made on all clients that are using roaming profiles.
\subsubsection{Profile Changes}
\label{id2533312}\hypertarget{id2533312}{}%

\index{NTUSER.DAT} \index{\%USERNAME\%} There are two changes that should be done to each user's profile. Move each of the directories that you have excluded from being copied back and forth out of the usual profile path. Modify each user's {\texttt{\docbookhyphenatefilename{NTUSER.\dbz{}DAT}}} file to point to the new paths that are shared over the network instead of to the default path ({\texttt{\docbookhyphenatefilename{C:\docbooktolatexgobble\string\\Documents and Settings\docbooktolatexgobble\string\\\%USERNAME\%}}}).

\index{Default User} \index{regedt32} The above modifies existing user profiles. So that newly created profiles have these settings, you need to modify the {\texttt{\docbookhyphenatefilename{NTUSER.\dbz{}DAT}}} in the {\texttt{\docbookhyphenatefilename{C:\docbooktolatexgobble\string\\Documents and Settings\docbooktolatexgobble\string\\Default User}}} folder on each client machine, changing the same registry keys. You could do this by copying {\texttt{\docbookhyphenatefilename{NTUSER.\dbz{}DAT}}} to a Linux box and using {\bfseries{regedt32}}. The basic method is described under \hyperlink{redirfold}{Section {\ref{redirfold}}}.
\subsubsection{Using a Network Default User Profile}
\label{id2533397}\hypertarget{id2533397}{}%

\index{NETLOGON} \index{NTUSER.DAT} If you are using Samba as your PDC, you should create a file share called {\texttt{\docbookhyphenatedot{NETLOGON}}} and within that create a directory called {\texttt{\docbookhyphenatefilename{Default User}}}, which is a copy of the desired default user configuration (including a copy of {\texttt{\docbookhyphenatefilename{NTUSER.\dbz{}DAT}}}). If this share exists and the {\texttt{\docbookhyphenatefilename{Default User}}} folder exists, the first login from a new account pulls its configuration from it. See also the Real Men Don't Click\label{id2533443}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://isg.ee.ethz.ch/tools/realmen/det/skel.en.html}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2533443} Web site.
\subsubsection{Installation of Printer Driver Auto-Download}
\label{id2533452}\hypertarget{id2533452}{}%

\index{printing!dumb} \index{dumb printing} \index{Raw Print Through} The subject of printing is quite topical. Printing problems run second place to name resolution issues today. So far in this book, you have experienced only what is generally known as {``}dumb{''} printing. Dumb printing is the arrangement by which all drivers are manually installed on each client and the printing subsystems perform no filtering or intelligent processing. Dumb printing is easily understood. It usually works without many problems, but it has its limitations also. Dumb printing is better known as {\bfseries{Raw-Print-Through}} printing.

\index{printing!drag-and-drop} \index{printing!point-n-click} Samba permits the configuration of {\bfseries{smart}} printing using the Microsoft Windows point-and-click (also called drag-and-drop) printing. What this provides is essentially the ability to print to any printer. If the local client does not yet have a driver installed, the driver is automatically downloaded from the Samba server and installed on the client. Drag-and-drop printing is neat; it means the user never needs to fuss with driver installation, and that is a Good Thing,\texttrademark{} isn't it?

There is a further layer of print job processing that is known as {\bfseries{intelligent}} printing that automatically senses the file format of data submitted for printing and then invokes a suitable print filter to convert the incoming data stream into a format suited to the printer to which the job is dispatched.

\index{CUPS} \index{Easy Software Products} \index{Postscript} The CUPS printing subsystem is capable of intelligent printing. It has the capacity to detect the data format and apply a print filter. This means that it is feasible to install on all Windows clients a single printer driver for use with all printers that are routed through CUPS. The most sensible driver to use is one for a PostScript printer. Fortunately, Easy Software Products\label{id2533579}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.easysw.com}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2533579}, the authors of CUPS, have released a PostScript printing driver for Windows. It can be installed into the Samba printing backend so that it automatically downloads to the client when needed.

This means that so long as there is a CUPS driver for the printer, all printing from Windows software can use PostScript, no matter what the actual printer language for the physical device is. It also means that the administrator can swap out a printer with a totally different type of device without ever needing to change a client workstation driver.

This book is about Samba-3, so you can confine the printing style to just the smart style of installation. Those interested in further information regarding intelligent printing should review documentation on the Easy Software Products Web site.
\subsubsection{Avoiding Failures: Solving Problems Before They Happen}
\label{sbeavoid}\hypertarget{sbeavoid}{}%

It has often been said that there are three types of people in the world: those who have sharp minds and those who forget things. Please do not ask what the third group is like! Well, it seems that many of us have company in the second group. There must be a good explanation why so many network administrators fail to solve apparently simple problems efficiently and effectively.

Here are some diagnostic guidelines that can be referred to when things go wrong:
\subparagraph*{Preliminary Advice: Dangers Can Be Avoided}
\label{id2533630}\hypertarget{id2533630}{}%

The best advice regarding how to mend a broken leg is {``}Never break a leg!{''}

\index{LDAP} Newcomers to Samba and LDAP seem to struggle a great deal at first. If you want advice regarding the best way to remedy LDAP and Samba problems: {``}Avoid them like the plague!{''}

If you are now asking yourself how problems can be avoided, the best advice is to start out your learning experience with a {\em{known-good configuration.}} After you have seen a fully working solution, a good way to learn is to make slow and progressive changes that cause things to break, then observe carefully how and why things ceased to work.

The examples in this chapter (also in the book as a whole) are known to work. That means that they could serve as the kick-off point for your journey through fields of knowledge. Use this resource carefully; we hope it serves you well.

\begin{admonition}{xslt/figures/warning}{Warning}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

Do not be lulled into thinking that you can easily adopt the examples in this book and adapt them without first working through the examples provided. A little thing overlooked can cause untold pain and may permanently tarnish your experience.
\end{admonition}

\subparagraph*{The Name Service Caching Daemon}
\label{id2533688}\hypertarget{id2533688}{}%

The name service caching daemon (nscd) is a primary cause of difficulties with name resolution, particularly where {\bfseries{winbind}} is used. Winbind does its own caching, thus nscd causes double caching which can lead to peculiar problems during debugging. As a rule, it is a good idea to turn off the name service caching daemon.

Operation of the name service caching daemon is controlled by the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nscd.\dbz{}conf}}} file. Typical contents of this file are as follows: 
\begin{Verbatim}[]

# /etc/nscd.conf
# An example Name Service Cache config file.  This file is needed by nscd.
# Legal entries are:
#       logfile                 <file>
#       debug-level             <level>
#       threads                 <threads to use>
#       server-user             <user to run server as instead of root>
#               server-user is ignored if nscd is started with -S parameters
#       stat-user               <user who is allowed to request statistics>
#       reload-count            unlimited|<number>
#
#       enable-cache            <service> <yes|no>
#       positive-time-to-live   <service> <time in seconds>
#       negative-time-to-live   <service> <time in seconds>
#       suggested-size          <service> <prime number>
#       check-files             <service> <yes|no>
#       persistent              <service> <yes|no>
#       shared                  <service> <yes|no>
# Currently supported cache names (services): passwd, group, hosts
#       logfile                 /var/log/nscd.log
#       threads                 6
#       server-user             nobody
#       stat-user               somebody
        debug-level             0
#       reload-count            5
        enable-cache            passwd          yes
        positive-time-to-live   passwd          600
        negative-time-to-live   passwd          20
        suggested-size          passwd          211
        check-files             passwd          yes
        persistent              passwd          yes
        shared                  passwd          yes
        enable-cache            group           yes
        positive-time-to-live   group           3600
        negative-time-to-live   group           60
        suggested-size          group           211
        check-files             group           yes
        persistent              group           yes
        shared                  group           yes
# !!!!!WARNING!!!!! Host cache is insecure!!! The mechanism in nscd to
# cache hosts will cause your local system to not be able to trust
# forward/reverse lookup checks. DO NOT USE THIS if your system relies on
# this sort of security mechanism. Use a caching DNS server instead.
        enable-cache            hosts           no
        positive-time-to-live   hosts           3600
        negative-time-to-live   hosts           20
        suggested-size          hosts           211
        check-files             hosts           yes
        persistent              hosts           yes
        shared                  hosts           yes

\end{Verbatim}
 It is feasible to comment out the {\texttt{\docbookhyphenatedot{passwd}}} and {\texttt{\docbookhyphenatedot{group}}} entries so they will not be cached. Alternatively, it is often simpler to just disable the {\bfseries{nscd}} service by executing (on Novell SUSE Linux): 
\begin{Verbatim}[]

root#  chkconfig nscd off
root#  rcnscd off

\end{Verbatim}

\subparagraph*{Debugging LDAP}
\label{id2533799}\hypertarget{id2533799}{}%

\index{/etc/openldap/slapd.conf} \index{loglevel} \index{slapd} In the example {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap/\dbz{}slapd.\dbz{}conf}}} control file (see \hyperlink{sbehap-dbconf}{Example {\ref{sbehap-dbconf}}}) there is an entry for {\texttt{\docbookhyphenatedot{loglevel 256}}}. To enable logging via the syslog infrastructure, it is necessary to uncomment this parameter and restart {\bfseries{slapd}}.

\index{/etc/syslog.conf} \index{/var/log/ldaplogs} LDAP log information can be directed into a file that is separate from the normal system log files by changing the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}syslog.\dbz{}conf}}} file so it has the following contents: 
\begin{Verbatim}[]

# Some foreign boot scripts require local7
#
local0,local1.*                 -/var/log/localmessages
local2,local3.*                 -/var/log/localmessages
local5.*                        -/var/log/localmessages
local6,local7.*                 -/var/log/localmessages
local4.*                        -/var/log/ldaplogs

\end{Verbatim}
 In this case, all LDAP-related logs will be directed to the file {\texttt{\docbookhyphenatefilename{/\dbz{}var/\dbz{}log/\dbz{}ldaplogs}}}. This makes it easy to track LDAP errors. The snippet provides a simple example of usage that can be modified to suit local site needs. The configuration used later in this chapter reflects such customization with the intent that LDAP log files will be stored at a location that meets local site needs and wishes more fully.
\subparagraph*{Debugging NSS\_LDAP}
\label{id2533894}\hypertarget{id2533894}{}%

The basic mechanism for diagnosing problems with the nss\_ldap utility involves adding to the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}} file the following parameters: 
\begin{Verbatim}[]

debug 256
logdir /data/logs

\end{Verbatim}
 Create the log directory as follows: 
\begin{Verbatim}[]

root#  mkdir /data/logs

\end{Verbatim}

\newpage 
The diagnostic process should follow these steps:
NSS_LDAP Diagnostic Steps\begin{enumerate}

\item{Verify the {\texttt{\docbookhyphenatedot{nss\_base\_passwd, nss\_base\_shadow, nss\_base\_group}}} entries in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}} file and compare them closely with the directory tree location that was chosen when the directory was first created.  One way this can be done is by executing: 
\begin{Verbatim}[]

root#  slapcat | grep Group | grep dn
dn: ou=Groups,dc=abmas,dc=biz
dn: cn=Domain Admins,ou=Groups,dc=abmas,dc=biz
dn: cn=Domain Users,ou=Groups,dc=abmas,dc=biz
dn: cn=Domain Guests,ou=Groups,dc=abmas,dc=biz
dn: cn=Domain Computers,ou=Groups,dc=abmas,dc=biz
dn: cn=Administrators,ou=Groups,dc=abmas,dc=biz
dn: cn=Print Operators,ou=Groups,dc=abmas,dc=biz
dn: cn=Backup Operators,ou=Groups,dc=abmas,dc=biz
dn: cn=Replicators,ou=Groups,dc=abmas,dc=biz

\end{Verbatim}
 The first line is the DIT entry point for the container for POSIX groups. The correct entry for the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}} for the {\texttt{\docbookhyphenatedot{nss\_base\_group}}} parameter therefore is the distinguished name (dn) as applied here: 
\begin{Verbatim}[]

nss_base_group ou=Groups,dc=abmas,dc=biz?one

\end{Verbatim}
 The same process may be followed to determine the appropriate dn for user accounts. If the container for computer accounts is not the same as that for users (see the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file entry for {\texttt{\docbookhyphenatedot{ldap machine suffix}}}), it may be necessary to set the following DIT dn in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}} file: 
\begin{Verbatim}[]

nss_base_passwd dc=abmas,dc=biz?sub

\end{Verbatim}
 This instructs LDAP to search for machine as well as user entries from the top of the DIT down. This is inefficient, but at least should work. Note: It is possible to specify multiple {\texttt{\docbookhyphenatedot{nss\_base\_passwd}}} entries in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}} file; they will be evaluated sequentially. Let us consider an example of use where the following DIT has been implemented:  
\begin{itemize}
%--- Item
\item 
User accounts are stored under the DIT: ou=Users, dc=abmas, dc=biz


%--- Item
\item 
User login accounts are under the DIT: ou=People, ou-Users, dc=abmas, dc=biz


%--- Item
\item 
Computer accounts are under the DIT: ou=Computers, ou=Users, dc=abmas, dc=biz

\end{itemize}
  The appropriate multiple entry for the {\texttt{\docbookhyphenatedot{nss\_base\_passwd}}} directive in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}} file may be: 
\begin{Verbatim}[]

nss_base_passwd ou=People,ou=Users,dc=abmas,dc=org?one
nss_base_passwd ou=Computers,ou=Users,dc=abmas,dc=org?one

\end{Verbatim}
}

\item{Perform lookups such as: 
\begin{Verbatim}[]

root#  getent passwd

\end{Verbatim}
 Each such lookup will create an entry in the {\texttt{\docbookhyphenatefilename{/\dbz{}data/\dbz{}log}}} directory for each such process executed. The contents of each file created in this directory may provide a hint as to the cause of the a problem that is under investigation.}

\item{For additional diagnostic information, check the contents of the {\texttt{\docbookhyphenatefilename{/\dbz{}var/\dbz{}log/\dbz{}messages}}} to see what error messages are being generated as a result of the LDAP lookups. Here is an example of a successful lookup: 
\begin{Verbatim}[]

slapd[12164]: conn=0 fd=10 ACCEPT from IP=127.0.0.1:33539
(IP=0.0.0.0:389)
slapd[12164]: conn=0 op=0 BIND dn="" method=128
slapd[12164]: conn=0 op=0 RESULT tag=97 err=0 text=
slapd[12164]: conn=0 op=1 SRCH base="" scope=0 deref=0
filter="(objectClass=*)"
slapd[12164]: conn=0 op=1 SEARCH RESULT tag=101 err=0
nentries=1 text=
slapd[12164]: conn=0 op=2 UNBIND
slapd[12164]: conn=0 fd=10 closed
slapd[12164]: conn=1 fd=10 ACCEPT from
IP=127.0.0.1:33540 (IP=0.0.0.0:389)
slapd[12164]: conn=1 op=0 BIND
dn="cn=Manager,dc=abmas,dc=biz" method=128
slapd[12164]: conn=1 op=0 BIND
dn="cn=Manager,dc=abmas,dc=biz" mech=SIMPLE ssf=0
slapd[12164]: conn=1 op=0 RESULT tag=97 err=0 text=
slapd[12164]: conn=1 op=1 SRCH
base="ou=People,dc=abmas,dc=biz" scope=1 deref=0
filter="(objectClass=posixAccount)"
slapd[12164]: conn=1 op=1 SRCH attr=uid userPassword
uidNumber gidNumber cn
homeDirectory loginShell gecos description objectClass
slapd[12164]: conn=1 op=1 SEARCH RESULT tag=101 err=0
nentries=2 text=
slapd[12164]: conn=1 fd=10 closed


\end{Verbatim}
}

\item{Check that the bindpw entry in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}} or in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}secrets}}} file is correct, as specified in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap/\dbz{}slapd.\dbz{}conf}}} file.}
\end{enumerate}
\subparagraph*{Debugging Samba}
\label{id2534168}\hypertarget{id2534168}{}%

The following parameters in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file can be useful in tracking down Samba-related problems: 
\begin{Verbatim}[]

[global]
	...
	log level = 5
	log file = /var/log/samba/%m.log
	max log size = 0
	...

\end{Verbatim}
 This will result in the creation of a separate log file for every client from which connections are made. The log file will be quite verbose and will grow continually. Do not forget to change these lines to the following when debugging has been completed: 
\begin{Verbatim}[]

[global]
	...
	log level = 1
	log file = /var/log/samba/%m.log
	max log size = 50
	...

\end{Verbatim}


The log file can be analyzed by executing: 
\begin{Verbatim}[]

root#  cd /var/log/samba
root#  grep -v "^\[200" machine_name.log

\end{Verbatim}


Search for hints of what may have failed by looking for the words {\em{fail}} and {\em{error}}.
\subparagraph*{Debugging on the Windows Client}
\label{id2534234}\hypertarget{id2534234}{}%

MS Windows 2000 Professional and Windows XP Professional clients can be configured to create a netlogon.log file that can be very helpful in diagnosing network logon problems. Search the Microsoft knowledge base for detailed instructions. The techniques vary a little with each version of MS Windows.
\subsection{Political Issues}
\label{id2534251}\hypertarget{id2534251}{}%

MS Windows network users are generally very sensitive to limits that may be imposed when confronted with locked-down workstation configurations. The challenge you face must be promoted as a choice between reliable, fast network operation and a constant flux of problems that result in user irritation.
\subsection{Installation Checklist}
\label{id2534266}\hypertarget{id2534266}{}%

You are starting a complex project. Even though you went through the installation of a complex network in \hyperlink{Big500users}{Chapter {\ref{Big500users}}, {``}The 500-User Office{''}}, this network is a bigger challenge because of the large number of complex applications that must be configured before the first few steps can be validated. Take stock of what you are about to undertake, prepare yourself, and frequently review the steps ahead while making at least a mental note of what has already been completed. The following task list may help you to keep track of the task items that are covered:

\begin{itemize}
%--- Item
\item 
Samba-3 PDC Server Configuration

\begin{enumerate}
%--- Item
\item 
DHCP and DNS servers


%--- Item
\item 
OpenLDAP server


%--- Item
\item 
PAM and NSS client tools


%--- Item
\item 
Samba-3 PDC


%--- Item
\item 
Idealx smbldap scripts


%--- Item
\item 
LDAP initialization


%--- Item
\item 
Create user and group accounts


%--- Item
\item 
Printers


%--- Item
\item 
Share point directory roots


%--- Item
\item 
Profile directories


%--- Item
\item 
Logon scripts


%--- Item
\item 
Configuration of user rights and privileges

\end{enumerate}


%--- Item
\item 
Samba-3 BDC Server Configuration

\begin{enumerate}
%--- Item
\item 
DHCP and DNS servers


%--- Item
\item 
PAM and NSS client tools


%--- Item
\item 
Printers


%--- Item
\item 
Share point directory roots


%--- Item
\item 
Profiles directories

\end{enumerate}


%--- Item
\item 
Windows XP Client Configuration

\begin{enumerate}
%--- Item
\item 
Default profile folder redirection


%--- Item
\item 
MS Outlook PST file relocation


%--- Item
\item 
Delete roaming profile on logout


%--- Item
\item 
Upload printer drivers to Samba servers


%--- Item
\item 
Install software


%--- Item
\item 
Creation of roll-out images

\end{enumerate}

\end{itemize}

% ------------------------   
% Section 
\section{Samba Server Implementation}
\label{id2534436}\hypertarget{id2534436}{}%

\index{file servers} \index{BDC} The network design shown in \hyperlink{chap6net}{Figure {\ref{chap6net}}} is not comprehensive. It is assumed that you will install additional file servers and possibly additional BDCs.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{chap6net}{}%
\includegraphics[scale=0.5]{Samba3-ByExample/images/chap6-net}
{{\caption[{Network Topology ---  500 User Network Using ldapsam passdb backend}]{{{Network Topology ---  500 User Network Using ldapsam passdb backend}}}\label{chap6net}}}
\end{center}
\end{figure}


\index{SUSE Linux} \index{Red Hat Linux} All configuration files and locations are shown for SUSE Linux 9.2 and are equally valid for SUSE Linux Enterprise Server 9. The file locations for Red Hat Linux are similar. You may need to adjust the locations for your particular Linux system distribution/implementation.

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

The following information applies to Samba-3.0.20 when used with the Idealx smbldap-tools scripts version 0.9.1. If using a different version of Samba or of the smbldap-tools tarball, please verify that the versions you are about to use are matching. The smbldap-tools package uses counter-entries in the LDAP directory to avoid duplication of the UIDs and GIDs that are issued for POSIX accounts. The LDAP rdn under which this information is stored are called {\texttt{\docbookhyphenatedot{uidNumber}}} and {\texttt{\docbookhyphenatedot{gidNumber}}} respectively. These may be located in any convenient part of the directory information tree (DIT). In the examples that follow they have been located under {\texttt{\docbookhyphenatedot{dn=sambaDomainName=MEGANET2,dc=abmas,dc=org}}}. They could just as well be located under the rdn {\texttt{\docbookhyphenatedot{cn=NextFreeUnixId}}}.
\end{admonition}


The steps in the process involve changes from the network configuration shown in \hyperlink{Big500users}{Chapter {\ref{Big500users}}, {``}The 500-User Office{''}}. Before implementing the following steps, you must have completed the network implementation shown in that chapter. If you are starting with newly installed Linux servers, you must complete the steps shown in \hyperlink{ch5-dnshcp-setup}{Section {\ref{ch5-dnshcp-setup}}} before commencing at \hyperlink{ldapsetup}{Section {\ref{ldapsetup}}}.
\subsection{OpenLDAP Server Configuration}
\label{ldapsetup}\hypertarget{ldapsetup}{}%

\index{nss\_ldap} \index{pam\_ldap} \index{openldap} Confirm that the packages shown in \hyperlink{oldapreq}{Table {\ref{oldapreq}}} are installed on your system.

% table ------------------------------------------------------
\begin{table}[htb]
\begin{center}%
\hypertarget{oldapreq}{}%
\captionswapskip{}{{\caption{Required OpenLDAP Linux Packages}\label{oldapreq}}}
\captionswapskip{}\begin{tabular}{|l|l|l|}
\hline 
\docbooktolatexaligncl {{{\bfseries SUSE Linux 8.x}}} & \docbooktolatexaligncl {{{\bfseries SUSE Linux 9.x}}} & \docbooktolatexaligncl {{{\bfseries Red Hat Linux}}} \tabularnewline
 \hline 
{{nss\_ldap}} & {{nss\_ldap}} & {{nss\_ldap}} \tabularnewline
 \hline 
{{pam\_ldap}} & {{pam\_ldap}} & {{pam\_ldap}} \tabularnewline
 \hline 
{{openldap2}} & {{openldap2}} & {{openldap}} \tabularnewline
 \hline 
{{openldap2-client}} & {{openldap2-client}} & {{}} \tabularnewline
\hline 
\end{tabular}
\end{center}
\end{table}


Samba-3 and OpenLDAP will have a degree of interdependence that is unavoidable. The method for bootstrapping the LDAP and Samba-3 configuration is relatively straightforward. If you follow these guidelines, the resulting system should work fine.
OpenLDAP Server Configuration Steps\begin{enumerate}

\item{\index{/etc/openldap/slapd.conf} Install the file shown in \hyperlink{sbehap-slapdconf}{Example {\ref{sbehap-slapdconf}}} in the directory {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap}}}.}

\item{\index{/data/ldap} \index{group account} \index{user account} Remove all files from the directory {\texttt{\docbookhyphenatefilename{/\dbz{}data/\dbz{}ldap}}}, making certain that the directory exists with permissions: 
\begin{Verbatim}[]

root#  ls -al /data | grep ldap
drwx------   2 ldap    ldap       48 Dec 15 22:11 ldap

\end{Verbatim}
 This may require you to add a user and a group account for LDAP if they do not exist.}

\item{\index{DB\_CONFIG} Install the file shown in \hyperlink{sbehap-dbconf}{Example {\ref{sbehap-dbconf}}} in the directory {\texttt{\docbookhyphenatefilename{/\dbz{}data/\dbz{}ldap}}}. In the event that this file is added after {\texttt{\docbookhyphenatedot{ldap}}} has been started, it is possible to cause the new settings to take effect by shutting down the {\texttt{\docbookhyphenatedot{LDAP}}} server, executing the {\bfseries{db\_recover}} command inside the {\texttt{\docbookhyphenatefilename{/\dbz{}data/\dbz{}ldap}}} directory, and then restarting the {\texttt{\docbookhyphenatedot{LDAP}}} server.}

\item{\index{syslog} Performance logging can be enabled and should preferably be sent to a file on a file system that is large enough to handle significantly sized logs. To enable the logging at a verbose level to permit detailed analysis, uncomment the entry in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap/\dbz{}slapd.\dbz{}conf}}} shown as {``}loglevel 256{''}.  Edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}syslog.\dbz{}conf}}} file to add the following at the end of the file: 
\begin{Verbatim}[]

local4.*        -/data/ldap/log/openldap.log

\end{Verbatim}
 Note: The path {\texttt{\docbookhyphenatefilename{/\dbz{}data/\dbz{}ldap/\dbz{}log}}} should be set at a location that is convenient and that can store a large volume of data.}
\end{enumerate}

\begin{example}%
\hypertarget{sbehap-dbconf}{}%
\captionswapskip{}{{\caption{LDAP DB\_CONFIG File}\label{sbehap-dbconf}}}
\captionswapskip{}
\begin{Verbatim}[]

set_cachesize           0 150000000 1
set_lg_regionmax        262144
set_lg_bsize            2097152
#set_lg_dir             /var/log/bdb
set_flags               DB_LOG_AUTOREMOVE

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{sbehap-slapdconf}{}%
\captionswapskip{}{{\caption{LDAP Master Configuration File ---  /\dbz{}etc/\dbz{}openldap/\dbz{}slapd.\dbz{}conf Part A}\label{sbehap-slapdconf}}}
\captionswapskip{}
\begin{Verbatim}[]

include		/etc/openldap/schema/core.schema
include		/etc/openldap/schema/cosine.schema
include		/etc/openldap/schema/inetorgperson.schema
include		/etc/openldap/schema/nis.schema
include		/etc/openldap/schema/samba3.schema

pidfile		/var/run/slapd/slapd.pid
argsfile	/var/run/slapd/slapd.args

access to dn.base=""
		by self write
		by * auth

access to attr=userPassword
		by self write
		by * auth

access to attr=shadowLastChange
		by self write
		by * read

access to *
                by * read
                by anonymous auth

#loglevel	256

schemacheck 	on
idletimeout	30
backend		bdb
database	bdb
checkpoint      1024 5
cachesize       10000

suffix		"dc=abmas,dc=biz"
rootdn		"cn=Manager,dc=abmas,dc=biz"

# rootpw = not24get
rootpw          {SSHA}86kTavd9Dw3FAz6qzWTrCOKX/c0Qe+UV

directory	/data/ldap

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{sbehap-slapdconf2}{}%
\captionswapskip{}{{\caption{LDAP Master Configuration File ---  /\dbz{}etc/\dbz{}openldap/\dbz{}slapd.\dbz{}conf Part B}\label{sbehap-slapdconf2}}}
\captionswapskip{}
\begin{Verbatim}[]

# Indices to maintain
index objectClass           eq
index cn                    pres,sub,eq
index sn                    pres,sub,eq
index uid                   pres,sub,eq
index displayName           pres,sub,eq
index uidNumber             eq
index gidNumber             eq
index memberUID             eq
index sambaSID              eq
index sambaPrimaryGroupSID  eq
index sambaDomainName       eq
index default               sub

\end{Verbatim}
\end{example}

\subsection{PAM and NSS Client Configuration}
\label{sbehap-PAM-NSS}\hypertarget{sbehap-PAM-NSS}{}%

\index{LDAP} \index{NSS} \index{PAM} The steps that follow involve configuration of LDAP, NSS LDAP-based resolution of users and groups. Also, so that LDAP-based accounts can log onto the system, the steps ahead configure the Pluggable Authentication Modules (PAM) to permit LDAP-based authentication.

\index{Pluggable Authentication Modules|textit{see} {PAM} } \index{pam\_unix2.so} Since you have chosen to put UNIX user and group accounts into the LDAP database, it is likely that you may want to use them for UNIX system (Linux) local machine logons. This necessitates correct configuration of PAM. The {\bfseries{pam\_ldap}} open source package provides the PAM modules that most people would use. On SUSE Linux systems, the {\bfseries{pam\_unix2.so}} module also has the ability to redirect authentication requests through LDAP.

\index{YaST} \index{SUSE Linux} \index{Red Hat Linux} \index{authconfig} You have chosen to configure these services by directly editing the system files, but of course, you know that this configuration can be done using system tools provided by the Linux system vendor. SUSE Linux has a facility in YaST (the system admin tool) through {\sffamily \bfseries yast} $\to$ {\sffamily \bfseries system} $\to$ {\sffamily \bfseries ldap-client} that permits configuration of SUSE Linux as an LDAP client. Red Hat Linux provides the {\bfseries{authconfig}} tool for this.
PAM and NSS Client Configuration Steps
\begin{example}%
\hypertarget{sbehap-nss01}{}%
\captionswapskip{}{{\caption{Configuration File for NSS LDAP Support ---  /\dbz{}etc/\dbz{}ldap.\dbz{}conf}\label{sbehap-nss01}}}
\captionswapskip{}
\begin{Verbatim}[]

host 127.0.0.1

base dc=abmas,dc=biz

binddn cn=Manager,dc=abmas,dc=biz
bindpw not24get

timelimit 50
bind_timelimit 50
bind_policy hard

idle_timelimit 3600

pam_password exop

nss_base_passwd ou=People,dc=abmas,dc=biz?one
nss_base_shadow ou=People,dc=abmas,dc=biz?one
nss_base_group  ou=Groups,dc=abmas,dc=biz?one

ssl off

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{sbehap-nss02}{}%
\captionswapskip{}{{\caption{Configuration File for NSS LDAP Clients Support ---  /\dbz{}etc/\dbz{}ldap.\dbz{}conf}\label{sbehap-nss02}}}
\captionswapskip{}
\begin{Verbatim}[]

host 172.16.0.1

base dc=abmas,dc=biz

binddn cn=Manager,dc=abmas,dc=biz
bindpw not24get

timelimit 50
bind_timelimit 50
bind_policy hard

idle_timelimit 3600

pam_password exop

nss_base_passwd ou=People,dc=abmas,dc=biz?one
nss_base_shadow ou=People,dc=abmas,dc=biz?one
nss_base_group  ou=Groups,dc=abmas,dc=biz?one

ssl off

\end{Verbatim}
\end{example}

\begin{enumerate}

\item{\index{/lib/libnss\_ldap.so.2} \index{/etc/ldap.conf} \index{nss\_ldap} Execute the following command to find where the {\texttt{\docbookhyphenatefilename{nss\_\dbz{}ldap}}} module expects to find its control file: 
\begin{Verbatim}[]

root#  strings /lib/libnss_ldap.so.2 | grep conf

\end{Verbatim}
 The preferred and usual location is {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}}.}

\item{On the server {\texttt{\docbookhyphenatedot{MASSIVE}}}, install the file shown in \hyperlink{sbehap-nss01}{Example {\ref{sbehap-nss01}}} into the path that was obtained from the step above. On the servers called {\texttt{\docbookhyphenatedot{BLDG1}}} and {\texttt{\docbookhyphenatedot{BLDG2}}}, install the file shown in \hyperlink{sbehap-nss02}{Example {\ref{sbehap-nss02}}} into the path that was obtained from the step above.}

\item{\index{/etc/nsswitch.conf} Edit the NSS control file ({\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}}) so that the lines that control user and group resolution will obtain information from the normal system files as well as from {\bfseries{ldap}}: 
\begin{Verbatim}[]

passwd: files ldap
shadow: files ldap
group:  files ldap
hosts:  files dns wins

\end{Verbatim}
 Later, when the LDAP database has been initialized and user and group accounts have been added, you can validate resolution of the LDAP resolver process. The inclusion of WINS-based hostname resolution is deliberate so that all MS Windows client hostnames can be resolved to their IP addresses, whether or not they are DHCP clients. 
\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

Some Linux systems (Novell SUSE Linux in particular) add entries to the {\texttt{\docbookhyphenatefilename{nsswitch.\dbz{}conf}}} file that may cause operational problems with the configuration methods adopted in this book. It is advisable to comment out the entries {\texttt{\docbookhyphenatedot{passwd\_compat}}} and {\texttt{\docbookhyphenatedot{group\_compat}}} where they are found in this file.
\end{admonition}

 Even at the risk of overstating the issue, incorrect and inappropriate configuration of the {\texttt{\docbookhyphenatefilename{nsswitch.\dbz{}conf}}} file is a significant cause of operational problems with LDAP.}

\item{\index{pam\_unix2.so!use\_ldap} For PAM LDAP configuration on this SUSE Linux 9.0 system, the simplest solution is to edit the following files in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}pam.\dbz{}d}}} directory: {\bfseries{login}}, {\bfseries{password}}, {\bfseries{samba}}, {\bfseries{sshd}}. In each file, locate every entry that has the {\bfseries{pam\_unix2.so}} entry and add to the line the entry {\bfseries{use\_ldap}} as shown for the {\bfseries{login}} module in this example: 
\begin{Verbatim}[]

#%PAM-1.0
auth      requisite  pam_unix2.so   nullok use_ldap #set_secrpc
auth      required   pam_securetty.so
auth      required   pam_nologin.so
#auth     required   pam_homecheck.so
auth      required   pam_env.so
auth      required   pam_mail.so
account   required   pam_unix2.so   use_ldap
password  required   pam_pwcheck.s  nullok
password  required   pam_unix2.so   nullok use_first_pass \
                                    use_authtok use_ldap
session   required   pam_unix2.so   none use_ldap # debug or trace
session   required   pam_limits.so

\end{Verbatim}
  \index{pam\_ldap.so} On other Linux systems that do not have an LDAP-enabled {\bfseries{pam\_unix2.so}} module, you must edit these files by adding the {\bfseries{pam\_ldap.so}} modules as shown here: 
\begin{Verbatim}[]

#%PAM-1.0
auth     required    pam_securetty.so
auth     required    pam_nologin.so
auth     sufficient  pam_ldap.so
auth     required    pam_unix2.so   nullok try_first_pass #set_secrpc
account  sufficient  pam_ldap.so
account  required    pam_unix2.so
password required    pam_pwcheck.so nullok
password required    pam_ldap.so    use_first_pass use_authtok
password required    pam_unix2.so   nullok use_first_pass use_authtok
session  required    pam_unix2.so   none # debug or trace
session  required    pam_limits.so
session  required    pam_env.so
session  optional    pam_mail.so

\end{Verbatim}
 This example does have the LDAP-enabled {\bfseries{pam\_unix2.so}}, but simply demonstrates the use of the {\bfseries{pam\_ldap.so}} module. You can use either implementation, but if the {\bfseries{pam\_unix2.so}} on your system supports LDAP, you probably want to use it rather than add an additional module.}
\end{enumerate}
\subsection{Samba-3 PDC Configuration}
\label{sbehap-massive}\hypertarget{sbehap-massive}{}%

\index{Samba RPM Packages} Verify that the Samba-3.0.20 (or later) packages are installed on each SUSE Linux server before following the steps below. If Samba-3.0.20 (or later) is not installed, you have the choice to either build your own or obtain the packages from a dependable source. Packages for SUSE Linux 8.x, 9.x, and SUSE Linux Enterprise Server 9, as well as for Red Hat Fedora Core and Red Hat Enterprise Linux Server 3 and 4, are included on the CD-ROM that is included with this book.
Configuration of PDC Called MASSIVE\begin{enumerate}

\item{Install the files in \hyperlink{sbehap-massive-smbconfa}{Example {\ref{sbehap-massive-smbconfa}}}, \hyperlink{sbehap-massive-smbconfb}{Example {\ref{sbehap-massive-smbconfb}}}, \hyperlink{sbehap-shareconfa}{Example {\ref{sbehap-shareconfa}}}, and \hyperlink{sbehap-shareconfb}{Example {\ref{sbehap-shareconfb}}} into the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}}}} directory. The three files should be added together to form the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} master file. It is a good practice to call this file something like {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf.\dbz{}master}}} and then to perform all file edits on the master file. The operational {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} is then generated as shown in the next step.}

\item{\index{testparm} Create and verify the contents of the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file that is generated by: 
\begin{Verbatim}[]

root#  testparm -s smb.conf.master > smb.conf

\end{Verbatim}
 Immediately follow this with the following: 
\begin{Verbatim}[]

root#  testparm

\end{Verbatim}
 The output that is created should be free from errors, as shown here: 
\begin{Verbatim}[]

Load smb config files from /etc/samba/smb.conf
Processing section "[accounts]"
Processing section "[service]"
Processing section "[pidata]"
Processing section "[homes]"
Processing section "[printers]"
Processing section "[apps]"
Processing section "[netlogon]"
Processing section "[profiles]"
Processing section "[profdata]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_DOMAIN_PDC
Press enter to see a dump of your service definitions

\end{Verbatim}
}

\item{Delete all runtime files from prior Samba operation by executing (for SUSE Linux): 
\begin{Verbatim}[]

root#  rm /etc/samba/*tdb
root#  rm /var/lib/samba/*tdb
root#  rm /var/lib/samba/*dat
root#  rm /var/log/samba/*

\end{Verbatim}
}

\item{\index{secrets.tdb} \index{smbpasswd} Samba-3 communicates with the LDAP server. The password that it uses to authenticate to the LDAP server must be stored in the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file. Execute the following to create the new {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} files and store the password for the LDAP Manager: 
\begin{Verbatim}[]

root#  smbpasswd -w not24get

\end{Verbatim}
 The expected output from this command is: 
\begin{Verbatim}[]

Setting stored password for "cn=Manager,dc=abmas,dc=biz" in secrets.tdb

\end{Verbatim}
}

\item{\index{smbd} \index{net!getlocalsid} Samba-3 generates a Windows Security Identifier (SID) only when {\bfseries{smbd}} has been started. For this reason, you start Samba. After a few seconds delay, execute: 
\begin{Verbatim}[]

root#  smbclient -L localhost -U%
root#  net getlocalsid

\end{Verbatim}
 A report such as the following means that the domain SID has not yet been written to the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} or to the LDAP backend: 
\begin{Verbatim}[]

[2005/03/03 23:19:34, 0] lib/smbldap.c:smbldap_connect_system(852)
  failed to bind to server ldap://massive.abmas.biz
with dn="cn=Manager,dc=abmas,dc=biz" Error: Can't contact LDAP server
        (unknown)
[2005/03/03 23:19:48, 0] lib/smbldap.c:smbldap_search_suffix(1169)
  smbldap_search_suffix: Problem during the LDAP search:
        (unknown) (Timed out)

\end{Verbatim}
 The attempt to read the SID will cause and attempted bind to the LDAP server. Because the LDAP server is not running, this operation will fail by way of a timeout, as shown previously. This is normal output; do not worry about this error message. When the domain has been created and written to the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file, the output should look like this: 
\begin{Verbatim}[]

SID for domain MASSIVE is: S-1-5-21-3504140859-1010554828-2431957765

\end{Verbatim}
 If, after a short delay (a few seconds), the domain SID has still not been written to the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file, it is necessary to investigate what may be misconfigured. In this case, carefully check the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file for typographical errors (the most common problem). The use of the {\bfseries{testparm}} is highly recommended to validate the contents of this file.}

\item{When a positive domain SID has been reported, stop Samba.}

\item{\index{NFS server} \index{/etc/exports} \index{BDC} \index{rsync} Configure the NFS server for your Linux system. So you can complete the steps that follow, enter into the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}exports}}} the following entry: 
\begin{Verbatim}[]

/home   *(rw,root_squash,sync)

\end{Verbatim}
 This permits the user home directories to be used on the BDC servers for testing purposes. You, of course, decide what is the best way for your site to distribute data drives, and you create suitable backup and restore procedures for Abmas I'd strongly recommend that for normal operation the BDC is completely independent of the PDC. rsync is a useful tool here, as it resembles the NT replication service quite closely. If you do use NFS, do not forget to start the NFS server as follows: 
\begin{Verbatim}[]

root#  rcnfsserver start

\end{Verbatim}
}
\end{enumerate}

Your Samba-3 PDC is now ready to communicate with the LDAP password backend. Let's get on with configuration of the LDAP server.

\begin{example}%
\hypertarget{sbehap-massive-smbconfa}{}%
\captionswapskip{}{{\caption{LDAP Based smb.\dbz{}conf File, Server: MASSIVE ---  global Section: Part A}\label{sbehap-massive-smbconfa}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	unix charset = LOCALE
 	workgroup = MEGANET2
 	netbios name = MASSIVE
 	interfaces = eth1, lo
 	bind interfaces only = Yes
 	passdb backend = ldapsam:ldap://massive.abmas.biz
 	enable privileges = Yes
 	username map = /etc/samba/smbusers
 	log level = 1
 	syslog = 0
 	log file = /var/log/samba/%m
 	max log size = 50
 	smb ports = 139
 	name resolve order = wins bcast hosts
 	time server = Yes
 	printcap name = CUPS
 	show add printer wizard = No
 	add user script = /opt/IDEALX/sbin/smbldap-useradd -m "%u"
 	delete user script = /opt/IDEALX/sbin/smbldap-userdel "%u"
 	add group script = /opt/IDEALX/sbin/smbldap-groupadd -p "%g"
 	delete group script = /opt/IDEALX/sbin/smbldap-groupdel "%g"
 	add user to group script = /opt/IDEALX/sbin/smbldap-groupmod -m "%u" "%g"
 	delete user from group script = /opt/IDEALX/sbin/smbldap-groupmod -x "%u" "%g"
 	set primary group script = /opt/IDEALX/sbin/smbldap-usermod -g "%g" "%u"
 	add machine script = /opt/IDEALX/sbin/smbldap-useradd -w "%u"
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{sbehap-massive-smbconfb}{}%
\captionswapskip{}{{\caption{LDAP Based smb.\dbz{}conf File, Server: MASSIVE ---  global Section: Part B}\label{sbehap-massive-smbconfb}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
	logon script = scripts\logon.bat
 	logon path = \\%L\profiles\%U
 	logon drive = X:
 	domain logons = Yes
 	preferred master = Yes
 	wins support = Yes
 	ldap suffix = dc=abmas,dc=biz
 	ldap machine suffix = ou=People
 	ldap user suffix = ou=People
 	ldap group suffix = ou=Groups
 	ldap idmap suffix = ou=Idmap
 	ldap admin dn = cn=Manager,dc=abmas,dc=biz
 	idmap backend = ldap:ldap://massive.abmas.biz
 	idmap uid = 10000-20000
 	idmap gid = 10000-20000
 	map acl inherit = Yes
 	printing = cups
 	printer admin = root, chrisr
\end{lstlisting}
\end{example}

\subsection{Install and Configure Idealx smbldap-tools Scripts}
\label{sbeidealx}\hypertarget{sbeidealx}{}%

\index{Idealx!smbldap-tools} The Idealx scripts, or equivalent, are necessary to permit Samba-3 to manage accounts on the LDAP server. You have chosen the Idealx scripts because they are the best-known LDAP configuration scripts. The use of these scripts will help avoid the necessity to create custom scripts. It is easy to download them from the Idealx Web site\label{id2536125}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://samba.idealx.org/index.en.html}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2536125}. The tarball may be directly downloaded\label{id2536132}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://samba.idealx.org/dist/smbldap-tools-0.9.1.tgz}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2536132} from this site also. Alternatively, you may obtain the smbldap-tools-0.9.1-1.src.rpm\label{id2536139}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://samba.idealx.org/dist/smbldap-tools-0.9.1-1.src.rpm}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2536139} file that may be used to build an installable RPM package for your Linux system.

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

The smbldap-tools scripts can be installed in any convenient directory of your choice, in which case you must change the path to them in your {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file on the PDC ({\texttt{\docbookhyphenatedot{MASSIVE}}}).
\end{admonition}


The smbldap-tools are located in {\texttt{\docbookhyphenatefilename{/\dbz{}opt/\dbz{}IDEALX/\dbz{}sbin}}}. The scripts are not needed on BDC machines because all LDAP updates are handled by the PDC alone.
\subsubsection{Installation of smbldap-tools from the Tarball}
\label{id2536175}\hypertarget{id2536175}{}%

To perform a manual installation of the smbldap-tools scripts, the following procedure may be used:
Unpacking and Installation Steps for the smbldap-tools Tarball\begin{enumerate}

\item{Create the {\texttt{\docbookhyphenatefilename{/\dbz{}opt/\dbz{}IDEALX/\dbz{}sbin}}} directory, and set its permissions and ownership as shown here: 
\begin{Verbatim}[]

root#  mkdir -p /opt/IDEALX/sbin
root#  chown root:root /opt/IDEALX/sbin
root#  chmod 755 /opt/IDEALX/sbin
root#  mkdir -p /etc/smbldap-tools
root#  chown root:root /etc/smbldap-tools
root#  chmod 755 /etc/smbldap-tools

\end{Verbatim}
}

\item{If you wish to use the downloaded tarball, unpack the smbldap-tools in a suitable temporary location. Change into either the directory extracted from the tarball or the smbldap-tools directory in your {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}share/\dbz{}doc/\dbz{}packages}}} directory tree.}

\item{Copy all the {\texttt{\docbookhyphenatefilename{smbldap-\dbz{}*}}} and the {\texttt{\docbookhyphenatefilename{configure.\dbz{}pl}}} files into the {\texttt{\docbookhyphenatefilename{/\dbz{}opt/\dbz{}IDEALX/\dbz{}sbin}}} directory, as shown here: 
\begin{Verbatim}[]

root#  cd smbldap-tools-0.9.1/
root#  cp smbldap-* configure.pl *pm /opt/IDEALX/sbin/
root#  cp smbldap*conf /etc/smbldap-tools/
root#  chmod 750 /opt/IDEALX/sbin/smbldap-*
root#  chmod 750 /opt/IDEALX/sbin/configure.pl
root#  chmod 640 /etc/smbldap-tools/smbldap.conf
root#  chmod 600 /etc/smbldap-tools/smbldap_bind.conf

\end{Verbatim}
}

\item{The smbldap-tools scripts master control file must now be configured. Change to the {\texttt{\docbookhyphenatefilename{/\dbz{}opt/\dbz{}IDEALX/\dbz{}sbin}}} directory, then edit the {\texttt{\docbookhyphenatefilename{smbldap\_\dbz{}tools.\dbz{}pm}}} to affect the changes shown here: 
\begin{Verbatim}[]

...
# ugly funcs using global variables and spawning openldap clients

my $smbldap_conf="/etc/smbldap-tools/smbldap.conf";
my $smbldap_bind_conf="/etc/smbldap-tools/smbldap_bind.conf";
...

\end{Verbatim}
}

\item{To complete the configuration of the smbldap-tools, set the permissions and ownership by executing the following commands: 
\begin{Verbatim}[]

root#  chown root:root /opt/IDEALX/sbin/* 
root#  chmod 755 /opt/IDEALX/sbin/smbldap-*
root#  chmod 640 /opt/IDEALX/sbin/smb*pm 

\end{Verbatim}
 The smbldap-tools scripts are now ready for the configuration step outlined in \hyperlink{smbldap-init}{Section {\ref{smbldap-init}}}.}
\end{enumerate}
\subsubsection{Installing smbldap-tools from the RPM Package}
\label{id2536402}\hypertarget{id2536402}{}%

In the event that you have elected to use the RPM package provided by Idealx, download the source RPM {\texttt{\docbookhyphenatefilename{smbldap-\dbz{}tools-\dbz{}0.\dbz{}9.\dbz{}1-\dbz{}1.\dbz{}src.\dbz{}rpm}}}, then follow this procedure:
Installation Steps for smbldap-tools RPM's\begin{enumerate}

\item{Install the source RPM that has been downloaded as follows: 
\begin{Verbatim}[]

root#  rpm -i smbldap-tools-0.9.1-1.src.rpm

\end{Verbatim}
}

\item{Change into the directory in which the SPEC files are located. On SUSE Linux: 
\begin{Verbatim}[]

root#  cd /usr/src/packages/SPECS

\end{Verbatim}
 On Red Hat Linux systems: 
\begin{Verbatim}[]

root#  cd /usr/src/redhat/SPECS

\end{Verbatim}
}

\item{Edit the {\texttt{\docbookhyphenatefilename{smbldap-\dbz{}tools.\dbz{}spec}}} file to change the value of the {\texttt{\docbookhyphenatedot{\_sysconfig}}} macro as shown here: 
\begin{Verbatim}[]

%define _prefix /opt/IDEALX
%define _sysconfdir /etc

\end{Verbatim}
 Note: Any suitable directory can be specified.}

\item{Build the package by executing: 
\begin{Verbatim}[]

root#  rpmbuild -ba -v smbldap-tools.spec

\end{Verbatim}
 A build process that has completed without error will place the installable binary files in the directory {\texttt{\docbookhyphenatefilename{.\dbz{}.\dbz{}/\dbz{}RPMS/\dbz{}noarch}}}.}

\item{Install the binary package by executing: 
\begin{Verbatim}[]

root#  rpm -Uvh ../RPMS/noarch/smbldap-tools-0.9.1-1.noarch.rpm

\end{Verbatim}
}
\end{enumerate}

The Idealx scripts should now be ready for configuration using the steps outlined in \hyperlink{smbldap-init}{Section {\ref{smbldap-init}}}.
\subsubsection{Configuration of smbldap-tools}
\label{smbldap-init}\hypertarget{smbldap-init}{}%

Prior to use, the smbldap-tools must be configured to match the settings in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file and to match the settings in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap/\dbz{}slapd.\dbz{}conf}}} file. The assumption is made that the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file has correct contents. The following procedure ensures that this is completed correctly:

The smbldap-tools require that the NetBIOS name (machine name) of the Samba server be included in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file.
Configuration Steps for smbldap-tools to Enable Use\begin{enumerate}

\item{Change into the directory that contains the {\texttt{\docbookhyphenatefilename{configure.\dbz{}pl}}} script. 
\begin{Verbatim}[]

root#  cd /opt/IDEALX/sbin

\end{Verbatim}
}

\item{Execute the {\texttt{\docbookhyphenatefilename{configure.\dbz{}pl}}} script as follows: 
\begin{Verbatim}[]

root#  ./configure.pl

\end{Verbatim}
 The interactive use of this script for the PDC is demonstrated here: 
\begin{Verbatim}[]

root#  /opt/IDEALX/sbin/configure.pl 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
       smbldap-tools script configuration
       -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Before starting, check
 . if your samba controller is up and running.
 . if the domain SID is defined (you can get it with the
                                                    'net getlocalsid')

 . you can leave the configuration using the Crtl-c key combination
 . empty value can be set with the "." character
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Looking for configuration files...

Samba Config File Location [/etc/samba/smb.conf] > 
smbldap-tools configuration file Location (global parameters)
                        [/etc/opt/IDEALX/smbldap-tools/smbldap.conf] > 
smbldap Config file Location (bind parameters) 
                   [/etc/opt/IDEALX/smbldap-tools/smbldap_bind.conf] > 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Let's start configuring the smbldap-tools scripts ...

. workgroup name: name of the domain Samba act as a PDC
  workgroup name [MEGANET2] > 
. netbios name: netbios name of the samba controler
  netbios name [MASSIVE] > 
. logon drive: local path to which the home directory 
                    will be connected (for NT Workstations). Ex: 'H:'
  logon drive [H:] > 
. logon home: home directory location (for Win95/98 or NT Workstation)
  (use %U as username) Ex:'\\MASSIVE\%U'
  logon home (press the "." character if you don't want homeDirectory)
                                                     [\\MASSIVE\%U] > 
. logon path: directory where roaming profiles are stored. 
                                            Ex:'\\MASSIVE\profiles\%U'
  logon path (press the "." character
               if you don't want roaming profile) [\\%L\profiles\%U] >
. home directory prefix (use %U as username)
                                           [/home/%U] > /data/users/%U
. default users' homeDirectory mode [700] > 
. default user netlogon script (use %U as username)
                                                 [scripts\logon.bat] >
  default password validation time (time in days) [45] > 900
. ldap suffix [dc=abmas,dc=biz] > 
. ldap group suffix [ou=Groups] > 
. ldap user suffix [ou=People,ou=Users] > 
. ldap machine suffix [ou=Computers,ou=Users] > 
. Idmap suffix [ou=Idmap] > 
. sambaUnixIdPooldn: object where you want to store the next uidNumber
  and gidNumber available for new users and groups
  sambaUnixIdPooldn object (relative to ${suffix}) 
                                          [sambaDomainName=MEGANET2] > 
. ldap master server: IP adress or DNS name of the master 
                                                (writable) ldap server
  ldap master server [massive.abmas.biz] > 
. ldap master port [389] > 
. ldap master bind dn [cn=Manager,dc=abmas,dc=biz] > 
. ldap master bind password [] > 
. ldap slave server: IP adress or DNS name of the slave ldap server: 
                                            can also be the master one
  ldap slave server [massive.abmas.biz] > 
. ldap slave port [389] > 
. ldap slave bind dn [cn=Manager,dc=abmas,dc=biz] > 
. ldap slave bind password [] > 
. ldap tls support (1/0) [0] > 
. SID for domain MEGANET2: SID of the domain 
                      (can be obtained with 'net getlocalsid MASSIVE')
  SID for domain MEGANET2
                        [S-1-5-21-3504140859-1010554828-2431957765]] >
. unix password encryption: encryption used for unix passwords
  unix password encryption (CRYPT, MD5, SMD5, SSHA, SHA) [SSHA] > MD5
. default user gidNumber [513] > 
. default computer gidNumber [515] > 
. default login shell [/bin/bash] > 
. default skeleton directory [/etc/skel] > 
. default domain name to append to mail adress [] > abmas.biz
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
backup old configuration files:
  /etc/opt/IDEALX/smbldap-tools/smbldap.conf->
                        /etc/opt/IDEALX/smbldap-tools/smbldap.conf.old
  /etc/opt/IDEALX/smbldap-tools/smbldap_bind.conf->
                   /etc/opt/IDEALX/smbldap-tools/smbldap_bind.conf.old
writing new configuration file:
  /etc/opt/IDEALX/smbldap-tools/smbldap.conf done.
  /etc/opt/IDEALX/smbldap-tools/smbldap_bind.conf done.

\end{Verbatim}
 Since a slave LDAP server has not been configured, it is necessary to specify the IP address of the master LDAP server for both the master and the slave configuration prompts.}

\item{Change to the directory that contains the {\texttt{\docbookhyphenatefilename{smbldap.\dbz{}conf}}} file, then verify its contents.}
\end{enumerate}

The smbldap-tools are now ready for use.
\subsection{LDAP Initialization and Creation of User and Group Accounts}
\label{id2536758}\hypertarget{id2536758}{}%

The LDAP database must be populated with well-known Windows domain user accounts and domain group accounts before Samba can be used. The following procedures step you through the process.

At this time, Samba-3 requires that on a PDC all UNIX (POSIX) group accounts that are mapped (linked) to Windows domain group accounts must be in the LDAP database. It does not hurt to have UNIX user and group accounts in both the system files as well as in the LDAP database. From a UNIX system perspective, the NSS resolver checks system files before referring to LDAP. If the UNIX system can resolve (find) an account in the system file, it does not need to ask LDAP.

Addition of an account to the LDAP backend can be done in two ways:

\begin{itemize}
%--- Item
\item 
\index{NIS} \index{/etc/passwd} \index{Posix accounts} \index{pdbedit} \index{SambaSamAccount} \index{PosixAccount} If you always have a user account in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} on every server or in a NIS(+) backend, it is not necessary to add POSIX accounts for them in LDAP. In this case, you can add Windows domain user accounts using the {\bfseries{pdbedit}} utility. Use of this tool from the command line adds the SambaSamAccount entry for the user, but does not add the PosixAccount entry for the user.

This is the least desirable method because when LDAP is used as the passwd backend Samba expects the POSIX account to be in LDAP also. It is possible to use the PADL account migration tool to migrate all system accounts from either the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} files, or from NIS, to LDAP.


%--- Item
\item 
If you decide that it is probably a good idea to add both the PosixAccount attributes as well as the SambaSamAccount attributes for each user, then a suitable script is needed. In the example system you are installing in this exercise, you are making use of the Idealx smbldap-tools scripts. A copy of these tools, preconfigured for this system, is included on the enclosed CD-ROM under {\texttt{\docbookhyphenatefilename{Chap06/\dbz{}Tools.\dbz{}}}}

\end{itemize}

\index{Idealx!smbldap-tools} If you wish to have more control over how the LDAP database is initialized or if you don't want to use the Idealx smbldap-tools, you should refer to \hyperlink{appendix}{Chapter {\ref{appendix}}, {``}A Collection of Useful Tidbits{''}}, \hyperlink{altldapcfg}{Section {\ref{altldapcfg}}}.

\index{smbldap-populate} The following steps initialize the LDAP database, and then you can add user and group accounts that Samba can use. You use the {\bfseries{smbldap-populate}} to seed the LDAP database. You then manually add the accounts shown in \hyperlink{sbehap-bigacct}{Table {\ref{sbehap-bigacct}}}. The list of users does not cover all 500 network users; it provides examples only.

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

\index{LDAP!database} \index{directory!People container} \index{directory!Computers container} In the following examples, as the LDAP database is initialized, we do create a container for Computer (machine) accounts. In the Samba-3 {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} files, specific use is made of the People container, not the Computers container, for domain member accounts. This is not a mistake; it is a deliberate action that is necessitated by the fact that the resolution of a machine (computer) account to a UID is done via NSS. The only way this can be handled is using the NSS ({\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}}) entry for {\texttt{\docbookhyphenatedot{passwd}}}, which is resolved using the {\texttt{\docbookhyphenatefilename{nss\_\dbz{}ldap}}} library. The configuration file for the {\texttt{\docbookhyphenatefilename{nss\_\dbz{}ldap}}} library is the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}} that provides only one possible LDAP search command that is specified by the entry called {\texttt{\docbookhyphenatedot{nss\_base\_passwd}}}. This means that the search path must take into account the directory structure so that the LDAP search will commence at a level that is above both the Computers container and the Users (or People) container. If this is done, it is necessary to use a search that will descend the directory tree so that the machine account can be found. Alternatively, by placing all machine accounts in the People container, we are able to sidestep this limitation. This is the simpler solution that has been adopted in this chapter.
\end{admonition}


% table ------------------------------------------------------
\begin{table}[htb]
\begin{center}%
\hypertarget{sbehap-bigacct}{}%
\captionswapskip{}{{\caption{Abmas Network Users and Groups}\label{sbehap-bigacct}}}
\captionswapskip{}\begin{tabular}{|l|l|l|l|}
\hline 
\docbooktolatexaligncl {{{\bfseries Account Name}}} & \docbooktolatexaligncl {{{\bfseries Type}}} & \docbooktolatexaligncl {{{\bfseries ID}}} & \docbooktolatexaligncl {{{\bfseries Password}}} \tabularnewline
 \hline 
{{Robert Jordan}} & {{User}} & {{bobj}} & {{n3v3r2l8}} \tabularnewline
 \hline 
{{Stanley Soroka}} & {{User}} & {{stans}} & {{impl13dst4r}} \tabularnewline
 \hline 
{{Christine Roberson}} & {{User}} & {{chrisr}} & {{S9n0nw4ll}} \tabularnewline
 \hline 
{{Mary Vortexis}} & {{User}} & {{maryv}} & {{kw13t0n3}} \tabularnewline
 \hline 
{{Accounts}} & {{Group}} & {{Accounts}} & {{}} \tabularnewline
 \hline 
{{Finances}} & {{Group}} & {{Finances}} & {{}} \tabularnewline
 \hline 
{{Insurance}} & {{Group}} & {{PIOps}} & {{}} \tabularnewline
\hline 
\end{tabular}
\end{center}
\end{table}

LDAP Directory Initialization Steps\begin{enumerate}

\item{Start the LDAP server by executing: 
\begin{Verbatim}[]

root#  rcldap start
Starting ldap-server                           done

\end{Verbatim}
}

\item{Change to the {\texttt{\docbookhyphenatefilename{/\dbz{}opt/\dbz{}IDEALX/\dbz{}sbin}}} directory.}

\item{Execute the script that will populate the LDAP database as shown here: 
\begin{Verbatim}[]

root#  ./smbldap-populate -a root -k 0 -m 0

\end{Verbatim}
 The expected output from this is: 
\begin{Verbatim}[]

Using workgroup name from smb.conf: sambaDomainName=MEGANET2
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=> Warning: you must update smbldap.conf configuration file to :
=> sambaUnixIdPooldn parameter must be set
	to "sambaDomainName=MEGANET2,dc=abmas,dc=biz"
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Using builtin directory structure
adding new entry: dc=abmas,dc=biz
adding new entry: ou=People,dc=abmas,dc=biz
adding new entry: ou=Groups,dc=abmas,dc=biz
entry ou=People,dc=abmas,dc=biz already exist.
adding new entry: ou=Idmap,dc=abmas,dc=biz
adding new entry: sambaDomainName=MEGANET2,dc=abmas,dc=biz
adding new entry: uid=root,ou=People,dc=abmas,dc=biz
adding new entry: uid=nobody,ou=People,dc=abmas,dc=biz
adding new entry: cn=Domain Admins,ou=Groups,dc=abmas,dc=biz
adding new entry: cn=Domain Users,ou=Groups,dc=abmas,dc=biz
adding new entry: cn=Domain Guests,ou=Groups,dc=abmas,dc=biz
adding new entry: cn=Domain Computers,ou=Groups,dc=abmas,dc=biz
adding new entry: cn=Administrators,ou=Groups,dc=abmas,dc=biz
adding new entry: cn=Print Operators,ou=Groups,dc=abmas,dc=biz
adding new entry: cn=Backup Operators,ou=Groups,dc=abmas,dc=biz
adding new entry: cn=Replicators,ou=Groups,dc=abmas,dc=biz

\end{Verbatim}
}

\item{Edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}smbldap-\dbz{}tools/\dbz{}smbldap.\dbz{}conf}}} file so that the following information is changed from: 
\begin{Verbatim}[]

# Where to store next uidNumber and gidNumber available
sambaUnixIdPooldn="cn=NextFreeUnixId,${suffix}"

\end{Verbatim}
 to read, after modification: 
\begin{Verbatim}[]

# Where to store next uidNumber and gidNumber available
#sambaUnixIdPooldn="cn=NextFreeUnixId,${suffix}"
sambaUnixIdPooldn="sambaDomainName=MEGANET2,dc=abmas,dc=biz"

\end{Verbatim}
}

\item{It is necessary to restart the LDAP server as shown here: 
\begin{Verbatim}[]

root#  rcldap restart
Shutting down ldap-server                            done
Starting ldap-server                                 done

\end{Verbatim}
}

\item{\index{slapcat} So that we can use a global IDMAP repository, the LDAP directory must have a container object for IDMAP data. There are several ways you can check that your LDAP database is able to receive IDMAP information. One of the simplest is to execute: 
\begin{Verbatim}[]

root#  slapcat | grep -i idmap
dn: ou=Idmap,dc=abmas,dc=biz
ou: idmap

\end{Verbatim}
 \index{ldapadd} If the execution of this command does not return IDMAP entries, you need to create an LDIF template file (see \hyperlink{sbehap-ldifadd}{Example {\ref{sbehap-ldifadd}}}). You can add the required entries using the following command: 
\begin{Verbatim}[]

root#  ldapadd -x -D "cn=Manager,dc=abmas,dc=biz" \
		-w not24get < /etc/openldap/idmap.LDIF

\end{Verbatim}
 Samba automatically populates this LDAP directory container when it needs to.}

\item{\index{slapcat} It looks like all has gone well, as expected. Let's confirm that this is the case by running a few tests. First we check the contents of the database directly by running {\bfseries{slapcat}} as follows (the output has been cut down): 
\begin{Verbatim}[]

root#  slapcat
dn: dc=abmas,dc=biz
objectClass: dcObject
objectClass: organization
dc: abmas
o: abmas
structuralObjectClass: organization
entryUUID: 5ab02bf6-c536-1027-9d29-b1f32350fb43
creatorsName: cn=Manager,dc=abmas,dc=biz
createTimestamp: 20031217234200Z
entryCSN: 2003121723:42:00Z#0x0001#0#0000
modifiersName: cn=Manager,dc=abmas,dc=biz
modifyTimestamp: 20031217234200Z
...
dn: cn=Domain Computers,ou=Groups,dc=abmas,dc=biz
objectClass: posixGroup
objectClass: sambaGroupMapping
gidNumber: 553
cn: Domain Computers
description: Netbios Domain Computers accounts
sambaSID: S-1-5-21-3504140859-1010554828-2431957765-553
sambaGroupType: 2
displayName: Domain Computers
structuralObjectClass: posixGroup
entryUUID: 5e0a41d8-c536-1027-9d3b-b1f32350fb43
creatorsName: cn=Manager,dc=abmas,dc=biz
createTimestamp: 20031217234206Z
entryCSN: 2003121723:42:06Z#0x0002#0#0000
modifiersName: cn=Manager,dc=abmas,dc=biz
modifyTimestamp: 20031217234206Z

\end{Verbatim}
 This looks good so far.}

\item{\index{ldapsearch} The next step is to prove that the LDAP server is running and responds to a search request. Execute the following as shown (output has been cut to save space): 
\begin{Verbatim}[]

root#  ldapsearch -x -b "dc=abmas,dc=biz" "(ObjectClass=*)"
# extended LDIF
#
# LDAPv3
# base <dc=abmas,dc=biz> with scope sub
# filter: (ObjectClass=*)
# requesting: ALL
#

# abmas.biz
dn: dc=abmas,dc=biz
objectClass: dcObject
objectClass: organization
dc: abmas
o: abmas

# People, abmas.biz
dn: ou=People,dc=abmas,dc=biz
objectClass: organizationalUnit
ou: People
...
# Domain Computers, Groups, abmas.biz
dn: cn=Domain Computers,ou=Groups,dc=abmas,dc=biz
objectClass: posixGroup
objectClass: sambaGroupMapping
gidNumber: 553
cn: Domain Computers
description: Netbios Domain Computers accounts
sambaSID: S-1-5-21-3504140859-1010554828-2431957765-553
sambaGroupType: 2
displayName: Domain Computers

# search result
search: 2
result: 0 Success

# numResponses: 20
# numEntries: 19

\end{Verbatim}
 Good. It is all working just fine.}

\item{\index{getent} You must now make certain that the NSS resolver can interrogate LDAP also. Execute the following commands: 
\begin{Verbatim}[]

root#  getent passwd | grep root
root:x:998:512:Netbios Domain Administrator:/home:/bin/false

root#  getent group | grep Domain
Domain Admins:x:512:root
Domain Users:x:513:
Domain Guests:x:514:
Domain Computers:x:553:

\end{Verbatim}
 \index{nss\_ldap} This demonstrates that the {\bfseries{nss\_ldap}} library is functioning as it should. If these two steps fail to produce this information, refer to \hyperlink{sbeavoid}{Section {\ref{sbeavoid}}} for diagnostic procedures that can be followed to isolate the cause of the problem. Proceed to the next step only when the previous steps have been successfully completed.}

\item{\index{smbldap-useradd} \index{smbldap-passwd} \index{smbpasswd} Our database is now ready for the addition of network users. For each user for whom an account must be created, execute the following: 
\begin{Verbatim}[]

root#  ./smbldap-useradd -m -a username
root#  ./smbldap-passwd username
Changing password for username
New password : XXXXXXXX
Retype new password : XXXXXXXX

root#  smbpasswd username
New SMB password: XXXXXXXX
Retype new SMB password: XXXXXXXX

\end{Verbatim}
 where {\texttt{\docbookhyphenatedot{username}}} is the login ID for each user.}

\item{\index{getent} Now verify that the UNIX (POSIX) accounts can be resolved via NSS by executing the following: 
\begin{Verbatim}[]

root#  getent passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/bash
...
root:x:0:512:Netbios Domain Administrator:/home:/bin/false
nobody:x:999:514:nobody:/dev/null:/bin/false
bobj:x:1000:513:System User:/home/bobj:/bin/bash
stans:x:1001:513:System User:/home/stans:/bin/bash
chrisr:x:1002:513:System User:/home/chrisr:/bin/bash
maryv:x:1003:513:System User:/home/maryv:/bin/bash

\end{Verbatim}
 This demonstrates that user account resolution via LDAP is working.}

\item{This step will determine whether or not identity resolution is working correctly. Do not procede is this step fails, rather find the cause of the failure. The {\bfseries{id}} command may be used to validate your configuration so far, as shown here: 
\begin{Verbatim}[]

root#  id chrisr
uid=1002(chrisr) gid=513(Domain Users) groups=513(Domain Users)

\end{Verbatim}
 This confirms that the UNIX (POSIX) user account information can be resolved from LDAP by system tools that make a getentpw() system call.}

\item{\index{smbldap-usermod} The root account must have UID=0; if not, this means that operations conducted from a Windows client using tools such as the Domain User Manager fails under UNIX because the management of user and group accounts requires that the UID=0. Additionally, it is a good idea to make certain that no matter how root account credentials are resolved, the home directory and shell are valid. You decide to effect this immediately as demonstrated here: 
\begin{Verbatim}[]

root#  cd /opt/IDEALX/sbin
root#  ./smbldap-usermod -u 0 -d /root -s /bin/bash root

\end{Verbatim}
}

\item{Verify that the changes just made to the {\texttt{\docbookhyphenatedot{root}}} account were accepted by executing: 
\begin{Verbatim}[]

root#  getent passwd | grep root
root:x:0:0:root:/root:/bin/bash
root:x:0:512:Netbios Domain Administrator:/root:/bin/bash

\end{Verbatim}
 This demonstrates that the changes were accepted.}

\item{Make certain that a home directory has been created for every user by listing the directories in {\texttt{\docbookhyphenatefilename{/\dbz{}home}}} as follows: 
\begin{Verbatim}[]

root#  ls -al /home
drwxr-xr-x   8 root   root         176 Dec 17 18:50 ./
drwxr-xr-x  21 root   root         560 Dec 15 22:19 ../
drwx------   7 bobj   Domain Users     568 Dec 17 01:16 bobj/
drwx------   7 chrisr Domain Users     568 Dec 17 01:19 chrisr/
drwx------   7 maryv  Domain Users     568 Dec 17 01:27 maryv/
drwx------   7 stans  Domain Users     568 Dec 17 01:43 stans/

\end{Verbatim}
 This is precisely what we want to see.}

\item{\index{ldapsam} \index{pdbedit} The final validation step involves making certain that Samba-3 can obtain the user accounts from the LDAP ldapsam passwd backend. Execute the following command as shown: 
\begin{Verbatim}[]

root#  pdbedit -Lv chrisr
Unix username:        chrisr
NT username:          chrisr
Account Flags:        [U          ]
User SID:             S-1-5-21-3504140859-1010554828-2431957765-3004
Primary Group SID:    S-1-5-21-3504140859-1010554828-2431957765-513
Full Name:            System User
Home Directory:       \\MASSIVE\homes
HomeDir Drive:        H:
Logon Script:         scripts\login.cmd
Profile Path:         \\MASSIVE\profiles\chrisr
Domain:               MEGANET2
Account desc:         System User
Workstations:
Munged dial:
Logon time:           0
Logoff time:          Mon, 18 Jan 2038 20:14:07 GMT
Kickoff time:         Mon, 18 Jan 2038 20:14:07 GMT
Password last set:    Wed, 17 Dec 2003 17:17:40 GMT
Password can change:  Wed, 17 Dec 2003 17:17:40 GMT
Password must change: Mon, 18 Jan 2038 20:14:07 GMT
Last bad password   : 0
Bad password count  : 0
Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

\end{Verbatim}
 This looks good. Of course, you fully expected that it would all work, didn't you?}

\item{\index{smbldap-groupadd} Now you add the group accounts that are used on the Abmas network. Execute the following exactly as shown: 
\begin{Verbatim}[]

root#  ./smbldap-groupadd -a Accounts
root#  ./smbldap-groupadd -a Finances
root#  ./smbldap-groupadd -a PIOps

\end{Verbatim}
 The addition of groups does not involve keyboard interaction, so the lack of console output is of no concern.}

\item{\index{getent} You really do want to confirm that UNIX group resolution from LDAP is functioning as it should. Let's do this as shown here: 
\begin{Verbatim}[]

root#  getent group
...
Domain Admins:x:512:root
Domain Users:x:513:bobj,stans,chrisr,maryv
Domain Guests:x:514:
...
Accounts:x:1000:
Finances:x:1001:
PIOps:x:1002:

\end{Verbatim}
 The well-known special accounts (Domain Admins, Domain Users, Domain Guests), as well as our own site-specific group accounts, are correctly listed. This is looking good.}

\item{\index{net!groupmap!list} The final step we need to validate is that Samba can see all the Windows domain groups and that they are correctly mapped to the respective UNIX group account. To do this, just execute the following command: 
\begin{Verbatim}[]

root#  net groupmap list
Domain Admins (S-1-5-21-3504140859-...-2431957765-512) -> Domain Admins
Domain Users (S-1-5-21-3504140859-...-2431957765-513) -> Domain Users
Domain Guests (S-1-5-21-3504140859-...-2431957765-514) -> Domain Guests
...
Accounts (S-1-5-21-3504140859-1010554828-2431957765-3001) -> Accounts
Finances (S-1-5-21-3504140859-1010554828-2431957765-3003) -> Finances
PIOps (S-1-5-21-3504140859-1010554828-2431957765-3005) -> PIOps

\end{Verbatim}
 This is looking good. Congratulations ---  it works! Note that in the above output the lines were shortened by replacing the middle value (1010554828) of the SID with the ellipsis (...).}

\item{The server you have so carefully built is now ready for another important step. You start the Samba-3 server and validate its operation. Execute the following to render all the processes needed fully operative so that, on system reboot, they are automatically started: 
\begin{Verbatim}[]

root#  chkconfig named on
root#  chkconfig dhcpd on
root#  chkconfig ldap on
root#  chkconfig nmb on
root#  chkconfig smb on
root#  chkconfig winbind on
root#  rcnmb start
root#  rcsmb start
root#  rcwinbind start

\end{Verbatim}
}

\item{The next step might seem a little odd at this point, but take note that you are about to start {\bfseries{winbindd}}, which must be able to authenticate to the PDC via the localhost interface with the {\bfseries{smbd}} process. This account can be easily created by joining the PDC to the domain by executing the following command: 
\begin{Verbatim}[]

root#  net rpc join -S MASSIVE -U root%not24get

\end{Verbatim}
 Note: Before executing this command on the PDC, both {\bfseries{nmbd}} and {\bfseries{smbd}} must be started so that the {\bfseries{net}} command can communicate with {\bfseries{smbd}}. The expected output is as follows: 
\begin{Verbatim}[]

Joined domain MEGANET2.

\end{Verbatim}
 This indicates that the domain security account for the PDC has been correctly created.}

\item{At this time it is necessary to restart {\bfseries{winbindd}} so that it can correctly authenticate to the PDC. The following command achieves that: 
\begin{Verbatim}[]

root#  rcwinbind restart

\end{Verbatim}
}

\item{\index{smbclient} You may now check Samba-3 operation as follows: 
\begin{Verbatim}[]

root#  smbclient -L massive -U%

        Sharename      Type      Comment
        ---------      ----      -------
        IPC$           IPC       IPC Service (Samba 3.0.20)
        accounts       Disk      Accounting Files
        service        Disk      Financial Services Files
        pidata         Disk      Property Insurance Files
        apps           Disk      Application Files
        netlogon       Disk      Network Logon Service
        profiles       Disk      Profile Share
        profdata       Disk      Profile Data Share
        ADMIN$         IPC       IPC Service (Samba 3.0.20)

        Server               Comment
        ---------            -------
        MASSIVE              Samba 3.0.20

        Workgroup            Master
        ---------            -------
        MEGANET2             MASSIVE

\end{Verbatim}
 This shows that an anonymous connection is working.}

\item{For your finale, let's try an authenticated connection: 
\begin{Verbatim}[]

root#  smbclient //massive/bobj -Ubobj%n3v3r2l8
smb: \> dir
  .                    D        0  Wed Dec 17 01:16:19 2003
  ..                   D        0  Wed Dec 17 19:04:42 2003
  bin                  D        0  Tue Sep  2 04:00:57 2003
  Documents            D        0  Sun Nov 30 07:28:20 2003
  public_html          D        0  Sun Nov 30 07:28:20 2003
  .urlview             H      311  Fri Jul  7 06:55:35 2000
  .dvipsrc             H      208  Fri Nov 17 11:22:02 1995

          57681 blocks of size 524288. 57128 blocks available
smb: \> q

\end{Verbatim}
 Well done. All is working fine.}
\end{enumerate}

The server {\texttt{\docbookhyphenatedot{MASSIVE}}} is now configured, and it is time to move onto the next task.
\subsection{Printer Configuration}
\label{sbehap-ptrcfg}\hypertarget{sbehap-ptrcfg}{}%

\index{CUPS} The configuration for Samba-3 to enable CUPS raw-print-through printing has already been taken care of in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file. The only preparation needed for {\texttt{\docbookhyphenatedot{smart}}} printing to be possible involves creation of the directories in which Samba-3 stores Windows printing driver files.
Printer Configuration Steps\begin{enumerate}

\item{Configure all network-attached printers to have a fixed IP address.}

\item{Create an entry in the DNS database on the server {\texttt{\docbookhyphenatedot{MASSIVE}}} in both the forward lookup database for the zone {\texttt{\docbookhyphenatedot{abmas.biz.hosts}}} and in the reverse lookup database for the network segment that the printer is to be located in. Example configuration files for similar zones were presented in \hyperlink{secure}{Chapter {\ref{secure}}, {``}Secure Office Networking{''}}, \hyperlink{abmasbiz}{Example {\ref{abmasbiz}}} and in \hyperlink{eth2zone}{Example {\ref{eth2zone}}}.}

\item{Follow the instructions in the printer manufacturers' manuals to permit printing to port 9100. Use any other port the manufacturer specifies for direct mode, raw printing. This allows the CUPS spooler to print using raw mode protocols. \index{CUPS} \index{raw printing}}

\item{\index{lpadmin} \index{CUPS!queue} Only on the server to which the printer is attached, configure the CUPS Print Queues as follows: 
\begin{Verbatim}[]

root#  lpadmin -p printque
	 -v socket://printer-name.abmas.biz:9100 -E

\end{Verbatim}
 \index{print filter} This step creates the necessary print queue to use no assigned print filter. This is ideal for raw printing, that is, printing without use of filters. The name {\ttfamily\itshape{\docbookhyphenatedot{printque}}} is the name you have assigned for the particular printer.}

\item{Print queues may not be enabled at creation. Make certain that the queues you have just created are enabled by executing the following: 
\begin{Verbatim}[]

root#  /usr/bin/enable printque

\end{Verbatim}
}

\item{Even though your print queue may be enabled, it is still possible that it may not accept print jobs. A print queue will service incoming printing requests only when configured to do so. Ensure that your print queue is set to accept incoming jobs by executing the following commands: 
\begin{Verbatim}[]

root#  /usr/bin/accept printque

\end{Verbatim}
}

\item{\index{mime type} \index{/etc/mime.convs} \index{application/octet-stream} Edit the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}cups/\dbz{}mime.\dbz{}convs}}} to uncomment the line: 
\begin{Verbatim}[]

application/octet-stream     application/vnd.cups-raw      0     -

\end{Verbatim}
}

\item{\index{/etc/mime.types} Edit the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}cups/\dbz{}mime.\dbz{}types}}} to uncomment the line: 
\begin{Verbatim}[]

application/octet-stream

\end{Verbatim}
}

\item{Refer to the CUPS printing manual for instructions regarding how to configure CUPS so that print queues that reside on CUPS servers on remote networks route print jobs to the print server that owns that queue. The default setting on your CUPS server may automatically discover remotely installed printers and may permit this functionality without requiring specific configuration.}

\item{The following action creates the necessary directory subsystem. Follow these steps to printing heaven: 
\begin{Verbatim}[]

root#  mkdir -p /var/lib/samba/drivers/{W32ALPHA,W32MIPS,W32X86,WIN40}
root#  chown -R root:root /var/lib/samba/drivers
root#  chmod -R ug=rwx,o=rx /var/lib/samba/drivers

\end{Verbatim}
}
\end{enumerate}

% ------------------------   
% Section 
\section{Samba-3 BDC Configuration}
\label{sbehap-bldg1}\hypertarget{sbehap-bldg1}{}%
Configuration of BDC Called: BLDG1\begin{enumerate}

\item{Install the files in \hyperlink{sbehap-bldg1-smbconf}{Example {\ref{sbehap-bldg1-smbconf}}}, \hyperlink{sbehap-shareconfa}{Example {\ref{sbehap-shareconfa}}}, and \hyperlink{sbehap-shareconfb}{Example {\ref{sbehap-shareconfb}}} into the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}}}} directory. The three files should be added together to form the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file.}

\item{Verify the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file as in step 2 of \hyperlink{sbehap-massive}{Section {\ref{sbehap-massive}}}.}

\item{Carefully follow the steps outlined in \hyperlink{sbehap-PAM-NSS}{Section {\ref{sbehap-PAM-NSS}}}, taking particular note to install the correct {\texttt{\docbookhyphenatefilename{ldap.\dbz{}conf}}}.}

\item{Verify that the NSS resolver is working. You may need to cycle the run level to 1 and back to 5 before the NSS LDAP resolver functions. Follow these commands: 
\begin{Verbatim}[]

root#  init 1

\end{Verbatim}
 After the run level has been achieved, you are prompted to provide the {\texttt{\docbookhyphenatedot{root}}} password. Log on, and then execute: 
\begin{Verbatim}[]

root#  init 5

\end{Verbatim}
 When the normal logon prompt appears, log into the system as {\texttt{\docbookhyphenatedot{root}}} and then execute these commands: 
\begin{Verbatim}[]

root#  getent passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/bin/bash
daemon:x:2:2:Daemon:/sbin:/bin/bash
lp:x:4:7:Printing daemon:/var/spool/lpd:/bin/bash
mail:x:8:12:Mailer daemon:/var/spool/clientmqueue:/bin/false
...
root:x:0:512:Netbios Domain Administrator:/root:/bin/bash
nobody:x:999:514:nobody:/dev/null:/bin/false
bobj:x:1000:513:System User:/home/bobj:/bin/bash
stans:x:1001:513:System User:/home/stans:/bin/bash
chrisr:x:1002:513:System User:/home/chrisr:/bin/bash
maryv:x:1003:513:System User:/home/maryv:/bin/bash
vaioboss$:x:1005:553:vaioboss$:/dev/null:/bin/false
bldg1$:x:1006:553:bldg1$:/dev/null:/bin/false

\end{Verbatim}
 This is the correct output. If the accounts that have UIDs above 512 are not shown, there is a problem.}

\item{\index{getent} The next step in the verification process involves testing the operation of UNIX group resolution via the NSS LDAP resolver. Execute these commands: 
\begin{Verbatim}[]

root#  getent group
root:x:0:
bin:x:1:daemon
daemon:x:2:
sys:x:3:
...
Domain Admins:x:512:root
Domain Users:x:513:bobj,stans,chrisr,maryv,jht
Domain Guests:x:514:
Administrators:x:544:
Users:x:545:
Guests:x:546:nobody
Power Users:x:547:
Account Operators:x:548:
Server Operators:x:549:
Print Operators:x:550:
Backup Operators:x:551:
Replicator:x:552:
Domain Computers:x:553:
Accounts:x:1000:
Finances:x:1001:
PIOps:x:1002:

\end{Verbatim}
 This is also the correct and desired output, because it demonstrates that the LDAP client is able to communicate correctly with the LDAP server ({\texttt{\docbookhyphenatedot{MASSIVE}}}).}

\item{\index{smbpasswd} You must now set the LDAP administrative password into the Samba-3 {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file by executing this command: 
\begin{Verbatim}[]

root#  smbpasswd -w not24get
Setting stored password for "cn=Manager,dc=abmas,dc=biz" in secrets.tdb

\end{Verbatim}
}

\item{Now you must obtain the domain SID from the PDC and store it into the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file also. This step is not necessary with an LDAP passdb backend because Samba-3 obtains the domain SID from the sambaDomain object it automatically stores in the LDAP backend. It does not hurt to add the SID to the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}}, and if you wish to do so, this command can achieve that: 
\begin{Verbatim}[]

root#  net rpc getsid MEGANET2
Storing SID S-1-5-21-3504140859-1010554828-2431957765 \
                           for Domain MEGANET2 in secrets.tdb

\end{Verbatim}
 When configuring a Samba-3 BDC that has an LDAP backend, there is no need to take any special action to join it to the domain. However, winbind communicates with the domain controller that is running on the localhost and must be able to authenticate, thus requiring that the BDC should be joined to the domain. The process of joining the domain creates the necessary authentication accounts.}

\item{To join the Samba BDC to the domain, execute the following: 
\begin{Verbatim}[]

root#  net rpc join -U root%not24get
Joined domain MEGANET2.

\end{Verbatim}
 This indicates that the domain security account for the BDC has been correctly created.}

\item{\index{pdbedit} Verify that user and group account resolution works via Samba-3 tools as follows: 
\begin{Verbatim}[]

root#  pdbedit -L
root:0:root
nobody:65534:nobody
bobj:1000:System User
stans:1001:System User
chrisr:1002:System User
maryv:1003:System User
bldg1$:1006:bldg1$

root#  net groupmap list
Domain Admins (S-1-5-21-3504140859-...-2431957765-512) ->
                                                        Domain Admins
Domain Users (S-1-5-21-3504140859-...-2431957765-513) -> Domain Users
Domain Guests (S-1-5-21-3504140859-...-2431957765-514) -> 
                                                        Domain Guests
Administrators (S-1-5-21-3504140859-...-2431957765-544) ->
                                                       Administrators
...
Accounts (S-1-5-21-3504140859-1010554828-2431957765-3001) -> Accounts
Finances (S-1-5-21-3504140859-1010554828-2431957765-3003) -> Finances
PIOps (S-1-5-21-3504140859-1010554828-2431957765-3005) -> PIOps

\end{Verbatim}
 These results show that all things are in order.}

\item{The server you have so carefully built is now ready for another important step. Now start the Samba-3 server and validate its operation. Execute the following to render all the processes needed fully operative so that, upon system reboot, they are automatically started: 
\begin{Verbatim}[]

root#  chkconfig named on
root#  chkconfig dhcpd on
root#  chkconfig nmb on
root#  chkconfig smb on
root#  chkconfig winbind on
root#  rcnmb start
root#  rcsmb start
root#  rcwinbind start

\end{Verbatim}
 Samba-3 should now be running and is ready for a quick test. But not quite yet!}

\item{Your new {\texttt{\docbookhyphenatedot{BLDG1, BLDG2}}} servers do not have home directories for users. To rectify this using the SUSE yast2 utility or by manually editing the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}fstab}}} file, add a mount entry to mount the {\texttt{\docbookhyphenatedot{home}}} directory that has been exported from the {\texttt{\docbookhyphenatedot{MASSIVE}}} server. Mount this resource before proceeding. An alternate approach could be to create local home directories for users who are to use these machines. This is a choice that you, as system administrator, must make. The following entry in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}fstab}}} file suffices for now: 
\begin{Verbatim}[]

massive.abmas.biz:/home  /home  nfs     rw 0 0

\end{Verbatim}
 To mount this resource, execute: 
\begin{Verbatim}[]

root#  mount -a

\end{Verbatim}
 Verify that the home directory has been mounted as follows: 
\begin{Verbatim}[]

root#  df | grep home
massive:/home         29532988    283388  29249600   1% /home

\end{Verbatim}
}

\item{Implement a quick check using one of the users that is in the LDAP database. Here you go: 
\begin{Verbatim}[]

root#  smbclient //bldg1/bobj -Ubobj%n3v3r2l8
smb: \> dir
  .                    D        0  Wed Dec 17 01:16:19 2003
  ..                   D        0  Wed Dec 17 19:04:42 2003
  bin                  D        0  Tue Sep  2 04:00:57 2003
  Documents            D        0  Sun Nov 30 07:28:20 2003
  public_html          D        0  Sun Nov 30 07:28:20 2003
  .urlview             H      311  Fri Jul  7 06:55:35 2000
  .dvipsrc             H      208  Fri Nov 17 11:22:02 1995

          57681 blocks of size 524288. 57128 blocks available
smb: \> q

\end{Verbatim}
}
\end{enumerate}

Now that the first BDC ({\texttt{\docbookhyphenatedot{BDLG1}}}) has been configured it is time to build and configure the second BDC server ({\texttt{\docbookhyphenatedot{BLDG2}}}) as follows:
Configuration of BDC Called BLDG2\begin{enumerate}

\item{Install the files in \hyperlink{sbehap-bldg2-smbconf}{Example {\ref{sbehap-bldg2-smbconf}}}, \hyperlink{sbehap-shareconfa}{Example {\ref{sbehap-shareconfa}}}, and \hyperlink{sbehap-shareconfb}{Example {\ref{sbehap-shareconfb}}} into the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}}}} directory. The three files should be added together to form the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file.}

\item{Follow carefully the steps shown in \hyperlink{sbehap-bldg1}{Section {\ref{sbehap-bldg1}}}, starting at step 2.}
\end{enumerate}

\begin{example}%
\hypertarget{sbehap-bldg1-smbconf}{}%
\captionswapskip{}{{\caption{LDAP Based smb.\dbz{}conf File, Server: BLDG1}\label{sbehap-bldg1-smbconf}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	unix charset = LOCALE
 	workgroup = MEGANET2
 	netbios name = BLDG1
 	passdb backend = ldapsam:ldap://massive.abmas.biz
 	enable privileges = Yes
 	username map = /etc/samba/smbusers
 	log level = 1
 	syslog = 0
 	log file = /var/log/samba/%m
 	max log size = 50
 	smb ports = 139
 	name resolve order = wins bcast hosts
 	printcap name = CUPS
 	show add printer wizard = No
 	logon script = scripts\logon.bat
 	logon path = \\%L\profiles\%U
 	logon drive = X:
 	domain logons = Yes
 	domain master = No
 	wins server = 172.16.0.1
 	ldap suffix = dc=abmas,dc=biz
 	ldap machine suffix = ou=People
 	ldap user suffix = ou=People
 	ldap group suffix = ou=Groups
 	ldap idmap suffix = ou=Idmap
 	ldap admin dn = cn=Manager,dc=abmas,dc=biz
 	idmap backend = ldap:ldap://massive.abmas.biz
 	idmap uid = 10000-20000
 	idmap gid = 10000-20000
 	printing = cups
 	printer admin = root, chrisr
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{sbehap-bldg2-smbconf}{}%
\captionswapskip{}{{\caption{LDAP Based smb.\dbz{}conf File, Server: BLDG2}\label{sbehap-bldg2-smbconf}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	unix charset = LOCALE
 	workgroup = MEGANET2
 	netbios name = BLDG2
 	passdb backend = ldapsam:ldap://massive.abmas.biz
 	enable privileges = Yes
 	username map = /etc/samba/smbusers
 	log level = 1
 	syslog = 0
 	log file = /var/log/samba/%m
 	max log size = 50
 	smb ports = 139
 	name resolve order = wins bcast hosts
 	printcap name = CUPS
 	show add printer wizard = No
 	logon script = scripts\logon.bat
 	logon path = \\%L\profiles\%U
 	logon drive = X:
 	domain logons = Yes
 	domain master = No
 	wins server = 172.16.0.1
 	ldap suffix = dc=abmas,dc=biz
 	ldap machine suffix = ou=People
 	ldap user suffix = ou=People
 	ldap group suffix = ou=Groups
 	ldap idmap suffix = ou=Idmap
 	ldap admin dn = cn=Manager,dc=abmas,dc=biz
 	idmap backend = ldap:ldap://massive.abmas.biz
 	idmap uid = 10000-20000
 	idmap gid = 10000-20000
 	printing = cups
 	printer admin = root, chrisr
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{sbehap-shareconfa}{}%
\captionswapskip{}{{\caption{LDAP Based smb.\dbz{}conf File, Shares Section ---  Part A}\label{sbehap-shareconfa}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[accounts]
 	comment = Accounting Files
 	path = /data/accounts
 	read only = No
 [service]
 	comment = Financial Services Files
 	path = /data/service
 	read only = No
 [pidata]
 	comment = Property Insurance Files
 	path = /data/pidata
 	read only = No
 [homes]
 	comment = Home Directories
 	valid users = %S
 	read only = No
 	browseable = No
 [printers]
 	comment = SMB Print Spool
 	path = /var/spool/samba
 	guest ok = Yes
 	printable = Yes
 	browseable = No
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{sbehap-shareconfb}{}%
\captionswapskip{}{{\caption{LDAP Based smb.\dbz{}conf File, Shares Section ---  Part B}\label{sbehap-shareconfb}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[apps]
 	comment = Application Files
 	path = /apps
 	admin users = bjordan
 	read only = No
 [netlogon]
 	comment = Network Logon Service
 	path = /var/lib/samba/netlogon
 	guest ok = Yes
 	locking = No
 [profiles]
 	comment = Profile Share
 	path = /var/lib/samba/profiles
 	read only = No
 	profile acls = Yes
 [profdata]
 	comment = Profile Data Share
 	path = /var/lib/samba/profdata
 	read only = No
 	profile acls = Yes
 [print$]
 	comment = Printer Drivers
 	path = /var/lib/samba/drivers
 	browseable = yes
 	guest ok = no
 	read only = yes
 	write list = root, chrisr
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{sbehap-ldifadd}{}%
\captionswapskip{}{{\caption{LDIF IDMAP Add-On Load File ---  File: /etc/openldap/idmap.LDIF}\label{sbehap-ldifadd}}}
\captionswapskip{}
\begin{Verbatim}[]

dn: ou=Idmap,dc=abmas,dc=biz
objectClass: organizationalUnit
ou: idmap
structuralObjectClass: organizationalUnit

\end{Verbatim}
\end{example}


% ------------------------   
% Section 
\section{Miscellaneous Server Preparation Tasks}
\label{id2540002}\hypertarget{id2540002}{}%

My father would say, {``}Dinner is not over until the dishes have been done.{''} The makings of a great network environment take a lot of effort and attention to detail. So far, you have completed most of the complex (and to many administrators, the interesting part of server configuration) steps, but remember to tie it all together. Here are a few more steps that must be completed so that your network runs like a well-rehearsed orchestra.
\subsection{Configuring Directory Share Point Roots}
\label{id2540023}\hypertarget{id2540023}{}%

In your {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file, you have specified Windows shares. Each has a {\ttfamily\itshape{\docbookhyphenatedot{path}}} parameter. Even though it is obvious to all, one of the common Samba networking problems is caused by forgetting to verify that every such share root directory actually exists and that it has the necessary permissions and ownership.

Here is an example, but remember to create the directory needed for every share: 
\begin{Verbatim}[]

root#  mkdir -p /data/{accounts,finsvcs,piops}
root#  mkdir -p /apps
root#  chown -R root:root /data
root#  chown -R root:root /apps
root#  chown -R bobj:Accounts /data/accounts
root#  chown -R bobj:Finances /data/finsvcs
root#  chown -R bobj:PIOps /data/piops
root#  chmod -R ug+rwxs,o-rwx /data
root#  chmod -R ug+rwx,o+rx-w /apps

\end{Verbatim}

\subsection{Configuring Profile Directories}
\label{id2540120}\hypertarget{id2540120}{}%

You made a conscious decision to do everything it would take to improve network client performance. One of your decisions was to implement folder redirection. This means that Windows user desktop profiles are now made up of two components: a dynamically loaded part and a set of file network folders.

For this arrangement to work, every user needs a directory structure for the network folder portion of his or her profile as shown here: 
\begin{Verbatim}[]

root#  mkdir -p /var/lib/samba/profdata
root#  chown root:root /var/lib/samba/profdata
root#  chmod 755 /var/lib/samba/profdata

# Per user structure
root#  cd /var/lib/samba/profdata
root#  mkdir -p username
root#  for i in InternetFiles Cookies History AppData \
                      LocalSettings MyPictures MyDocuments Recent
root#  do
root#  mkdir username/$i
root#  done
root#  chown -R username:Domain\ Users username
root#  chmod -R 750 username

\end{Verbatim}


\index{roaming profile} \index{mandatory profile} You have three options insofar as the dynamically loaded portion of the roaming profile is concerned:

\begin{itemize}
%--- Item
\item 
You may permit the user to obtain a default profile.


%--- Item
\item 
You can create a mandatory profile.


%--- Item
\item 
You can create a group profile (which is almost always a mandatory profile).

\end{itemize}

Mandatory profiles cannot be overwritten by a user. The change from a user profile to a mandatory profile is effected by renaming the {\texttt{\docbookhyphenatefilename{NTUSER.\dbz{}DAT}}} to {\texttt{\docbookhyphenatefilename{NTUSER.\dbz{}MAN}}}, that is, just by changing the filename extension.

\index{SRVTOOLS.EXE} \index{Domain User Manager} The location of the profile that a user can obtain is set in the user's account in the LDAP passdb backend. You can manage this using the Idealx smbldap-tools or using the Windows NT4 Domain User Manager\label{id2540315}\begingroup\catcode`\#=12\footnote{ {\textless}\url{ftp://ftp.microsoft.com/Softlib/MSLFILES/SRVTOOLS.EXE}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2540315}.

It may not be obvious that you must ensure that the root directory for the user's profile exists and has the needed permissions. Use the following commands to create this directory: 
\begin{Verbatim}[]

root#  mkdir -p /var/lib/samba/profiles/username
root#  chown username:Domain\ Users
	    /var/lib/samba/profiles/username
root#  chmod 700  /var/lib/samba/profiles/username

\end{Verbatim}

\subsection{Preparation of Logon Scripts}
\label{id2540372}\hypertarget{id2540372}{}%

\index{logon script} The use of a logon script with Windows XP Professional is an option that every site should consider. Unless you have locked down the desktop so the user cannot change anything, there is risk that a vital network drive setting may be broken or that printer connections may be lost. Logon scripts can help to restore persistent network folder (drive) and printer connections in a predictable manner. One situation in which such breakage may occur in particular is when a mobile PC (notebook) user attaches to another company's network that forces environment changes that are alien to your network.

If you decide to use network logon scripts, by reference to the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} files for the domain controllers, you see that the path to the share point for the {\texttt{\docbookhyphenatedot{NETLOGON}}} share defined is {\texttt{\docbookhyphenatefilename{/\dbz{}var/\dbz{}lib/\dbz{}samba/\dbz{}netlogon}}}. The path defined for the logon script inside that share is {\texttt{\docbookhyphenatefilename{scripts\docbooktolatexgobble\string\\logon.\dbz{}bat}}}. This means that as a Windows NT/200x/XP client logs onto the network, it tries to obtain the file {\texttt{\docbookhyphenatefilename{logon.\dbz{}bat}}} from the fully qualified path {\texttt{\docbookhyphenatefilename{/\dbz{}var/\dbz{}lib/\dbz{}samba/\dbz{}netlogon/\dbz{}scripts}}}. This fully qualified path should therefore exist whether you install the {\texttt{\docbookhyphenatefilename{logon.\dbz{}bat}}}.

You can, of course, create the fully qualified path by executing: 
\begin{Verbatim}[]

root#  mkdir -p /var/lib/samba/netlogon/scripts

\end{Verbatim}


You should research the options for logon script implementation by referring to {\em{TOSHARG2}}, Chapter 24, Section 24.4. A quick Web search will bring up a host of options. One of the most popular logon facilities in use today is called KiXtart\label{id2540478}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.kixtart.org}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2540478}.
\subsection{Assigning User Rights and Privileges}
\label{id2540487}\hypertarget{id2540487}{}%

The ability to perform tasks such as joining Windows clients to the domain can be assigned to normal user accounts. By default, only the domain administrator account ({\texttt{\docbookhyphenatedot{root}}} on UNIX systems because it has UID=0) can add accounts. New to Samba 3.0.11 is the ability to grant this privilege in a very limited fashion to particular accounts.

By default, even Samba-3.0.11 does not grant any rights even to the {\texttt{\docbookhyphenatedot{Domain Admins}}} group. Here we grant this group all privileges.

Samba limits privileges on a per-server basis. This is a deliberate limitation so that users who are granted rights can be restricted to particular machines. It is left to the network administrator to determine which rights should be provided and to whom.
Steps for Assignment of User Rights and Privileges\begin{enumerate}

\item{Log onto the PDC as the {\texttt{\docbookhyphenatedot{root}}} account.}

\item{Execute the following command to grant the {\texttt{\docbookhyphenatedot{Domain Admins}}} group all rights and privileges: 
\begin{Verbatim}[]

root#  net -S MASSIVE  -U root%not24get rpc rights grant \
        "MEGANET2\Domain Admins" SeMachineAccountPrivilege \
	SePrintOperatorPrivilege SeAddUsersPrivilege \
	SeDiskOperatorPrivilege SeRemoteShutdownPrivilege
Successfully granted rights.

\end{Verbatim}
 Repeat this step on each domain controller, in each case substituting the name of the server (e.g., BLDG1, BLDG2) in place of the PDC called MASSIVE.}

\item{In this step the privilege will be granted to Bob Jordan (bobj) to add Windows workstations to the domain. Execute the following only on the PDC. It is not necessary to do this on BDCs or on DMS machines because machine accounts are only ever added by the PDC: 
\begin{Verbatim}[]

root#  net -S MASSIVE  -U root%not24get rpc rights grant \
             "MEGANET2\bobj" SeMachineAccountPrivilege
Successfully granted rights.

\end{Verbatim}
}

\item{Verify that privilege assignments have been correctly applied by executing: 
\begin{Verbatim}[]

net rpc rights list accounts -Uroot%not24get
MEGANET2\bobj
SeMachineAccountPrivilege

S-0-0
No privileges assigned

BUILTIN\Print Operators
No privileges assigned

BUILTIN\Account Operators
No privileges assigned

BUILTIN\Backup Operators
No privileges assigned

BUILTIN\Server Operators
No privileges assigned

BUILTIN\Administrators
No privileges assigned

Everyone
No privileges assigned

MEGANET2\Domain Admins
SeMachineAccountPrivilege
SePrintOperatorPrivilege
SeAddUsersPrivilege
SeRemoteShutdownPrivilege
SeDiskOperatorPrivilege

\end{Verbatim}
}
\end{enumerate}

% ------------------------   
% Section 
\section{Windows Client Configuration}
\label{id2540625}\hypertarget{id2540625}{}%

\index{NETLOGON} In the next few sections, you can configure a new Windows XP Professional disk image on a staging machine. You will configure all software, printer settings, profile and policy handling, and desktop default profile settings on this system. When it is complete, you copy the contents of the {\texttt{\docbookhyphenatefilename{C:\docbooktolatexgobble\string\\Documents and Settings\docbooktolatexgobble\string\\Default User}}} directory to a directory with the same name in the {\texttt{\docbookhyphenatedot{NETLOGON}}} share on the domain controllers.

Much can be learned from the Microsoft Support site regarding how best to set up shared profiles. One knowledge-base article in particular stands out: "How to Create a Base Profile for All Users."\label{id2540664}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://support.microsoft.com/default.aspx?scid=kb;EN-US;168475}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2540664}
\subsection{Configuration of Default Profile with Folder Redirection}
\label{redirfold}\hypertarget{redirfold}{}%

\index{folder redirection} Log onto the Windows XP Professional workstation as the local {\texttt{\docbookhyphenatedot{Administrator}}}. It is necessary to expose folders that are generally hidden to provide access to the {\texttt{\docbookhyphenatedot{Default User}}} folder.
Expose Hidden Folders\begin{enumerate}

\item{Launch the Windows Explorer by clicking {\sffamily \bfseries Start} $\to$ {\sffamily \bfseries My Computer} $\to$ {\sffamily \bfseries Tools} $\to$ {\sffamily \bfseries Folder Options} $\to$ {\sffamily \bfseries View Tab}. Select {\sffamily \bfseries Show hidden files and folders}, and click {\sffamily \bfseries OK}. Exit Windows Explorer.}

\item{\index{regedt32} Launch the Registry Editor. Click {\sffamily \bfseries Start} $\to$ {\sffamily \bfseries Run}. Key in {\bfseries{regedt32}}, and click {\sffamily \bfseries OK}.}
\end{enumerate}


Redirect Folders in Default System User Profile\begin{enumerate}

\item{\index{HKEY\_LOCAL\_MACHINE} \index{Default User} Give focus to {\texttt{\docbookhyphenatedot{HKEY\_LOCAL\_MACHINE}}} hive entry in the left panel. Click {\sffamily \bfseries File} $\to$ {\sffamily \bfseries Load Hive...} $\to$ {\sffamily \bfseries Documents and Settings} $\to$ {\sffamily \bfseries Default User} $\to$ {\sffamily \bfseries NTUSER} $\to$ {\sffamily \bfseries Open}. In the dialog box that opens, enter the key name {\texttt{\docbookhyphenatedot{Default}}} and click {\sffamily \bfseries OK}.}

\item{Browse inside the newly loaded Default folder to: 
\begin{Verbatim}[]

HKEY_LOCAL_MACHINE\Default\Software\Microsoft\Windows\
                     CurrentVersion\Explorer\User Shell Folders\

\end{Verbatim}
 The right panel reveals the contents as shown in \hyperlink{XP-screen001}{Figure {\ref{XP-screen001}}}.}

\item{\index{\%USERPROFILE\%} \index{\%LOGONSERVER\%} You edit hive keys. Acceptable values to replace the {\texttt{\docbookhyphenatedot{\%USERPROFILE\%}}} variable includes: 
\begin{itemize}
%--- Item
\item 
A drive letter such as {\texttt{\docbookhyphenatedot{U:}}}


%--- Item
\item 
A direct network path such as {\texttt{\docbookhyphenatedot{\textbackslash \textbackslash MASSIVE\textbackslash profdata}}}


%--- Item
\item 
A network redirection (UNC name) that contains a macro such as

{\texttt{\docbookhyphenatedot{\%LOGONSERVER\%\textbackslash profdata\textbackslash}}}

\end{itemize}
}

\item{\index{registry keys} Set the registry keys as shown in \hyperlink{proffold}{Table {\ref{proffold}}}. Your implementation makes the assumption that users have statically located machines. Notebook computers (mobile users) need to be accommodated using local profiles. This is not an uncommon assumption.}

\item{Click back to the root of the loaded hive {\texttt{\docbookhyphenatedot{Default}}}. Click {\sffamily \bfseries File} $\to$ {\sffamily \bfseries Unload Hive...} $\to$ {\sffamily \bfseries Yes}.}

\item{\index{Registry Editor} Click {\sffamily \bfseries File} $\to$ {\sffamily \bfseries Exit}. This exits the Registry Editor.}

\item{Now follow the procedure given in \hyperlink{sbehap-locgrppol}{Section {\ref{sbehap-locgrppol}}}. Make sure that each folder you have redirected is in the exclusion list.}

\item{You are now ready to copy\label{id2541089}\begingroup\catcode`\#=12\footnote{
There is an alternate method by which a default user profile can be added to the {\texttt{\docbookhyphenatedot{NETLOGON}}} share. This facility in the Windows System tool permits profiles to be exported. The export target may be a particular user or group profile share point or else the {\texttt{\docbookhyphenatedot{NETLOGON}}} share. In this case, the profile directory must be named {\texttt{\docbookhyphenatedot{Default User}}}.
}\endgroup\docbooktolatexmakefootnoteref{id2541089} the Default User profile to the Samba domain controllers. Launch Microsoft Windows Explorer, and use it to copy the full contents of the directory {\texttt{\docbookhyphenatefilename{Default User}}} that is in the {\texttt{\docbookhyphenatefilename{C:\docbooktolatexgobble\string\\Documents and Settings}}} to the root directory of the {\texttt{\docbookhyphenatedot{NETLOGON}}} share. If the {\texttt{\docbookhyphenatedot{NETLOGON}}} share has the defined UNIX path of {\texttt{\docbookhyphenatefilename{/\dbz{}var/\dbz{}lib/\dbz{}samba/\dbz{}netlogon}}}, when the copy is complete there must be a directory in there called {\texttt{\docbookhyphenatefilename{Default User}}}.}
\end{enumerate}

Before punching out new desktop images for the client workstations, it is perhaps a good idea that desktop behavior should be returned to the original Microsoft settings. The following steps achieve that ojective:
Reset Folder Display to Original Behavior\begin{enumerate}

\item{To launch the Windows Explorer, click {\sffamily \bfseries Start} $\to$ {\sffamily \bfseries My Computer} $\to$ {\sffamily \bfseries Tools} $\to$ {\sffamily \bfseries Folder Options} $\to$ {\sffamily \bfseries View Tab}. Deselect {\sffamily \bfseries Show hidden files and folders}, and click {\sffamily \bfseries OK}. Exit Windows Explorer.}
\end{enumerate}

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{XP-screen001}{}%
\includegraphics[scale=0.65]{Samba3-ByExample/images/XP-screen001}
{{\caption[{Windows XP Professional ---  User Shared Folders}]{{{Windows XP Professional ---  User Shared Folders}}}\label{XP-screen001}}}
\end{center}
\end{figure}


% table ------------------------------------------------------
\begin{table}[htb]
\begin{center}%
\hypertarget{proffold}{}%
\captionswapskip{}{{\caption{Default Profile Redirections}\label{proffold}}}
\captionswapskip{}\begin{tabular}{|l|l|}
\hline 
{{{\bfseries Registry Key}}} & {{{\bfseries Redirected Value}}} \tabularnewline
 \hline 
{{Cache}} & {{\%LOGONSERVER\%\textbackslash profdata\textbackslash \%USERNAME\%\textbackslash InternetFiles}} \tabularnewline
 \hline 
{{Cookies}} & {{\%LOGONSERVER\%\textbackslash profdata\textbackslash \%USERNAME\%\textbackslash Cookies}} \tabularnewline
 \hline 
{{History}} & {{\%LOGONSERVER\%\textbackslash profdata\textbackslash \%USERNAME\%\textbackslash History}} \tabularnewline
 \hline 
{{Local AppData}} & {{\%LOGONSERVER\%\textbackslash profdata\textbackslash \%USERNAME\%\textbackslash AppData}} \tabularnewline
 \hline 
{{Local Settings}} & {{\%LOGONSERVER\%\textbackslash profdata\textbackslash \%USERNAME\%\textbackslash LocalSettings}} \tabularnewline
 \hline 
{{My Pictures}} & {{\%LOGONSERVER\%\textbackslash profdata\textbackslash \%USERNAME\%\textbackslash MyPictures}} \tabularnewline
 \hline 
{{Personal}} & {{\%LOGONSERVER\%\textbackslash profdata\textbackslash \%USERNAME\%\textbackslash MyDocuments}} \tabularnewline
 \hline 
{{Recent}} & {{\%LOGONSERVER\%\textbackslash profdata\textbackslash \%USERNAME\%\textbackslash Recent}} \tabularnewline
\hline 
\end{tabular}
\end{center}
\end{table}

\subsection{Configuration of MS Outlook to Relocate PST File}
\label{id2541388}\hypertarget{id2541388}{}%

\index{Outlook!PST} \index{MS Outlook!PST} Microsoft Outlook can store a Personal Storage file, generally known as a PST file. It is the nature of email storage that this file grows, at times quite rapidly. So that users' email is available to them at every workstation they may log onto, it is common practice in well-controlled sites to redirect the PST folder to the users' home directory. Follow these steps for each user who wishes to do this.

To redirect the Outlook PST file in Outlook 2003 (older versions of Outlook behave slightly differently), follow these steps:
Outlook PST File Relocation\begin{enumerate}

\item{Close Outlook if it is open.}

\item{From the {\sffamily \bfseries Control Panel}, launch the Mail icon.}

\item{Click {\sffamily \bfseries Email Accounts.}}

\item{Make a note of the location of the PST file(s). From this location, move the files to the desired new target location. The most desired new target location may well be the users' home directory.}

\item{Add a new data file, selecting the PST file in the new desired target location. Give this entry (not the filename) a new name such as {``}Personal Mail Folders.{''}  Note: If MS Outlook has been configured to use an IMAP account configuration there may be problems following these instructions. Feedback from users suggests that where IMAP is used the PST file is used to store rules and filters. When the PST store is relocated it appears to break MS Outlook's Send/Receive button. If anyone has sucessfully relocated PST files where IMAP is used please email {\texttt{\docbookhyphenatedot{jht@samba.\dbz{}org}}} with useful tips and suggestions so that this warning can be removed or modified.}

\item{Close the {\sffamily \bfseries Date Files} windows, then click {\sffamily \bfseries Email Accounts}.}

\item{Select {\sffamily \bfseries View of Change} exiting email accounts, click {\sffamily \bfseries Next.}}

\item{Change the {\sffamily \bfseries Mail Delivery Location} so as to use the data file in the new target location.}

\item{Go back to the {\sffamily \bfseries Data Files} window, then delete the old data file entry.}
\end{enumerate}

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

\index{Outlook Address Book} You may have to remove and reinstall the Outlook Address Book (Contacts) entries, otherwise the user may be not be able to retrieve contacts when addressing a new email message.
\end{admonition}


\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

\index{Outlook Express} Outlook Express is not at all like MS OutLook. It stores file very differently also. Outlook Express storage files can not be redirected to network shares. The options panel will not permit this, but they can be moved to folders outside of the user's profile. They can also be excluded from folder synchronization as part of the roaming profile.

While it is possible to redirect the data stores for Outlook Express data stores by editing the registry, experience has shown that data corruption and loss of email messages will result.

\index{Outlook Express} \index{MS Outlook} In the same vane as MS Outlook, Outlook Express data stores can become very large. When used with roaming profiles this can result in excruciatingly long login and logout behavior will files are synchronized. For this reason, it is highly recommended not to use Outlook Express where roaming profiles are used.
\end{admonition}


\index{PST file} Microsoft does not support storing PST files on network shares, although the practice does appear to be rather popular. Anyone who does relocation the PST file to a network resource should refer the Microsoft reference\label{id2541656}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://support.microsoft.com/kb/297019/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2541656} to better understand the issues.

\index{PST file} Apart from manually moving PST files to a network share, it is possible to set the default PST location for new accounts by following the instructions at the WindowsITPro web\label{id2541677}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.windowsitpro.com/Windows/Article/ArticleID/48228/48228.html}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2541677} site.

\index{PST file} User feedback suggests that disabling of oplocks on PST files will significantly improve network performance by reducing locking overheads. One way this can be done is to add to the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file stanza for the share the PST file the following: 
\begin{Verbatim}[]

veto oplock files = /*.pdf/*.PST/

\end{Verbatim}

\subsection{Configure Delete Cached Profiles on Logout}
\label{id2541714}\hypertarget{id2541714}{}%

Configure the Windows XP Professional client to auto-delete roaming profiles on logout:

\index{MMC} Click {\sffamily \bfseries Start} $\to$ {\sffamily \bfseries Run}. In the dialog box, enter {\bfseries{MMC}} and click {\sffamily \bfseries OK}.

Follow these steps to set the default behavior of the staging machine so that all roaming profiles are deleted as network users log out of the system. Click {\sffamily \bfseries File} $\to$ {\sffamily \bfseries Add/Remove Snap-in} $\to$ {\sffamily \bfseries Add} $\to$ {\sffamily \bfseries Group Policy} $\to$ {\sffamily \bfseries Add} $\to$ {\sffamily \bfseries Finish} $\to$ {\sffamily \bfseries Close} $\to$ {\sffamily \bfseries OK}.

\index{Microsoft Management Console|textit{see} {MMC} } The Microsoft Management Console now shows the {\sffamily \bfseries Group Policy} utility that enables you to set the policies needed. In the left panel, click {\sffamily \bfseries Local Computer Policy} $\to$ {\sffamily \bfseries Administrative Templates} $\to$ {\sffamily \bfseries System} $\to$ {\sffamily \bfseries User Profiles}. In the right panel, set the properties shown here by double-clicking on each item as shown:

\begin{itemize}
%--- Item
\item 
Do not check for user ownership of Roaming Profile Folders = Enabled


%--- Item
\item 
Delete cached copies of roaming profiles = Enabled

\end{itemize}

Close the Microsoft Management Console. The settings take immediate effect and persist onto all image copies made of this system to deploy the new standard desktop system.
\subsection{Uploading Printer Drivers to Samba Servers}
\label{id2541904}\hypertarget{id2541904}{}%

\index{printing!drag-and-drop} Users want to be able to use network printers. You have a vested interest in making it easy for them to print. You have chosen to install the printer drivers onto the Samba servers and to enable point-and-click (drag-and-drop) printing. This process results in Samba being able to automatically provide the Windows client with the driver necessary to print to the printer chosen. The following procedure must be followed for every network printer:
Steps to Install Printer Drivers on the Samba Servers\begin{enumerate}

\item{Join your Windows XP Professional workstation (the staging machine) to the {\texttt{\docbookhyphenatedot{MEGANET2}}} domain. If you are not sure of the procedure, follow the guidance given in \hyperlink{appendix}{Chapter {\ref{appendix}}, {``}A Collection of Useful Tidbits{''}}, \hyperlink{domjoin}{Section {\ref{domjoin}}}.}

\item{After the machine has rebooted, log onto the workstation as the domain {\texttt{\docbookhyphenatedot{root}}} (this is the Administrator account for the operating system that is the host platform for this implementation of Samba.}

\item{Launch MS Windows Explorer. Navigate in the left panel. Click {\sffamily \bfseries My Network Places} $\to$ {\sffamily \bfseries Entire Network} $\to$ {\sffamily \bfseries Microsoft Windows Network} $\to$ {\sffamily \bfseries Meganet2} $\to$ {\sffamily \bfseries Massive}. Click on {\sffamily \bfseries Massive} {\sffamily \bfseries Printers and Faxes}.}

\item{Identify a printer that is shown in the right panel. Let us assume the printer is called {\texttt{\docbookhyphenatedot{ps01-color}}}. Right-click on the {\sffamily \bfseries ps01-color} icon and select the {\sffamily \bfseries Properties} entry. This opens a dialog box that indicates that {``}The printer driver is not installed on this computer. Some printer properties will not be accessible unless you install the printer driver. Do you want to install the driver now?{''} It is important at this point you answer {\sffamily \bfseries No}.}

\item{The printer properties panel for the {\sffamily \bfseries ps01-color} printer on the server {\texttt{\docbookhyphenatedot{MASSIVE}}} is displayed. Click the {\sffamily \bfseries Advanced} tab. Note that the box labeled {\sffamily \bfseries Driver} is empty. Click the {\sffamily \bfseries New Driver} button that is next to the {\sffamily \bfseries Driver} box. This launches the {``}Add Printer Wizard{''}.}

\item{\index{Add Printer Wizard!APW} \index{APW} The {``}Add Printer Driver Wizard on {\texttt{\docbookhyphenatedot{MASSIVE}}}{''} panel is now presented. Click {\sffamily \bfseries Next} to continue. From the left panel, select the printer manufacturer. In your case, you are adding a driver for a printer manufactured by Lexmark. In the right panel, select the printer (Lexmark Optra Color 40 PS). Click {\sffamily \bfseries Next}, and then {\sffamily \bfseries Finish} to commence driver upload. A progress bar appears and instructs you as each file is being uploaded and that it is being directed at the network server {\texttt{\docbookhyphenatedot{\textbackslash \textbackslash massive\textbackslash ps01-color}}}.}

\item{\index{printers!Advanced} \index{printers!Properties} \index{printers!Sharing} \index{printers!General} \index{printers!Security} \index{AD printer publishing} The driver upload completes in anywhere from a few seconds to a few minutes. When it completes, you are returned to the {\sffamily \bfseries Advanced} tab in the {\sffamily \bfseries Properties} panel. You can set the Location (under the {\sffamily \bfseries General} tab) and Security settings (under the {\sffamily \bfseries Security} tab). Under the {\sffamily \bfseries Sharing} tab it is possible to load additional printer drivers; there is also a check-box in this tab called {``}List in the directory{''}. When this box is checked, the printer will be published in Active Directory (Applicable to Active Directory use only.)}

\item{\index{printers!Default Settings} Click {\sffamily \bfseries OK}. It will take a minute or so to upload the settings to the server. You are now returned to the {\sffamily \bfseries Printers and Faxes on Massive} monitor. Right-click on the printer, click {\sffamily \bfseries Properties} $\to$ {\sffamily \bfseries Device Settings}. Now change the settings to suit your requirements. BE CERTAIN TO CHANGE AT LEAST ONE SETTING and apply the changes even if you need to reverse the changes back to their original settings.}

\item{This is necessary so that the printer settings are initialized in the Samba printers database. Click {\sffamily \bfseries Apply} to commit your settings. Revert any settings you changed just to initialize the Samba printers database entry for this printer. If you need to revert a setting, click {\sffamily \bfseries Apply} again.}

\item{\index{Print Test Page} Verify that all printer settings are at the desired configuration. When you are satisfied that they are, click the {\sffamily \bfseries General} tab. Now click the {\sffamily \bfseries Print Test Page} button. A test page should print. Verify that it has printed correctly. Then click {\sffamily \bfseries OK} in the panel that is newly presented. Click {\sffamily \bfseries OK} on the {\sffamily \bfseries ps01-color on massive Properties} panel.}

\item{You must repeat this process for all network printers (i.e., for every printer on each server). When you have finished uploading drivers to all printers, close all applications. The next task is to install software your users require to do their work.}
\end{enumerate}
\subsection{Software Installation}
\label{id2542417}\hypertarget{id2542417}{}%

Your network has both fixed desktop workstations as well as notebook computers. As a general rule, it is a good idea to not tamper with the operating system that is provided by the notebook computer manufacturer. Notebooks require special handling that is beyond the scope of this chapter.

For desktop systems, the installation of software onto administratively centralized application servers make a lot of sense. This means that you can manage software maintenance from a central perspective and that only minimal application stubware needs to be installed onto the desktop systems. You should proceed with software installation and default configuration as far as is humanly possible and so long as it makes sense to do so. Make certain to thoroughly test and validate every aspect of software operations and configuration.

When you believe that the overall configuration is complete, be sure to create a shared group profile and migrate that to the Samba server for later reuse when creating custom mandatory profiles, just in case a user may have specific needs you had not anticipated.
\subsection{Roll-out Image Creation}
\label{id2542454}\hypertarget{id2542454}{}%

The final steps before preparing the distribution Norton Ghost image file you might follow are:
\begin{quote}

Unjoin the domain ---  Each workstation requires a unique name and must be independently joined into domain membership.
\end{quote}
\begin{quote}

Defragment the hard disk ---  While not obvious to the uninitiated, defragmentation results in better performance and often significantly reduces the size of the compressed disk image. That also means it will take less time to deploy the image onto 500 workstations.
\end{quote}

% ------------------------   
% Section 
\section{Key Points Learned}
\label{id2542489}\hypertarget{id2542489}{}%

This chapter introduced many new concepts. Is it a sad fact that the example presented deliberately avoided any consideration of security. Security does not just happen; you must design it into your total network. Security begins with a systems design and implementation that anticipates hostile behavior from users both inside and outside the organization. Hostile and malicious intruders do not respect barriers; they accept them as challenges. For that reason, if not simply from a desire to establish safe networking practices, you must not deploy the design presented in this book in an environment where there is risk of compromise.

\index{Access Control Lists|textit{see} {ACLs} } \index{ACLs} As a minimum, the LDAP server must be protected by way of Access Control Lists (ACLs), and it must be configured to use secure protocols for all communications over the network. Of course, secure networking does not result just from systems design and implementation but involves constant user education training and, above all, disciplined attention to detail and constant searching for signs of unfriendly or alien activities. Security is itself a topic for a whole book. Please do consult appropriate sources. Jerry Carter's book {\em{LDAP System Administration}}\label{id2542538}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.booksense.com/product/info.jsp\string&isbn=1565924916}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2542538} is a good place to start reading about OpenLDAP as well as security considerations.

The substance of this chapter that has been deserving of particular attention includes:

\begin{itemize}
%--- Item
\item 
Implementation of an OpenLDAP-based passwd backend, necessary to support distributed domain control.


%--- Item
\item 
Implementation of Samba primary and secondary domain controllers with a common LDAP backend for user and group accounts that is shared with the UNIX system through the PADL nss\_ldap and pam\_ldap tool-sets.


%--- Item
\item 
Use of the Idealx smbldap-tools scripts for UNIX (POSIX) account management as well as to manage Samba Windows user and group accounts.


%--- Item
\item 
The basics of implementation of Group Policy controls for Windows network clients.


%--- Item
\item 
Control over roaming profiles, with particular focus on folder redirection to network drives.


%--- Item
\item 
Use of the CUPS printing system together with Samba-based printer driver auto-download.

\end{itemize}

% ------------------------   
% Section 
\section{Questions and Answers}
\label{id2542601}\hypertarget{id2542601}{}%

Well, here we are at the end of this chapter and we have only ten questions to help you to remember so much. There are bound to be some sticky issues here.
% -------------------------------------------------------------
% QandASet                                                     
% -------------------------------------------------------------
\subsection*{F.A.Q.}
\label{id2542613}
\vspace{1em}
\noindent{}1.~\textbf{Q:}~\textit{Why did you not cover secure practices? Isn't it rather irresponsible to instruct network administrators to implement insecure solutions?}
\newline
\noindent\textbf{A:}~
Let's get this right. This is a book about Samba, not about OpenLDAP and secure communication protocols for subjects other than Samba. Earlier on, you note, that the dynamic DNS and DHCP solutions also used no protective secure communications protocols. The reason for this is simple: There are so many ways of implementing secure protocols that this book would have been even larger and more complex.

The solutions presented here all work (at least they did for me). Network administrators have the interest and the need to be better trained and instructed in secure networking practices and ought to implement safe systems. I made the decision, right or wrong, to keep this material as simple as possible. The intent of this book is to demonstrate a working solution and not to discuss too many peripheral issues.

This book makes little mention of backup techniques. Does that mean that I am recommending that you should implement a network without provision for data recovery and for disaster management? Back to our focus: The deployment of Samba has been clearly demonstrated.


\vspace{1em}
\vspace{1em}
\noindent{}2.~\textbf{Q:}~\textit{You have focused much on SUSE Linux and little on the market leader, Red Hat. Do you have a problem with Red Hat Linux? Doesn't that make your guidance irrelevant to the Linux I might be using?}
\newline
\noindent\textbf{A:}~
Both Red Hat Linux and SUSE Linux comply with the Linux Standards Base specifications for a standard Linux distribution. The differences are marginal. Surely you know your Linux platform, and you do have access to administration manuals for it. This book is not a Linux tutorial; it is a Samba tutorial. Let's keep the focus on the Samba part of the book; all the other bits are peripheral (but important) to creation of a total network solution.

What I find interesting is the attention reviewers give to Linux installation and to the look and feel of the desktop, but does that make for a great server? In this book, I have paid particular attention to the details of creating a whole solution framework. I have not tightened every nut and bolt, but I have touched on all the issues you need to be familiar with. Over the years many people have approached me wanting to know the details of exactly how to implement a DHCP and dynamic DNS server with Samba and WINS. In this chapter, it is plain to see what needs to be configured to provide transparent interoperability. Likewise for CUPS and Samba interoperation. These are key stumbling areas for many people.

At every critical junction, I have provided comparative guidance for both SUSE and Red Hat Linux. Both manufacturers have done a great job in furthering the cause of open source software. I favor neither and respect both. I like particular features of both products (companies also). No bias in presentation is intended. Oh, before I forget, I particularly like Debian Linux; that is my favorite playground.


\vspace{1em}
\vspace{1em}
\noindent{}3.~\textbf{Q:}~\textit{You did not use SWAT to configure Samba. Is there something wrong with it?}
\newline
\noindent\textbf{A:}~
That is a good question. As it is, the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file configurations are presented in as direct a format as possible. Adding SWAT into the equation would have complicated matters. I sought simplicity of implementation. The fact is that I did use SWAT to create the files in the first place.

There are people in the Linux and open source community who feel that SWAT is dangerous and insecure. Many will not touch it with a barge-pole. By not introducing SWAT, I hope to have brought their interests on board. SWAT is well covered is {\em{TOSHARG2}}.


\vspace{1em}
\vspace{1em}
\noindent{}4.~\textbf{Q:}~\textit{You have exposed a well-used password {\em{not24get}}. Is that not irresponsible?}
\newline
\noindent\textbf{A:}~
Well, I had to use a password of some sort. At least this one has been consistently used throughout. I guess you can figure out that in a real deployment it would make sense to use a more secure and original password.


\vspace{1em}
\vspace{1em}
\noindent{}5.~\textbf{Q:}~\textit{The Idealx smbldap-tools create many domain group accounts that are not used. Is that a good thing?}
\newline
\noindent\textbf{A:}~
I took this up with Idealx and found them most willing to change that in the next version. Let's give Idealx some credit for the contribution they have made. I appreciate their work and, besides, it does no harm to create accounts that are not now used ---  at some time Samba may well use them.


\vspace{1em}
\vspace{1em}
\noindent{}6.~\textbf{Q:}~\textit{Can I use LDAP just for Samba accounts and not for UNIX system accounts?}
\newline
\noindent\textbf{A:}~
Yes, you can do that for user accounts only. Samba requires there to be a POSIX (UNIX) group account for every Windows domain group account. But if you put your users into the system password account, how do you plan to keep all domain controller system password files in sync? I think that having everything in LDAP makes a lot of sense for the UNIX administrator who is still learning the craft and is migrating from MS Windows.


\vspace{1em}
\vspace{1em}
\noindent{}7.~\textbf{Q:}~\textit{Why are the Windows domain RID portions not the same as the UNIX UID?}
\newline
\noindent\textbf{A:}~
Samba uses a well-known public algorithm for assigning RIDs from UIDs and GIDs. This algorithm ought to ensure that there will be no clashes with well-known RIDs. Well-known RIDs have special significance to MS Windows clients. The automatic assignment used the calculation: RID = UID x 2 + 1000. Of course, Samba does permit you to override that to some extent. See the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} man page entry for {\ttfamily\itshape{\docbookhyphenatedot{algorithmic rid base}}}.


\vspace{1em}
\vspace{1em}
\noindent{}8.~\textbf{Q:}~\textit{Printer configuration examples all show printing to the HP port 9100. Does this mean that I must have HP printers for these solutions to work?}
\newline
\noindent\textbf{A:}~
No. You can use any type of printer and must use the interfacing protocol supported by the printer. Many networks use LPR/LPD print servers to which are attached PCL printers, inkjet printers, plotters, and so on. At home I use a USB-attached inkjet printer. Use the appropriate device URI (Universal Resource Interface) argument to the {\texttt{\docbookhyphenatedot{lpadmin -v}}} option that is right for your printer.


\vspace{1em}
\vspace{1em}
\noindent{}9.~\textbf{Q:}~\textit{Is folder redirection dangerous? I've heard that you can lose your data that way.}
\newline
\noindent\textbf{A:}~
The only loss of data I know of that involved folder redirection was caused by manual misuse of the redirection tool. The administrator redirected a folder to a network drive and said he wanted to migrate (move) the data over. Then he changed his mind, so he moved the folder back to the roaming profile. This time, he declined to move the data because he thought it was still in the local profile folder. That was not the case, so by declining to move the data back, he wiped out the data. You cannot hold the tool responsible for that. Caveat emptor still applies.


\vspace{1em}
\vspace{1em}
\noindent{}10.~\textbf{Q:}~\textit{Is it really necessary to set a local Group Policy to exclude the redirected folders from the roaming profile?}
\newline
\noindent\textbf{A:}~
Yes. If you do not do this, the data will still be copied from the network folder (share) to the local cached copy of the profile.


\vspace{1em}
\cleardoublepage 
% -------------------------------------------------------------
% Chapter A Distributed 2000-User Network 
% ------------------------------------------------------------- 	
\chapter{A Distributed 2000-User Network}
\label{2000users}\hypertarget{2000users}{}%

There is something indeed mystical about things that are big. Large networks exhibit a certain magnetism and exude a sense of importance that obscures reality. You and I know that it is no more difficult to secure a large network than it is a small one. We all know that over and above a particular number of network clients, the rules no longer change; the only real dynamic is the size of the domain (much like a kingdom) over which the network ruler (oops, administrator) has control. The real dynamic then transforms from the technical to the political. Then again, that point is often reached well before the kingdom (or queendom) grows large.

If you have systematically worked your way to this chapter, hopefully you have found some gems and techniques that are applicable in your world. The network designs you have worked with in this book have their strong points as well as weak ones. That is to be expected given that they are based on real business environments, the specifics of which are molded to serve the purposes of this book.

This chapter is intent on wrapping up issues that are central to implementation and design of progressively larger networks. Are you ready for this chapter? Good, it is time to move on.

In previous chapters, you made the assumption that your network administration staff need detailed instruction right down to the nuts and bolts of implementing the solution. That is still the case, but they have graduated now. You decide to document only those issues, methods, and techniques that are new or complex. Routine tasks such as implementing a DNS or a DHCP server are under control. Even the basics of Samba are largely under control. So in this section you focus on the specifics of implementing LDAP changes, Samba changes, and approach and design of the solution and its deployment.

% ------------------------   
% Section 
\section{Introduction}
\label{id2459002}\hypertarget{id2459002}{}%

Abmas is a miracle company. Most businesses would have collapsed under the weight of rapid expansion that this company has experienced. Samba is flexible, so there is no need to reinstall the whole operating system just because you need to implement a new network design. In fact, you can keep an old server running right up to the moment of cutover and then do a near-live conversion. There is no need to reinstall a Samba server just to change the way your network should function.

\index{LDAP} Network growth is common to all organizations. In this exercise, your preoccupation is with the mechanics of implementing Samba and LDAP so that network users on each network segment can work without impediment.
\subsection{Assignment Tasks}
\label{id2530842}\hypertarget{id2530842}{}%

Starting with the configuration files for the server called {\texttt{\docbookhyphenatedot{MASSIVE}}} in \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}}, you now deal with the issues that are particular to large distributed networks. Your task is simple ---  identify the challenges, consider the alternatives, and then design and implement a solution.

\index{VPN} Remember, you have users based in London (UK), Los Angeles, Washington. DC, and, three buildings in New York. A significant portion of your workforce have notebook computers and roam all over the world. Some dial into the office, others use VPN connections over the Internet, and others just move between buildings.i

What do you say to an employee who normally uses a desktop system but must spend six weeks on the road with a notebook computer? She is concerned about email access and how to keep coworkers current with changing documents.

To top it all off, you have one network support person and one help desk person based in London, a single person dedicated to all network operations in Los Angeles, five staff for user administration and help desk in New York, plus one {\em{floater}} for Washington.

You have outsourced all desktop deployment and management to DirectPointe. Your concern is server maintenance and third-level support. Build a plan and show what must be done.

% ------------------------   
% Section 
\section{Dissection and Discussion}
\label{id2530911}\hypertarget{id2530911}{}%

\index{passdb backend} \index{LDAP} In \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}}, you implemented an LDAP server that provided the {\ttfamily\itshape{\docbookhyphenatedot{passdb backend}}} for the Samba servers. You explored ways to accelerate Windows desktop profile handling and you took control of network performance.

\index{ldapsam} \index{tdbsam} \index{smbpasswd} \index{replicated} The implementation of an LDAP-based passdb backend (known as {\em{ldapsam}} in Samba parlance), or some form of database that can be distributed, is essential to permit the deployment of Samba Primary and Backup Domain Controllers (PDC/BDCs). You see, the problem is that the {\em{tdbsam}}-style passdb backend does not lend itself to being replicated. The older plain-text-based {\em{smbpasswd}}-style passdb backend can be replicated using a tool such as {\bfseries{rsync}}, but {\em{smbpasswd}} suffers the drawback that it does not support the range of account facilities demanded by modern network managers.

\index{XML} \index{SQL} The new {\em{tdbsam}} facility supports functionality that is similar to an {\em{ldapsam}}, but the lack of distributed infrastructure sorely limits the scope for its deployment. This raises the following questions: Why can't I just use an XML-based backend, or for that matter, why not use an SQL-based backend? Is support for these tools broken? Answers to these questions require a bit of background.

\index{directory} \index{database} \index{transaction processing} \index{LDAP} {\em{What is a directory?}} A directory is a collection of information regarding objects that can be accessed to rapidly find information that is relevant in a particular and consistent manner. A directory differs from a database in that it is generally more often searched (read) than updated. As a consequence, the information is organized to facilitate read access rather than to support transaction processing.

\index{Lightweight Directory Access Protocol|textit{see} {LDAP} } \index{LDAP} \index{master} \index{slave} The Lightweight Directory Access Protocol (LDAP) differs considerably from a traditional database. It has a simple search facility that uniquely makes a highly preferred mechanism for managing user identities. LDAP provides a scalable mechanism for distributing the data repository and for keeping all copies (slaves) in sync with the master repository.

\index{identity management} \index{Active Directory} \index{OpenLDAP} Samba is a flexible and powerful file and print sharing technology. It can use many external authentication sources and can be part of a total authentication and identity management infrastructure. The two most important external sources for large sites are Microsoft Active Directory and LDAP. Sites that specifically wish to avoid the proprietary implications of Microsoft Active Directory naturally gravitate toward OpenLDAP.

\index{network!routed} In \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}}, you had to deal with a locally routed network. All deployment concerns focused around making users happy, and that simply means taking control over all network practices and usage so that no one user is disadvantaged by any other. The real lesson is one of understanding that no matter how much network bandwidth you provide, bandwidth remains a precious resource.

In this chapter, you must now consider how the overall network must function. In particular, you must be concerned with users who move between offices. You must take into account the way users need to access information globally. And you must make the network robust enough so that it can sustain partial breakdown without causing loss of productivity.
\subsection{Technical Issues}
\label{id2519666}\hypertarget{id2519666}{}%

There are at least three areas that need to be addressed as you approach the challenge of designing a network solution for the newly expanded business:

\begin{itemize}
%--- Item
\item 
\index{mobility} User needs such as mobility and data access


%--- Item
\item 
The nature of Windows networking protocols


%--- Item
\item 
Identity management infrastructure needs

\end{itemize}

Let's look at each in turn.
\subsubsection{User Needs}
\label{id2519705}\hypertarget{id2519705}{}%

The new company has three divisions. Staff for each division are spread across the company. Some staff are office-bound and some are mobile users. Mobile users travel globally. Some spend considerable periods working in other offices. Everyone wants to be able to work without constraint of productivity.

The challenge is not insignificant. In some parts of the world, even dial-up connectivity is poor, while in other regions political encumbrances severely curtail user needs. Parts of the global Internet infrastructure remain shielded off for reasons outside the scope of this discussion.

\index{synchronize} Decisions must be made regarding where data is to be stored, how it will be replicated (if at all), and what the network bandwidth implications are. For example, one decision that can be made is to give each office its own master file storage area that can be synchronized to a central repository in New York. This would permit global data to be backed up from a single location. The synchronization tool could be {\bfseries{rsync,}} run via a cron job. Mobile users may use off-line file storage under Windows XP Professional. This way, they can synchronize all files that have changed since each logon to the network.

\index{bandwidth!requirements} \index{roaming profile} No matter which way you look at this, the bandwidth requirements for acceptable performance are substantial even if only 10 percent of staff are global data users. A company with 3,500 employees, 280 of whom are mobile users who use a similarly distributed network, found they needed at least 2 Mb/sec connectivity between the UK and US offices. Even over 2 Mb/sec bandwidth, this company abandoned any attempt to run roaming profile usage for mobile users. At that time, the average roaming profile took 480 KB, while today the minimum Windows XP Professional roaming profile involves a transfer of over 750 KB from the profile server to and from the client.

\index{wide-area} Obviously then, user needs and wide-area practicalities dictate the economic and technical aspects of your network design as well as for standard operating procedures.
\subsubsection{The Nature of Windows Networking Protocols}
\label{id2519801}\hypertarget{id2519801}{}%

\index{profile!mandatory} Network logons that include roaming profile handling requires from 140 KB to 2 MB. The inclusion of support for a minimal set of common desktop applications can push the size of a complete profile to over 15 MB. This has substantial implications for location of user profiles. Additionally, it is a significant factor in determining the nature and style of mandatory profiles that may be enforced as part of a total service-level assurance program that might be implemented.

\index{logon traffic} \index{redirected folders} One way to reduce the network bandwidth impact of user logon traffic is through folder redirection. In \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}}, you implemented this in the new Windows XP Professional standard desktop configuration. When desktop folders such as {\sffamily \bfseries My Documents} are redirected to a network drive, they should also be excluded from synchronization to and from the server on logon or logout. Redirected folders are analogous to network drive connections.

\index{application servers} Of course, network applications should only be run off local application servers. As a general rule, even with 2 Mb/sec network bandwidth, it would not make sense at all for someone who is working out of the London office to run applications off a server that is located in New York.

\index{affordability} When network bandwidth becomes a precious commodity (that is most of the time), there is a significant demand to understand network processes and to mold the limits of acceptability around the constraints of affordability.

When a Windows NT4/200x/XP Professional client user logs onto the network, several important things must happen.

\begin{itemize}
%--- Item
\item 
\index{DHCP} The client obtains an IP address via DHCP. (DHCP is necessary so that users can roam between offices.)


%--- Item
\item 
\index{WINS} \index{DNS} The client must register itself with the WINS and/or DNS server.


%--- Item
\item 
\index{Domain Controller!closest} The client must locate the closest domain controller.


%--- Item
\item 
The client must log onto a domain controller and obtain as part of that process the location of the user's profile, load it, connect to redirected folders, and establish all network drive and printer connections.


%--- Item
\item 
The domain controller must be able to resolve the user's credentials before the logon process is fully implemented.

\end{itemize}

Given that this book is about Samba and that it implements the Windows NT4-style domain semantics, it makes little sense to compare Samba with Microsoft Active Directory insofar as the logon protocols and principles of operation are concerned. The following information pertains exclusively to the interaction between a Windows XP Professional workstation and a Samba-3.0.20 server. In the discussion that follows, use is made of DHCP and WINS.

As soon as the Windows workstation starts up, it obtains an IP address. This is immediately followed by registration of its name both by broadcast and Unicast registration that is directed at the WINS server.

\index{Unicast} \index{broadcast!directed}\index{NetBIOS} Given that the client is already a domain member, it then sends a directed (Unicast) request to the WINS server seeking the list of IP addresses for domain controllers (NetBIOS name type 0x1C). The WINS server replies with the information requested.

\index{broadcast!mailslot} \index{Unicast} \index{WINS} The client sends two netlogon mailslot broadcast requests to the local network and to each of the IP addresses returned by the WINS server. Whichever answers this request first appears to be the machine that the Windows XP client attempts to use to process the network logon. The mailslot messages use UDP broadcast to the local network and UDP Unicast directed at each machine that was listed in the WINS server response to a request for the list of domain controllers.

\index{protocol!negotiation} \index{logon server} \index{fail} The logon process begins with negotiation of the SMB/CIFS protocols that are to be used; this is followed by an exchange of information that ultimately includes the client sending the credentials with which the user is attempting to logon. The logon server must now approve the further establishment of the connection, but that is a good point to halt for now. The priority here must center around identification of network infrastructure needs. A secondary fact we need to know is, what happens when local domain controllers fail or break?

\index{Domain Controller} \index{PDC} \index{BDC} \index{netlogon} Under most circumstances, the nearest domain controller responds to the netlogon mailslot broadcast. The exception to this norm occurs when the nearest domain controller is too busy or is out of service. Herein lies an important fact. This means it is important that every network segment should have at least two domain controllers. Since there can be only one PDC, all additional domain controllers are by definition BDCs.

\index{authentication} \index{Identity Management} The provision of sufficient servers that are BDCs is an important design factor. The second important design factor involves how each of the BDCs obtains user authentication data. That is the subject of the next section, which involves key decisions regarding Identity Management facilities.
\subsubsection{Identity Management Needs}
\label{id2492153}\hypertarget{id2492153}{}%

\index{privacy} \index{user credentials} \index{validated} \index{privileges} Network managers recognize that in large organizations users generally need to be given resource access based on needs, while being excluded from other resources for reasons of privacy. It is therefore essential that all users identify themselves at the point of network access. The network logon is the principal means by which user credentials are validated and filtered and appropriate rights and privileges are allocated.

\index{Identity Management} \index{Yellow Pages} \index{NIS} Unfortunately, network resources tend to have their own Identity Management facilities, the quality and manageability of which varies from quite poor to exceptionally good. Corporations that use a mixture of systems soon discover that until recently, few systems were designed to interoperate. For example, UNIX systems each have an independent user database. Sun Microsystems developed a facility that was originally called {\texttt{\docbookhyphenatedot{Yellow Pages}}}, and was renamed when a telephone company objected to the use of its trademark. What was once called {\texttt{\docbookhyphenatedot{Yellow Pages}}} is today known as {\texttt{\docbookhyphenatedot{Network Information System}}} (NIS).

\index{NIS+} NIS gained a strong following throughout the UNIX/VMS space in a short period of time and retained that appeal and use for over a decade. Security concerns and inherent limitations have caused it to enter its twilight. NIS did not gain widespread appeal outside of the UNIX world and was not universally adopted. Sun updated this to a more secure implementation called NIS+, but even it has fallen victim to changing demands as the demand for directory services that can be coupled with other information systems is catching on.

\index{NIS} \index{government} \index{education} Nevertheless, both NIS and NIS+ continue to hold ground in business areas where UNIX still has major sway. Examples of organizations that remain firmly attached to the use of NIS and NIS+ include large government departments, education institutions, and large corporations that have a scientific or engineering focus.

\index{scalable} \index{distributed} Today's networking world needs a scalable, distributed Identity Management infrastructure, commonly called a directory. The most popular technologies today are Microsoft Active Directory service and a number of LDAP implementations.

\index{multiple directories} The problem of managing multiple directories has become a focal point over the past decade, creating a large market for metadirectory products and services that allow organizations that have multiple directories and multiple management and control centers to provision information from one directory into another. The attendant benefit to end users is the promise of having to remember and deal with fewer login identities and passwords.

\index{network!bandwidth} The challenge of every large network is to find the optimum balance of internal systems and facilities for Identity Management resources. How well the solution is chosen and implemented has potentially significant impact on network bandwidth and systems response needs.

\index{LDAP server} \index{LDAP!master} \index{LDAP!slave} In \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}}, you implemented a single LDAP server for the entire network. This may work for smaller networks, but almost certainly fails to meet the needs of large and complex networks. The following section documents how you may implement a single master LDAP server with multiple slave servers.

What is the best method for implementing master/slave LDAP servers within the context of a distributed 2,000-user network is a question that remains to be answered.

\index{distributed domain} \index{wide-area} One possibility that has great appeal is to create a single, large distributed domain. The practical implications of this design (see \hyperlink{chap7net}{Figure {\ref{chap7net}}}) demands the placement of sufficient BDCs in each location. Additionally, network administrators must make sure that profiles are not transferred over the wide-area links, except as a totally unavoidable measure. Network design must balance the risk of loss of user productivity against the cost of network management and maintenance.

\index{domain name space} The network design in \hyperlink{chap7net2}{Figure {\ref{chap7net2}}} takes the approach that management of networks that are too remote to be managed effectively from New York ought to be given a certain degree of autonomy. With this rationale, the Los Angeles and London networks, though fully integrated with those on the East Coast, each have their own domain name space and can be independently managed and controlled. One of the key drawbacks of this design is that it flies in the face of the ability for network users to roam globally without some compromise in how they may access global resources.

\index{interdomain trusts} Desk-bound users need not be negatively affected by this design, since the use of interdomain trusts can be used to satisfy the need for global data sharing.

\index{LDAP} \index{LDAP!backend} \index{SID} When Samba-3 is configured to use an LDAP backend, it stores the domain account information in a directory entry. This account entry contains the domain SID. An unintended but exploitable side effect is that this makes it possible to operate with more than one PDC on a distributed network.

\index{WINS} \index{wins.dat} \index{SID} How might this peculiar feature be exploited? The answer is simple. It is imperative that each network segment have its own WINS server. Major servers on remote network segments can be given a static WINS entry in the {\texttt{\docbookhyphenatefilename{wins.\dbz{}dat}}} file on each WINS server. This allows all essential data to be visible from all locations. Each location would, however, function as if it is an independent domain, while all sharing the same domain SID. Since all domain account information can be stored in a single LDAP backend, users have unfettered ability to roam.

\index{NetBIOS name!aliases} \index{fail-over} This concept has not been exhaustively validated, though we can see no reason why this should not work. The important facets are the following: The name of the domain must be identical in all locations. Each network segment must have its own WINS server. The name of the PDC must be the same in all locations; this necessitates the use of NetBIOS name aliases for each PDC so that they can be accessed globally using the alias and not the PDC's primary name. A single master LDAP server can be based in New York, with multiple LDAP slave servers located on every network segment. Finally, the BDCs should each use failover LDAP servers that are in fact slave LDAP servers on the local segments.

\index{LDAP!updates} \index{domain tree} \index{LDAP!database} \index{LDAP!directory} With a single master LDAP server, all network updates are effected on a single server. In the event that this should become excessively fragile or network bandwidth limiting, one could implement a delegated LDAP domain. This is also known as a partitioned (or multiple partition) LDAP database and as a distributed LDAP directory.

As the LDAP directory grows, it becomes increasingly important that its structure is implemented in a manner that mirrors organizational needs, so as to limit network update and referential traffic. It should be noted that all directory administrators must of necessity follow the same standard procedures for managing the directory, because retroactive correction of inconsistent directory information can be exceedingly difficult.
\subsection{Political Issues}
\label{id2493251}\hypertarget{id2493251}{}%

As organizations grow, the number of points of control increases also. In a large distributed organization, it is important that the Identity Management system be capable of being updated from many locations, and it is equally important that changes made should become usable in a reasonable period, typically minutes rather than days (the old limitation of highly manual systems).

% ------------------------   
% Section 
\section{Implementation}
\label{id2493270}\hypertarget{id2493270}{}%

\index{winbind} \index{LDAP} \index{UID} \index{GID} Samba-3 has the ability to use multiple password (authentication and identity resolution) backends. The diagram in \hyperlink{chap7idres}{Figure {\ref{chap7idres}}} demonstrates how Samba uses winbind, LDAP, and NIS, the traditional system password database. The diagram only documents the mechanisms for authentication and identity resolution (obtaining a UNIX UID/GID) using the specific systems shown.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{chap7idres}{}%
\includegraphics[scale=0.55]{Samba3-ByExample/images/chap7-idresol}
{{\caption[{Samba and Authentication Backend Search Pathways}]{{{Samba and Authentication Backend Search Pathways}}}\label{chap7idres}}}
\end{center}
\end{figure}


\index{smbpasswd} \index{xmlsam} \index{SMB passwords} \index{tdbsam} \index{mysqlsam} \index{LDAP} \index{distributed} Samba is capable of using the {\texttt{\docbookhyphenatedot{smbpasswd}}}, {\texttt{\docbookhyphenatedot{tdbsam}}}, {\texttt{\docbookhyphenatedot{xmlsam}}}, and {\texttt{\docbookhyphenatedot{mysqlsam}}} authentication databases. The SMB passwords can, of course, also be stored in an LDAP ldapsam backend. LDAP is the preferred passdb backend for distributed network operations.

\index{passdb backend} Additionally, it is possible to use multiple passdb backends concurrently as well as have multiple LDAP backends. As a result, you can specify a failover LDAP backend. The syntax for specifying a single LDAP backend in {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} is: 
\begin{Verbatim}[]

...
passdb backend = ldapsam:ldap://master.abmas.biz
...

\end{Verbatim}
 This configuration tells Samba to use a single LDAP server, as shown in \hyperlink{ch7singleLDAP}{Figure {\ref{ch7singleLDAP}}}. 
% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{ch7singleLDAP}{}%
\includegraphics[scale=0.65]{Samba3-ByExample/images/ch7-singleLDAP}
{{\caption[{Samba Configuration to Use a Single LDAP Server}]{{{Samba Configuration to Use a Single LDAP Server}}}\label{ch7singleLDAP}}}
\end{center}
\end{figure}

 \index{LDAP!fail-over} \index{fail-over} The addition of a failover LDAP server can simply be done by adding a second entry for the failover server to the single {\ttfamily\itshape{\docbookhyphenatedot{ldapsam}}} entry, as shown here (note the particular use of the double quotes): 
\begin{Verbatim}[]

...
passdb backend = ldapsam:"ldap://master.abmas.biz \
	                  ldap://slave.abmas.biz"
...

\end{Verbatim}
 This configuration tells Samba to use a master LDAP server, with failover to a slave server if necessary, as shown in \hyperlink{ch7dualLDAP}{Figure {\ref{ch7dualLDAP}}}. 
% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{ch7dualLDAP}{}%
\includegraphics[scale=0.65]{Samba3-ByExample/images/ch7-fail-overLDAP}
{{\caption[{Samba Configuration to Use a Dual (Fail-over) LDAP Server}]{{{Samba Configuration to Use a Dual (Fail-over) LDAP Server}}}\label{ch7dualLDAP}}}
\end{center}
\end{figure}



Some folks have tried to implement this without the use of double quotes. This is the type of entry they created: 
\begin{Verbatim}[]

...
passdb backend = ldapsam:ldap://master.abmas.biz \
                 ldapsam:ldap://slave.abmas.biz
...

\end{Verbatim}
 \index{contiguous directory} The effect of this style of entry is that Samba lists the users that are in both LDAP databases. If both contain the same information, it results in each record being shown twice. This is, of course, not the solution desired for a failover implementation. The net effect of this configuration is shown in \hyperlink{ch7dualadd}{Figure {\ref{ch7dualadd}}}

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{ch7dualadd}{}%
\includegraphics[scale=0.55]{Samba3-ByExample/images/ch7-dual-additive-LDAP}
{{\caption[{Samba Configuration to Use Dual LDAP Databases - Broken - Do Not Use!}]{{{Samba Configuration to Use Dual LDAP Databases - Broken - Do Not Use!}}}\label{ch7dualadd}}}
\end{center}
\end{figure}


If, however, each LDAP database contains unique information, this may well be an advantageous way to effectively integrate multiple LDAP databases into one seemingly contiguous directory. Only the first database will be updated. An example of this configuration is shown in \hyperlink{ch7dualok}{Figure {\ref{ch7dualok}}}.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{ch7dualok}{}%
\includegraphics[scale=0.55]{Samba3-ByExample/images/ch7-dual-additive-LDAP-Ok}
{{\caption[{Samba Configuration to Use Two LDAP Databases - The result is additive.}]{{{Samba Configuration to Use Two LDAP Databases - The result is additive.}}}\label{ch7dualok}}}
\end{center}
\end{figure}


\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

When the use of ldapsam is specified twice, as shown here, it is imperative that the two LDAP directories must be disjoint. If the entries are for a master LDAP server as well as its own slave server, updates to the LDAP database may end up being lost or corrupted. You may safely use multiple LDAP backends only if both are entirely separate from each other.
\end{admonition}


It is assumed that the network you are working with follows in a pattern similar to what was covered in \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}}. The following steps permit the operation of a master/slave OpenLDAP arrangement.
Implementation Steps for an LDAP Slave Server\begin{enumerate}

\item{\index{SUSE Linux} \index{Red Hat Linux} Log onto the master LDAP server as {\texttt{\docbookhyphenatedot{root}}}. You are about to change the configuration of the LDAP server, so it makes sense to temporarily halt it. Stop OpenLDAP from running on SUSE Linux by executing: 
\begin{Verbatim}[]

root#  rcldap stop

\end{Verbatim}
 On Red Hat Linux, you can do this by executing: 
\begin{Verbatim}[]

root#  service ldap stop

\end{Verbatim}
}

\item{\index{/etc/openldap/slapd.conf} Edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap/\dbz{}slapd.\dbz{}conf}}} file so it matches the content of \hyperlink{ch7-LDAP-master}{Example {\ref{ch7-LDAP-master}}}.}

\item{Create a file called {\texttt{\docbookhyphenatefilename{admin-\dbz{}accts.\dbz{}ldif}}} with the following contents: 
\begin{Verbatim}[]

dn: cn=updateuser,dc=abmas,dc=biz
objectClass: person
cn: updateuser
sn: updateuser
userPassword: not24get

dn: cn=sambaadmin,dc=abmas,dc=biz
objectClass: person
cn: sambaadmin
sn: sambaadmin
userPassword: buttercup

\end{Verbatim}
}

\item{Add an account called {``}updateuser{''} to the master LDAP server as shown here: 
\begin{Verbatim}[]

root#  slapadd -v -l admin-accts.ldif

\end{Verbatim}
}

\item{\index{LDIF} \index{LDAP!preload} Change directory to a suitable place to dump the contents of the LDAP server. The dump file (and LDIF file) is used to preload the slave LDAP server database. You can dump the database by executing: 
\begin{Verbatim}[]

root#  slapcat -v -l LDAP-transfer-LDIF.txt

\end{Verbatim}
 Each record is written to the file.}

\item{\index{LDAP-transfer-LDIF.txt} Copy the file {\texttt{\docbookhyphenatefilename{LDAP-\dbz{}transfer-\dbz{}LDIF.\dbz{}txt}}} to the intended slave LDAP server. A good location could be in the directory {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap/\dbz{}preload}}}.}

\item{Log onto the slave LDAP server as {\texttt{\docbookhyphenatedot{root}}}. You can now configure this server so the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap/\dbz{}slapd.\dbz{}conf}}} file matches the content of \hyperlink{ch7-LDAP-slave}{Example {\ref{ch7-LDAP-slave}}}.}

\item{Change directory to the location in which you stored the {\texttt{\docbookhyphenatefilename{LDAP-\dbz{}transfer-\dbz{}LDIF.\dbz{}txt}}} file ({\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap/\dbz{}preload}}}). While in this directory, execute: 
\begin{Verbatim}[]

root#  slapadd -v -l LDAP-transfer-LDIF.txt

\end{Verbatim}
 If all goes well, the following output confirms that the data is being loaded as intended: 
\begin{Verbatim}[]

added: "dc=abmas,dc=biz" (00000001)
added: "cn=sambaadmin,dc=abmas,dc=biz" (00000002)
added: "cn=updateuser,dc=abmas,dc=biz" (00000003)
added: "ou=People,dc=abmas,dc=biz" (00000004)
added: "ou=Groups,dc=abmas,dc=biz" (00000005)
added: "ou=Computers,dc=abmas,dc=biz" (00000006)
added: "uid=Administrator,ou=People,dc=abmas,dc=biz" (00000007)
added: "uid=nobody,ou=People,dc=abmas,dc=biz" (00000008)
added: "cn=Domain Admins,ou=Groups,dc=abmas,dc=biz" (00000009)
added: "cn=Domain Users,ou=Groups,dc=abmas,dc=biz" (0000000a)
added: "cn=Domain Guests,ou=Groups,dc=abmas,dc=biz" (0000000b)
added: "uid=bobj,ou=People,dc=abmas,dc=biz" (0000000c)
added: "sambaDomainName=MEGANET2,dc=abmas,dc=biz" (0000000d)
added: "uid=stans,ou=People,dc=abmas,dc=biz" (0000000e)
added: "uid=chrisr,ou=People,dc=abmas,dc=biz" (0000000f)
added: "uid=maryv,ou=People,dc=abmas,dc=biz" (00000010)
added: "cn=Accounts,ou=Groups,dc=abmas,dc=biz" (00000011)
added: "cn=Finances,ou=Groups,dc=abmas,dc=biz" (00000012)
added: "cn=PIOps,ou=Groups,dc=abmas,dc=biz" (00000013)

\end{Verbatim}
}

\item{Now start the LDAP server and set it to run automatically on system reboot by executing: 
\begin{Verbatim}[]

root#  rcldap start
root#  chkconfig ldap on

\end{Verbatim}
 On Red Hat Linux, execute the following: 
\begin{Verbatim}[]

root#  service ldap start
root#  chkconfig ldap on

\end{Verbatim}
}

\item{\index{chkconfig} \index{service} \index{rcldap} Go back to the master LDAP server. Execute the following to start LDAP as well as {\bfseries{slurpd}}, the synchronization daemon, as shown here: 
\begin{Verbatim}[]

root#  rcldap start
root#  chkconfig ldap on
root#  rcslurpd start
root#  chkconfig slurpd on

\end{Verbatim}
 \index{slurpd} On Red Hat Linux, check the equivalent command to start {\bfseries{slurpd}}.}

\item{\index{smbldap-useradd} On the master LDAP server you may now add an account to validate that replication is working. Assuming the configuration shown in \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}}, execute: 
\begin{Verbatim}[]

root#  /var/lib/samba/sbin/smbldap-useradd -a fruitloop

\end{Verbatim}
}

\item{On the slave LDAP server, change to the directory {\texttt{\docbookhyphenatefilename{/\dbz{}var/\dbz{}lib/\dbz{}ldap}}}. There should now be a file called {\texttt{\docbookhyphenatefilename{replogfile}}}. If replication worked as expected, the content of this file should be: 
\begin{Verbatim}[]

time: 1072486403
dn: uid=fruitloop,ou=People,dc=abmas,dc=biz
changetype: modify
replace: sambaProfilePath
sambaProfilePath: \\MASSIVE\profiles\fruitloop
-
replace: sambaHomePath
sambaHomePath: \\MASSIVE\homes
-
replace: entryCSN
entryCSN: 2003122700:43:38Z#0x0005#0#0000
-
replace: modifiersName
modifiersName: cn=Manager,dc=abmas,dc=biz
-
replace: modifyTimestamp
modifyTimestamp: 20031227004338Z
-

\end{Verbatim}
}

\item{Given that this first slave LDAP server is now working correctly, you may now implement additional slave LDAP servers as required.}

\item{On each machine (PDC and BDCs) after the respective {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} files have been created as shown in \hyperlink{ch7-massmbconfA}{Example {\ref{ch7-massmbconfA}}} and on BDCs the \hyperlink{ch7-slvsmbocnfA}{Example {\ref{ch7-slvsmbocnfA}}} execute the following: 
\begin{Verbatim}[]

root#  smbpasswd -w buttercup

\end{Verbatim}
 This will install in the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file the password that Samba will need to manage (write to) the LDAP Master server to perform account updates.}
\end{enumerate}

\begin{example}%
\hypertarget{ch7-LDAP-master}{}%
\captionswapskip{}{{\caption{LDAP Master Server Configuration File ---  /\dbz{}etc/\dbz{}openldap/\dbz{}slapd.\dbz{}conf}\label{ch7-LDAP-master}}}
\captionswapskip{}
\begin{Verbatim}[]

include     /etc/openldap/schema/core.schema
include     /etc/openldap/schema/cosine.schema
include     /etc/openldap/schema/inetorgperson.schema
include     /etc/openldap/schema/nis.schema
include     /etc/openldap/schema/samba.schema

pidfile     /var/run/slapd/slapd.pid
argsfile    /var/run/slapd/slapd.args

database    bdb
suffix      "dc=abmas,dc=biz"
rootdn      "cn=Manager,dc=abmas,dc=biz"

# rootpw = not24get
rootpw      {SSHA}86kTavd9Dw3FAz6qzWTrCOKX/c0Qe+UV

replica     host=lapdc.abmas.biz:389
            suffix="dc=abmas,dc=biz"
            binddn="cn=updateuser,dc=abmas,dc=biz"
            bindmethod=simple credentials=not24get

access to attrs=sambaLMPassword,sambaNTPassword
           by dn="cn=sambaadmin,dc=abmas,dc=biz" write
           by * none

replogfile  /var/lib/ldap/replogfile

directory   /var/lib/ldap

# Indices to maintain
index objectClass           eq
index cn                    pres,sub,eq
index sn                    pres,sub,eq
index uid                   pres,sub,eq
index displayName           pres,sub,eq
index uidNumber             eq
index gidNumber             eq
index memberUID             eq
index sambaSID              eq
index sambaPrimaryGroupSID  eq
index sambaDomainName       eq
index default               sub

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{ch7-LDAP-slave}{}%
\captionswapskip{}{{\caption{LDAP Slave Configuration File ---  /\dbz{}etc/\dbz{}openldap/\dbz{}slapd.\dbz{}conf}\label{ch7-LDAP-slave}}}
\captionswapskip{}
\begin{Verbatim}[]

include     /etc/openldap/schema/core.schema
include     /etc/openldap/schema/cosine.schema
include     /etc/openldap/schema/inetorgperson.schema
include     /etc/openldap/schema/nis.schema
include     /etc/openldap/schema/samba.schema

pidfile     /var/run/slapd/slapd.pid
argsfile    /var/run/slapd/slapd.args

database    bdb
suffix      "dc=abmas,dc=biz"
rootdn      "cn=Manager,dc=abmas,dc=biz"

# rootpw = not24get
rootpw      {SSHA}86kTavd9Dw3FAz6qzWTrCOKX/c0Qe+UV

access to *
            by dn=cn=updateuser,dc=abmas,dc=biz write
            by * read

updatedn    cn=updateuser,dc=abmas,dc=biz
updateref   ldap://massive.abmas.biz

directory   /var/lib/ldap

# Indices to maintain
index objectClass           eq
index cn                    pres,sub,eq
index sn                    pres,sub,eq
index uid                   pres,sub,eq
index displayName           pres,sub,eq
index uidNumber             eq
index gidNumber             eq
index memberUID             eq
index sambaSID              eq
index sambaPrimaryGroupSID  eq
index sambaDomainName       eq
index default               sub

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{ch7-massmbconfA}{}%
\captionswapskip{}{{\caption{Primary Domain Controller smb.\dbz{}conf File ---  Part A}\label{ch7-massmbconfA}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	unix charset = LOCALE
 	workgroup = MEGANET2
 	passdb backend = ldapsam:ldap://massive.abmas.biz
 	username map = /etc/samba/smbusers
 	log level = 1
 	syslog = 0
 	log file = /var/log/samba/%m
 	max log size = 0
 	smb ports = 139
 	name resolve order = wins bcast hosts
 	time server = Yes
 	printcap name = CUPS
 	add user script = /opt/IDEALX/sbin/smbldap-useradd -m '%u'
 	delete user script = /opt/IDEALX/sbin/smbldap-userdel '%u'
 	add group script = /opt/IDEALX/sbin/smbldap-groupadd -p '%g'
 	delete group script = /opt/IDEALX/sbin/smbldap-groupdel '%g'
 	add user to group script = /opt/IDEALX/sbin/smbldap-groupmod -m '%g' '%u'
 	delete user from group script = /opt/IDEALX/sbin/smbldap-groupmod -x '%g' '%u'
 	set primary group script = /opt/IDEALX/sbin/smbldap-usermod -g '%g' '%u'
 	add machine script = /opt/IDEALX/sbin/smbldap-useradd -w '%u'
 	shutdown script = /var/lib/samba/scripts/shutdown.sh
 	abort shutdown script = /sbin/shutdown -c
 	logon script = scripts\logon.bat
 	logon path = \\%L\profiles\%U
 	logon drive = X:
 	domain logons = Yes
 	domain master = Yes
 	wins support = Yes
 	ldap suffix = dc=abmas,dc=biz
 	ldap machine suffix = ou=People
 	ldap user suffix = ou=People
 	ldap group suffix = ou=Groups
 	ldap idmap suffix = ou=Idmap
 	ldap admin dn = cn=sambaadmin,dc=abmas,dc=biz
 	idmap backend = ldap://massive.abmas.biz
 	idmap uid = 10000-20000
 	idmap gid = 10000-20000
 	printer admin = root
 	printing = cups
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch7-massmbconfB}{}%
\captionswapskip{}{{\caption{Primary Domain Controller smb.\dbz{}conf File ---  Part B}\label{ch7-massmbconfB}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[IPC$]
 	path = /tmp
 [accounts]
 	comment = Accounting Files
 	path = /data/accounts
 	read only = No
 [service]
 	comment = Financial Services Files
 	path = /data/service
 	read only = No
 [pidata]
 	comment = Property Insurance Files
 	path = /data/pidata
 	read only = No
 [homes]
 	comment = Home Directories
 	valid users = %S
 	read only = No
 	browseable = No
 [printers]
 	comment = SMB Print Spool
 	path = /var/spool/samba
 	guest ok = Yes
 	printable = Yes
 	browseable = No
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch7-massmbconfC}{}%
\captionswapskip{}{{\caption{Primary Domain Controller smb.\dbz{}conf File ---  Part C}\label{ch7-massmbconfC}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[apps]
 	comment = Application Files
 	path = /apps
 	admin users = bjones
 	read only = No
 [netlogon]
 	comment = Network Logon Service
 	path = /var/lib/samba/netlogon
 	admin users = root, Administrator
 	guest ok = Yes
 	locking = No
 [profiles]
 	comment = Profile Share
 	path = /var/lib/samba/profiles
 	read only = No
 	profile acls = Yes
 [profdata]
 	comment = Profile Data Share
 	path = /var/lib/samba/profdata
 	read only = No
 	profile acls = Yes
 [print$]
 	comment = Printer Drivers
 	path = /var/lib/samba/drivers
 	write list = root
 	admin users = root, Administrator
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch7-slvsmbocnfA}{}%
\captionswapskip{}{{\caption{Backup Domain Controller smb.\dbz{}conf File ---  Part A}\label{ch7-slvsmbocnfA}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# \# Global parameters
 [global]
 	unix charset = LOCALE
 	workgroup = MEGANET2
 	netbios name = BLDG1
 	passdb backend = ldapsam:ldap://lapdc.abmas.biz
 	username map = /etc/samba/smbusers
 	log level = 1
 	syslog = 0
 	log file = /var/log/samba/%m
 	max log size = 50
 	smb ports = 139
 	name resolve order = wins bcast hosts
 	printcap name = CUPS
 	show add printer wizard = No
 	logon script = scripts\logon.bat
 	logon path = \\%L\profiles\%U
 	logon drive = X:
 	domain logons = Yes
 	os level = 63
 	domain master = No
 	wins server = 192.168.2.1
 	ldap suffix = dc=abmas,dc=biz
 	ldap machine suffix = ou=People
 	ldap user suffix = ou=People
 	ldap group suffix = ou=Groups
 	ldap idmap suffix = ou=Idmap
 	ldap admin dn = cn=sambaadmin,dc=abmas,dc=biz
 	utmp = Yes
 	idmap backend = ldap://massive.abmas.biz
 	idmap uid = 10000-20000
 	idmap gid = 10000-20000
 	printing = cups
 [accounts]
 	comment = Accounting Files
 	path = /data/accounts
 	read only = No
 [service]
 	comment = Financial Services Files
 	path = /data/service
 	read only = No
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch7-slvsmbocnfB}{}%
\captionswapskip{}{{\caption{Backup Domain Controller smb.\dbz{}conf File ---  Part B}\label{ch7-slvsmbocnfB}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[pidata]
 	comment = Property Insurance Files
 	path = /data/pidata
 	read only = No
 [homes]
 	comment = Home Directories
 	valid users = %S
 	read only = No
 	browseable = No
 [printers]
 	comment = SMB Print Spool
 	path = /var/spool/samba
 	guest ok = Yes
 	printable = Yes
 	browseable = No
 [apps]
 	comment = Application Files
 	path = /apps
 	admin users = bjones
 	read only = No
 [netlogon]
 	comment = Network Logon Service
 	path = /var/lib/samba/netlogon
 	guest ok = Yes
 	locking = No
 [profiles]
 	comment = Profile Share
 	path = /var/lib/samba/profiles
 	read only = No
 	profile acls = Yes
 [profdata]
 	comment = Profile Data Share
 	path = /var/lib/samba/profdata
 	read only = No
 	profile acls = Yes
\end{lstlisting}
\end{example}

\subsection{Key Points Learned}
\label{id2504684}\hypertarget{id2504684}{}%

\begin{itemize}
%--- Item
\item 
\index{LDAP}\index{BDC} Where Samba-3 is used as a domain controller, the use of LDAP is an essential component to permit the use of BDCs.


%--- Item
\item 
\index{wide-area} Replication of the LDAP master server to create a network of BDCs is an important mechanism for limiting WAN traffic.


%--- Item
\item 
Network administration presents many complex challenges, most of which can be satisfied by good design but that also require sound communication and unification of management practices. This can be highly challenging in a large, globally distributed network.


%--- Item
\item 
Roaming profiles must be contained to the local network segment. Any departure from this may clog wide-area arteries and slow legitimate network traffic to a crawl.

\end{itemize}

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{chap7net}{}%
\includegraphics[scale=0.8]{Samba3-ByExample/images/chap7-net-Ar}
{{\caption[{Network Topology ---  2000 User Complex Design A}]{{{Network Topology ---  2000 User Complex Design A}}}\label{chap7net}}}
\end{center}
\end{figure}


% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{chap7net2}{}%
\includegraphics[scale=0.8]{Samba3-ByExample/images/chap7-net2-Br}
{{\caption[{Network Topology ---  2000 User Complex Design B}]{{{Network Topology ---  2000 User Complex Design B}}}\label{chap7net2}}}
\end{center}
\end{figure}


% ------------------------   
% Section 
\section{Questions and Answers}
\label{id2504788}\hypertarget{id2504788}{}%

There is much rumor and misinformation regarding the use of MS Windows networking protocols. These questions are just a few of those frequently asked.
% -------------------------------------------------------------
% QandASet                                                     
% -------------------------------------------------------------
\subsection*{F.A.Q.}
\label{id2504800}
\vspace{1em}
\noindent{}1.~\textbf{Q:}~\textit{\index{DHCP} \index{network!bandwidth} Is it true that DHCP uses lots of WAN bandwidth?}
\newline
\noindent\textbf{A:}~
\index{DHCP!Relay Agent} \index{routers} \index{DHCP!servers} It is a smart practice to localize DHCP servers on each network segment. As a rule, there should be two DHCP servers per network segment. This means that if one server fails, there is always another to service user needs. DHCP requests use only UDP broadcast protocols. It is possible to run a DHCP Relay Agent on network routers. This makes it possible to run fewer DHCP servers.

\index{DHCP!request} \index{DHCP!traffic} A DHCP network address request and confirmation usually results in about six UDP packets. The packets are from 60 to 568 bytes in length. Let us consider a site that has 300 DHCP clients and that uses a 24-hour IP address lease. This means that all clients renew their IP address lease every 24 hours. If we assume an average packet length equal to the maximum (just to be on the safe side), and we have a 128 Kb/sec wide-area connection, how significant would the DHCP traffic be if all of it were to use DHCP Relay?

I must stress that this is a bad design, but here is the calculation: 
\begin{Verbatim}[]

Daily Network Capacity: 128,000 (Kbits/s) / 8 (bits/byte) 
                             x 3600 (sec/hr) x 24 (hrs/day)= 2288 Mbytes/day.

DHCP traffic:          300 (clients) x 6 (packets) 
                                       x 512 (bytes/packet) = 0.9 Mbytes/day.

\end{Verbatim}
 From this can be seen that the traffic impact would be minimal.

\index{DNS!Dynamic} \index{DHCP} Even when DHCP is configured to do DNS update (dynamic DNS) over a wide-area link, the impact of the update is no more than the DHCP IP address renewal traffic and thus still insignificant for most practical purposes.


\vspace{1em}
\vspace{1em}
\noindent{}2.~\textbf{Q:}~\textit{\index{background communication} \index{LDAP!master/slave!background communication} How much background communication takes place between a master LDAP server and its slave LDAP servers?}
\newline
\noindent\textbf{A:}~
\index{slurpd} The process that controls the replication of data from the master LDAP server to the slave LDAP servers is called {\bfseries{slurpd}}. The {\bfseries{slurpd}} remains nascent (quiet) until an update must be propagated. The propagation traffic per LDAP slave to update (add/modify/delete) two user accounts requires less than 10KB traffic.


\vspace{1em}
\vspace{1em}
\noindent{}3.~\textbf{Q:}~\textit{LDAP has a database. Is LDAP not just a fancy database front end?}
\newline
\noindent\textbf{A:}~
\index{database} \index{LDAP!database} \index{SQL} \index{transactional} LDAP does store its data in a database of sorts. In fact, the LDAP backend is an application-specific data storage system. This type of database is indexed so that records can be rapidly located, but the database is not generic and can be used only in particular pre-programmed ways. General external applications do not gain access to the data. This type of database is used also by SQL servers. Both an SQL server and an LDAP server provide ways to access the data. An SQL server has a transactional orientation and typically allows external programs to perform ad hoc queries, even across data tables. An LDAP front end is a purpose-built tool that has a search orientation that is designed around specific simple queries. The term {\texttt{\docbookhyphenatedot{database}}} is heavily overloaded and thus much misunderstood.


\vspace{1em}
\vspace{1em}
\noindent{}4.~\textbf{Q:}~\textit{\index{OpenLDAP} Can Active Directory obtain account information from an OpenLDAP server?}
\newline
\noindent\textbf{A:}~
\index{meta-directory} No, at least not directly. It is possible to provision Active Directory from and/or to an OpenLDAP database through use of a metadirectory server. Microsoft MMS (now called MIIS) can interface to OpenLDAP using standard LDAP queries and updates.


\vspace{1em}
\vspace{1em}
\noindent{}5.~\textbf{Q:}~\textit{What are the parts of a roaming profile? How large is each part?}
\newline
\noindent\textbf{A:}~
\index{roaming profile} A roaming profile consists of

\begin{itemize}
%--- Item
\item 
Desktop folders such as {\texttt{\docbookhyphenatedot{Desktop}}}, {\texttt{\docbookhyphenatedot{My Documents}}}, {\texttt{\docbookhyphenatedot{My Pictures}}}, {\texttt{\docbookhyphenatedot{My Music}}}, {\texttt{\docbookhyphenatedot{Internet Files}}}, {\texttt{\docbookhyphenatedot{Cookies}}}, {\texttt{\docbookhyphenatedot{Application Data}}}, {\texttt{\docbookhyphenatedot{Local Settings,}}} and more. See \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}}, \hyperlink{XP-screen001}{Figure {\ref{XP-screen001}}}.

\index{folder redirection} Each of these can be anywhere from a few bytes to gigabytes in capacity. Fortunately, all such folders can be redirected to network drive resources. See \hyperlink{redirfold}{Section {\ref{redirfold}}} for more information regarding folder redirection.


%--- Item
\item 
A static or rewritable portion that is typically only a few files (2-5 KB of information).


%--- Item
\item 
\index{NTUSER.DAT} \index{HKEY\_LOCAL\_USER} The registry load file that modifies the {\texttt{\docbookhyphenatedot{HKEY\_LOCAL\_USER}}} hive. This is the {\texttt{\docbookhyphenatefilename{NTUSER.\dbz{}DAT}}} file. It can be from 0.4 to 1.5 MB.

\end{itemize}

\index{Microsoft Outlook!PST files} Microsoft Outlook PST files may be stored in the {\texttt{\docbookhyphenatedot{Local Settings\textbackslash Application Data}}} folder. It can be up to 2 GB in size per PST file.


\vspace{1em}
\vspace{1em}
\noindent{}6.~\textbf{Q:}~\textit{Can the {\texttt{\docbookhyphenatedot{My Documents}}} folder be stored on a network drive?}
\newline
\noindent\textbf{A:}~
\index{UNC name} \index{Universal Naming Convention|textit{see} {UNC name} } Yes. More correctly, such folders can be redirected to network shares. No specific network drive connection is required. Registry settings permit this to be redirected directly to a UNC (Universal Naming Convention) resource, though it is possible to specify a network drive letter instead of a UNC name. See \hyperlink{redirfold}{Section {\ref{redirfold}}}.


\vspace{1em}
\vspace{1em}
\noindent{}7.~\textbf{Q:}~\textit{\index{wide-area} \index{network!bandwidth} \index{WINS} How much WAN bandwidth does WINS consume?}
\newline
\noindent\textbf{A:}~
\index{NetBIOS!name cache} \index{WINS server} \index{domain replication} MS Windows clients cache information obtained from WINS lookups in a local NetBIOS name cache. This keeps WINS lookups to a minimum. On a network with 3500 MS Windows clients and a central WINS server, the total bandwidth demand measured at the WINS server, averaged over an 8-hour working day, was less than 30 KB/sec. Analysis of network traffic over a 6-week period showed that the total of all background traffic consumed about 11 percent of available bandwidth over 64 Kb/sec links. Background traffic consisted of domain replication, WINS queries, DNS lookups, and authentication traffic. Each of 11 branch offices had a 64 Kb/sec wide-area link, with a 1.5 Mb/sec main connection that aggregated the branch office connections plus an Internet connection.

In conclusion, the total load afforded through WINS traffic is again marginal to total operational usage ---  as it should be.


\vspace{1em}
\vspace{1em}
\noindent{}8.~\textbf{Q:}~\textit{How many BDCs should I have? What is the right number of Windows clients per server?}
\newline
\noindent\textbf{A:}~
It is recommended to have at least one BDC per network segment, including the segment served by the PDC. Actual requirements vary depending on the working load on each of the BDCs and the load demand pattern of client usage. I have seen sites that function without problem with 200 clients served by one BDC, and yet other sites that had one BDC per 20 clients. In one particular company, there was a drafting office that had 30 CAD/CAM operators served by one server, a print server; and an application server. While all three were BDCs, typically only the print server would service network logon requests after the first 10 users had started to use the network. This was a reflection of the service load placed on both the application server and the data server.

As unsatisfactory as the answer might sound, it all depends on network and server load characteristics.


\vspace{1em}
\vspace{1em}
\noindent{}9.~\textbf{Q:}~\textit{\index{NIS server}\index{LDAP} I've heard that you can store NIS accounts in LDAP. Is LDAP not just a smarter way to run an NIS server?}
\newline
\noindent\textbf{A:}~
The correct answer to both questions is yes. But do understand that an LDAP server has a configurable schema that can store far more information for many more purposes than just NIS.


\vspace{1em}
\vspace{1em}
\noindent{}10.~\textbf{Q:}~\textit{Can I use NIS in place of LDAP?}
\newline
\noindent\textbf{A:}~
\index{NIS} \index{NIS schema} No. The NIS database does not have provision to store Microsoft encrypted passwords and does not deal with the types of data necessary for interoperability with Microsoft Windows networking. The use of LDAP with Samba requires the use of a number of schemas, one of which is the NIS schema, but also a Samba-specific schema extension.


\vspace{1em}
\cleardoublepage % ------------------------------------------------------------- 
% 
% PART Domain Members, Updating Samba and Migration
% 
% ------------------------------------------------------------- 
\part{Domain Members, Updating Samba and Migration}
\label{DMSMig}\hypertarget{DMSMig}{}%

% -------------------------------------------------------------
% PartIntro Domain Members, Updating Samba and Migration 
% ------------------------------------------------------------- 	
\chapter*{Domain Members, Updating Samba and Migration}
\label{id2408433}\hypertarget{id2408433}{}%

This section {\em{Samba-3 by Example}} covers two main topics: How to add Samba Domain Member Servers and Samba Domain Member Clients to a Samba domain, the other subject is that of how to migrate from and NT4 Domain, a NetWare server, or from an earlier Samba version to environments that use the most recent Samba-3 release.

Those who are making use of the chapter on Adding UNIX clients and servers running Samba to a Samba or a Windows networking domain may also benefit by referring to the book {\em{The Official Samba-3 HOWTO and Reference Guide.}}
\cleardoublepage 
% -------------------------------------------------------------
% Chapter Adding Domain Member Servers and Clients 
% ------------------------------------------------------------- 	
\chapter{Adding Domain Member Servers and Clients}
\label{unixclients}\hypertarget{unixclients}{}%

\index{Open Magazine}\index{survey} The most frequently discussed Samba subjects over the past 2 years have focused around domain control and printing. It is well known that Samba is a file and print server. A recent survey conducted by {\em{Open Magazine}} found that of all respondents, 97 percent use Samba for file and print services, and 68 percent use Samba for Domain Control. See the Open-Mag\label{id2517877}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.open-mag.com/cgi-bin/opencgi/surveys/survey.cgi?survey_name=samba}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2517877} Web site for current information. The survey results as found on January 14, 2004, are shown in \hyperlink{ch09openmag}{Figure {\ref{ch09openmag}}}.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{ch09openmag}{}%
\includegraphics[scale=0.6]{Samba3-ByExample/images/openmag}
{{\caption[{Open Magazine Samba Survey}]{{{Open Magazine Samba Survey}}}\label{ch09openmag}}}
\end{center}
\end{figure}


While domain control is an exciting subject, basic file and print sharing remains the staple bread-and-butter function that Samba provides. Yet this book may give the appearance of having focused too much on more exciting aspects of Samba deployment. This chapter directs your attention to provide important information on the addition of Samba servers into your present Windows network ---  whatever the controlling technology may be. So let's get back to our good friends at Abmas.

% ------------------------   
% Section 
\section{Introduction}
\label{id2498681}\hypertarget{id2498681}{}%

\index{Linux desktop}\index{Domain Member!server} Looking back over the achievements of the past year or two, daily events at Abmas are rather straightforward with not too many distractions or problems. Your team is doing well, but a number of employees are asking for Linux desktop systems. Your network has grown and demands additional domain member servers. Let's get on with this; Christine and Stan are ready to go.

\index{Domain Member!desktop} Stan is firmly in control of the department of the future, while Christine is enjoying a stable and predictable network environment. It is time to add more servers and to add Linux desktops. It is time to meet the demands of future growth and endure trial by fire.
\subsection{Assignment Tasks}
\label{id2491350}\hypertarget{id2491350}{}%

\index{Active Directory} You must now add UNIX/Linux domain member servers to your network. You have a friend who has a Windows 2003 Active Directory domain network who wants to add a Samba/Linux server and has asked Christine to help him out. Your real objective is to help Christine to see more of the way the Microsoft world lives and use her help to get validation that Samba really does live up to expectations.

Over the past 6 months, you have hired several new staff who want Linux on their desktops. You must integrate these systems to make sure that Abmas is not building islands of technology. You ask Christine to do likewise at Swodniw Biz NL (your friend's company) to help them to evaluate a Linux desktop. You want to make the right decision, don't you?

% ------------------------   
% Section 
\section{Dissection and Discussion}
\label{id2491387}\hypertarget{id2491387}{}%

\index{winbind} Recent Samba mailing-list activity is witness to how many sites are using winbind. Some have no trouble at all with it, yet to others the problems seem insurmountable. Periodically there are complaints concerning an inability to achieve identical user and group IDs between Windows and UNIX environments.

You provide step-by-step implementations of the various tools that can be used for identity resolution. You also provide working examples of solutions for integrated authentication for both UNIX/Linux and Windows environments.
\subsection{Technical Issues}
\label{id2491416}\hypertarget{id2491416}{}%

One of the great challenges we face when people ask us, {``}What is the best way to solve this problem?{''} is to get beyond the facts so we not only can clearly comprehend the immediate technical problem, but also can understand how needs may change.

\index{integrate} There are a few facts we should note when dealing with the question of how best to integrate UNIX/Linux clients and servers into a Windows networking environment:

\begin{itemize}
%--- Item
\item 
\index{Domain Controller} \index{authoritative} \index{accounts!authoritative} \index{PDC} \index{BDC} A domain controller (PDC or BDC) is always authoritative for all accounts in its domain. This means that a BDC must (of necessity) be able to resolve all account UIDs and GIDs to the same values that the PDC resolved them to.


%--- Item
\item 
\index{local accounts} \index{Domain Member!authoritative!local accounts} \index{Domain accounts} \index{winbindd} A domain member can be authoritative for local accounts, but is never authoritative for domain accounts. If a user is accessing a domain member server and that user's account is not known locally, the domain member server must resolve the identity of that user from the domain in which that user's account resides. It must then map that ID to a UID/GID pair that it can use locally. This is handled by {\bfseries{winbindd}}.


%--- Item
\item 
Samba, when running on a domain member server, can resolve user identities from a number of sources:

\begin{itemize}
%--- Item
\item 
\index{getpwnam} \index{getgrnam} \index{NSS} \index{LDAP} \index{NIS} By executing a system {\bfseries{getpwnam()}} or {\bfseries{getgrnam()}} call. On systems that support it, this utilizes the name service switch (NSS) facility to resolve names according to the configuration of the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file. NSS can be configured to use LDAP, winbind, NIS, or local files.


%--- Item
\item 
\index{passdb backend} \index{PADL} \index{nss\_ldap} Performing, via NSS, a direct LDAP search (where an LDAP passdb backend has been configured). This requires the use of the PADL nss\_ldap tool (or equivalent).


%--- Item
\item 
\index{winbindd} \index{SID} \index{winbindd\_idmap.tdb} \index{winbindd\_cache.tdb} Directly by querying {\bfseries{winbindd}}. The {\bfseries{winbindd}} contacts a domain controller to attempt to resolve the identity of the user or group. It receives the Windows networking security identifier (SID) for that appropriate account and then allocates a local UID or GID from the range of available IDs and creates an entry in its {\texttt{\docbookhyphenatefilename{winbindd\_\dbz{}idmap.\dbz{}tdb}}} and {\texttt{\docbookhyphenatefilename{winbindd\_\dbz{}cache.\dbz{}tdb}}} files.

\index{idmap backend} \index{mapping} If the parameter \smbconfoption{idmap backend} = ldap:ldap://myserver.domain was specified and the LDAP server has been configured with a container in which it may store the IDMAP entries, all domain members may share a common mapping.

\end{itemize}

Irrespective of how {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} is configured, winbind creates and caches a local copy of the ID mapping database. It uses the {\texttt{\docbookhyphenatefilename{winbindd\_\dbz{}idmap.\dbz{}tdb}}} and {\texttt{\docbookhyphenatefilename{winbindd\_\dbz{}cache.\dbz{}tdb}}} files to do this.

Which of the resolver methods is chosen is determined by the way that Samba is configured in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file. Some of the configuration options are rather less than obvious to the casual user.


%--- Item
\item 
\index{winbind trusted domains only} \index{domain member!servers} \index{domain controllers} If you wish to make use of accounts (users and/or groups) that are local to (i.e., capable of being resolved using) the NSS facility, it is possible to use the \smbconfoption{winbind trusted domains only} = Yes in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file. This parameter specifically applies to domain controllers, and to domain member servers.

\end{itemize}

\index{Posix accounts} \index{Samba accounts} \index{LDAP} For many administrators, it should be plain that the use of an LDAP-based repository for all network accounts (both for POSIX accounts and for Samba accounts) provides the most elegant and controllable facility. You eventually appreciate the decision to use LDAP.

\index{nss\_ldap} \index{identifiers} \index{resolve} If your network account information resides in an LDAP repository, you should use it ahead of any alternative method. This means that if it is humanly possible to use the {\bfseries{nss\_ldap}} tools to resolve UNIX account UIDs/GIDs via LDAP, this is the preferred solution, because it provides a more readily controllable method for asserting the exact same user and group identifiers throughout the network.

\index{Domain Member!server} \index{winbind trusted domains only} \index{getpwnam} \index{smbd} \index{Trusted Domains} \index{External Domains} In the situation where UNIX accounts are held on the domain member server itself, the only effective way to use them involves the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} entry \smbconfoption{winbind trusted domains only} = Yes. This forces Samba ({\bfseries{smbd}}) to perform a {\bfseries{getpwnam()}} system call that can then be controlled via {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file settings. The use of this parameter disables the use of Samba with trusted domains (i.e., external domains).

\index{appliance mode} \index{Domain Member!server} \index{winbindd} \index{automatically allocate} Winbind can be used to create an appliance mode domain member server. In this capacity, {\bfseries{winbindd}} is configured to automatically allocate UIDs/GIDs from numeric ranges set in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file. The allocation is made for all accounts that connect to that domain member server, whether within its own domain or from trusted domains. If not stored in an LDAP backend, each domain member maintains its own unique mapping database. This means that it is almost certain that a given user who accesses two domain member servers does not have the same UID/GID on both servers ---  however, this is transparent to the Windows network user. This data is stored in the {\texttt{\docbookhyphenatefilename{winbindd\_\dbz{}idmap.\dbz{}tdb}}} and {\texttt{\docbookhyphenatefilename{winbindd\_\dbz{}cache.\dbz{}tdb}}} files.

\index{mapping} The use of an LDAP backend for the Winbind IDMAP facility permits Windows domain SIDs mappings to UIDs/GIDs to be stored centrally. The result is a consistent mapping across all domain member servers so configured. This solves one of the major headaches for network administrators who need to copy files between or across network file servers.
\subsection{Political Issues}
\label{id2485572}\hypertarget{id2485572}{}%

\index{OpenLDAP} \index{NIS} \index{yellow pages|textit{see} {NIS} } \index{identity management} One of the most fierce conflicts recently being waged is resistance to the adoption of LDAP, in particular OpenLDAP, as a replacement for UNIX NIS (previously called Yellow Pages). Let's face it, LDAP is different and requires a new approach to the need for a better identity management solution. The more you work with LDAP, the more its power and flexibility emerges from its dark, cavernous chasm.

LDAP is a most suitable solution for heterogenous environments. If you need crypto, add Kerberos. The reason these are preferable is because they are heterogenous. Windows solutions of this sort are {\em{not}} heterogenous by design. This is fundamental ---  it isn't religious or political. This also doesn't say that you can't use Windows Active Directory in a heterogenous environment ---  it can be done, it just requires commercial integration products. But it's not what Active Directory was designed for.

\index{directory} \index{management} A number of long-term UNIX devotees have recently commented in various communications that the Samba Team is the first application group to almost force network administrators to use LDAP. It should be pointed out that we resisted this for as long as we could. It is not out of laziness or malice that LDAP has finally emerged as the preferred identity management backend for Samba. We recommend LDAP for your total organizational directory needs.

% ------------------------   
% Section 
\section{Implementation}
\label{id2509474}\hypertarget{id2509474}{}%

\index{Domain Member!server} \index{Domain Member!client} \index{Domain Controller} The domain member server and the domain member client are at the center of focus in this chapter. Configuration of Samba-3 domain controller is covered in earlier chapters, so if your interest is in domain controller configuration, you will not find that here. You will find good oil that helps you to add domain member servers and clients.

\index{Domain Member!workstations} In practice, domain member servers and domain member workstations are very different entities, but in terms of technology they share similar core infrastructure. A technologist would argue that servers and workstations are identical. Many users would argue otherwise, given that in a well-disciplined environment a workstation (client) is a device from which a user creates documents and files that are located on servers. A workstation is frequently viewed as a disposable (easy to replace) item, but a server is viewed as a core component of the business.

\index{workstation} We can look at this another way. If a workstation breaks down, one user is affected, but if a server breaks down, hundreds of users may not be able to work. The services that a workstation must provide are document- and file-production oriented; a server provides information storage and is distribution oriented.

\index{authentication process} \index{logon process} \index{user identities} {\em{Why is this important?}} For starters, we must identify what components of the operating system and its environment must be configured. Also, it is necessary to recognize where the interdependencies between the various services to be used are. In particular, it is important to understand the operation of each critical part of the authentication process, the logon process, and how user identities get resolved and applied within the operating system and applications (like Samba) that depend on this and may actually contribute to it.

So, in this chapter we demonstrate how to implement the technology. It is done within a context of what type of service need must be fulfilled.
\subsection{Samba Domain with Samba Domain Member Server --- Using NSS LDAP}
\label{sdcsdmldap}\hypertarget{sdcsdmldap}{}%

\index{ldapsam} \index{ldapsam backend} \index{IDMAP} \index{mapping!consistent} \index{winbindd} \index{foreign SID} In this example, it is assumed that you have Samba PDC/BDC servers. This means you are using an LDAP ldapsam backend. We are adding to the LDAP backend database (directory) containers for use by the IDMAP facility. This makes it possible to have globally consistent mapping of SIDs to and from UIDs and GIDs. This means that it is necessary to run {\bfseries{winbindd}} as part of your configuration. The primary purpose of running {\bfseries{winbindd}} (within this operational context) is to permit mapping of foreign SIDs (those not originating from the the local Samba server). Foreign SIDs can come from any domain member client or server, or from Windows clients that do not belong to a domain. Another way to explain the necessity to run {\bfseries{winbindd}} is that Samba can locally resolve only accounts that belong to the security context of its own machine SID. Winbind handles all non-local SIDs and maps them to a local UID/GID value. The UID and GID are allocated from the parameter values set in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file for the {\ttfamily\itshape{\docbookhyphenatedot{idmap uid}}} and {\ttfamily\itshape{\docbookhyphenatedot{idmap gid}}} ranges. Where LDAP is used, the mappings can be stored in LDAP so that all domain member servers can use a consistent mapping.

\index{winbindd} \index{getpwnam} \index{NSS} If your installation is accessed only from clients that are members of your own domain, and all user accounts are present in a local passdb backend then it is not necessary to run {\bfseries{winbindd}}. The local passdb backend can be in smbpasswd, tdbsam, or in ldapsam.

It is possible to use a local passdb backend with any convenient means of resolving the POSIX user and group account information. The POSIX information is usually obtained using the {\bfseries{getpwnam()}} system call. On NSS-enabled systems, the actual POSIX account source can be provided from

\begin{itemize}
%--- Item
\item 
\index{/etc/passwd} \index{/etc/group} Accounts in {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} or in {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}group}}}.


%--- Item
\item 
\index{NSS} \index{compat} \index{ldap} \index{nis} \index{nisplus} \index{hesiod} \index{ldap} \index{nss\_ldap} \index{PADL Software} Resolution via NSS. On NSS-enabled systems, there is usually a facility to resolve IDs via multiple methods. The methods typically include {\bfseries{files}}, {\bfseries{compat}}, {\bfseries{db}}, {\bfseries{ldap}}, {\bfseries{nis}}, {\bfseries{nisplus}}, {\bfseries{hesiod.}} When correctly installed, Samba adds to this list the {\bfseries{winbindd}} facility. The ldap facility is frequently the nss\_ldap tool provided by PADL Software.

\end{itemize}

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

To advoid confusion the use of the term {\texttt{\docbookhyphenatedot{local passdb backend}}} means that the user account backend is not shared by any other Samba server ---  instead, it is used only locally on the Samba domain member server under discussion.
\end{admonition}


\index{Identity resolution} The diagram in \hyperlink{ch9-sambadc}{Figure {\ref{ch9-sambadc}}} demonstrates the relationship of Samba and system components that are involved in the identity resolution process where Samba is used as a domain member server within a Samba domain control network.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{ch9-sambadc}{}%
\includegraphics[scale=0.6]{Samba3-ByExample/images/chap9-SambaDC}
{{\caption[{Samba Domain: Samba Member Server}]{{{Samba Domain: Samba Member Server}}}\label{ch9-sambadc}}}
\end{center}
\end{figure}


\index{IDMAP} \index{foreign} In this example configuration, Samba will directly search the LDAP-based passwd backend ldapsam to obtain authentication and user identity information. The IDMAP information is stored in the LDAP backend so that it can be shared by all domain member servers so that every user will have a consistent UID and GID across all of them. The IDMAP facility will be used for all foreign (i.e., not having the same SID as the domain it is a member of) domains. The configuration of NSS will ensure that all UNIX processes will obtain a consistent UID/GID.

The instructions given here apply to the Samba environment shown in \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}} and \hyperlink{2000users}{Chapter {\ref{2000users}}, {``}A Distributed 2000-User Network{''}}. If the network does not have an LDAP slave server (i.e., \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}} configuration), change the target LDAP server from {\texttt{\docbookhyphenatedot{lapdc}}} to {\texttt{\docbookhyphenatedot{massive.}}}
Configuration of NSS_LDAP-Based Identity Resolution\begin{enumerate}

\item{Create the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file as shown in \hyperlink{ch9-sdmsdc}{Example {\ref{ch9-sdmsdc}}}. Locate this file in the directory {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba}}}.}

\item{\index{ldap.conf} Configure the file that will be used by {\texttt{\docbookhyphenatedot{nss\_ldap}}} to locate and communicate with the LDAP server. This file is called {\texttt{\docbookhyphenatefilename{ldap.\dbz{}conf}}}. If your implementation of {\texttt{\docbookhyphenatedot{nss\_ldap}}} is consistent with the defaults suggested by PADL (the authors), it will be located in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc}}} directory. On some systems, the default location is the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap}}} directory, however this file is intended for use by the OpenLDAP utilities and should not really be used by the nss\_ldap utility since its content and structure serves the specific purpose of enabling the resolution of user and group IDs via NSS.  Change the parameters inside the file that is located on your OS so it matches \hyperlink{ch9-sdmlcnf}{Example {\ref{ch9-sdmlcnf}}}. To find the correct location of this file, you can obtain this from the library that will be used by executing the following: 
\begin{Verbatim}[]

root#  strings /lib/libnss_ldap* | grep ldap.conf
/etc/ldap.conf

\end{Verbatim}
}

\item{Configure the NSS control file so it matches the one shown in \hyperlink{ch9-sdmnss}{Example {\ref{ch9-sdmnss}}}.}

\item{\index{Identity resolution} \index{getent} Before proceeding to configure Samba, validate the operation of the NSS identity resolution via LDAP by executing: 
\begin{Verbatim}[]

root#  getent passwd
...
root:x:0:512:Netbios Domain Administrator:/root:/bin/false
nobody:x:999:514:nobody:/dev/null:/bin/false
bobj:x:1000:513:Robert Jordan:/home/bobj:/bin/bash
stans:x:1001:513:Stanley Soroka:/home/stans:/bin/bash
chrisr:x:1002:513:Christine Roberson:/home/chrisr:/bin/bash
maryv:x:1003:513:Mary Vortexis:/home/maryv:/bin/bash
jht:x:1004:513:John H Terpstra:/home/jht:/bin/bash
bldg1$:x:1006:553:bldg1$:/dev/null:/bin/false
temptation$:x:1009:553:temptation$:/dev/null:/bin/false
vaioboss$:x:1005:553:vaioboss$:/dev/null:/bin/false
fran$:x:1008:553:fran$:/dev/null:/bin/false
josephj:x:1007:513:Joseph James:/home/josephj:/bin/bash

\end{Verbatim}
 You should notice the location of the users' home directories. First, make certain that the home directories exist on the domain member server; otherwise, the home directory share is not available. The home directories could be mounted off a domain controller using NFS or by any other suitable means. Second, the absence of the domain name in the home directory path is indicative that identity resolution is not being done via winbind. 
\begin{Verbatim}[]

root#  getent group
...
Domain Admins:x:512:root,jht
Domain Users:x:513:bobj,stans,chrisr,maryv,jht,josephj
Domain Guests:x:514:
Accounts:x:1000:
Finances:x:1001:
PIOps:x:1002:
sammy:x:4321:

\end{Verbatim}
 \index{secondary group} \index{primary group} \index{group membership} This shows that all is working as it should be. Notice that in the LDAP database the users' primary and secondary group memberships are identical. It is not necessary to add secondary group memberships (in the group database) if the user is already a member via primary group membership in the password database. When using winbind, it is in fact undesirable to do this because it results in doubling up of group memberships and may cause problems with winbind under certain conditions. It is intended that these limitations with winbind will be resolved soon after Samba-3.0.20 has been released.}

\item{\index{slapcat} The LDAP directory must have a container object for IDMAP data. There are several ways you can check that your LDAP database is able to receive IDMAP information. One of the simplest is to execute: 
\begin{Verbatim}[]

root#  slapcat | grep -i idmap
dn: ou=Idmap,dc=abmas,dc=biz
ou: idmap

\end{Verbatim}
 \index{ldapadd} If the execution of this command does not return IDMAP entries, you need to create an LDIF template file (see \hyperlink{ch9-ldifadd}{Example {\ref{ch9-ldifadd}}}). You can add the required entries using the following command: 
\begin{Verbatim}[]

root#  ldapadd -x -D "cn=Manager,dc=abmas,dc=biz" \
		-w not24get < /etc/openldap/idmap.LDIF

\end{Verbatim}
}

\item{Samba automatically populates the LDAP directory container when it needs to. To permit Samba write access to the LDAP directory it is necessary to set the LDAP administrative password in the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file as shown here: 
\begin{Verbatim}[]

root#  smbpasswd -w not24get

\end{Verbatim}
}

\item{\index{net!rpc!join} \index{Domain join} The system is ready to join the domain. Execute the following: 
\begin{Verbatim}[]

root#  net rpc join -U root%not24get
Joined domain MEGANET2.

\end{Verbatim}
 This indicates that the domain join succeeded.  Failure to join the domain could be caused by any number of variables. The most common causes of failure to join are:  
\begin{itemize}
%--- Item
\item 
Broken resolution of NetBIOS names to the respective IP address.


%--- Item
\item 
Incorrect username and password credentials.


%--- Item
\item 
The NT4 {\ttfamily\itshape{\docbookhyphenatedot{restrict anonymous}}} is set to exclude anonymous connections.

\end{itemize}
  The connection setup can be diagnosed by executing: 
\begin{Verbatim}[]

root#  net rpc join -S 'pdc-name' -U administrator%password -d 5

\end{Verbatim}
 \index{failed} \index{failed join} \index{rejected} \index{restrict anonymous} Note: Use "root" for UNIX/Linux and Samba, use "Administrator" for Windows NT4/200X. If the cause of the failure appears to be related to a rejected or failed NT\_SESSION\_SETUP* or an error message that says NT\_STATUS\_ACCESS\_DENIED immediately check the Windows registry setting that controls the {\texttt{\docbookhyphenatedot{restrict anonymous}}} setting. Set this to the value 0 so that an anonymous connection can be sustained, then try again.  It is possible (perhaps even recommended) to use the following to validate the ability to connect to an NT4 PDC/BDC: 
\begin{Verbatim}[]

root#  net rpc info -S 'pdc-name' -U Administrator%not24get
Domain Name: MEGANET2
Domain SID: S-1-5-21-422319763-4138913805-7168186429
Sequence number: 1519909596
Num users: 7003
Num domain groups: 821
Num local groups: 8

root#  net rpc testjoin -S 'pdc-name' -U Administrator%not24get
Join to 'MEGANET2' is OK

\end{Verbatim}
 If for any reason the following response is obtained to the last command above,it is time to call in the Networking Super-Snooper task force (i.e., start debugging): 
\begin{Verbatim}[]

NT_STATUS_ACCESS_DENIED
Join to 'MEGANET2' failed.

\end{Verbatim}
}

\item{\index{wbinfo} Just joining the domain is not quite enough; you must now provide a privileged set of credentials through which {\bfseries{winbindd}} can interact with the domain servers. Execute the following to implant the necessary credentials: 
\begin{Verbatim}[]

root#  wbinfo --set-auth-user=Administrator%not24get

\end{Verbatim}
 The configuration is now ready to obtain the Samba domain user and group information.}

\item{You may now start Samba in the usual manner, and your Samba domain member server is ready for use. Just add shares as required.}
\end{enumerate}

\begin{example}%
\hypertarget{ch9-sdmsdc}{}%
\captionswapskip{}{{\caption{Samba Domain Member in Samba Domain Using LDAP ---  smb.\dbz{}conf File}\label{ch9-sdmsdc}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	unix charset = LOCALE
 	workgroup = MEGANET2
 	security = DOMAIN
 	username map = /etc/samba/smbusers
 	log level = 10
 	syslog = 0
 	log file = /var/log/samba/%m
 	max log size = 50
 	smb ports = 139
 	name resolve order = wins bcast hosts
 	printcap name = CUPS
 	wins server = 192.168.2.1
 	ldap suffix = dc=abmas,dc=biz
 	ldap machine suffix = ou=People
 	ldap user suffix = ou=People
 	ldap group suffix = ou=Groups
 	ldap idmap suffix = ou=Idmap
 	ldap admin dn = cn=Manager,dc=abmas,dc=biz
 	idmap backend = ldap:ldap://lapdc.abmas.biz
 	idmap uid = 10000-20000
 	idmap gid = 10000-20000
 	winbind trusted domains only = Yes
 	printer admin = root
 	printing = cups
 [homes]
 	comment = Home Directories
 	valid users = %S
 	read only = No
 	browseable = No
 [printers]
 	comment = SMB Print Spool
 	path = /var/spool/samba
 	guest ok = Yes
 	printable = Yes
 	browseable = No
 [print$]
 	comment = Printer Drivers
 	path = /var/lib/samba/drivers
 	admin users = root, Administrator
 	write list = root
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch9-ldifadd}{}%
\captionswapskip{}{{\caption{LDIF IDMAP Add-On Load File ---  File: /etc/openldap/idmap.LDIF}\label{ch9-ldifadd}}}
\captionswapskip{}
\begin{Verbatim}[]

dn: ou=Idmap,dc=abmas,dc=biz
objectClass: organizationalUnit
ou: idmap
structuralObjectClass: organizationalUnit

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{ch9-sdmlcnf}{}%
\captionswapskip{}{{\caption{Configuration File for NSS LDAP Support ---  /\dbz{}etc/\dbz{}ldap.\dbz{}conf}\label{ch9-sdmlcnf}}}
\captionswapskip{}
\begin{Verbatim}[]

URI     ldap://massive.abmas.biz ldap://massive.abmas.biz:636
host    192.168.2.1
base    dc=abmas,dc=biz
binddn  cn=Manager,dc=abmas,dc=biz
bindpw  not24get

pam_password exop

nss_base_passwd ou=People,dc=abmas,dc=biz?one
nss_base_shadow ou=People,dc=abmas,dc=biz?one
nss_base_group  ou=Groups,dc=abmas,dc=biz?one
ssl     no

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{ch9-sdmnss}{}%
\captionswapskip{}{{\caption{NSS using LDAP for Identity Resolution ---  File: /\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}\label{ch9-sdmnss}}}
\captionswapskip{}
\begin{Verbatim}[]

passwd:         files ldap
shadow:         files ldap
group:          files ldap

hosts:          files dns wins
networks:       files dns

services:       files
protocols:      files
rpc:            files
ethers:         files
netmasks:       files
netgroup:       files
publickey:      files

bootparams:     files
automount:      files
aliases:        files

\end{Verbatim}
\end{example}

\subsection{NT4/Samba Domain with Samba Domain Member Server: Using NSS and Winbind}
\label{wdcsdm}\hypertarget{wdcsdm}{}%

You need to use this method for creating a Samba domain member server if any of the following conditions prevail:

\begin{itemize}
%--- Item
\item 
LDAP support (client) is not installed on the system.


%--- Item
\item 
There are mitigating circumstances forcing a decision not to use LDAP.


%--- Item
\item 
The Samba domain member server must be part of a Windows NT4 Domain, or a Samba Domain.

\end{itemize}

\index{Windows ADS Domain} \index{Samba Domain} \index{LDAP} Later in the chapter, you can see how to configure a Samba domain member server for a Windows ADS domain. Right now your objective is to configure a Samba server that can be a member of a Windows NT4-style domain and/or does not use LDAP.

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

\index{duplicate accounts} If you use {\bfseries{winbind}} for identity resolution, make sure that there are no duplicate accounts.

\index{/etc/passwd} For example, do not have more than one account that has UID=0 in the password database. If there is an account called {\texttt{\docbookhyphenatedot{root}}} in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} database, it is okay to have an account called {\texttt{\docbookhyphenatedot{root}}} in the LDAP ldapsam or in the tdbsam. But if there are two accounts in the passdb backend that have the same UID, winbind will break. This means that the {\texttt{\docbookhyphenatedot{Administrator}}} account must be called {\texttt{\docbookhyphenatedot{root}}}.

\index{/etc/passwd} \index{ldapsam} \index{tdbsam} Winbind will break if there is an account in {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} that has the same UID as an account that is in LDAP ldapsam (or in tdbsam) but that differs in name only.
\end{admonition}


\index{credentials} \index{traverse} \index{wide-area} \index{network!wide-area} \index{tdbdump} The following configuration uses CIFS/SMB protocols alone to obtain user and group credentials. The winbind information is locally cached in the {\texttt{\docbookhyphenatefilename{winbindd\_\dbz{}cache.\dbz{}tdb winbindd\_\dbz{}idmap.\dbz{}tdb}}} files. This provides considerable performance benefits compared with the LDAP solution, particularly where the LDAP lookups must traverse WAN links. You may examine the contents of these files using the tool {\bfseries{tdbdump}}, though you may have to build this from the Samba source code if it has not been supplied as part of a binary package distribution that you may be using.
Configuration of Winbind-Based Identity Resolution\begin{enumerate}

\item{Using your favorite text editor, create the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file so it has the contents shown in \hyperlink{ch0-NT4DSDM}{Example {\ref{ch0-NT4DSDM}}}.}

\item{\index{/etc/nsswitch.conf} Edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} so it has the entries shown in \hyperlink{ch9-sdmnss}{Example {\ref{ch9-sdmnss}}}.}

\item{\index{net!rpc!join} The system is ready to join the domain. Execute the following: 
\begin{Verbatim}[]

net rpc join -U root%not2g4et
Joined domain MEGANET2.

\end{Verbatim}
 This indicates that the domain join succeed.}

\item{\index{winbind} \index{wbinfo} Validate operation of {\bfseries{winbind}} using the {\bfseries{wbinfo}} tool as follows: 
\begin{Verbatim}[]

root#  wbinfo -u
MEGANET2+root
MEGANET2+nobody
MEGANET2+jht
MEGANET2+maryv
MEGANET2+billr
MEGANET2+jelliott
MEGANET2+dbrady
MEGANET2+joeg
MEGANET2+balap

\end{Verbatim}
 This shows that domain users have been listed correctly. 
\begin{Verbatim}[]

root#  wbinfo -g
MEGANET2+Domain Admins
MEGANET2+Domain Users
MEGANET2+Domain Guests
MEGANET2+Accounts
MEGANET2+Finances
MEGANET2+PIOps

\end{Verbatim}
 This shows that domain groups have been correctly obtained also.}

\item{\index{NSS} \index{getent} \index{winbind} The next step verifies that NSS is able to obtain this information correctly from {\bfseries{winbind}} also. 
\begin{Verbatim}[]

root#  getent passwd
...
MEGANET2+root:x:10000:10001:NetBIOS Domain Admin:
                      /home/MEGANET2/root:/bin/bash
MEGANET2+nobody:x:10001:10001:nobody:
                      /home/MEGANET2/nobody:/bin/bash
MEGANET2+jht:x:10002:10001:John H Terpstra:
                      /home/MEGANET2/jht:/bin/bash
MEGANET2+maryv:x:10003:10001:Mary Vortexis:
                      /home/MEGANET2/maryv:/bin/bash
MEGANET2+billr:x:10004:10001:William Randalph:
                      /home/MEGANET2/billr:/bin/bash
MEGANET2+jelliott:x:10005:10001:John G Elliott:
                      /home/MEGANET2/jelliott:/bin/bash
MEGANET2+dbrady:x:10006:10001:Darren Brady:
                      /home/MEGANET2/dbrady:/bin/bash
MEGANET2+joeg:x:10007:10001:Joe Green:
                      /home/MEGANET2/joeg:/bin/bash
MEGANET2+balap:x:10008:10001:Bala Pillay:
                      /home/MEGANET2/balap:/bin/bash

\end{Verbatim}
 The user account information has been correctly obtained. This information has been merged with the winbind template information configured in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file. 
\begin{Verbatim}[]

root# # getent group
...
MEGANET2+Domain Admins:x:10000:MEGANET2+root,MEGANET2+jht
MEGANET2+Domain Users:x:10001:MEGANET2+jht,MEGANET2+maryv,\
        MEGANET2+billr,MEGANET2+jelliott,MEGANET2+dbrady,\
        MEGANET2+joeg,MEGANET2+balap
MEGANET2+Domain Guests:x:10002:MEGANET2+nobody
MEGANET2+Accounts:x:10003:
MEGANET2+Finances:x:10004:
MEGANET2+PIOps:x:10005:

\end{Verbatim}
}

\item{The Samba member server of a Windows NT4 domain is ready for use.}
\end{enumerate}

\begin{example}%
\hypertarget{ch0-NT4DSDM}{}%
\captionswapskip{}{{\caption{Samba Domain Member Server Using Winbind smb.\dbz{}conf File for NT4 Domain}\label{ch0-NT4DSDM}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	unix charset = LOCALE
 	workgroup = MEGANET2
 	security = DOMAIN
 	username map = /etc/samba/smbusers
 	log level = 1
 	syslog = 0
 	log file = /var/log/samba/%m
 	max log size = 0
 	smb ports = 139
 	name resolve order = wins bcast hosts
 	printcap name = CUPS
 	wins server = 192.168.2.1
 	idmap uid = 10000-20000
 	idmap gid = 10000-20000
 	template primary group = "Domain Users"
 	template shell = /bin/bash
 	winbind separator = +
 	printer admin = root
 	hosts allow = 192.168.2., 192.168.3., 127.
 	printing = cups
 [homes]
 	comment = Home Directories
 	valid users = %S
 	read only = No
 	browseable = No
 [printers]
 	comment = SMB Print Spool
 	path = /var/spool/samba
 	guest ok = Yes
 	printable = Yes
 	browseable = No
 [print$]
 	comment = Printer Drivers
 	path = /var/lib/samba/drivers
 	admin users = root, Administrator
 	write list = root
\end{lstlisting}
\end{example}

\subsection{NT4/Samba Domain with Samba Domain Member Server without NSS Support}
\label{dcwonss}\hypertarget{dcwonss}{}%

No matter how many UNIX/Linux administrators there may be who believe that a UNIX operating system that does not have NSS and PAM support to be outdated, the fact is there are still many such systems in use today. Samba can be used without NSS support, but this does limit it to the use of local user and group accounts only.

The following steps may be followed to implement Samba with support for local accounts. In this configuration Samba is made a domain member server. All incoming connections to the Samba server will cause the look-up of the incoming username. If the account is found, it is used. If the account is not found, one will be automatically created on the local machine so that it can then be used for all access controls.
Configuration Using Local Accounts Only\begin{enumerate}

\item{Using your favorite text editor, create the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file so it has the contents shown in \hyperlink{ch0-NT4DSCM}{Example {\ref{ch0-NT4DSCM}}}.}

\item{\index{net!rpc!join} The system is ready to join the domain. Execute the following: 
\begin{Verbatim}[]

net rpc join -U root%not24get
Joined domain MEGANET2.

\end{Verbatim}
 This indicates that the domain join succeed.}

\item{Be sure to run all three Samba daemons: {\bfseries{smbd}}, {\bfseries{nmbd}}, {\bfseries{winbindd}}.}

\item{The Samba member server of a Windows NT4 domain is ready for use.}
\end{enumerate}

\begin{example}%
\hypertarget{ch0-NT4DSCM}{}%
\captionswapskip{}{{\caption{Samba Domain Member Server Using Local Accounts smb.\dbz{}conf File for NT4 Domain}\label{ch0-NT4DSCM}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	unix charset = LOCALE
 	workgroup = MEGANET3
 	netbios name = BSDBOX
 	security = DOMAIN
 	username map = /etc/samba/smbusers
 	log level = 1
 	syslog = 0
 	add user script = /usr/sbin/useradd -m '%u'
 	add machine script = /usr/sbin/useradd -M '%u'
 	add group script = /usr/sbin/groupadd '%g'
 	log file = /var/log/samba/%m
 	max log size = 0
 	smb ports = 139
 	name resolve order = wins bcast hosts
 	printcap name = CUPS
 	wins server = 192.168.2.1
 	printer admin = root
 	hosts allow = 192.168.2., 192.168.3., 127.
 	printing = cups
 [homes]
 	comment = Home Directories
 	valid users = %S
 	read only = No
 	browseable = No
 [printers]
 	comment = SMB Print Spool
 	path = /var/spool/samba
 	guest ok = Yes
 	printable = Yes
 	browseable = No
 [print$]
 	comment = Printer Drivers
 	path = /var/lib/samba/drivers
 	admin users = root, Administrator
 	write list = root
\end{lstlisting}
\end{example}

\subsection{Active Directory Domain with Samba Domain Member Server}
\label{adssdm}\hypertarget{adssdm}{}%

\index{Active Directory!join} \index{Kerberos} \index{Domain Member!server} One of the much-sought-after features new to Samba-3 is the ability to join an Active Directory domain using Kerberos protocols. This makes it possible to operate an entire Windows network without the need to run NetBIOS over TCP/IP and permits more secure networking in general. An exhaustively complete discussion of the protocols is not possible in this book; perhaps a later book may explore the intricacies of the NetBIOS-less operation that Samba-3 can participate in. For now, we simply focus on how a Samba-3 server can be made a domain member server.

\index{Active Directory} \index{LDAP} \index{Identity resolution} \index{Kerberos} The diagram in \hyperlink{ch9-adsdc}{Figure {\ref{ch9-adsdc}}} demonstrates how Samba-3 interfaces with Microsoft Active Directory components. It should be noted that if Microsoft Windows Services for UNIX (SFU) has been installed and correctly configured, it is possible to use client LDAP for identity resolution just as can be done with Samba-3 when using an LDAP passdb backend. The UNIX tool that you need for this, as in the case of LDAP on UNIX/Linux, is the PADL Software nss\_ldap tool-set. Compared with use of winbind and Kerberos, the use of LDAP-based identity resolution is a little less secure. In view of the fact that this solution requires additional software to be installed on the Windows 200x ADS domain controllers, and that means more management overhead, it is likely that most Samba-3 ADS client sites may elect to use winbind.

Do not attempt to use this procedure if you are not 100 percent certain that the build of Samba-3 you are using has been compiled and linked with all the tools necessary for this to work. Given the importance of this step, you must first validate that the Samba-3 message block daemon ({\bfseries{smbd}}) has the necessary features.

The hypothetical domain you are using in this example assumes that the Abmas London office decided to take its own lead (some would say this is a typical behavior in a global corporate world; besides, a little divergence and conflict makes for an interesting life). The Windows Server 2003 ADS domain is called {\texttt{\docbookhyphenatedot{london.abmas.biz}}} and the name of the server is {\texttt{\docbookhyphenatedot{W2K3S}}}. In ADS realm terms, the domain controller is known as {\texttt{\docbookhyphenatedot{w2k3s.london.abmas.biz}}}. In NetBIOS nomenclature, the domain name is {\texttt{\docbookhyphenatedot{LONDON}}} and the server name is {\texttt{\docbookhyphenatedot{W2K3S}}}.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{ch9-adsdc}{}%
\includegraphics[scale=0.6]{Samba3-ByExample/images/chap9-ADSDC}
{{\caption[{Active Directory Domain: Samba Member Server}]{{{Active Directory Domain: Samba Member Server}}}\label{ch9-adsdc}}}
\end{center}
\end{figure}

Joining a Samba Server as an ADS Domain Member\begin{enumerate}

\item{\index{smbd} Before you try to use Samba-3, you want to know for certain that your executables have support for Kerberos and for LDAP. Execute the following to identify whether or not this build is perhaps suitable for use: 
\begin{Verbatim}[]

root#  cd /usr/sbin
root#  smbd -b | grep KRB
   HAVE_KRB5_H
   HAVE_ADDR_TYPE_IN_KRB5_ADDRESS
   HAVE_KRB5
   HAVE_KRB5_AUTH_CON_SETKEY
   HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES
   HAVE_KRB5_GET_PW_SALT
   HAVE_KRB5_KEYBLOCK_KEYVALUE
   HAVE_KRB5_KEYTAB_ENTRY_KEYBLOCK
   HAVE_KRB5_MK_REQ_EXTENDED
   HAVE_KRB5_PRINCIPAL_GET_COMP_STRING
   HAVE_KRB5_SET_DEFAULT_IN_TKT_ETYPES
   HAVE_KRB5_STRING_TO_KEY
   HAVE_KRB5_STRING_TO_KEY_SALT
   HAVE_LIBKRB5

\end{Verbatim}
 This output was obtained on a SUSE Linux system and shows the output for Samba that has been compiled and linked with the Heimdal Kerberos libraries. The following is a typical output that will be found on a Red Hat Linux system that has been linked with the MIT Kerberos libraries: 
\begin{Verbatim}[]

root#  cd /usr/sbin
root#  smbd -b | grep KRB
   HAVE_KRB5_H
   HAVE_ADDRTYPE_IN_KRB5_ADDRESS
   HAVE_KRB5
   HAVE_KRB5_AUTH_CON_SETUSERUSERKEY
   HAVE_KRB5_ENCRYPT_DATA
   HAVE_KRB5_FREE_DATA_CONTENTS
   HAVE_KRB5_FREE_KTYPES
   HAVE_KRB5_GET_PERMITTED_ENCTYPES
   HAVE_KRB5_KEYTAB_ENTRY_KEY
   HAVE_KRB5_LOCATE_KDC
   HAVE_KRB5_MK_REQ_EXTENDED
   HAVE_KRB5_PRINCIPAL2SALT
   HAVE_KRB5_PRINC_COMPONENT
   HAVE_KRB5_SET_DEFAULT_TGS_KTYPES
   HAVE_KRB5_SET_REAL_TIME
   HAVE_KRB5_STRING_TO_KEY
   HAVE_KRB5_TKT_ENC_PART2
   HAVE_KRB5_USE_ENCTYPE
   HAVE_LIBGSSAPI_KRB5
   HAVE_LIBKRB5

\end{Verbatim}
 You can validate that Samba has been compiled and linked with LDAP support by executing: 
\begin{Verbatim}[]

root#  smbd -b | grep LDAP
massive:/usr/sbin # smbd -b | grep LDAP
   HAVE_LDAP_H
   HAVE_LDAP
   HAVE_LDAP_DOMAIN2HOSTLIST
   HAVE_LDAP_INIT
   HAVE_LDAP_INITIALIZE
   HAVE_LDAP_SET_REBIND_PROC
   HAVE_LIBLDAP
   LDAP_SET_REBIND_PROC_ARGS

\end{Verbatim}
 This does look promising; {\bfseries{smbd}} has been built with Kerberos and LDAP support. You are relieved to know that it is safe to progress.}

\item{\index{Kerberos!libraries} \index{MIT Kerberos} \index{Heimdal Kerberos} \index{Kerberos!MIT} \index{Kerberos!Heimdal} \index{Red Hat Linux} \index{SUSE Linux} \index{SerNet} \index{validated} The next step is to identify which version of the Kerberos libraries have been used. In order to permit Samba-3 to interoperate with Windows 2003 Active Directory, it is essential that it has been linked with either MIT Kerberos version 1.3.1 or later, or that it has been linked with Heimdal Kerberos 0.6 plus specific patches. You may identify what version of the MIT Kerberos libraries are installed on your system by executing (on Red Hat Linux): 
\begin{Verbatim}[]

root#  rpm -q krb5

\end{Verbatim}
 Or on SUSE Linux, execute: 
\begin{Verbatim}[]

root#  rpm -q heimdal

\end{Verbatim}
 Please note that the RPMs provided by the Samba-Team are known to be working and have been validated. Red Hat Linux RPMs may be obtained from the Samba FTP sites. SUSE Linux RPMs may be obtained from Sernet\label{id2547080}\begingroup\catcode`\#=12\footnote{ {\textless}\url{ftp://ftp.sernet.de}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2547080} in Germany.  From this point on, you are certain that the Samba-3 build you are using has the necessary capabilities. You can now configure Samba-3 and the NSS.}

\item{Using you favorite editor, configure the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file that is located in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba}}} directory so that it has the contents shown in \hyperlink{ch9-adssdm}{Example {\ref{ch9-adssdm}}}.}

\item{Edit or create the NSS control file so it has the contents shown in \hyperlink{ch9-sdmnss}{Example {\ref{ch9-sdmnss}}}.}

\item{\index{/etc/samba/secrets.tdb} Delete the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}secrets.\dbz{}tdb}}} if it exists. Of course, you do keep a backup, don't you?}

\item{Delete the tdb files that cache Samba information. You keep a backup of the old files, of course. You also remove all files to ensure that nothing can pollute your nice, new configuration. Execute the following (example is for SUSE Linux): 
\begin{Verbatim}[]

root#  rm /var/lib/samba/*tdb

\end{Verbatim}
}

\item{\index{testparm} Validate your {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file using {\bfseries{testparm}} (as you have done previously). Correct all errors reported before proceeding. The command you execute is: 
\begin{Verbatim}[]

root#  testparm -s | less

\end{Verbatim}
 Now that you are satisfied that your Samba server is ready to join the Windows ADS domain, let's move on.}

\item{\index{net!ads!join} \index{Kerberos} This is a good time to double-check everything and then execute the following command when everything you have done has checked out okay: 
\begin{Verbatim}[]

root#  net ads join -UAdministrator%not24get
Using short domain name -- LONDON
Joined 'FRAN' to realm 'LONDON.ABMAS.BIZ'

\end{Verbatim}
 You have successfully made your Samba-3 server a member of the ADS domain using Kerberos protocols.  \index{silent return} \index{failed join} In the event that you receive no output messages, a silent return means that the domain join failed. You should use {\bfseries{ethereal}} to identify what may be failing. Common causes of a failed join include: 
\begin{itemize}
%--- Item
\item 
\index{name resolution!Defective} Defective or misconfigured DNS name resolution.


%--- Item
\item 
\index{Restrictive security} Restrictive security settings on the Windows 200x ADS domain controller preventing needed communications protocols. You can check this by searching the Windows Server 200x Event Viewer.


%--- Item
\item 
Incorrectly configured {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file settings.


%--- Item
\item 
Lack of support of necessary Kerberos protocols because the version of MIT Kerberos (or Heimdal) in use is not up to date enough to support the necessary functionality.

\end{itemize}
 \index{net!rpc!join} \index{RPC} \index{mixed mode} In any case, never execute the {\bfseries{net rpc join}} command in an attempt to join the Samba server to the domain, unless you wish not to use the Kerberos security protocols. Use of the older RPC-based domain join facility requires that Windows Server 200x ADS has been configured appropriately for mixed mode operation.}

\item{\index{tdbdump} \index{/etc/samba/secrets.tdb} If the {\bfseries{tdbdump}} is installed on your system (not essential), you can look inside the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}secrets.\dbz{}tdb}}} file. If you wish to do this, execute: 
\begin{Verbatim}[]

root#  tdbdump secrets.tdb
{
key = "SECRETS/SID/LONDON"
data = "\01\04\00\00\00\00\00\05\15\00\00\00\EBw\86\F1\ED\BD\
   F6{\5C6\E5W\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\
   00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\
   00\00\00\00\00\00\00\00"
}
{
key = "SECRETS/MACHINE_PASSWORD/LONDON"
data = "le3Q5FPnN5.ueC\00"
}
{
key = "SECRETS/MACHINE_SEC_CHANNEL_TYPE/LONDON"
data = "\02\00\00\00"
}
{
key = "SECRETS/MACHINE_LAST_CHANGE_TIME/LONDON"
data = "E\89\F6?"
}

\end{Verbatim}
 This is given to demonstrate to the skeptics that this process truly does work.}

\item{It is now time to start Samba in the usual way (as has been done many time before in this book).}

\item{\index{wbinfo} This is a good time to verify that everything is working. First, check that winbind is able to obtain the list of users and groups from the ADS domain controller. Execute the following: 
\begin{Verbatim}[]

root#  wbinfo -u
LONDON+Administrator
LONDON+Guest
LONDON+SUPPORT_388945a0
LONDON+krbtgt
LONDON+jht

\end{Verbatim}
 Good, the list of users was obtained. Now do likewise for group accounts: 
\begin{Verbatim}[]

root#  wbinfo -g
LONDON+Domain Computers
LONDON+Domain Controllers
LONDON+Schema Admins
LONDON+Enterprise Admins
LONDON+Domain Admins
LONDON+Domain Users
LONDON+Domain Guests
LONDON+Group Policy Creator Owners
LONDON+DnsUpdateProxy

\end{Verbatim}
 Excellent. That worked also, as expected.}

\item{\index{getent} Now repeat this via NSS to validate that full identity resolution is functional as required. Execute: 
\begin{Verbatim}[]

root#  getent passwd
...
LONDON+Administrator:x:10000:10000:Administrator:
             /home/LONDON/administrator:/bin/bash
LONDON+Guest:x:10001:10001:Guest:
             /home/LONDON/guest:/bin/bash
LONDON+SUPPORT_388945a0:x:10002:10000:SUPPORT_388945a0:
             /home/LONDON/support_388945a0:/bin/bash
LONDON+krbtgt:x:10003:10000:krbtgt:
             /home/LONDON/krbtgt:/bin/bash
LONDON+jht:x:10004:10000:John H. Terpstra:
             /home/LONDON/jht:/bin/bash

\end{Verbatim}
 Okay, ADS user accounts are being resolved. Now you try group resolution: 
\begin{Verbatim}[]

root#  getent group
...
LONDON+Domain Computers:x:10002:
LONDON+Domain Controllers:x:10003:
LONDON+Schema Admins:x:10004:LONDON+Administrator
LONDON+Enterprise Admins:x:10005:LONDON+Administrator
LONDON+Domain Admins:x:10006:LONDON+jht,LONDON+Administrator
LONDON+Domain Users:x:10000:
LONDON+Domain Guests:x:10001:
LONDON+Group Policy Creator Owners:x:10007:LONDON+Administrator
LONDON+DnsUpdateProxy:x:10008:

\end{Verbatim}
 This is very pleasing. Everything works as expected.}

\item{\index{net!ads!info} \index{Active Directory!server} \index{Kerberos} You may now perform final verification that communications between Samba-3 winbind and the Active Directory server is using Kerberos protocols. Execute the following: 
\begin{Verbatim}[]

root#  net ads info
LDAP server: 192.168.2.123
LDAP server name: w2k3s
Realm: LONDON.ABMAS.BIZ
Bind Path: dc=LONDON,dc=ABMAS,dc=BIZ
LDAP port: 389
Server time: Sat, 03 Jan 2004 02:44:44 GMT
KDC server: 192.168.2.123
Server time offset: 2

\end{Verbatim}
 It should be noted that Kerberos protocols are time-clock critical. You should keep all server time clocks synchronized using the network time protocol (NTP). In any case, the output we obtained confirms that all systems are operational.}

\item{\index{net!ads!status} There is one more action you elect to take, just because you are paranoid and disbelieving, so you execute the following command: 
\begin{Verbatim}[]

root#  net ads status -UAdministrator%not24get
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: user
objectClass: computer
cn: fran
distinguishedName: CN=fran,CN=Computers,DC=london,DC=abmas,DC=biz
instanceType: 4
whenCreated: 20040103092006.0Z
whenChanged: 20040103092006.0Z
uSNCreated: 28713
uSNChanged: 28717
name: fran
objectGUID: 58f89519-c467-49b9-acb0-f099d73696e
userAccountControl: 69632
badPwdCount: 0
codePage: 0
countryCode: 0
badPasswordTime: 0
lastLogoff: 0
lastLogon: 127175965783327936
localPolicyFlags: 0
pwdLastSet: 127175952062598496
primaryGroupID: 515
objectSid: S-1-5-21-4052121579-2079768045-1474639452-1109
accountExpires: 9223372036854775807
logonCount: 13
sAMAccountName: fran$
sAMAccountType: 805306369
operatingSystem: Samba
operatingSystemVersion: 3.0.20-SUSE
dNSHostName: fran
userPrincipalName: HOST/fran@LONDON.ABMAS.BIZ
servicePrincipalName: CIFS/fran.london.abmas.biz
servicePrincipalName: CIFS/fran
servicePrincipalName: HOST/fran.london.abmas.biz
servicePrincipalName: HOST/fran
objectCategory: CN=Computer,CN=Schema,CN=Configuration,
                              DC=london,DC=abmas,DC=biz
isCriticalSystemObject: FALSE
-------------- Security Descriptor (revision: 1, type: 0x8c14)
owner SID: S-1-5-21-4052121579-2079768045-1474639452-512
group SID: S-1-5-21-4052121579-2079768045-1474639452-513
------- (system) ACL (revision: 4, size: 120, number of ACEs: 2)
------- ACE (type: 0x07, flags: 0x5a, size: 0x38, 
               mask: 0x20, object flags: 0x3)
access SID:  S-1-1-0
access type: AUDIT OBJECT
Permissions:
        [Write All Properties]
------- ACE (type: 0x07, flags: 0x5a, size: 0x38, 
               mask: 0x20, object flags: 0x3)
access SID:  S-1-1-0
access type: AUDIT OBJECT
Permissions:
        [Write All Properties]
------- (user) ACL (revision: 4, size: 1944, number of ACEs: 40)
------- ACE (type: 0x00, flags: 0x00, size: 0x24, mask: 0xf01ff)
access SID:  S-1-5-21-4052121579-2079768045-1474639452-512
access type: ALLOWED
Permissions: [Full Control]
------- ACE (type: 0x00, flags: 0x00, size: 0x18, mask: 0xf01ff)
access SID:  S-1-5-32-548
...
------- ACE (type: 0x05, flags: 0x12, size: 0x38, 
                mask: 0x10, object flags: 0x3)
access SID:  S-1-5-9
access type: ALLOWED OBJECT
Permissions:
        [Read All Properties]
-------------- End Of Security Descriptor

\end{Verbatim}
 And now you have conclusive proof that your Samba-3 ADS domain member server called {\texttt{\docbookhyphenatedot{FRAN}}} is able to communicate fully with the ADS domain controllers.}
\end{enumerate}

Your Samba-3 ADS domain member server is ready for use. During training sessions, you may be asked what is inside the {\texttt{\docbookhyphenatefilename{winbindd\_\dbz{}cache.\dbz{}tdb and winbindd\_\dbz{}idmap.\dbz{}tdb}}} files. Since curiosity just took hold of you, execute the following: 
\begin{Verbatim}[]

root#  tdbdump /var/lib/samba/winbindd_idmap.tdb
{
key = "S-1-5-21-4052121579-2079768045-1474639452-501\00"
data = "UID 10001\00"
}
{
key = "UID 10005\00"
data = "S-1-5-21-4052121579-2079768045-1474639452-1111\00"
}
{
key = "GID 10004\00"
data = "S-1-5-21-4052121579-2079768045-1474639452-518\00"
}
{
key = "S-1-5-21-4052121579-2079768045-1474639452-502\00"
data = "UID 10003\00"
}
...

root#  tdbdump /var/lib/samba/winbindd_cache.tdb
{
key = "UL/LONDON"
data = "\00\00\00\00bp\00\00\06\00\00\00\0DAdministrator\0D
   Administrator-S-1-5-21-4052121579-2079768045-1474639452-500-
   S-1-5-21-4052121579-2079768045-1474639452-513\05Guest\05
   Guest-S-1-5-21-4052121579-2079768045-1474639452-501-
   S-1-5-21-4052121579-2079768045-1474639452-514\10
   SUPPORT_388945a0\10SUPPORT_388945a0.
   S-1-5-21-4052121579-2079768045-1474639452-1001-
   S-1-5-21-4052121579-2079768045-1474639452-513\06krbtgt\06
   krbtgt-S-1-5-21-4052121579-2079768045-1474639452-502-
   S-1-5-21-4052121579-2079768045-1474639452-513\03jht\10
   John H. Terpstra.S-1-5-21-4052121579-2079768045-1474639452-1110-
   S-1-5-21-4052121579-2079768045-1474639452-513"
}
{
key = "GM/S-1-5-21-4052121579-2079768045-1474639452-512"
data = "\00\00\00\00bp\00\00\02\00\00\00.
   S-1-5-21-4052121579-2079768045-1474639452-1110\03
   jht\01\00\00\00-S-1-5-21-4052121579-2079768045-1474639452-500\0D
   Administrator\01\00\00\00"
}
{
key = "SN/S-1-5-21-4052121579-2079768045-1474639452-513"
data = "\00\00\00\00xp\00\00\02\00\00\00\0CDomain Users"
}
{
key = "GM/S-1-5-21-4052121579-2079768045-1474639452-518"
data = "\00\00\00\00bp\00\00\01\00\00\00-
   S-1-5-21-4052121579-2079768045-1474639452-500\0D
   Administrator\01\00\00\00"
}
{
key = "SEQNUM/LONDON\00"
data = "xp\00\00C\92\F6?"
}
{
key = "U/S-1-5-21-4052121579-2079768045-1474639452-1110"
data = "\00\00\00\00xp\00\00\03jht\10John H. Terpstra.
   S-1-5-21-4052121579-2079768045-1474639452-1110-
   S-1-5-21-4052121579-2079768045-1474639452-513"
}
{
key = "NS/S-1-5-21-4052121579-2079768045-1474639452-502"
data = "\00\00\00\00bp\00\00-
   S-1-5-21-4052121579-2079768045-1474639452-502"
}
{
key = "SN/S-1-5-21-4052121579-2079768045-1474639452-1001"
data = "\00\00\00\00bp\00\00\01\00\00\00\10SUPPORT_388945a0"
}
{
key = "SN/S-1-5-21-4052121579-2079768045-1474639452-500"
data = "\00\00\00\00bp\00\00\01\00\00\00\0DAdministrator"
}
{
key = "U/S-1-5-21-4052121579-2079768045-1474639452-502"
data = "\00\00\00\00bp\00\00\06krbtgt\06krbtgt-
   S-1-5-21-4052121579-2079768045-1474639452-502-
   S-1-5-21-4052121579-2079768045-1474639452-513"
}
....

\end{Verbatim}
 Now all is revealed. Your curiosity, as well as that of your team, has been put at ease. May this server serve well all who happen upon it.

\begin{example}%
\hypertarget{ch9-adssdm}{}%
\captionswapskip{}{{\caption{Samba Domain Member smb.\dbz{}conf File for Active Directory Membership}\label{ch9-adssdm}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	unix charset = LOCALE
 	workgroup = LONDON
 	realm = LONDON.ABMAS.BIZ
 	server string = Samba 3.0.20
 	security = ADS
 	username map = /etc/samba/smbusers
 	log level = 1
 	syslog = 0
 	log file = /var/log/samba/%m
 	max log size = 50
 	printcap name = CUPS
 	ldap ssl = no
 	idmap uid = 10000-20000
 	idmap gid = 10000-20000
 	template primary group = "Domain Users"
 	template shell = /bin/bash
 	winbind separator = +
 	printing = cups
 [homes]
 	comment = Home Directories
 	valid users = %S
 	read only = No
 	browseable = No
 [printers]
 	comment = SMB Print Spool
 	path = /var/spool/samba
 	guest ok = Yes
 	printable = Yes
 	browseable = No
 [print$]
 	comment = Printer Drivers
 	path = /var/lib/samba/drivers
 	admin users = root, Administrator
 	write list = root
\end{lstlisting}
\end{example}

\subsubsection{IDMAP\_RID with Winbind}
\label{id2547910}\hypertarget{id2547910}{}%

\index{idmap\_rid} \index{SID} \index{RID} \index{IDMAP} The {\bfseries{idmap\_rid}} facility is a new tool that, unlike native winbind, creates a predictable mapping of MS Windows SIDs to UNIX UIDs and GIDs. The key benefit of this method of implementing the Samba IDMAP facility is that it eliminates the need to store the IDMAP data in a central place. The downside is that it can be used only within a single ADS domain and is not compatible with trusted domain implementations.

\index{SID} \index{allow trusted domains} \index{idmap uid} \index{idmap gid} This alternate method of SID to UID/GID mapping can be achieved with the idmap\_rid plug-in. This plug-in uses the RID of the user SID to derive the UID and GID by adding the RID to a base value specified. This utility requires that the parameter {``}allow trusted domains = No{''} must be specified, as it is not compatible with multiple domain environments. The {\ttfamily\itshape{\docbookhyphenatedot{idmap uid}}} and {\ttfamily\itshape{\docbookhyphenatedot{idmap gid}}} ranges must be specified.

\index{idmap\_rid} \index{realm} The idmap\_rid facility can be used both for NT4/Samba-style domains as well as with Active Directory. To use this with an NT4 domain, the {\ttfamily\itshape{\docbookhyphenatedot{realm}}} is not used. Additionally the method used to join the domain uses the {\texttt{\docbookhyphenatedot{net rpc join}}} process.

An example {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file for an ADS domain environment is shown in \hyperlink{sbe-idmapridex}{Example {\ref{sbe-idmapridex}}}.

\begin{example}%
\hypertarget{sbe-idmapridex}{}%
\captionswapskip{}{{\caption{Example smb.\dbz{}conf File Using idmap\_rid}\label{sbe-idmapridex}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	workgroup = KPAK
 	netbios name = BIGJOE
 	realm = CORP.KPAK.COM
 	server string = Office Server
 	security = ADS
 	allow trusted domains = No
 	idmap backend = idmap_rid:KPAK=500-100000000
 	idmap uid = 500-100000000
 	idmap gid = 500-100000000
 	template shell = /bin/bash
 	winbind use default domain = Yes
 	winbind enum users = No
 	winbind enum groups = No
 	winbind nested groups = Yes
 	printer admin = "KPAK\Domain Admins"
\end{lstlisting}
\end{example}


\index{large domain} \index{Active Directory} \index{response} \index{getent} In a large domain with many users, it is imperative to disable enumeration of users and groups. For example, at a site that has 22,000 users in Active Directory the winbind-based user and group resolution is unavailable for nearly 12 minutes following first start-up of {\bfseries{winbind}}. Disabling of such enumeration results in instantaneous response. The disabling of user and group enumeration means that it will not be possible to list users or groups using the {\bfseries{getent passwd}} and {\bfseries{getent group}} commands. It will be possible to perform the lookup for individual users, as shown in the procedure below.

\index{NSS} \index{/etc/nsswitch.conf} The use of this tool requires configuration of NSS as per the native use of winbind. Edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} so it has the following parameters: 
\begin{Verbatim}[]

...
passwd: files winbind
shadow: files winbind
group:  files winbind
...
hosts:  files wins
...

\end{Verbatim}


The following procedure can be used to utilize the idmap\_rid facility:
\begin{enumerate}

\item{Create or install and {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file with the above configuration.}

\item{Edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file as shown above.}

\item{Execute: 
\begin{Verbatim}[]

root#  net ads join -UAdministrator%password
Using short domain name -- KPAK
Joined 'BIGJOE' to realm 'CORP.KPAK.COM'

\end{Verbatim}
  \index{failed join} An invalid or failed join can be detected by executing: 
\begin{Verbatim}[]

root#  net ads testjoin
BIGJOE$@'s password:
[2004/11/05 16:53:03, 0] utils/net_ads.c:ads_startup(186)
  ads_connect: No results returned
Join to domain is not valid

\end{Verbatim}
 The specific error message may differ from the above because it depends on the type of failure that may have occurred. Increase the {\ttfamily\itshape{\docbookhyphenatedot{log level}}} to 10, repeat the above test, and then examine the log files produced to identify the nature of the failure.}

\item{Start the {\bfseries{nmbd}}, {\bfseries{winbind,}} and {\bfseries{smbd}} daemons in the order shown.}

\item{Validate the operation of this configuration by executing: \index{} 
\begin{Verbatim}[]

root#  getent passwd administrator
administrator:x:1000:1013:Administrator:/home/BE/administrator:/bin/bash

\end{Verbatim}
}
\end{enumerate}
\subsubsection{IDMAP Storage in LDAP using Winbind}
\label{id2548373}\hypertarget{id2548373}{}%

\index{ADAM} \index{ADS} The storage of IDMAP information in LDAP can be used with both NT4/Samba-3-style domains as well as with ADS domains. OpenLDAP is a commonly used LDAP server for this purpose, although any standards-compliant LDAP server can be used. It is therefore possible to deploy this IDMAP configuration using the Sun iPlanet LDAP server, Novell eDirectory, Microsoft ADS plus ADAM, and so on.

The example in \hyperlink{sbeunxa}{Example {\ref{sbeunxa}}} is for an ADS-style domain.

\begin{example}%
\hypertarget{sbeunxa}{}%
\captionswapskip{}{{\caption{Typical ADS Style Domain smb.\dbz{}conf File}\label{sbeunxa}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	workgroup = SNOWSHOW
 	netbios name = GOODELF
 	realm = SNOWSHOW.COM
 	server string = Samba Server
 	security = ADS
 	log level = 1 ads:10 auth:10 sam:10 rpc:10
 	ldap admin dn = cn=Manager,dc=SNOWSHOW,dc=COM
 	ldap idmap suffix = ou=Idmap
 	ldap suffix = dc=SNOWSHOW,dc=COM
 	idmap backend = ldap:ldap://ldap.snowshow.com
 	idmap uid = 150000-550000
 	idmap gid = 150000-550000
 	template shell = /bin/bash
 	winbind use default domain = Yes
\end{lstlisting}
\end{example}


\index{realm} In the case of an NT4 or Samba-3-style domain the {\ttfamily\itshape{\docbookhyphenatedot{realm}}} is not used, and the command used to join the domain is {\bfseries{net rpc join}}. The above example also demonstrates advanced error reporting techniques that are documented in the chapter called "Reporting Bugs" in {``}The Official Samba-3 HOWTO and Reference Guide, Second Edition{''} (TOSHARG2).

\index{MIT kerberos} \index{Heimdal kerberos} \index{/etc/krb5.conf} Where MIT kerberos is installed (version 1.3.4 or later), edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}krb5.\dbz{}conf}}} file so it has the following contents: 
\begin{Verbatim}[]

[logging]
 default = FILE:/var/log/krb5libs.log
 kdc = FILE:/var/log/krb5kdc.log
 admin_server = FILE:/var/log/kadmind.log

[libdefaults]
 default_realm = SNOWSHOW.COM
 dns_lookup_realm = false
 dns_lookup_kdc = true

[appdefaults]
 pam = {
   debug = false
   ticket_lifetime = 36000
   renew_lifetime = 36000
   forwardable = true
   krb4_convert = false
 }

\end{Verbatim}


Where Heimdal kerberos is installed, edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}krb5.\dbz{}conf}}} file so it is either empty (i.e., no contents) or it has the following contents: 
\begin{Verbatim}[]

[libdefaults]
        default_realm = SNOWSHOW.COM
        clockskew = 300

[realms]
        SNOWSHOW.COM = {
                kdc = ADSDC.SHOWSHOW.COM
        }

[domain_realm]
        .snowshow.com = SNOWSHOW.COM

\end{Verbatim}


\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

Samba cannot use the Heimdal libraries if there is no {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}krb5.\dbz{}conf}}} file. So long as there is an empty file, the Heimdal kerberos libraries will be usable. There is no need to specify any settings because Samba, using the Heimdal libraries, can figure this out automatically.
\end{admonition}


Edit the NSS control file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} so it has the following entries: 
\begin{Verbatim}[]

...
passwd: files ldap
shadow: files ldap
group:  files ldap
...
hosts:  files wins
...

\end{Verbatim}


\index{PADL} \index{/etc/ldap.conf} You will need the PADL\label{id2548673}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.padl.com}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2548673} {\bfseries{nss\_ldap}} tool set for this solution. Configure the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}} file so it has the information needed. The following is an example of a working file: 
\begin{Verbatim}[]

host    192.168.2.1
base    dc=snowshow,dc=com
binddn  cn=Manager,dc=snowshow,dc=com
bindpw  not24get

pam_password exop

nss_base_passwd ou=People,dc=snowshow,dc=com?one
nss_base_shadow ou=People,dc=snowshow,dc=com?one
nss_base_group  ou=Groups,dc=snowshow,dc=com?one
ssl     no

\end{Verbatim}


The following procedure may be followed to affect a working configuration:
\begin{enumerate}

\item{Configure the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file as shown above.}

\item{Create the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}krb5.\dbz{}conf}}} file following the indications above.}

\item{Configure the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file as shown above.}

\item{Download, build, and install the PADL nss\_ldap tool set. Configure the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}} file as shown above.}

\item{Configure an LDAP server and initialize the directory with the top-level entries needed by IDMAP as shown in the following LDIF file: 
\begin{Verbatim}[]

dn: dc=snowshow,dc=com
objectClass: dcObject
objectClass: organization
dc: snowshow
o: The Greatest Snow Show in Singapore.
description: Posix and Samba LDAP Identity Database

dn: cn=Manager,dc=snowshow,dc=com
objectClass: organizationalRole
cn: Manager
description: Directory Manager

dn: ou=Idmap,dc=snowshow,dc=com
objectClass: organizationalUnit
ou: idmap

\end{Verbatim}
}

\item{Execute the command to join the Samba domain member server to the ADS domain as shown here: 
\begin{Verbatim}[]

root#  net ads testjoin
Using short domain name -- SNOWSHOW
Joined 'GOODELF' to realm 'SNOWSHOW.COM'

\end{Verbatim}
}

\item{Store the LDAP server access password in the Samba {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file as follows: 
\begin{Verbatim}[]

root#  smbpasswd -w not24get

\end{Verbatim}
}

\item{Start the {\bfseries{nmbd}}, {\bfseries{winbind}}, and {\bfseries{smbd}} daemons in the order shown.}
\end{enumerate}

\index{diagnostic} Follow the diagnostic procedures shown earlier in this chapter to identify success or failure of the join. In many cases a failure is indicated by a silent return to the command prompt with no indication of the reason for failure.
\subsubsection{IDMAP and NSS Using LDAP from ADS with RFC2307bis Schema Extension}
\label{id2548887}\hypertarget{id2548887}{}%

\index{rfc2307bis} \index{schema} The use of this method is messy. The information provided in this section is for guidance only and is very definitely not complete. This method does work; it is used in a number of large sites and has an acceptable level of performance.

An example {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file is shown in \hyperlink{sbewinbindex}{Example {\ref{sbewinbindex}}}.

\begin{example}%
\hypertarget{sbewinbindex}{}%
\captionswapskip{}{{\caption{ADS Membership Using RFC2307bis Identity Resolution smb.\dbz{}conf File}\label{sbewinbindex}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	workgroup = BUBBAH
 	netbios name = MADMAX
 	realm = BUBBAH.COM
 	server string = Samba Server
 	security = ADS
 	idmap uid = 150000-550000
 	idmap gid = 150000-550000
 	template shell = /bin/bash
 	winbind use default domain = Yes
 	winbind trusted domains only = Yes
 	winbind nested groups = Yes
\end{lstlisting}
\end{example}


\index{nss\_ldap} The DMS must be joined to the domain using the usual procedure. Additionally, it is necessary to build and install the PADL nss\_ldap tool set. Be sure to build this tool set with the following: 
\begin{Verbatim}[]

./configure --enable-rfc2307bis --enable-schema-mapping
make install

\end{Verbatim}


\index{/etc/nsswitch.conf} The following {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file contents are required: 
\begin{Verbatim}[]

...
passwd: files ldap
shadow: files ldap
group:  files ldap
...
hosts:  files wins
...

\end{Verbatim}


\index{/etc/ldap.conf} \index{nss\_ldap} The {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}} file must be configured also. Refer to the PADL documentation and source code for nss\_ldap instructions.

The next step involves preparation on the ADS schema. This is briefly discussed in the remaining part of this chapter.
\subparagraph*{IDMAP, Active Directory, and MS Services for UNIX 3.5}
\label{id2549107}\hypertarget{id2549107}{}%

\index{SFU} The Microsoft Windows Service for UNIX version 3.5 is available for free download\label{id2549126}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.microsoft.com/windows/sfu/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2549126} from the Microsoft Web site. You will need to download this tool and install it following Microsoft instructions.
\subparagraph*{IDMAP, Active Directory, and AD4UNIX}
\label{id2549138}\hypertarget{id2549138}{}%

Instructions for obtaining and installing the AD4UNIX tool set can be found from the Geekcomix\label{id2549149}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.geekcomix.com/cgi-bin/classnotes/wiki.pl?LDAP01/An_Alternative_Approach}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2549149} Web site.
\subsection{UNIX/Linux Client Domain Member}
\label{id2549162}\hypertarget{id2549162}{}%

\index{user credentials} So far this chapter has been mainly concerned with the provision of file and print services for domain member servers. However, an increasing number of UNIX/Linux workstations are being installed that do not act as file or print servers to anyone other than a single desktop user. The key demand for desktop systems is to be able to log onto any UNIX/Linux or Windows desktop using the same network user credentials.

\index{Single Sign-On|textit{see} {SSO} } The ability to use a common set of user credential across a variety of network systems is generally regarded as a single sign-on (SSO) solution. SSO systems are sold by a large number of vendors and include a range of technologies such as:

\begin{itemize}
%--- Item
\item 
Proxy sign-on


%--- Item
\item 
Federated directory provisioning


%--- Item
\item 
Metadirectory server solutions


%--- Item
\item 
Replacement authentication systems

\end{itemize}

\index{Identity management} There are really four solutions that provide integrated authentication and user identity management facilities:

\begin{itemize}
%--- Item
\item 
Samba winbind (free). Samba-3.0.20 introduced a complete replacement for Winbind that now provides a greater level of scalability in large ADS environments.


%--- Item
\item 
PADL\label{id2549260}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.padl.com}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2549260} PAM and LDAP tools (free).


%--- Item
\item 
Vintela\label{id2549272}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.vintela.com}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2549272} Authentication Services (commercial).


%--- Item
\item 
Centrify\label{id2549284}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.centrify.com}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2549284} DirectControl (commercial). Centrify's commercial product allows UNIX and Linux systems to use Active Directory security, directory and policy services. Enhancements include a centralized ID mapping that allows Samba, DirectControl and Active Directory to seamlessly work together.

\end{itemize}

The following guidelines are pertinent to the deployment of winbind-based authentication and identity resolution with the express purpose of allowing users to log on to UNIX/Linux desktops using Windows network domain user credentials (username and password).

You should note that it is possible to use LDAP-based PAM and NSS tools to permit distributed systems logons (SSO), providing user and group accounts are stored in an LDAP directory. This provides logon services for UNIX/Linux users, while Windows users obtain their sign-on support via Samba-3.

\index{Windows Services for UNIX|textit{see} {SUS} } On the other hand, if the authentication and identity resolution backend must be provided by a Windows NT4-style domain or from an Active Directory Domain that does not have the Microsoft Windows Services for UNIX installed, winbind is your best friend. Specific guidance for these situations now follows.

\index{PAM} \index{Identity resolution} \index{NSS} To permit users to log on to a Linux system using Windows network credentials, you need to configure identity resolution (NSS) and PAM. This means that the basic steps include those outlined above with the addition of PAM configuration. Given that most workstations (desktop/client) usually do not need to provide file and print services to a group of users, the configuration of shares and printers is generally less important. Often this allows the share specifications to be entirely removed from the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file. That is obviously an administrator decision.
\subsubsection{NT4 Domain Member}
\label{id2549374}\hypertarget{id2549374}{}%

The following steps provide a Linux system that users can log onto using Windows NT4 (or Samba-3) domain network credentials:
\begin{enumerate}

\item{Follow the steps outlined in \hyperlink{wdcsdm}{Section {\ref{wdcsdm}}} and ensure that all validation tests function as shown.}

\item{Identify what services users must log on to. On Red Hat Linux, if it is intended that the user shall be given access to all services, it may be most expeditious to simply configure the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}pam.\dbz{}d/\dbz{}system-\dbz{}auth}}}.}

\item{Carefully make a backup copy of all PAM configuration files before you begin making changes. If you break the PAM configuration, please note that you may need to use an emergency boot process to recover your Linux system. It is possible to break the ability to log into the system if PAM files are incorrectly configured. The entire directory {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}pam.\dbz{}d}}} should be backed up to a safe location.}

\item{If you require only console login support, edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}pam.\dbz{}d/\dbz{}login}}} so it matches \hyperlink{ch9-pamwnbdlogin}{Example {\ref{ch9-pamwnbdlogin}}}.}

\item{To provide the ability to log onto the graphical desktop interface, you must edit the files {\texttt{\docbookhyphenatefilename{gdm}}} and {\texttt{\docbookhyphenatefilename{xdm}}} in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}pam.\dbz{}d}}} directory.}

\item{Edit only one file at a time. Carefully validate its operation before attempting to reboot the machine.}
\end{enumerate}
\subsubsection{ADS Domain Member}
\label{id2549495}\hypertarget{id2549495}{}%

This procedure should be followed to permit a Linux network client (workstation/desktop) to permit users to log on using Microsoft Active Directory-based user credentials.
\begin{enumerate}

\item{Follow the steps outlined in \hyperlink{adssdm}{Section {\ref{adssdm}}} and ensure that all validation tests function as shown.}

\item{Identify what services users must log on to. On Red Hat Linux, if it is intended that the user shall be given access to all services, it may be most expeditious to simply configure the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}pam.\dbz{}d/\dbz{}system-\dbz{}auth}}} as shown in \hyperlink{ch9-rhsysauth}{Example {\ref{ch9-rhsysauth}}}.}

\item{Carefully make a backup copy of all PAM configuration files before you begin making changes. If you break the PAM configuration, please note that you may need to use an emergency boot process to recover your Linux system. It is possible to break the ability to log into the system if PAM files are incorrectly configured. The entire directory {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}pam.\dbz{}d}}} should be backed up to a safe location.}

\item{If you require only console login support, edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}pam.\dbz{}d/\dbz{}login}}} so it matches \hyperlink{ch9-pamwnbdlogin}{Example {\ref{ch9-pamwnbdlogin}}}.}

\item{To provide the ability to log onto the graphical desktop interface, you must edit the files {\texttt{\docbookhyphenatefilename{gdm}}} and {\texttt{\docbookhyphenatefilename{xdm}}} in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}pam.\dbz{}d}}} directory.}

\item{Edit only one file at a time. Carefully validate its operation before attempting to reboot the machine.}
\end{enumerate}

\begin{example}%
\hypertarget{ch9-pamwnbdlogin}{}%
\captionswapskip{}{{\caption{SUSE: PAM login Module Using Winbind}\label{ch9-pamwnbdlogin}}}
\captionswapskip{}
\begin{Verbatim}[]

# /etc/pam.d/login

#%PAM-1.0
auth sufficient pam_unix2.so    nullok
auth sufficient pam_winbind.so use_first_pass use_authtok
auth required   pam_securetty.so
auth required   pam_nologin.so
auth required   pam_env.so
auth required   pam_mail.so
account sufficient      pam_unix2.so
account sufficient      pam_winbind.so user_first_pass use_authtok
password required       pam_pwcheck.so  nullok
password sufficient     pam_unix2.so    nullok use_first_pass use_authtok
password sufficient     pam_winbind.so  use_first_pass use_authtok
session sufficient      pam_unix2.so    none
session sufficient      pam_winbind.so  use_first_pass use_authtok
session required        pam_limits.so

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{ch9-pamwbndxdm}{}%
\captionswapskip{}{{\caption{SUSE: PAM xdm Module Using Winbind}\label{ch9-pamwbndxdm}}}
\captionswapskip{}
\begin{Verbatim}[]

# /etc/pam.d/gdm (/etc/pam.d/xdm)

#%PAM-1.0
auth     sufficient     pam_unix2.so     nullok
auth     sufficient     pam_winbind.so   use_first_pass use_authtok
account  sufficient     pam_unix2.so
account  sufficient     pam_winbind.so   use_first_pass use_authtok
password sufficient     pam_unix2.so
password sufficient     pam_winbind.so   use_first_pass use_authtok
session  sufficient     pam_unix2.so
session  sufficient     pam_winbind.so   use_first_pass use_authtok
session  required       pam_dev perm.so
session  required       pam_resmgr.so

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{ch9-rhsysauth}{}%
\captionswapskip{}{{\caption{Red Hat 9: PAM System Authentication File: /\dbz{}etc/\dbz{}pam.\dbz{}d/\dbz{}system-\dbz{}auth Module Using Winbind}\label{ch9-rhsysauth}}}
\captionswapskip{}
\begin{Verbatim}[]

#%PAM-1.0
auth        required      /lib/security/$ISA/pam_env.so
auth        sufficient    /lib/security/$ISA/pam_unix.so likeauth nullok
auth        sufficient    /lib/security/$ISA/pam_winbind.so use_first_pass
auth        required      /lib/security/$ISA/pam_deny.so

account     required      /lib/security/$ISA/pam_unix.so
account     sufficient    /lib/security/$ISA/pam_winbind.so use_first_pass

password    required      /lib/security/$ISA/pam_cracklib.so retry=3 type=
# Note: The above line is complete. There is nothing following the '='
password    sufficient    /lib/security/$ISA/pam_unix.so \
                                             nullok use_authtok md5 shadow
password    sufficient    /lib/security/$ISA/pam_winbind.so use_first_pass
password    required      /lib/security/$ISA/pam_deny.so

session     required      /lib/security/$ISA/pam_limits.so
session     sufficient    /lib/security/$ISA/pam_unix.so
session     sufficient    /lib/security/$ISA/pam_winbind.so use_first_pass

\end{Verbatim}
\end{example}

\subsection{Key Points Learned}
\label{id2549732}\hypertarget{id2549732}{}%

The addition of UNIX/Linux Samba servers and clients is a common requirement. In this chapter, you learned how to integrate such servers so that the UID/GID mappings they use can be consistent across all domain member servers. You also discovered how to implement the ability to use Samba or Windows domain account credentials to log on to a UNIX/Linux client.

The following are key points made in this chapter:

\begin{itemize}
%--- Item
\item 
Domain controllers are always authoritative for the domain.


%--- Item
\item 
Domain members may have local accounts and must be able to resolve the identity of domain user accounts. Domain user account identity must map to a local UID/GID. That local UID/GID can be stored in LDAP. This way, it is possible to share the IDMAP data across all domain member machines.


%--- Item
\item 
Resolution of user and group identities on domain member machines may be implemented using direct LDAP services or using winbind.


%--- Item
\item 
On NSS/PAM enabled UNIX/Linux systems, NSS is responsible for identity management and PAM is responsible for authentication of logon credentials (username and password).

\end{itemize}

% ------------------------   
% Section 
\section{Questions and Answers}
\label{id2549789}\hypertarget{id2549789}{}%

The following questions were obtained from the mailing list and also from private discussions with Windows network administrators.
% -------------------------------------------------------------
% QandASet                                                     
% -------------------------------------------------------------
\subsection*{F.A.Q.}
\label{id2549802}
\vspace{1em}
\noindent{}1.~\textbf{Q:}~\textit{We use NIS for all UNIX accounts. Why do we need winbind?}
\newline
\noindent\textbf{A:}~
\index{NIS} \index{encrypted passwords} \index{smbpasswd} \index{tdbsam} \index{passdb backend} \index{Winbind} You can use NIS for your UNIX accounts. NIS does not store the Windows encrypted passwords that need to be stored in one of the acceptable passdb backends. Your choice of backend is limited to {\ttfamily\itshape{\docbookhyphenatedot{smbpasswd}}} or {\ttfamily\itshape{\docbookhyphenatedot{tdbsam}}}. Winbind is needed to handle the resolution of SIDs from trusted domains to local UID/GID values.

\index{winbind trusted domains only} \index{getpwnam()} On a domain member server, you effectively map Windows domain users to local users that are in your NIS database by specifying the {\ttfamily\itshape{\docbookhyphenatedot{winbind trusted domains only}}}. This causes user and group account lookups to be routed via the {\bfseries{getpwnam()}} family of systems calls. On an NIS-enabled client, this pushes the resolution of users and groups out through NIS.

As a general rule, it is always a good idea to run winbind on all Samba servers.


\vspace{1em}
\vspace{1em}
\noindent{}2.~\textbf{Q:}~\textit{Our IT management people do not like LDAP but are looking at Microsoft Active Directory. Which is better?\index{Active Directory}}
\newline
\noindent\textbf{A:}~
\index{LDAP!server}\index{Kerberos}\index{schema} Microsoft Active Directory is an LDAP server that is intricately tied to a Kerberos infrastructure. Most IT managers who object to LDAP do so because an LDAP server is most often supplied as a raw tool that needs to be configured and for which the administrator must create the schema, create the administration tools, and devise the backup and recovery facilities in a site-dependent manner. LDAP servers in general are seen as a high-energy, high-risk facility.

\index{management} Microsoft Active Directory by comparison is easy to install and configure and is supplied with all tools necessary to implement and manage the directory. For sites that lack a lot of technical competence, Active Directory is a good choice. For sites that have the technical competence to handle Active Directory well, LDAP is a good alternative. The real issue is, What type of solution does the site want? If management wants a choice to use an alternative, they may want to consider the options. On the other hand, if management just wants a solution that works, Microsoft Active Directory is a good solution.


\vspace{1em}
\vspace{1em}
\noindent{}3.~\textbf{Q:}~\textit{We want to implement a Samba PDC, four Samba BDCs, and 10 Samba servers. Is it possible to use NIS in place of LDAP?}
\newline
\noindent\textbf{A:}~
\index{NIS}\index{LDAP}\index{encrypted passwords}\index{synchronized}\index{secure account password}\index{PDC}\index{BDC} Yes, it is possible to use NIS in place of LDAP, but there may be problems with keeping the Windows (SMB) encrypted passwords database correctly synchronized across the entire network. Workstations (Windows client machines) periodically change their domain membership secure account password. How can you keep changes that are on remote BDCs synchronized on the PDC?

\index{centralized storage}\index{management}\index{network Identities} LDAP is a more elegant solution because it permits centralized storage and management of all network identities (user, group, and machine accounts) together with all information Samba needs to provide to network clients and their users.


\vspace{1em}
\vspace{1em}
\noindent{}4.~\textbf{Q:}~\textit{Are you suggesting that users should not log on to a domain member server? If so, why?}
\newline
\noindent\textbf{A:}~
\index{security}\index{data!integrity}\index{mapped drives} Many UNIX administrators mock the model that the personal computer industry has adopted as normative since the early days of Novell NetWare. The old perception of the necessity to keep users off file and print servers was a result of fears concerning the security and integrity of data. It was a simple and generally effective measure to keep users away from servers, except through mapped drives.

\index{user logins}\index{risk}\index{user errors}\index{strategy}\index{policy} UNIX administrators are fully correct in asserting that UNIX servers and workstations are identical in terms of the software that is installed. They correctly assert that in a well-secured environment it is safe to store files on a system that has hundreds of users. But all network administrators must factor into the decision to allow or reject general user logins to a UNIX system that is principally a file and print server the risk to operations through simple user errors. Only then can one begin to appraise the best strategy and adopt a site-specific policy that best protects the needs of users and of the organization alike.

\index{system level logins} From experience, it is my recommendation to keep general system-level logins to a practical minimum and to eliminate them if possible. This should not be taken as a hard rule, though. The better question is, what works best for the site?


\vspace{1em}
\vspace{1em}
\noindent{}5.~\textbf{Q:}~\textit{\index{trusted domains}\index{domain!trusted}\index{winbind trusted domains only}\index{domain members} We want to ensure that only users from our own domain plus from trusted domains can use our Samba servers. In the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file on all servers, we have enabled the {\ttfamily\itshape{\docbookhyphenatedot{winbind trusted domains only}}} parameter. We now find that users from trusted domains cannot access our servers, and users from Windows clients that are not domain members can also access our servers. Is this a Samba bug?}
\newline
\noindent\textbf{A:}~
\index{distributed}\index{NIS}\index{rsync}\index{LDAP}\index{winbindd}\index{/etc/passwd} The manual page for this {\ttfamily\itshape{\docbookhyphenatedot{winbind trusted domains only}}} parameter says, {``}This parameter is designed to allow Samba servers that are members of a Samba-controlled domain to use UNIX accounts distributed vi NIS, rsync, or LDAP as the UIDs for winbindd users in the hosts primary domain. Therefore, the user {\texttt{\docbookhyphenatedot{SAMBA\textbackslash user1}}} would be mapped to the account {\texttt{\docbookhyphenatedot{user1}}} in {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} instead of allocating a new UID for him or her.{''} This clearly suggests that you are trying to use this parameter inappropriately.

\index{valid users} A far better solution is to use the {\ttfamily\itshape{\docbookhyphenatedot{valid users}}} by specifying precisely the domain users and groups that should be permitted access to the shares. You could, for example, set the following parameters: 
\begin{Verbatim}[]

[demoshare]
	path = /export/demodata
	valid users = @"Domain Users", @"OTHERDOMAIN\Domain Users"

\end{Verbatim}



\vspace{1em}
\vspace{1em}
\noindent{}6.~\textbf{Q:}~\textit{What are the benefits of using LDAP for my domain member servers?}
\newline
\noindent\textbf{A:}~
\index{LDAP}\index{benefit}\index{UID}\index{GID}\index{Domain Controllers}\index{Domain Member servers}\index{copy}\index{replicate}\index{identity} The key benefit of using LDAP is that the UID of all users and the GID of all groups are globally consistent on domain controllers as well as on domain member servers. This means that it is possible to copy/replicate files across servers without loss of identity.

\index{Identity resolution}\index{winbind}\index{IDMAP backend}\index{LDAP}\index{Domain Controllers}\index{Domain Member!servers}\index{Posix}\index{account information} When use is made of account identity resolution via winbind, even when an IDMAP backend is stored in LDAP, the UID/GID on domain member servers is consistent, but differs from the ID that the user/group has on domain controllers. The winbind allocated UID/GID that is stored in LDAP (or locally) will be in the numeric range specified in the {\ttfamily\itshape{\docbookhyphenatedot{idmap uid/gid}}} in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file. On domain controllers, the UID/GID is that of the POSIX value assigned in the LDAP directory as part of the POSIX account information.


\vspace{1em}
\vspace{1em}
\noindent{}7.~\textbf{Q:}~\textit{Is proper DNS operation necessary for Samba-3 plus LDAP? If so, what must I put into my DNS configuration?}
\newline
\noindent\textbf{A:}~
\index{DNS!configuration}\index{DNS!lookup}\index{hosts}\index{/etc/nsswitch.conf}\index{NSS}\index{/etc/hosts}\index{WINS!lookup} Samba depends on correctly functioning resolution of hostnames to their IP address. Samba makes no direct DNS lookup calls, but rather redirects all name-to-address calls via the {\bfseries{getXXXbyXXX()}} function calls. The configuration of the {\texttt{\docbookhyphenatedot{hosts}}} entry in the NSS {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file determines how the underlying resolution process is implemented. If the {\texttt{\docbookhyphenatedot{hosts}}} entry in your NSS control file says: 
\begin{Verbatim}[]

hosts: files dns wins

\end{Verbatim}
 this means that a hostname lookup first tries the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}}. If this fails to resolve, it attempts a DNS lookup, and if that fails, it tries a WINS lookup.

\index{NetBIOS}\index{TCP/IP}\index{name resolution} The addition of the WINS-based name lookup makes sense only if NetBIOS over TCP/IP has been enabled on all Windows clients. Where NetBIOS over TCP/IP has been disabled, DNS is the preferred name resolution technology. This usually makes most sense when Samba is a client of an Active Directory domain, where NetBIOS use has been disabled. In this case, the Windows 200x autoregisters all locator records it needs with its own DNS server or servers.


\vspace{1em}
\vspace{1em}
\noindent{}8.~\textbf{Q:}~\textit{Our Windows 2003 Server Active Directory domain runs with NetBIOS disabled. Can we use Samba-3 with that configuration?}
\newline
\noindent\textbf{A:}~
Yes.


\vspace{1em}
\vspace{1em}
\noindent{}9.~\textbf{Q:}~\textit{\index{net!ads!join}\index{net!rpc!join} When I tried to execute net ads join, I got no output. It did not work, so I think that it failed. I then executed net rpc join and that worked fine. That is okay, isn't it?}
\newline
\noindent\textbf{A:}~
\index{Kerberos}\index{authentication} No. This is not okay. It means that your Samba-3 client has joined the ADS domain as a Windows NT4 client, and Samba-3 will not be using Kerberos-based authentication.


\vspace{1em}
\cleardoublepage 
% -------------------------------------------------------------
% Chapter Updating Samba-3 
% ------------------------------------------------------------- 	
\chapter{Updating Samba-3}
\label{upgrades}\hypertarget{upgrades}{}%

\index{migrate} \index{install} It was a little difficult to select an appropriate title for this chapter. From email messages on the Samba mailing lists it is clear that many people consider the updating and upgrading of Samba to be a migration matter. Others talk about migrating Samba servers when in fact the issue at hand is one of installing a new Samba server to replace an older existing Samba server.

\index{smbpasswd} \index{passdb backend} There has also been much talk about migration of Samba-3 from an smbpasswd passdb backend to the use of the tdbsam or ldapsam facilities that are new to Samba-3.

Clearly, there is not a great deal of clarity in the terminology that various people apply to these modes by which Samba servers are updated. This is further highlighted by an email posting that included the following neat remark:
\begin{quote}

\index{net!rpc!vampire} I like the {``}net rpc vampire{''} on NT4, but that to my surprise does not seem to work against a Samba PDC and, if addressed in the Samba to Samba context in either book, I could not find it.
\end{quote}

\index{contributions} So in response to the significant request for these situations to be better documented, this chapter has now been added. User contributions and documentation of real-world experiences are a most welcome addition to this chapter.

% ------------------------   
% Section 
\section{Introduction}
\label{id2457627}\hypertarget{id2457627}{}%

\index{update} \index{upgrade} \index{frustration} A Windows network administrator explained in an email what changes he was planning to make and followed with the question: {``}Anyone done this before?{''} Many of us have upgraded and updated Samba without incident. Others have experienced much pain and user frustration. So it is to be hoped that the notes in this chapter will make a positive difference by assuring that someone will be saved a lot of discomfort.

Before anyone commences an upgrade or an update of Samba, the one cardinal rule that must be observed is: Backup all Samba configuration files in case it is necessary to revert to the old version. Even if you do not like this precautionary step, users will punish an administrator who fails to take adequate steps to avoid situations that may inflict lost productivity on them.

\begin{admonition}{xslt/figures/warning}{Warning}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

\index{configuration files} \index{down-grade} Samba makes it possible to upgrade and update configuration files, but it is not possible to downgrade the configuration files. Please ensure that all configuration and control files are backed up to permit a down-grade in the rare event that this may be necessary.
\end{admonition}


\index{adequate precautions} \index{precaution} It is prudent also to backup all data files on the server before attempting to perform a major upgrade. Many administrators have experienced the consequences of failure to take adequate precautions. So what is adequate? That is simple! If data is lost during an upgrade or update and it can not be restored, the precautions taken were inadequate. If a backup was not needed, but was available, caution was on the side of the victor.
\subsection{Cautions and Notes}
\label{id2457725}\hypertarget{id2457725}{}%

Someone once said, {``}It is good to be sorry, but better never to need to be!{''} These are wise words of advice to those contemplating a Samba upgrade or update.

\index{update} \index{upgrade} \index{generation} This is as good a time as any to define the terms {\texttt{\docbookhyphenatedot{upgrade}}} and {\texttt{\docbookhyphenatedot{update}}}. The term {\texttt{\docbookhyphenatedot{upgrade}}} refers to the installation of a version of Samba that is a whole generation or more ahead of that which is installed. Generations are indicated by the first digit of the version number. So far Samba has been released in generations 1.x, 2.x, 3.x, and currently 4.0 is in development.

\index{generation} The term {\texttt{\docbookhyphenatedot{update}}} refers to a minor version number installation in place of one of the same generation. For example, updating from Samba 3.0.10 to 3.0.14 is an update. The move from Samba 2.0.7 to 3.0.14 is an upgrade.

\index{functional differences} While the use of these terms is an exercise in semantics, what needs to be realized is that there are major functional differences between a Samba 2.x release and a Samba 3.0.x release. Such differences may require a significantly different approach to solving the same networking challenge and generally require careful review of the latest documentation to identify precisely how the new installation may need to be modified to preserve prior functionality.

There is an old axiom that says, {``}The greater the volume of the documentation, the greater the risk that noone will read it, but where there is no documentation, noone can read it!{''} While true, some documentation is an evil necessity. It is hoped that this update to the documentation will avoid both extremes.
\subsubsection{Security Identifiers (SIDs)}
\label{id2508442}\hypertarget{id2508442}{}%

\index{Windows!NT} \index{OS/2} \index{DOS} \index{SID} \index{networking!client} \index{security!identifier} Before the days of Windows NT and OS/2, every Windows and DOS networking client that used the SMB protocols was an entirely autonomous entity. There was no concept of a security identifier for a machine or a user outside of the username, the machine name, and the workgroup name. In actual fact, these were not security identifiers in the same context as the way that the SID is used since the development of Windows NT 3.10.

\index{SessionSetUpAndX} \index{SMB} \index{CIFS} \index{SID} \index{username} \index{Windows!client} Versions of Samba prior to 1.9 did not make use of a SID. Instead they make exclusive use of the username that is embedded in the SessionSetUpAndX component of the connection setup process between a Windows client and an SMB/CIFS server.

\index{MACHINE.SID} \index{rpc} \index{security} Around November 1997 support was added to Samba-1.9 to handle the Windows security RPC-based protocols that implemented support for Samba to store a machine SID. This information was stored in a file called {\texttt{\docbookhyphenatefilename{MACHINE.\dbz{}SID.\dbz{}}}}

\index{machine} \index{SID} \index{secrets.tdb} Within the lifetime of the early Samba 2.x series, the machine SID information was relocated into a tdb file called {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}}, which is where it is still located in Samba 3.0.x along with other information that pertains to the local machine and its role within a domain security context.

\index{server!stand-alone} \index{server!domain member} \index{DMS} \index{SAS} There are two types of SID, those pertaining to the machine itself and the domain to which it may belong, and those pertaining to users and groups within the security context of the local machine, in the case of standalone servers (SAS) and domain member servers (DMS).

\index{smbd} \index{workgroup} \index{hostname} \index{daemon} \index{SID} \index{secrets.tdb} When the Samba {\bfseries{smbd}} daemon is first started, if the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file does not exist, it is created at the first client connection attempt. If this file does exist, {\bfseries{smbd}} checks that there is a machine SID (if it is a domain controller, it searches for the domain SID). If {\bfseries{smbd}} does not find one for the current name of the machine or for the current name of the workgroup, a new SID will be generated and then written to the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file. The SID is generated in a nondeterminative manner. This means that each time it is generated for a particular combination of machine name (hostname) and domain name (workgroup), it will be different.

\index{ACL} The SID is the key used by MS Windows networking for all networking operations. This means that when the machine or domain SID changes, all security-encoded objects such as profiles and ACLs may become unusable.

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

It is of paramount importance that the machine and domain SID be backed up so that in the event of a change of hostname (machine name) or domain name (workgroup) the SID can be restored to its previous value.
\end{admonition}


\index{domain controller} \index{PDC} \index{BDC} \index{domain SID} \index{hostname} \index{computer name} \index{netbios name} \index{stand-alone server} \index{SAS} \index{SID} In Samba-3 on a domain controller (PDC or BDC), the domain name controls the domain SID. On all prior versions the hostname (computer name, or NetBIOS name) controlled the SID. On a standalone server the hostname still controls the SID.

\index{net!getlocalsid} \index{net!setlocalsid} The local machine SID can be backed up using this procedure (Samba-3): 
\begin{Verbatim}[]

root#  net getlocalsid > /etc/samba/my-local-SID

\end{Verbatim}
 The contents of the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}my-\dbz{}local-\dbz{}SID}}} will be: 
\begin{Verbatim}[]

SID for domain FRODO is: S-1-5-21-726309263-4128913605-1168186429

\end{Verbatim}
 This SID can be restored by executing: 
\begin{Verbatim}[]

root#  net setlocalsid S-1-5-21-726309263-4128913605-1168186429

\end{Verbatim}


Samba 1.9.x stored the machine SID in the the file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}MACHINE.\dbz{}SID}}} from which it could be recovered and stored into the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file using the procedure shown above.

Where the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file exists and a version of Samba 2.x or later has been used, there is no specific need to go through this update process. Samba-3 has the ability to read the older tdb file and to perform an in-situ update to the latest tdb format. This is not a reversible process ---  it is a one-way upgrade.

\index{smbpasswd} In the course of the Samba 2.0.x series the {\bfseries{smbpasswd}} was modified to permit the domain SID to be captured to the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file by executing: 
\begin{Verbatim}[]

root#  smbpasswd -S PDC -Uadministrator%password

\end{Verbatim}


The release of the Samba 2.2.x series permitted the SID to be obtained by executing: 
\begin{Verbatim}[]

root#  smbpasswd -S PDC -Uadministrator%password

\end{Verbatim}
 from which the SID could be copied to a file and then written to the Samba-2.2.x {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file by executing: 
\begin{Verbatim}[]

root#  smbpasswd -W S-1-5-21-726309263-4128913605-1168186429

\end{Verbatim}


\index{rpcclient} \index{net!rpc!info} Domain security information, which includes the domain SID, can be obtained from Samba-2.2.x systems by executing: 
\begin{Verbatim}[]

root#  rpcclient hostname lsaquery -Uroot%password

\end{Verbatim}
 This can also be done with Samba-3 by executing: 
\begin{Verbatim}[]

root#  net rpc info -Uroot%password
Domain Name: MIDEARTH
Domain SID: S-1-5-21-726309263-4128913605-1168186429
Sequence number: 1113415916
Num users: 4237
Num domain groups: 86
Num local groups: 0

\end{Verbatim}
 It is a very good practice to store this SID information in a safely kept file, just in case it is ever needed at a later date.

\index{passdb backend} \index{LDAP} \index{SID} Take note that the domain SID is used extensively in Samba. Where LDAP is used for the {\ttfamily\itshape{\docbookhyphenatedot{passdb backend}}}, all user, group, and trust accounts are encoded with the domain SID. This means that if the domain SID changes for any reason, the entire Samba environment can become broken and require extensive corrective action if the original SID cannot be restored. Fortunately, it can be recovered from a dump of the LDAP database. A dump of the LDAP directory database can be obtained by executing: 
\begin{Verbatim}[]

root#  slapcat -v -l filename.ldif

\end{Verbatim}


\index{SID} \index{profiles} \index{RPM} When the domain SID has changed, roaming profiles cease to be functional. The recovery of roaming profiles necessitates resetting of the domain portion of the user SID that owns the profile. This is encoded in the {\texttt{\docbookhyphenatefilename{NTUser.\dbz{}DAT}}} and can be updated using the Samba {\bfseries{profiles}} utility. Please be aware that not all Linux distributions of the Samba RPMs include this essential utility. Please do not complain to the Samba Team if this utility is missing; that issue that must be addressed to the creator of the RPM package. The Samba Team do their best to make available all the tools needed to manage a Samba-based Windows networking environment.
\subsubsection{Change of hostname}
\label{id2463485}\hypertarget{id2463485}{}%

\index{netbios!machine name} \index{netbios name} Samba uses two methods by which the primary NetBIOS machine name (also known as a computer name or the hostname) may be determined: If the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file contains a {\ttfamily\itshape{\docbookhyphenatedot{netbios name}}} entry, its value will be used directly. In the absence of such an entry, the UNIX system hostname will be used.

Many sites have become victims of lost Samba functionality because the UNIX system hostname was changed for one reason or another. Such a change will cause a new machine SID to be generated. If this happens on a domain controller, it will also change the domain SID. These SIDs can be updated (restored) using the procedure outlined previously.

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

Do NOT change the hostname or the {\ttfamily\itshape{\docbookhyphenatedot{netbios name}}}. If this is changed, be sure to reset the machine SID to the original setting. Otherwise there may be serious interoperability and/or operational problems.
\end{admonition}

\subsubsection{Change of Workgroup (Domain) Name}
\label{id2463552}\hypertarget{id2463552}{}%

\index{workgroup} The domain name of a Samba server is identical to the workgroup name and is set in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file using the {\ttfamily\itshape{\docbookhyphenatedot{workgroup}}} parameter. This has been consistent throughout the history of Samba and across all versions.

\index{SID} Be aware that when the workgroup name is changed, a new SID will be generated. The old domain SID can be reset using the procedure outlined earlier in this chapter.
\subsubsection{Location of config files}
\label{sbeug1}\hypertarget{sbeug1}{}%

The Samba-Team has maintained a constant default location for all Samba control files throughout the life of the project. People who have produced binary packages of Samba have varied the location of the Samba control files. This has led to some confusion for network administrators.

\index{directory} The Samba 1.9.x {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file may be found either in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc}}} directory or in {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}local/\dbz{}samba/\dbz{}lib}}}.

During the life of the Samba 2.x release, the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file was relocated on Linux systems to the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba}}} directory where it remains located also for Samba 3.0.x installations.

\index{secrets.tdb} Samba 2.x introduced the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file that is also stored in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba}}} directory, or in the {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}local/\dbz{}samba/\dbz{}lib}}} directory subsystem.

\index{smbd} The location at which {\bfseries{smbd}} expects to find all configuration and control files is determined at the time of compilation of Samba. For versions of Samba prior to 3.0, one way to find the expected location of these files is to execute: 
\begin{Verbatim}[]

root#  strings /usr/sbin/smbd | grep conf
root#  strings /usr/sbin/smbd | grep secret
root#  strings /usr/sbin/smbd | grep smbpasswd

\end{Verbatim}
 Note: The {\bfseries{smbd}} executable may be located in the path {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}local/\dbz{}samba/\dbz{}sbin}}}.

\index{compile-time} Samba-3 provides a neat new way to track the location of all control files as well as to find the compile-time options used as the Samba package was built. Here is how the dark secrets of the internals of the location of control files within Samba executables can be uncovered: 
\begin{Verbatim}[]

root#  smbd -b | less
Build environment:
   Built by:    root@frodo
   Built on:    Mon Apr 11 20:23:27 MDT 2005
   Built using: gcc
   Build host:  Linux frodo 2.6...
   SRCDIR:      /usr/src/packages/BUILD/samba-3.0.20/source
   BUILDDIR:    /usr/src/packages/BUILD/samba-3.0.20/source

Paths:
   SBINDIR: /usr/sbin
   BINDIR: /usr/bin
   SWATDIR: /usr/share/samba/swat
   CONFIGFILE: /etc/samba/smb.conf
   LOGFILEBASE: /var/log/samba
   LMHOSTSFILE: /etc/samba/lmhosts
   LIBDIR: /usr/lib/samba
   SHLIBEXT: so
   LOCKDIR: /var/lib/samba
   PIDDIR: /var/run/samba
   SMB_PASSWD_FILE: /etc/samba/smbpasswd
   PRIVATE_DIR: /etc/samba
 ... 

\end{Verbatim}


\index{} It is important that both the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file and the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} be backed up before attempting any upgrade. The {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file is version-encoded, and therefore a newer version may not work with an older version of Samba. A backup means that it is always possible to revert a failed or problematic upgrade.
\subsubsection{International Language Support}
\label{id2511490}\hypertarget{id2511490}{}%

\index{unicode} \index{character set} \index{codepage} \index{internationalization} Samba-2.x had no support for Unicode; instead, all national language character-set support in file names was done using particular locale codepage mapping techniques. Samba-3 supports Unicode in file names, thus providing true internationalization support.

\index{8-bit} Non-English users whose national language character set has special characters and who upgrade naively will find that many files that have the special characters in the file name will see them garbled and jumbled up. This typically happens with umlauts and accents because these characters were particular to the codepage that was in use with Samba-2.x using an 8-bit encoding scheme.

\index{UTF-8} Files that are created with Samba-3 will use UTF-8 encoding. Should the file system ever end up with a mix of codepage (unix charset)-encoded file names and UTF-8-encoded file names, the mess will take some effort to set straight.

\index{convmv} A very helpful tool is available from Bjorn Jacke's convmv\label{id2511574}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://j3e.de/linux/convmv/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2511574} work. Convmv is a tool that can be used to convert file and directory names from one encoding method to another. The most common use for this tool is to convert locale-encoded files to UTF-8 Unicode encoding.
\subsubsection{Updates and Changes in Idealx smbldap-tools}
\label{id2511586}\hypertarget{id2511586}{}%

The smbldap-tools have been maturing rapidly over the past year. With maturation comes change. The location of the {\texttt{\docbookhyphenatefilename{smbldap.\dbz{}conf}}} and the {\texttt{\docbookhyphenatefilename{smbldap\_\dbz{}bind.\dbz{}conf}}} configuration files have been moved from the directory {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}smbldap-\dbz{}tools}}} to the new location of {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}opt/\dbz{}IDEALX/\dbz{}smblda-\dbz{}tools}}} directory.

The smbldap-tools maintains an entry in the LDAP directory in which it stores the next values that should be used for UID and GID allocation for POSIX accounts that are created using this tool. The DIT location of these values has changed recently. The original {\texttt{\docbookhyphenatedot{sambaUnixIdPooldn object}}} entity was stored in a directory entry (DIT object) called {\texttt{\docbookhyphenatedot{NextFreeUnixId}}}, this has been changed to the DIT object {\texttt{\docbookhyphenatedot{sambaDomainName}}}. Anyone who updates from an older version to the current release should note that the information stored under {\texttt{\docbookhyphenatedot{NextFreeUnixId}}} must now be relocated to the DIT object {\texttt{\docbookhyphenatedot{sambaDomainName}}}.

% ------------------------   
% Section 
\section{Upgrading from Samba 1.x and 2.x to Samba-3}
\label{id2511658}\hypertarget{id2511658}{}%

Sites that are being upgraded from Samba-2 (or earlier versions) to Samba-3 may experience little difficulty or may require a lot of effort, depending on the complexity of the configuration. Samba-1.9.x upgrades to Samba-3 will generally be simple and straightforward, although no upgrade should be attempted without proper planning and preparation.

There are two basic modes of use of Samba versions prior to Samba-3. The first does not use LDAP, the other does. Samba-1.9.x did not provide LDAP support. Samba-2.x could be compiled with LDAP support.
\subsection{Samba 1.9.x and 2.x Versions Without LDAP}
\label{sbeug2}\hypertarget{sbeug2}{}%

Where it is necessary to upgrade an old Samba installation to Samba-3, the following procedure can be followed:
Upgrading from a Pre-Samba-3 Version\begin{enumerate}

\item{\index{winbindd} \index{smbd} \index{nmbd} Stop Samba. This can be done using the appropriate system tool that is particular for each operating system or by executing the {\bfseries{kill}} command on {\bfseries{smbd}}, {\bfseries{nmbd}}, and {\bfseries{winbindd}}.}

\item{Find the location of the Samba {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file and back it up to a safe location.}

\item{Find the location of the {\texttt{\docbookhyphenatefilename{smbpasswd}}} file and back it up to a safe location.}

\item{Find the location of the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file and back it up to a safe location.}

\item{\index{lock directory} \index{/usr/local/samba/var/locks} \index{/var/cache/samba} \index{/var/lib/samba} Find the location of the lock directory. This is the directory in which Samba stores all its tdb control files. The default location used by the Samba Team is in {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}local/\dbz{}samba/\dbz{}var/\dbz{}locks}}} directory, but on Linux systems the old location was under the {\texttt{\docbookhyphenatefilename{/\dbz{}var/\dbz{}cache/\dbz{}samba}}} directory. However, the Linux Standards Base specified location is now under the {\texttt{\docbookhyphenatefilename{/\dbz{}var/\dbz{}lib/\dbz{}samba}}} directory. Copy all the tdb files to a safe location.}

\item{\index{RPM} It is now safe to upgrade the Samba installation. On Linux systems it is not necessary to remove the Samba RPMs because a simple upgrade installation will automatically remove the old files.  On systems that do not support a reliable package management system it is advisable either to delete the Samba old installation or to move it out of the way by renaming the directories that contain the Samba binary files.}

\item{When the Samba upgrade has been installed, the first step that should be completed is to identify the new target locations for the control files. Follow the steps shown in \hyperlink{sbeug1}{Section {\ref{sbeug1}}} to locate the correct directories to which each control file must be moved.}

\item{Do not change the hostname.}

\item{Do not change the workgroup name.}

\item{\index{testparm} Execute the {\bfseries{testparm}} to validate the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file. This process will flag any parameters that are no longer supported. It will also flag configuration settings that may be in conflict.  One solution that may be used to clean up and to update the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file involves renaming it to {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf.\dbz{}master}}} and then executing the following: 
\begin{Verbatim}[]

root#  cd /etc/samba
root#  testparm -s smb.conf.master > smb.conf

\end{Verbatim}
 \index{stripped} The resulting {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file will be stripped of all comments and of all nonconforming configuration settings.}

\item{\index{winbindd} It is now safe to start Samba using the appropriate system tool. Alternately, it is possible to just execute {\bfseries{nmbd}}, {\bfseries{smbd}}, and {\bfseries{winbindd}} for the command line while logged in as the root user.}
\end{enumerate}
\subsection{Applicable to All Samba 2.x to Samba-3 Upgrades}
\label{id2543002}\hypertarget{id2543002}{}%

\index{PDC} \index{domain controller} \index{inter-domain} Samba 2.x servers that were running as a domain controller (PDC) require changes to the configuration of the scripting interface tools that Samba uses to perform OS updates for users, groups, and trust accounts (machines and interdomain).

\index{parameters} The following parameters are new to Samba-3 and should be correctly configured. Please refer to \hyperlink{secure}{Chapter {\ref{secure}}, {``}Secure Office Networking{''}} through \hyperlink{2000users}{Chapter {\ref{2000users}}, {``}A Distributed 2000-User Network{''}} in this book for examples of use of the new parameters shown here: \index{add group script} \index{add machine script} \index{add user to group script} \index{delete group script} \index{delete user from group script} \index{set primary group script} \index{passdb backend}


\begin{tabular}{l}


add group script
  \\

add machine script
  \\

add user to group script
  \\

delete group script
  \\

delete user from group script
  \\

passdb backend
  \\

set primary group script
  \\
\end{tabular}


\index{add machine script} \index{add user script} The {\ttfamily\itshape{\docbookhyphenatedot{add machine script}}} functionality was previously handled by the {\ttfamily\itshape{\docbookhyphenatedot{add user script}}}, which in Samba-3 is used exclusively to add user accounts.

\index{passdb backend} \index{smbpasswd} \index{tdbsam} \index{useradd} \index{usermod} \index{userdel} \index{groupadd} \index{groupmod} \index{groupdel} Where the {\ttfamily\itshape{\docbookhyphenatedot{passdb backend}}} used is either {\texttt{\docbookhyphenatedot{smbpasswd}}} (the default) or the new {\texttt{\docbookhyphenatedot{tdbsam}}}, the system interface scripts are typically used. These involve use of OS tools such as {\bfseries{useradd}}, {\bfseries{usermod}}, {\bfseries{userdel}}, {\bfseries{groupadd}}, {\bfseries{groupmod}}, {\bfseries{groupdel}}, and so on.

\index{passdb backend} \index{LDAP} \index{Idealx} Where the {\ttfamily\itshape{\docbookhyphenatedot{passdb backend}}} makes use of an LDAP directory, it is necessary either to use the {\texttt{\docbookhyphenatedot{smbldap-tools}}} provided by Idealx or to use an alternate toolset provided by a third party or else home-crafted to manage the LDAP directory accounts.
\subsection{Samba-2.x with LDAP Support}
\label{id2543344}\hypertarget{id2543344}{}%

Samba version 2.x could be compiled for use either with or without LDAP. The LDAP control settings in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file in this old version are completely different (and less complete) than they are with Samba-3. This means that after migrating the control files, it is necessary to reconfigure the LDAP settings entirely.

Follow the procedure outlined in \hyperlink{sbeug2}{Section {\ref{sbeug2}}} to affect a migration of all files to the correct locations.

\index{schema} \index{WHATSNEW.txt} The Samba SAM schema required for Samba-3 is significantly different from that used with Samba 2.x. This means that the LDAP directory must be updated using the procedure outlined in the Samba WHATSNEW.txt file that accompanies all releases of Samba-3. This information is repeated here directly from this file: 
\begin{Verbatim}[]

This is an extract from the Samba-3.0.x WHATSNEW.txt file:
==========================================================
Changes in Behavior
-------------------

The following issues are known changes in behavior between Samba 2.2 and
Samba 3.0 that may affect certain installations of Samba.

  1)  When operating as a member of a Windows domain, Samba 2.2 would
      map any users authenticated by the remote DC to the 'guest account'
      if a uid could not be obtained via the getpwnam() call.  Samba 3.0
      rejects the connection as NT_STATUS_LOGON_FAILURE.  There is no
      current work around to re-establish the 2.2 behavior.

  2)  When adding machines to a Samba 2.2 controlled domain, the
      'add user script' was used to create the UNIX identity of the
      machine trust account.  Samba 3.0 introduces a new 'add machine
      script' that must be specified for this purpose.  Samba 3.0 will
      not fall back to using the 'add user script' in the absence of
      an 'add machine script'

######################################################################
Passdb Backends and Authentication
##################################

There have been a few new changes that Samba administrators should be
aware of when moving to Samba 3.0.

  1) encrypted passwords have been enabled by default in order to
     inter-operate better with out-of-the-box Windows client
     installations.  This does mean that either (a) a samba account
     must be created for each user, or (b) 'encrypt passwords = no'
     must be explicitly defined in smb.conf.

  2) Inclusion of new 'security = ads' option for integration
     with an Active Directory domain using the native Windows
     Kerberos 5 and LDAP protocols.

     MIT kerberos 1.3.1 supports the ARCFOUR-HMAC-MD5 encryption
     type which is necessary for servers on which the
     administrator password has not been changed, or kerberos-enabled
     SMB connections to servers that require Kerberos SMB signing.
     Besides this one difference, either MIT or Heimdal Kerberos
     distributions are usable by Samba 3.0.


Samba 3.0 also includes the possibility of setting up chains
of authentication methods (auth methods) and account storage
backends (passdb backend).  Please refer to the smb.conf(5)
man page for details.  While both parameters assume sane default
values, it is likely that you will need to understand what the
values actually mean in order to ensure Samba operates correctly.

The recommended passdb backends at this time are

  * smbpasswd - 2.2 compatible flat file format
  * tdbsam - attribute rich database intended as an smbpasswd
    replacement for stand alone servers
  * ldapsam - attribute rich account storage and retrieval
    backend utilizing an LDAP directory.
  * ldapsam_compat - a 2.2 backward compatible LDAP account
    backend

Certain functions of the smbpasswd(8) tool have been split between the
new smbpasswd(8) utility, the net(8) tool, and the new pdbedit(8)
utility.  See the respective man pages for details.

######################################################################
LDAP
####

This section outlines the new features affecting Samba / LDAP
integration.

New Schema
----------

A new object class (sambaSamAccount) has been introduced to replace
the old sambaAccount.  This change aids us in the renaming of
attributes to prevent clashes with attributes from other vendors.
There is a conversion script (examples/LDAP/convertSambaAccount) to
modify and LDIF file to the new schema.

Example:

  $ ldapsearch .... -b "ou=people,dc=..." > sambaAcct.ldif
  $ convertSambaAccount --sid=<Domain SID> \
    --input=sambaAcct.ldif --output=sambaSamAcct.ldif \
    --changetype=[modify|add]

The <DOM SID> can be obtained by running 'net getlocalsid
<DOMAINNAME>' on the Samba PDC as root.  The changetype determines
the format of the generated LDIF output--either create new entries
or modify existing entries.

The old sambaAccount schema may still be used by specifying the
"ldapsam_compat" passdb backend.  However, the sambaAccount and
associated attributes have been moved to the historical section of
the schema file and must be uncommented before use if needed.
The 2.2 object class declaration for a sambaAccount has not changed
in the 3.0 samba.schema file.

Other new object classes and their uses include:

  * sambaDomain - domain information used to allocate rids
    for users and groups as necessary.  The attributes are added
    in 'ldap suffix' directory entry automatically if
    an idmap uid/gid range has been set and the 'ldapsam'
    passdb backend has been selected.

  * sambaGroupMapping - an object representing the
    relationship between a posixGroup and a Windows
    group/SID.  These entries are stored in the 'ldap
    group suffix' and managed by the 'net groupmap' command.

  * sambaUnixIdPool - created in the 'ldap idmap suffix' entry
    automatically and contains the next available 'idmap uid' and
    'idmap gid'

  * sambaIdmapEntry - object storing a mapping between a
    SID and a UNIX uid/gid.  These objects are created by the
    idmap_ldap module as needed.

  * sambaSidEntry - object representing a SID alone, as a Structural
    class on which to build the sambaIdmapEntry.


New Suffix for Searching
------------------------

The following new smb.conf parameters have been added to aid in directing
certain LDAP queries when 'passdb backend = ldapsam://...' has been
specified.

  * ldap suffix         - used to search for user and computer accounts
  * ldap user suffix    - used to store user accounts
  * ldap machine suffix - used to store machine trust accounts
  * ldap group suffix   - location of posixGroup/sambaGroupMapping entries
  * ldap idmap suffix   - location of sambaIdmapEntry objects

If an 'ldap suffix' is defined, it will be appended to all of the
remaining sub-suffix parameters.  In this case, the order of the suffix
listings in smb.conf is important.  Always place the 'ldap suffix' first
in the list.

Due to a limitation in Samba's smb.conf parsing, you should not surround
the DN's with quotation marks.

\end{Verbatim}


% ------------------------   
% Section 
\section{Updating a Samba-3 Installation}
\label{id2543508}\hypertarget{id2543508}{}%

The key concern in this section is to deal with the changes that have been affected in Samba-3 between the Samba-3.0.0 release and the current update. Network administrators have expressed concerns over the steps that should be taken to update Samba-3 versions.

\index{control files} The information in \hyperlink{sbeug1}{Section {\ref{sbeug1}}} would not be necessary if every person who has ever produced Samba executable (binary) files could agree on the preferred location of the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file and other Samba control files. Clearly, such agreement is further away than a pipedream.

\index{vendors} Vendors and packagers who produce Samba binary installable packages do not, as a rule, use the default paths used by the Samba-Team for the location of the binary files, the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file, and the Samba control files (tdb's as well as files such as {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}}). This means that the network or UNIX administrator who sets out to build the Samba executable files from the Samba tarball must take particular care. Failure to take care will result in both the original vendor's version of Samba remaining installed and the new version being installed in the default location used by the Samba-Team. This can lead to confusion and to much lost time as the uninformed administrator deals with apparent failure of the update to take effect.

\index{packages} The best advice for those lacking in code compilation experience is to use only vendor (or Samba-Team) provided binary packages. The Samba packages that are provided by the Samba-Team are generally built to use file paths that are compatible with the original OS vendor's practices.

\index{binary package} \index{binary files} If you are not sure whether a binary package complies with the OS vendor's practices, it is better to ask the package maintainer via email than to waste much time dealing with the nuances. Alternately, just diagnose the paths specified by the binary files following the procedure outlined above.
\subsection{Samba-3 to Samba-3 Updates on the Same Server}
\label{id2543620}\hypertarget{id2543620}{}%

The guidance in this section deals with updates to an existing Samba-3 server installation.
\subsubsection{Updating from Samba Versions Earlier than 3.0.5}
\label{id2543632}\hypertarget{id2543632}{}%

With the provision that the binary Samba-3 package has been built with the same path and feature settings as the existing Samba-3 package that is being updated, an update of Samba-3 versions 3.0.0 through 3.0.4 can be updated to 3.0.5 without loss of functionality and without need to change either the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file or, where used, the LDAP schema.
\subsubsection{Updating from Samba Versions between 3.0.6 and 3.0.10}
\label{id2543656}\hypertarget{id2543656}{}%

\index{schema} \index{LDAP!schema} When updating versions of Samba-3 prior to 3.0.6 to 3.0.6 through 3.0.10, it is necessary only to update the LDAP schema (where LDAP is used). Always use the LDAP schema file that is shipped with the latest Samba-3 update.

\index{ldapsam} \index{tdbsam} \index{passdb backend} Samba-3.0.6 introduced the ability to remember the last {\em{n}} number of passwords a user has used. This information will work only with the {\texttt{\docbookhyphenatedot{tdbsam}}} and {\texttt{\docbookhyphenatedot{ldapsam}}} {\ttfamily\itshape{\docbookhyphenatedot{passdb backend}}} facilities.

After updating the LDAP schema, do not forget to re-index the LDAP database.
\subsubsection{Updating from Samba Versions after 3.0.6 to a Current Release}
\label{id2543738}\hypertarget{id2543738}{}%

\index{winbindd} Samba-3.0.8 introduced changes in how the {\ttfamily\itshape{\docbookhyphenatedot{username map}}} behaves. It also included a change in behavior of {\bfseries{winbindd}}. Please refer to the man page for {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} before implementing any update from versions prior to 3.0.8 to a current version.

\index{privileges} In Samba-3.0.11 a new privileges interface was implemented. Please refer to \hyperlink{sbehap-ppc}{Section {\ref{sbehap-ppc}}} for information regarding this new feature. It is not necessary to implement the privileges interface, but it is one that has been requested for several years and thus may be of interest at your site.

In Samba-3.0.11 there were some functional changes to the {\ttfamily\itshape{\docbookhyphenatedot{ldap user suffix}}} and to the {\ttfamily\itshape{\docbookhyphenatedot{ldap machine suffix}}} behaviors. The following information has been extracted from the WHATSNEW.txt file from this release: 
\begin{Verbatim}[]

============
LDAP Changes
============

If "ldap user suffix" or "ldap machine suffix" are defined in
smb.conf, all user-accounts must reside below the user suffix,
and all machine and inter-domain trust-accounts must be located
below the machine suffix.  Previous Samba releases would fall
back to searching the 'ldap suffix' in some cases.

\end{Verbatim}

\subsection{Migrating Samba-3 to a New Server}
\label{id2543830}\hypertarget{id2543830}{}%

The two most likely candidates for replacement of a server are domain member servers and domain controllers. Each needs to be handled slightly differently.
\subsubsection{Replacing a Domain Member Server}
\label{id2543843}\hypertarget{id2543843}{}%

\index{DMS} Replacement of a domain member server should be done using the same procedure as outlined in \hyperlink{unixclients}{Chapter {\ref{unixclients}}, {``}Adding Domain Member Servers and Clients{''}}.

Usually the new server will be introduced with a temporary name. After the old server data has been migrated to the new server, it is customary that the new server be renamed to that of the old server. This will change its SID and will necessitate rejoining to the domain.

\index{smbd} \index{nmbd} \index{winbindd} \index{wins.dat} \index{browse.dat} \index{resolution} Following a change of hostname (NetBIOS name) it is a good idea on all servers to shut down the Samba {\bfseries{smbd}}, {\bfseries{nmbd}}, and {\bfseries{winbindd}} services, delete the {\texttt{\docbookhyphenatefilename{wins.\dbz{}dat}}} and {\texttt{\docbookhyphenatefilename{browse.\dbz{}dat}}} files, then restart Samba. This will ensure that the old name and IP address information is no longer able to interfere with name to IP address resolution. If this is not done, there can be temporary name resolution problems. These problems usually clear within 45 minutes of a name change, but can persist for a longer period of time.

\index{DMS} \index{/etc/passwd} \index{/etc/shadow} \index{/etc/group} If the old domain member server had local accounts, it is necessary to create on the new domain member server the same accounts with the same UID and GID for each account. Where the {\ttfamily\itshape{\docbookhyphenatedot{passdb backend}}} database is stored in the {\texttt{\docbookhyphenatedot{smbpasswd}}} or in the {\texttt{\docbookhyphenatedot{tdbsam}}} format, the user and group account information for UNIX accounts that match the Samba accounts will reside in the system {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}}, {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}shadow}}}, and {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}group}}} files. In this case, be sure to copy these account entries to the new target server.

\index{nss\_ldap} Where the user accounts for both UNIX and Samba are stored in LDAP, the new target server must be configured to use the {\bfseries{nss\_ldap}} tool set. This will automatically ensure that the appropriate user entities are available on the new server.
\subsubsection{Replacing a Domain Controller}
\label{id2544050}\hypertarget{id2544050}{}%

\index{domain!controller} In the past, people who replaced a Windows NT4 domain controller typically installed a new server, created printers and file shares on it, then migrate across all data that was destined to reside on it. The same can of course be done with Samba.

From recent mailing list postings it would seem that some administrators have the intent to just replace the old Samba server with a new one with the same name as the old one. In this case, simply follow the same process as for upgrading a Samba 2.x system and do the following:

\begin{itemize}
%--- Item
\item 
Where UNIX (POSIX) user and group accounts are stored in the system {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}}, {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}shadow}}}, and {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}group}}} files, be sure to add the same accounts with identical UID and GID values for each user.

Where LDAP is used, if the new system is intended to be the LDAP server, migrate it across by configuring the LDAP server ({\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap/\dbz{}slapd.\dbz{}conf}}}). The directory can be populated either initially by setting this LDAP server up as a slave or by dumping the data from the old LDAP server using the {\bfseries{slapcat}} command and then reloading the same data into the new LDAP server using the {\bfseries{slapadd}} command. Do not forget to install and configure the {\bfseries{nss\_ldap}} tool and the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} (as shown in \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}}).


%--- Item
\item 
Copy the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file from the old server to the new server into the correct location as indicated previously in this chapter.


%--- Item
\item 
Copy the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file, the {\texttt{\docbookhyphenatefilename{smbpasswd}}} file (if it is used), the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}passdb.\dbz{}tdb}}} file (only used by the {\texttt{\docbookhyphenatedot{tdbsam}}} backend), and all the tdb control files from the old system to the correct location on the new system.


%--- Item
\item 
Before starting the Samba daemons, verify that the hostname of the new server is identical to that of the old one. Note: The IP address can be different from that of the old server.


%--- Item
\item 
Copy all files from the old server to the new server, taking precaution to preserve all file ownership and permissions as well as any POSIX ACLs that may have been created on the old server.

\end{itemize}

When replacing a Samba domain controller (PDC or BDC) that uses LDAP, the new server need simply be configured to use the LDAP directory, and for the rest it should just work. The domain SID is obtained from the LDAP directory as part of the first connect to the LDAP directory server.

All Samba servers, other than one that uses LDAP, depend on the tdb files, and particularly on the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file. So long as the tdb files are all in place, the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file is preserved, and either the hostname is identical or the {\ttfamily\itshape{\docbookhyphenatedot{netbios name}}} is set to the original server name, Samba should correctly pick up the original SID and preserve all other settings. It is sound advice to validate this before turning the system over to users.
\subsection{Migration of Samba Accounts to Active Directory}
\label{id2544252}\hypertarget{id2544252}{}%

Yes, it works. The Windows ADMT tool can be used to migrate Samba accounts to MS Active Directory. There are a few pitfalls to be aware of:
Migration to Active Directory\begin{enumerate}

\item{Administrator password must be THE SAME on the Samba server, the 2003 ADS, and the local Administrator account on the workstations. Perhaps this goes without saying, but there needs to be an account called {\texttt{\docbookhyphenatedot{Administrator}}} in your Samba domain, with full administrative (root) rights to that domain.}

\item{In the Advanced/DNS section of the TCP/IP settings on your Windows workstations, make sure the {\ttfamily\itshape{\docbookhyphenatedot{DNS suffix for this connection}}} field is blank.}

\item{Because you are migrating from Samba, user passwords cannot be migrated. You'll have to reset everyone's passwords. (If you were migrating from NT4 to ADS, you could migrate passwords as well.)  To date this has not been attempted with roaming profile support; it has been documented as working with local profiles.}

\item{Disable the Windows Firewall on all workstations. Otherwise, workstations won't be migrated to the new domain.}

\item{\index{ADMT} When migrating machines, always test first (using ADMT's test mode) and satisfy all errors before committing the migration. Note that the test will always fail, because the machine will not have been actually migrated. You'll need to interpret the errors to know whether the failure was due to a problem or simply to the fact that it was just a test.}
\end{enumerate}

\index{ADMT} There are some significant benefits of using the ADMT, besides just migrating user accounts. ADMT can be found on the Windows 2003 CD.

\begin{itemize}
%--- Item
\item 
You can migrate workstations remotely. You can specify that SIDs be simply added instead of replaced, giving you the option of joining a workstation back to the old domain if something goes awry. The workstations will be joined to the new domain.


%--- Item
\item 
Not only are user accounts migrated from the old domain to the new domain, but ACLs on the workstations are migrated as well. Like SIDs, ACLs can be added instead of replaced.


%--- Item
\item 
Locally stored user profiles on workstations are migrated as well, presenting almost no disruption to the user. Saved passwords will be lost, just as when you administratively reset the password in Windows ADS.


%--- Item
\item 
The ADMT lets you test all operations before actually performing the migration. Accounts and workstations can be migrated individually or in batches. User accounts can be safely migrated all at once (since no changes are made on the original domain). It is recommended to migrate only one or two workstations as a test before committing them all.

\end{itemize}
\cleardoublepage 
% -------------------------------------------------------------
% Chapter Migrating NT4 Domain to Samba-3 
% ------------------------------------------------------------- 	
\chapter{Migrating NT4 Domain to Samba-3}
\label{ntmigration}\hypertarget{ntmigration}{}%

Ever since Microsoft announced that it was discontinuing support for Windows NT4, Samba users started to ask for detailed instructions on how to migrate from NT4 to Samba-3. This chapter provides background information that should meet these needs.

One wonders how many NT4 systems will be left in service by the time you read this book though.

% ------------------------   
% Section 
\section{Introduction}
\label{id2479836}\hypertarget{id2479836}{}%

\index{migration} Network administrators who want to migrate off a Windows NT4 environment know one thing with certainty. They feel that NT4 has been abandoned, and they want to update. The desire to get off NT4 and to not adopt Windows 200x and Active Directory is driven by a mixture of concerns over complexity, cost, fear of failure, and much more.

\index{group policies} \index{accounts!user} \index{accounts!group} \index{accounts!machine} The migration from NT4 to Samba-3 can involve a number of factors, including migration of data to another server, migration of network environment controls such as group policies, and migration of the users, groups, and machine accounts.

\index{accounts!Domain} It should be pointed out now that it is possible to migrate some systems from a Windows NT4 domain environment to a Samba-3 domain environment. This is certainly not possible in every case. It is possible to just migrate the domain accounts to Samba-3 and then to switch machines, but as a hands-off transition, this is more the exception than the rule. Most systems require some tweaking after migration before an environment that is acceptable for immediate use is obtained.
\subsection{Assignment Tasks}
\label{id2474184}\hypertarget{id2474184}{}%

\index{LDAP} \index{ldapsam} \index{passdb backend} You are about to migrate an MS Windows NT4 domain accounts database to a Samba-3 server. The Samba-3 server is using a {\ttfamily\itshape{\docbookhyphenatedot{passdb backend}}} based on LDAP. The {\texttt{\docbookhyphenatedot{ldapsam}}} is ideal because an LDAP backend can be distributed for use with BDCs ---  generally essential for larger networks.

Your objective is to document the process of migrating user and group accounts from several NT4 domains into a single Samba-3 LDAP backend database.

% ------------------------   
% Section 
\section{Dissection and Discussion}
\label{id2492347}\hypertarget{id2492347}{}%

\index{snap-shot} \index{NT4 registry} \index{registry!keys!SAM} \index{registry!keys!SECURITY} \index{SAM} \index{Security Account Manager|textit{see} {SAM} } The migration process takes a snapshot of information that is stored in the Windows NT4 registry-based accounts database. That information resides in the Security Account Manager (SAM) portion of the NT4 registry under keys called {\texttt{\docbookhyphenatedot{SAM}}} and {\texttt{\docbookhyphenatedot{SECURITY}}}.

\begin{admonition}{xslt/figures/warning}{Warning}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

\index{crippled} \index{inoperative} The Windows NT4 registry keys called {\texttt{\docbookhyphenatedot{SAM}}} and {\texttt{\docbookhyphenatedot{SECURITY}}} are protected so that you cannot view the contents. If you change the security setting to reveal the contents under these hive keys, your Windows NT4 domain is crippled. Do not do this unless you are willing to render your domain controller inoperative.
\end{admonition}


\index{migration!objectives} \index{disruptive} Before commencing an NT4 to Samba-3 migration, you should consider what your objectives are. While in some cases it is possible simply to migrate an NT4 domain to a single Samba-3 server, that may not be a good idea from an administration perspective. Since the process involves going through a certain amount of disruptive activity anyhow, why not take this opportunity to review the structure of the network, how Windows clients are controlled and how they interact with the network environment.

\index{network!logon scripts} \index{profiles share} \index{security descriptors} MS Windows NT4 was introduced some time around 1996. Many environments in which NT4 was deployed have done little to keep the NT4 server environment up to date with more recent Windows releases, particularly Windows XP Professional. The migration provides opportunity to revise and update roaming profile deployment as well as folder redirection. Given that you must port the greater network configuration of this from the old NT4 server to the new Samba-3 server. Do not forget to validate the security descriptors in the profiles share as well as network logon scripts. Feedback from sites that are migrating to Samba-3 suggests that many are using this as a good time to update desktop systems also. In all, the extra effort should constitute no real disruption to users, but rather, with due diligence and care, should make their network experience a much happier one.
\subsection{Technical Issues}
\label{id2532051}\hypertarget{id2532051}{}%

\index{strategic} \index{active directory} Migration of an NT4 domain user and group database to Samba-3 involves a certain strategic element. Many sites have asked for instructions regarding merging of multiple NT4 domains into one Samba-3 LDAP database. It seems that this is viewed as a significant added value compared with the alternative of migration to Windows Server 200x and Active Directory. The diagram in \hyperlink{ch8-migration}{Figure {\ref{ch8-migration}}} illustrates the effect of migration from a Windows NT4 domain to a Samba domain.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{ch8-migration}{}%
\includegraphics[scale=0.55]{Samba3-ByExample/images/ch8-migration}
{{\caption[{Schematic Explaining the net rpc vampire Process}]{{{Schematic Explaining the net rpc vampire Process}}}\label{ch8-migration}}}
\end{center}
\end{figure}


\index{merge} \index{passdb.tdb} If you want to merge multiple NT4 domain account databases into one Samba domain, you must now dump the contents of the first migration and edit it as appropriate. Now clean out (remove) the tdbsam backend file ({\texttt{\docbookhyphenatefilename{passdb.\dbz{}tdb}}}) or the LDAP database files. You must start each migration with a new database into which you merge your NT4 domains.

\index{dump} At this point, you are ready to perform the second migration, following the same steps as for the first. In other words, dump the database, edit it, and then you may merge the dump for the first and second migrations.

\index{LDAP}\index{migrate}\index{Domain SID} You must be careful. If you choose to migrate to an LDAP backend, your dump file now contains the full account information, including the domain SID. The domain SID for each of the two NT4 domains will be different. You must choose one and change the domain portion of the account SIDs so that all are the same.

\index{passdb.tdb} \index{/etc/passwd} \index{merged} \index{logon script} \index{logon hours} \index{logon machines} \index{profile path} \index{smbpasswd} \index{tdbsam} \index{LDAP backend} \index{export} \index{import} If you choose to use a tdbsam ({\texttt{\docbookhyphenatefilename{passdb.\dbz{}tdb}}}) backend file, your best choice is to use {\bfseries{pdbedit}} to export the contents of the tdbsam file into an smbpasswd data file. This automatically strips out all domain-specific information, such as logon hours, logon machines, logon script, profile path, as well as the domain SID. The resulting file can be easily merged with other migration attempts (each of which must start with a clean file). It should also be noted that all users who end up in the merged smbpasswd file must have an account in {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}}. The resulting smbpasswd file may be exported or imported into either a tdbsam ({\texttt{\docbookhyphenatefilename{passdb.\dbz{}tdb}}}) or an LDAP backend.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{NT4DUM}{}%
\includegraphics[scale=0.5]{Samba3-ByExample/images/UserMgrNT4}
{{\caption[{View of Accounts in NT4 Domain User Manager}]{{{View of Accounts in NT4 Domain User Manager}}}\label{NT4DUM}}}
\end{center}
\end{figure}

\subsection{Political Issues}
\label{id2507640}\hypertarget{id2507640}{}%

The merging of multiple Windows NT4-style domains into a single LDAP-backend-based Samba-3 domain may be seen by those who had power over them as a loss of prestige or a loss of power. The imposition of a single domain may even be seen as a threat. So in migrating and merging account databases, be consciously aware of the political fall-out in which you may find yourself entangled when key staff feel a loss of prestige.

The best advice that can be given to those who set out to merge NT4 domains into a single Samba-3 domain is to promote (sell) the action as one that reduces costs and delivers greater network interoperability and manageability.

% ------------------------   
% Section 
\section{Implementation}
\label{id2507667}\hypertarget{id2507667}{}%

From feedback on the Samba mailing lists, it seems that most Windows NT4 migrations to Samba-3 are being performed using a new server or a new installation of a Linux or UNIX server. If you contemplate doing this, please note that the steps that follow in this chapter assume familiarity with the information that has been previously covered in this book. You are particularly encouraged to be familiar with \hyperlink{secure}{Chapter {\ref{secure}}, {``}Secure Office Networking{''}}, \hyperlink{Big500users}{Chapter {\ref{Big500users}}, {``}The 500-User Office{''}} and \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}}.

We present here the steps and example output for two NT4 to Samba-3 domain migrations. The first uses an LDAP-based backend, and the second uses a tdbsam backend. In each case the scripts you specify in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file for the {\ttfamily\itshape{\docbookhyphenatedot{add user script}}} collection of parameters are used to effect the addition of accounts into the passdb backend.

Before proceeding to NT4 migration using either a tdbsam or ldapsam, it is most strongly recommended to review \hyperlink{ch5-dnshcp-setup}{Section {\ref{ch5-dnshcp-setup}}} for DNS and DHCP configuration. The importance of correctly functioning name resolution must be recognized. This applies equally for both hostname and NetBIOS names (machine names, computer names, domain names, workgroup names ---  ALL names!).

The migration process involves the following steps:

\begin{itemize}
%--- Item
\item 
Prepare the target Samba-3 server. This involves configuring Samba-3 for migration to either a tdbsam or an ldapsam backend.


%--- Item
\item 
\index{uppercase} \index{Posix} \index{lower-case} Clean up the source NT4 PDC. Delete all accounts that need not be migrated. Delete all files that should not be migrated. Where possible, change NT group names so there are no spaces or uppercase characters. This is important if the target UNIX host insists on POSIX-compliant all lowercase user and group names.


%--- Item
\item 
Step through the migration process.


%--- Item
\item 
\index{PDC} Remove the NT4 PDC from the network.


%--- Item
\item 
Upgrade the Samba-3 server from a BDC to a PDC, and validate all account information.

\end{itemize}

It may help to use the above outline as a pre-migration checklist.
\subsection{NT4 Migration Using LDAP Backend}
\label{id2544472}\hypertarget{id2544472}{}%

In this example, the migration is of an NT4 PDC to a Samba-3 PDC with an LDAP backend. The accounts about to be migrated are shown in \hyperlink{NT4DUM}{Figure {\ref{NT4DUM}}}. In this example use is made of the smbldap-tools scripts to add the accounts that are migrated into the ldapsam passdb backend. Four scripts are essential to the migration process. Other scripts will be required for daily management, but these are not critical to migration. The critical scripts are dependant on which passdb backend is being used. Refer to \hyperlink{ch8-vampire}{Table {\ref{ch8-vampire}}} to see which scripts must be provided so that the migration process can complete.

Verify that you have correctly specified in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file the scripts and arguments that should be passed to them before attempting to perform the account migration. Note also that the deletion scripts must be commented out during migration. These should be uncommented following successful migration of the NT4 Domain accounts.

\begin{admonition}{xslt/figures/warning}{Warning}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

Under absolutely no circumstances should the Samba daemons be started until instructed to do so. Delete the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}secrets.\dbz{}tdb}}} file and all Samba control tdb files before commencing the following configuration steps.
\end{admonition}


% table ------------------------------------------------------
\begin{table}[htb]
\begin{center}%
\hypertarget{ch8-vampire}{}%
\captionswapskip{}{{\caption{Samba smb.\dbz{}conf Scripts Essential to Samba Operation}\label{ch8-vampire}}}
\captionswapskip{}\begin{tabular}{|l|c|c|}
\hline 
{{{\bfseries Entity}}} & {{{\bfseries ldapsam Script}}} & {{{\bfseries tdbsam Script}}} \tabularnewline
 \hline 
{{Add User Accounts}} & {{smbldap-useradd}} & {{useradd}} \tabularnewline
 \hline 
{{Delete User Accounts}} & {{smbldap-userdel}} & {{userdel}} \tabularnewline
 \hline 
{{Add Group Accounts}} & {{smbldap-groupadd}} & {{groupadd}} \tabularnewline
 \hline 
{{Delete Group Accounts}} & {{smbldap-groupdel}} & {{groupdel}} \tabularnewline
 \hline 
{{Add User to Group}} & {{smbldap-groupmod}} & {{usermod (See Note)}} \tabularnewline
 \hline 
{{Add Machine Accounts}} & {{smbldap-useradd}} & {{useradd}} \tabularnewline
\hline 
\end{tabular}
\end{center}
\end{table}


\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

\index{usermod} \index{groupmem} \index{smbldap-tools} The UNIX/Linux {\bfseries{usermod}} utility does not permit simple user addition to (or deletion of users from) groups. This is a feature provided by the smbldap-tools scripts. If you want this capability, you must create your own tool to do this. Alternately, you can search the Web to locate a utility called {\bfseries{groupmem}} (by George Kraft) that provides this functionality. The {\bfseries{groupmem}} utility was contributed to the shadow package but has not surfaced in the formal commands provided by Linux distributions (March 2004).
\end{admonition}


\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

\index{tdbdump} The {\bfseries{tdbdump}} utility is a utility that you can build from the Samba source-code tree. Not all Linux binary distributions include this tool. If it is missing from your Linux distribution, you will need to build this yourself or else forgo its use.
\end{admonition}


\index{User Manager} Before starting the migration, all dead accounts were removed from the NT4 domain using the User Manager for Domains.
User Migration Steps
\begin{example}%
\hypertarget{sbent4smb}{}%
\captionswapskip{}{{\caption{NT4 Migration Samba-3 Server smb.\dbz{}conf ---  Part: A}\label{sbent4smb}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[global]
 	workgroup = DAMNATION
 	netbios name = MERLIN
 	passdb backend = ldapsam:ldap://localhost
 	log level = 1
 	syslog = 0
 	log file = /var/log/samba/%m
 	max log size = 0
 	smb ports = 139 445
 	name resolve order = wins bcast hosts
 	add user script = /opt/IDEALX/sbin/smbldap-useradd -m '%u'
 	#delete user script = /opt/IDEALX/sbin/smbldap-userdel '%u'
 	add group script = /opt/IDEALX/sbin/smbldap-groupadd '%g'
 	#delete group script = /opt/IDEALX/sbin/smbldap-groupdel '%g'
 	add user to group script = /opt/IDEALX/sbin/ smbldap-groupmod -m '%u' '%g'
 	#delete user from group script = /opt/IDEALX/sbin/smbldap-groupmod -x '%u' '%g'
 	set primary group script = /opt/IDEALX/sbin/smbldap-usermod -g '%g' '%u'
 	add machine script = /opt/IDEALX/sbin/smbldap-useradd -w '%u'
 	logon script = scripts\logon.cmd
 	logon path = \\%L\profiles\%U
 	logon home = \\%L\%U
 	logon drive = X:
 	domain logons = Yes
 	domain master = No
 	#wins support = Yes
 	wins server = 192.168.123.124
 	ldap admin dn = cn=Manager,dc=terpstra-world,dc=org
 	ldap group suffix = ou=Groups
 	ldap idmap suffix = ou=Idmap
 	ldap machine suffix = ou=People
 	ldap passwd sync = Yes
 	ldap suffix = dc=terpstra-world,dc=org
 	ldap ssl = no
 	ldap timeout = 20
 	ldap user suffix = ou=People
 	idmap backend = ldap:ldap://localhost
 	idmap uid = 15000-20000
 	idmap gid = 15000-20000
 	winbind nested groups = Yes
 	ea support = Yes
 	map acl inherit = Yes
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{sbent4smb2}{}%
\captionswapskip{}{{\caption{NT4 Migration Samba-3 Server smb.\dbz{}conf ---  Part: B}\label{sbent4smb2}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[apps]
 	comment = Application Data
 	path = /data/home/apps
 	read only = No
 [homes]
 	comment = Home Directories
 	path = /home/users/%U/Documents
 	valid users = %S
 	read only = No
 	browseable = No
 [printers]
 	comment = SMB Print Spool
 	path = /var/spool/samba
 	guest ok = Yes
 	printable = Yes
 	use client driver = No
 	browseable = No
 [netlogon]
 	comment = Network Logon Service
 	path = /var/lib/samba/netlogon
 	guest ok = Yes
 	locking = No
 [profiles]
 	comment = Profile Share
 	path = /var/lib/samba/profiles
 	read only = No
 	profile acls = Yes
 [profdata]
 	comment = Profile Data Share
 	path = /var/lib/samba/profdata
 	read only = No
 	profile acls = Yes
 [print$]
 	comment = Printer Drivers
 	path = /var/lib/samba/drivers
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{sbentslapd}{}%
\captionswapskip{}{{\caption{NT4 Migration LDAP Server Configuration File: /\dbz{}etc/\dbz{}openldap/\dbz{}slapd.\dbz{}conf ---  Part A}\label{sbentslapd}}}
\captionswapskip{}
\begin{Verbatim}[]

include         /etc/openldap/schema/core.schema
include         /etc/openldap/schema/cosine.schema
include         /etc/openldap/schema/inetorgperson.schema
include         /etc/openldap/schema/nis.schema
include         /etc/openldap/schema/samba3.schema

pidfile         /var/run/slapd/slapd.pid
argsfile        /var/run/slapd/slapd.args

access to dn.base=""
                by self write
                by * auth

access to attr=userPassword
                by self write
                by * auth

access to attr=shadowLastChange
                by self write
                by * read

access to *
                by * read
                by anonymous auth

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{sbentslapd2}{}%
\captionswapskip{}{{\caption{NT4 Migration LDAP Server Configuration File: /\dbz{}etc/\dbz{}openldap/\dbz{}slapd.\dbz{}conf ---  Part B}\label{sbentslapd2}}}
\captionswapskip{}
\begin{Verbatim}[]

#loglevel       256

#schemacheck     on
idletimeout     30
#backend         bdb
database        bdb
checkpoint      1024 5
cachesize       10000

suffix          "dc=terpstra-world,dc=org"
rootdn          "cn=Manager,dc=terpstra-world,dc=org"

# rootpw = not24get
rootpw          {SSHA}86kTavd9Dw3FAz6qzWTrCOKX/c0Qe+UV

directory       /var/lib/ldap

# Indices to maintain
index objectClass           eq
index cn                    pres,sub,eq
index sn                    pres,sub,eq
index uid                   pres,sub,eq
index displayName           pres,sub,eq
index uidNumber             eq
index gidNumber             eq
index memberUID             eq
index sambaSID              eq
index sambaPrimaryGroupSID  eq
index sambaDomainName       eq
index default               sub

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{sbrntldapconf}{}%
\captionswapskip{}{{\caption{NT4 Migration NSS LDAP File: /\dbz{}etc/\dbz{}ldap.\dbz{}conf}\label{sbrntldapconf}}}
\captionswapskip{}
\begin{Verbatim}[]

host    127.0.0.1

base    dc=terpstra-world,dc=org

ldap_version    3

binddn cn=Manager,dc=terpstra-world,dc=org
bindpw not24get

pam_password exop

nss_base_passwd         ou=People,dc=terpstra-world,dc=org?one
nss_base_shadow         ou=People,dc=terpstra-world,dc=org?one
nss_base_group          ou=Groups,dc=terpstra-world,dc=org?one

ssl off

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{sbentnss}{}%
\captionswapskip{}{{\caption{NT4 Migration NSS Control File: /\dbz{}etc/\dbz{}nsswitch.\dbz{}conf (Stage:1)}\label{sbentnss}}}
\captionswapskip{}
\begin{Verbatim}[]

passwd:         files #ldap
shadow:         files #ldap
group:          files #ldap

hosts:          files dns wins
networks:       files dns

services:       files
protocols:      files
rpc:            files
ethers:         files
netmasks:       files
netgroup:       files
publickey:      files

bootparams:     files
automount:      files nis
aliases:        files
#passwd_compat: ldap       #Not needed.
#group_compat:  ldap      #Not needed.

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{sbentnss2}{}%
\captionswapskip{}{{\caption{NT4 Migration NSS Control File: /\dbz{}etc/\dbz{}nsswitch.\dbz{}conf (Stage:2)}\label{sbentnss2}}}
\captionswapskip{}
\begin{Verbatim}[]

passwd:         files ldap
shadow:         files ldap
group:          files ldap

hosts:          files dns wins
networks:       files dns

services:       files
protocols:      files
rpc:            files
ethers:         files
netmasks:       files
netgroup:       files
publickey:      files

bootparams:     files
automount:      files nis
aliases:        files
#passwd_compat: ldap       #Not needed.
#group_compat:  ldap      #Not needed.

\end{Verbatim}
\end{example}

\begin{enumerate}

\item{Configure the Samba {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file to create a BDC. An example configuration is given in \hyperlink{sbent4smb}{Example {\ref{sbent4smb}}}. The delete scripts are commented out so that during the process of migration no account information can be deleted.}

\item{\index{slapd.conf} Configure OpenLDAP in preparation for the migration. An example {\texttt{\docbookhyphenatefilename{sladp.\dbz{}conf}}} file is shown in \hyperlink{sbentslapd}{Example {\ref{sbentslapd}}}. The {\texttt{\docbookhyphenatedot{rootpw}}} value is an encrypted password string that can be obtained by executing the {\bfseries{slappasswd}} command.}

\item{\index{nss\_ldap} \index{/etc/ldap.conf} Install the PADL {\bfseries{nss\_ldap}} tool set, then configure the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}} as shown in \hyperlink{sbrntldapconf}{Example {\ref{sbrntldapconf}}}.}

\item{\index{/etc/nsswitch.conf} Edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file so it has the entries shown in \hyperlink{sbentnss}{Example {\ref{sbentnss}}}. Note that the LDAP entries have been commented out. This is deliberate. If these entries are active (not commented out), and the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}} file has been configured, when the LDAP server is started, the process of starting the LDAP server will cause LDAP lookups. This causes the LDAP server {\bfseries{slapd}} to hang because it finds port 389 open and therefore cannot gain exclusive control of it. By commenting these entries out, it is possible to avoid this gridlock situation and thus the overall installation and configuration will progress more smoothly.}

\item{Validate the the target NT4 PDC name is being correctly resolved to its IP address by executing the following: 
\begin{Verbatim}[]

root#  ping transgression
PING transgression.terpstra-world.org (192.168.1.5) 56(84) bytes of data.
64 bytes from (192.168.1.5): icmp_seq=1 ttl=128 time=0.159 ms
64 bytes from (192.168.1.5): icmp_seq=2 ttl=128 time=0.192 ms
64 bytes from (192.168.1.5): icmp_seq=3 ttl=128 time=0.141 ms

--- transgression.terpstra-world.org ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.141/0.164/0.192/0.021 ms

\end{Verbatim}
 Do not proceed to the next step if this step fails. It is imperative that the name of the PDC can be resolved to its IP address. If this is broken, fix it.}

\item{Pull the domain SID from the NT4 domain that is being migrated as follows: 
\begin{Verbatim}[]

root#  net rpc getsid -S TRANGRESSION -U Administrator%not24get
Storing SID S-1-5-21-1385457007-882775198-1210191635 \
                     for Domain DAMNATION in secrets.tdb

\end{Verbatim}
  Another way to obtain the domain SID from the target NT4 domain that is being migrated to Samba-3 is by executing the following: 
\begin{Verbatim}[]

root#  net rpc info -S TRANSGRESSION

\end{Verbatim}
 If this method is used, do not forget to store the SID obtained into the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file. This can be done by executing: 
\begin{Verbatim}[]

root#  net setlocalsid S-1-5-21-1385457007-882775198-1210191635

\end{Verbatim}
}

\item{\index{Idealx} \index{configure.pl} \index{/opt/IDEALX/sbin} \index{smbldap-tools} Install the Idealx {\bfseries{smbldap-tools}} software package, following the instructions given in \hyperlink{sbeidealx}{Section {\ref{sbeidealx}}}. The resulting perl scripts should be located in the {\texttt{\docbookhyphenatefilename{/\dbz{}opt/\dbz{}IDEALX/\dbz{}sbin}}} directory. Change into that location, or wherever the scripts have been installed. Execute the {\texttt{\docbookhyphenatefilename{configure.\dbz{}pl}}} script to configure the Idealx package for use. Note: Use the domain SID obtained from the step above. The following is an example configuration session: 
\begin{Verbatim}[]

root#  ./configure.pl
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
       smbldap-tools script configuration
       -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Before starting, check
 . if your samba controller is up and running.
 . if the domain SID is defined
                           (you can get it with the 'net getlocalsid')

 . you can leave the configuration using the Crtl-c key combination
 . empty value can be set with the "." character
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Looking for configuration files...

Samba Config File Location [/etc/samba/smb.conf] >
smbldap Config file Location (global parameters)
           [/etc/smbldap-tools/smbldap.conf] >
smbldap Config file Location (bind parameters)
      [/etc/smbldap-tools/smbldap_bind.conf] >
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Let's start configuring the smbldap-tools scripts ...

. workgroup name: name of the domain Samba act as a PDC
  workgroup name [DAMNATION] >
. netbios name: netbios name of the samba controller
  netbios name [MERLIN] >
. logon drive: local path to which the home directory
         will be connected (for NT Workstations). Ex: 'H:'
  logon drive [X:] > H:
. logon home: home directory location (for Win95/98 or NT Workstation)
  (use %U as username) Ex:'\\MERLIN\home\%U'
  logon home (leave blank if you don't want homeDirectory)
                                       [\\MERLIN\home\%U] > \\%L\%U
. logon path: directory where roaming profiles are stored.
                                     Ex:'\\MERLIN\profiles\%U'
  logon path (leave blank if you don't want roaming profile)
                          [\\MERLIN\profiles\%U] > \\%L\profiles\%U
. home directory prefix (use %U as username) [/home/%U] >
                                                        /home/users/%U
. default user netlogon script (use %U as username) 
                               [%U.cmd] > scripts\logon.cmd
  default password validation time (time in days) [45] > 180
. ldap suffix [dc=terpstra-world,dc=org] >
. ldap group suffix [ou=Groups] >
. ldap user suffix [ou=People] >
. ldap machine suffix [ou=People] >
. Idmap suffix [ou=Idmap] >
. sambaUnixIdPooldn: object where you want to store the next uidNumber
  and gidNumber available for new users and groups
  sambaUnixIdPooldn object (relative to ${suffix}) 
                                         [sambaDomainName=DAMNATION] >
. ldap master server: 
           IP address or DNS name of the master (writable) ldap server
  ldap master server [] > 127.0.0.1
. ldap master port [389] >
. ldap master bind dn [cn=Manager,dc=terpstra-world,dc=org] >
. ldap master bind password [] >
. ldap slave server: IP address or DNS name of the slave ldap server:
                                         can also be the master one
  ldap slave server [] > 127.0.0.1
. ldap slave port [389] >
. ldap slave bind dn [cn=Manager,dc=terpstra-world,dc=org] >
. ldap slave bind password [] >
. ldap tls support (1/0) [0] >
. SID for domain DAMNATION: SID of the domain 
                       (can be obtained with 'net getlocalsid MERLIN')
  SID for domain DAMNATION []
        > S-1-5-21-1385457007-882775198-1210191635
. unix password encryption: encryption used for unix passwords
unix password encryption (CRYPT, MD5, SMD5, SSHA, SHA) [SSHA] > MD5
. default user gidNumber [513] >
. default computer gidNumber [515] >
. default login shell [/bin/bash] >
. default domain name to append to mail address [] >
                                                    terpstra-world.org
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
backup old configuration files:
  /etc/smbldap-tools/smbldap.conf->
                              /etc/smbldap-tools/smbldap.conf.old
  /etc/smbldap-tools/smbldap_bind.conf->
                              /etc/smbldap-tools/smbldap_bind.conf.old
writing new configuration file:
  /etc/smbldap-tools/smbldap.conf done.
  /etc/smbldap-tools/smbldap_bind.conf done.

\end{Verbatim}
 \index{sambaDomainName} \index{NextFreeUnixId} \index{updating smbldap-tools} \index{smbldap-tools updating} Note that the NT4 domain SID that was previously obtained was entered above. Also, the sambaUnixIdPooldn object was specified as sambaDomainName=DAMNATION. This is the location into which the Idealx smbldap-tools store the next available UID/GID information. It is also where Samba stores domain specific information such as the next RID, the SID, and so on. In older version of the smbldap-tools this information was stored in the sambaUnixIdPooldn DIT location cn=NextFreeUnixId. Where smbldap-tools are being upgraded to version 0.9.1 it is appropriate to update this to the new location only if the directory information is also relocated.}

\item{Start the LDAP server using the system interface script. On Novell SLES9 this is done as shown here: 
\begin{Verbatim}[]

root#  rcldap start

\end{Verbatim}
}

\item{Edit the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file so it has the entries shown in \hyperlink{sbentnss2}{Example {\ref{sbentnss2}}}. Note that the LDAP entries have now been uncommented.}

\item{The LDAP management password must be installed into the {\texttt{\docbookhyphenatefilename{secrets.\dbz{}tdb}}} file as follows: 
\begin{Verbatim}[]

root#  smbpasswd -w not24get
Setting stored password for 
            "cn=Manager,dc=terpstra-world,dc=org" in secrets.tdb

\end{Verbatim}
}

\item{Populate the LDAP directory as shown here: 
\begin{Verbatim}[]

root#  /opt/IDEALX/sbin/smbldap-populate -a root -k 0 -m 0
Using workgroup name from sambaUnixIdPooldn (smbldap.conf):
                          sambaDomainName=DAMNATION
Using builtin directory structure
adding new entry: dc=terpstra-world,dc=org
adding new entry: ou=People,dc=terpstra-world,dc=org
adding new entry: ou=Groups,dc=terpstra-world,dc=org
entry ou=People,dc=terpstra-world,dc=org already exist.
adding new entry: ou=Idmap,dc=terpstra-world,dc=org
adding new entry: sambaDomainName=DAMNATION,dc=terpstra-world,dc=org
adding new entry: uid=root,ou=People,dc=terpstra-world,dc=org
adding new entry: uid=nobody,ou=People,dc=terpstra-world,dc=org
adding new entry: cn=Domain Admins,ou=Groups,dc=terpstra-world,dc=org
adding new entry: cn=Domain Users,ou=Groups,dc=terpstra-world,dc=org
adding new entry: cn=Domain Guests,ou=Groups,dc=terpstra-world,dc=org
adding new entry: cn=Domain Computers,ou=Groups,dc=terpstra-world,dc=org
adding new entry: cn=Administrators,ou=Groups,dc=terpstra-world,dc=org
adding new entry: cn=Print Operators,ou=Groups,dc=terpstra-world,dc=org
adding new entry: cn=Backup Operators,ou=Groups,dc=terpstra-world,dc=org
adding new entry: cn=Replicators,ou=Groups,dc=terpstra-world,dc=org

\end{Verbatim}
 The script tries to add the ou=People container twice, hence the error message. This is expected behavior.}

\item{\index{Novell SUSE SLES 9} Restart the LDAP server following initialization of the LDAP directory. Execute the system control script provided on your system. The following steps can be used on Novell SUSE SLES 9: 
\begin{Verbatim}[]

root#  rcldap restart
root#  chkconfig ldap on

\end{Verbatim}
}

\item{Verify that the new user accounts that have been added to the LDAP directory can be resolved as follows: 
\begin{Verbatim}[]

root#  getent passwd
...
nobody:x:65534:65533:nobody:/var/lib/nobody:/bin/bash
man:x:13:62:Manual pages viewer:/var/cache/man:/bin/bash
news:x:9:13:News system:/etc/news:/bin/bash
uucp:x:10:14:Unix-to-Unix CoPy system:/etc/uucp:/bin/bash
+::0:0:::
root:x:0:0:Netbios Domain Administrator:/home/users/root:/bin/false
nobody:x:999:514:nobody:/dev/null:/bin/false

\end{Verbatim}
 Now repeat this for the group accounts as shown here: 
\begin{Verbatim}[]

root#  getent group
...
nobody:x:65533:
nogroup:x:65534:nobody
users:x:100:
+::0:
Domain Admins:x:512:root
Domain Users:x:513:
Domain Guests:x:514:
Domain Computers:x:515:
Administrators:x:544:
Print Operators:x:550:
Backup Operators:x:551:
Replicators:x:552:

\end{Verbatim}
 In both cases the LDAP accounts follow the {``}+::0:{''} entry.}

\item{Now it is time to join the Samba BDC to the target NT4 domain that is being migrated to Samba-3 by executing the following: 
\begin{Verbatim}[]

root#  net rpc join -S TRANSGRESSION -U Administrator%not24get
merlin:/opt/IDEALX/sbin # net rpc join -S TRANSGRESSION \
                         -U Administrator%not24get
Joined domain DAMNATION.

\end{Verbatim}
}

\item{Set the new domain administrator (root) password for both UNIX and Windows as shown here: 
\begin{Verbatim}[]

root#  /opt/IDEALX/sbin/smbldap-passwd root
Changing password for root
New password : ********
Retype new password : ********

\end{Verbatim}
 Note: During account migration, the Windows Administrator account will not be migrated to the Samba server.}

\item{Now validate that these accounts can be resolved using Samba's tools as shown here for user accounts: 
\begin{Verbatim}[]

root#  pdbedit -Lw
root:0:84B0D8E14D158FF8417EAF50CFAC29C3:
        AF6DD3FD4E2EA8BDE1695A3F05EFBF52:[U          ]:LCT-425F6467:
nobody:65534:NO PASSWORDXXXXXXXXXXXXXXXXXXXXX:
        NO PASSWORDXXXXXXXXXXXXXXXXXXXXX:[NU         ]:LCT-00000000:

\end{Verbatim}
 Now complete the following step to validate that group account mappings have been correctly set: 
\begin{Verbatim}[]

root#  net groupmap list
Domain Admins (S-1-5-21-1385457007-882775198-1210191635-512)
                                            -> Domain Admins
Domain Users (S-1-5-21-1385457007-882775198-1210191635-513) 
                                             -> Domain Users
Domain Guests (S-1-5-21-1385457007-882775198-1210191635-514) 
                                            -> Domain Guests
Domain Computers (S-1-5-21-1385457007-882775198-1210191635-515) 
                                          -> Domain Computers
Administrators (S-1-5-32-544) -> Administrators
Print Operators (S-1-5-32-550) -> Print Operators
Backup Operators (S-1-5-32-551) -> Backup Operators
Replicators (S-1-5-32-552) -> Replicators

\end{Verbatim}
 These are the expected results for a correctly configured system.}

\item{Commence migration as shown here: 
\begin{Verbatim}[]

root#  net rpc vampire -S TRANSGRESSION \
       -U Administrator%not24get > /tmp/vampire.log 2>1

\end{Verbatim}
 Check the vampire log to confirm that only expected errors have been reported. See \hyperlink{sbevam1}{Section {\ref{sbevam1}}}.}

\item{The migration of user accounts can be quickly validated as follows: 
\begin{Verbatim}[]

root#  pdbedit -Lw
root:0:84B0D8E14D158FF8417EAF50CFAC29C3:...
nobody:65534:NO PASSWORDXXXXXXXXXXXXXXXXXXXXX:...
Administrator:0:84B0D8E14D158FF8417EAF50CFAC29C3:...
Guest:1:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:...
TRANSGRESSION$:2:CC044B748CEE294CE76B6B0D1B86C1A8:...
IUSR_TRANSGRESSION:3:64046AC81B056C375F9537FC409085F8:...
MIDEARTH$:4:E93186E5819706D2AAD3B435B51404EE:...
atrickhoffer:5:DC08CFE0C12B2867352502E32A407F23:...
barryf:6:B829BCDE01FF24376E45D5F10408CFBD:...
fsellerby:7:6A97CBEBE8F9826B417EAF50CFAC29C3:...
gdaison:8:48F6A8C8A900024351DA8C2061C5F1D3:...
hrambotham:9:7330D9EA0964465EAAD3B435B51404EE:...
jrhapsody:10:ACBA7D207E2BA35D9BD41A26B01626BD:...
maryk:11:293B5A4CA41F6CA1A7D80430B8342B73:...
jacko:12:8E8982D86BD037C364BBD09A598E07AD:...
bridge:13:0D2CA7D2BE67FE2193BE3A377C968336:...
sharpec:14:8841A75CAC19D2855D8B73B1F4D430F8:...
jimbo:15:6E8BDC904FD9EC5C17306D272A9441BB:...
dhenwick:16:D1694A03C33584BDAAD3B435B51404EE:...
dork:17:69E2D19E69A593D5AAD3B435B51404EE:...
blue:18:E355EBF9559979FEAAD3B435B51404EE:...
billw:19:EE35C3481CF7F7DB484448BC86A641A5:...
rfreshmill:20:7EC033B58661B60CAAD3B435B51404EE:...
MAGGOT$:21:A3B9334765AD30F7AAD3B435B51404EE:...
TRENTWARE$:22:1D92C8DD5E7F0DDF93BE3A377C968336:...
MORTON$:23:89342E69DCA9D3F8AAD3B435B51404EE:...
NARM$:24:2B93E2D1D25448BDAAD3B435B51404EE:...
LAPDOG$:25:14AA535885120943AAD3B435B51404EE:...
SCAVENGER$:26:B6288EB6D147B56F8963805A19B0ED49:...
merlin$:27:820C50523F368C54AB9D85AE603AD09D:...

\end{Verbatim}
}

\item{The mapping of UNIX and Windows groups can be validated as show here: 
\begin{Verbatim}[]

root#  net groupmap list
Domain Admins (S-1-5-21-1385457007-882775198-1210191635-512)
                                                     -> Domain Admins
Domain Users (S-1-5-21-1385457007-882775198-1210191635-513)
                                                      -> Domain Users
Domain Guests (S-1-5-21-1385457007-882775198-1210191635-514)
                                                     -> Domain Guests
Domain Computers (S-1-5-21-1385457007-882775198-1210191635-515)
                                                   -> Domain Computers
Administrators (S-1-5-32-544) -> Administrators
Print Operators (S-1-5-32-550) -> Print Operators
Backup Operators (S-1-5-32-551) -> Backup Operators
Replicator (S-1-5-32-552) -> Replicators
Engineers (S-1-5-21-1385457007-882775198-1210191635-1020) -> Engineers
Marketoids (S-1-5-21-1385457007-882775198-1210191635-1022) -> Marketoids
Gnomes (S-1-5-21-1385457007-882775198-1210191635-1023) -> Gnomes
Catalyst (S-1-5-21-1385457007-882775198-1210191635-1024) -> Catalyst
Recieving (S-1-5-21-1385457007-882775198-1210191635-1025) -> Recieving
Rubberboot (S-1-5-21-1385457007-882775198-1210191635-1026) -> Rubberboot
Sales (S-1-5-21-1385457007-882775198-1210191635-1027) -> Sales
Accounting (S-1-5-21-1385457007-882775198-1210191635-1028) -> Accounting
Shipping (S-1-5-21-1385457007-882775198-1210191635-1029) -> Shipping
Account Operators (S-1-5-32-548) -> Account Operators
Guests (S-1-5-32-546) -> Guests
Server Operators (S-1-5-32-549) -> Server Operators
Users (S-1-5-32-545) -> Users

\end{Verbatim}
 It is of vital importance that the domain SID portions of all group accounts are identical.}

\item{The final responsibility in the migration process is to create identical shares and printing resources on the new Samba-3 server, copy all data across, set up privileges, and set share and file/directory access controls.}

\item{\index{domain master} \index{PDC} Edit the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file to reset the parameter \smbconfoption{domain master} = Yes so that the Samba server functions as a PDC for the purpose of migration. Also, uncomment the deletion scripts so they will now be fully functional, enable the {\ttfamily\itshape{\docbookhyphenatedot{wins support = yes}}} parameter and comment out the {\ttfamily\itshape{\docbookhyphenatedot{wins server}}}. Validate the configuration with the {\bfseries{testparm}} utility as shown here: 
\begin{Verbatim}[]

root#  testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[apps]"
Processing section "[media]"
Processing section "[homes]"
Processing section "[printers]"
Processing section "[netlogon]"
Processing section "[profiles]"
Processing section "[profdata]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_DOMAIN_PDC
Press enter to see a dump of your service definitions

\end{Verbatim}
}

\item{Now shut down the old NT4 PDC. Only when the old NT4 PDC and all NT4 BDCs have been shut down can the Samba-3 PDC be started.}

\item{All workstations should function as they did with the old NT4 PDC. All interdomain trust accounts should remain in place and fully functional. All machine accounts and user logon accounts should also function correctly.}

\item{The configuration of Samba-3 BDC servers can be accomplished now or at any convenient time in the future. Please refer to the carefully detailed process for doing so is outlined in \hyperlink{sbehap-bldg1}{Section {\ref{sbehap-bldg1}}}.}
\end{enumerate}
\subsubsection{Migration Log Validation}
\label{sbevam1}\hypertarget{sbevam1}{}%

The following {\texttt{\docbookhyphenatefilename{vampire.\dbz{}log}}} file is typical of a valid migration. 
\begin{Verbatim}[]

adding user Administrator to group Domain Admins
adding user atrickhoffer to group Engineers
adding user dhenwick to group Engineers
adding user dork to group Engineers
adding user rfreshmill to group Marketoids
adding user jacko to group Gnomes
adding user jimbo to group Gnomes
adding user maryk to group Gnomes
adding user gdaison to group Gnomes
adding user dhenwick to group Catalyst
adding user jacko to group Catalyst
adding user jacko to group Recieving
adding user blue to group Recieving
adding user hrambotham to group Rubberboot
adding user billw to group Sales
adding user bridge to group Sales
adding user jrhapsody to group Sales
adding user maryk to group Sales
adding user rfreshmill to group Sales
adding user fsellerby to group Sales
adding user sharpec to group Sales
adding user jimbo to group Accounting
adding user gdaison to group Accounting
adding user jacko to group Shipping
adding user blue to group Shipping
Fetching DOMAIN database
Creating unix group: 'Engineers'
Creating unix group: 'Marketoids'
Creating unix group: 'Gnomes'
Creating unix group: 'Catalyst'
Creating unix group: 'Recieving'
Creating unix group: 'Rubberboot'
Creating unix group: 'Sales'
Creating unix group: 'Accounting'
Creating unix group: 'Shipping'
Creating account: Administrator
Creating account: Guest
Creating account: TRANSGRESSION$
Creating account: IUSR_TRANSGRESSION
Creating account: MIDEARTH$
Creating account: atrickhoffer
Creating account: barryf
Creating account: fsellerby
Creating account: gdaison
Creating account: hrambotham
Creating account: jrhapsody
Creating account: maryk
Creating account: jacko
Creating account: bridge
Creating account: sharpec
Creating account: jimbo
Creating account: dhenwick
Creating account: dork
Creating account: blue
Creating account: billw
Creating account: rfreshmill
Creating account: MAGGOT$
Creating account: TRENTWARE$
Creating account: MORTON$
Creating account: NARM$
Creating account: LAPDOG$
Creating account: SCAVENGER$
Creating account: merlin$
Group members of Domain Admins: Administrator,
Group members of Domain Users: Administrator(primary),
TRANSGRESSION$(primary),IUSR_TRANSGRESSION(primary),
MIDEARTH$(primary),atrickhoffer(primary),barryf(primary),
fsellerby(primary),gdaison(primary),hrambotham(primary),
jrhapsody(primary),maryk(primary),jacko(primary),bridge(primary),
sharpec(primary),jimbo(primary),dhenwick(primary),dork(primary),
blue(primary),billw(primary),rfreshmill(primary),MAGGOT$(primary),
TRENTWARE$(primary),MORTON$(primary),NARM$(primary),
LAPDOG$(primary),SCAVENGER$(primary),merlin$(primary),
Group members of Domain Guests: Guest(primary),
Group members of Engineers: atrickhoffer,dhenwick,dork,
Group members of Marketoids: rfreshmill,
Group members of Gnomes: jacko,jimbo,maryk,gdaison,
Group members of Catalyst: dhenwick,jacko,
Group members of Recieving: jacko,blue,
Group members of Rubberboot: hrambotham,
Group members of Sales: billw,bridge,jrhapsody,maryk,
rfreshmill,fsellerby,sharpec,
Group members of Accounting: jimbo,gdaison,
Group members of Shipping: jacko,blue,
Fetching BUILTIN database
skipping SAM_DOMAIN_INFO delta for 'Builtin' (is not my domain)
Creating unix group: 'Account Operators'
Creating unix group: 'Guests'
Creating unix group: 'Server Operators'
Creating unix group: 'Users'

\end{Verbatim}

\subsection{NT4 Migration Using tdbsam Backend}
\label{id2553869}\hypertarget{id2553869}{}%

In this example, we change the domain name of the NT4 server from {\texttt{\docbookhyphenatedot{DRUGPREP}}} to {\texttt{\docbookhyphenatedot{MEGANET}}} prior to the use of the vampire (migration) tool. This migration process makes use of Linux system tools (like {\bfseries{useradd}}) to add the accounts that are migrated into the UNIX/Linux {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} and {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}group}}} databases. These entries must therefore be present, and correct options specified, in your {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file, or else the migration does not work as it should.
Migration Steps Using tdbsam\begin{enumerate}

\item{Prepare a Samba-3 server precisely per the instructions shown in \hyperlink{Big500users}{Chapter {\ref{Big500users}}, {``}The 500-User Office{''}}. Set the workgroup name to {\texttt{\docbookhyphenatedot{MEGANET}}}.}

\item{\index{domain master}\index{BDC} Edit the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file to temporarily change the parameter \smbconfoption{domain master} = No so the Samba server functions as a BDC for the purpose of migration.}

\item{Start Samba as you have done previously.}

\item{\index{net!rpc!join} Join the NT4 Domain as a BDC, as shown here: 
\begin{Verbatim}[]

root#  net rpc join -S oldnt4pdc -W MEGANET -UAdministrator%not24get
Joined domain MEGANET.

\end{Verbatim}
}

\item{\index{net!rpc!vampire} You may vampire the accounts from the NT4 PDC by executing the command, as shown here: 
\begin{Verbatim}[]

root#  net rpc vampire -S oldnt4pdc -U Administrator%not24get
Fetching DOMAIN database
SAM_DELTA_DOMAIN_INFO not handled
Creating unix group: 'Domain Admins'
Creating unix group: 'Domain Users'
Creating unix group: 'Domain Guests'
Creating unix group: 'Engineers'
Creating unix group: 'Marketoids'
Creating unix group: 'Account Operators'
Creating unix group: 'Administrators'
Creating unix group: 'Backup Operators'
Creating unix group: 'Guests'
Creating unix group: 'Print Operators'
Creating unix group: 'Replicator'
Creating unix group: 'Server Operators'
Creating unix group: 'Users'
Creating account: Administrator
Creating account: Guest
Creating account: oldnt4pdc$
Creating account: jacko
Creating account: maryk
Creating account: bridge
Creating account: sharpec
Creating account: jimbo
Creating account: dhenwick
Creating account: dork
Creating account: blue
Creating account: billw
Creating account: massive$
Group members of Engineers: Administrator,
                 sharpec(primary),bridge,billw(primary),dhenwick
Group members of Marketoids: Administrator,jacko(primary),
                maryk(primary),jimbo,blue(primary),dork(primary)
Creating unix group: 'Gnomes'
Fetching BUILTIN database
SAM_DELTA_DOMAIN_INFO not handled

\end{Verbatim}
}

\item{\index{pdbedit} At this point, we can validate our migration. Let's look at the accounts in the form in which they are seen in a smbpasswd file. This achieves that: 
\begin{Verbatim}[]

root#  pdbedit -Lw
Administrator:505:84B0D8E14D158FF8417EAF50CFAC29C3:
     AF6DD3FD4E2EA8BDE1695A3F05EFBF52:[UX         ]:LCT-3DF7AA9F:
jimbo:512:6E9A2A51F64A1BD5C187B8085FE1D9DF:
     CDF7E305E639966E489A0CEFB95EE5E0:[UX         ]:LCT-3E9362BC:
sharpec:511:E4301A7CD8FDD1EC6BBF9BC19CDF8151:
     7000255938831D5B948C95C1931534C5:[UX         ]:LCT-3E8B42C4:
dhenwick:513:DCD8886141E3F892AAD3B435B51404EE:
     2DB36465949CB938DD98C312EFDC2639:[UX         ]:LCT-3E939F41:
bridge:510:3FE6873A43101B46417EAF50CFAC29C3:
     891741F481AF111B4CAA09A94016BD01:[UX         ]:LCT-3E8B4291:
blue:515:256D41D2559BB3D2AAD3B435B51404EE:
     9CCADDA4F7D281DD0FAD321478C6F971:[UX         ]:LCT-3E939FDC:
diamond$:517:6C8E7B64EDCDBC4218B6345447A4454B:
     3323AC63C666CFAACB60C13F65D54E9A:[S          ]:LCT-00000000:
oldnt4pdc$:507:3E39430CDCABB5B09ED320D0448AE568:
     95DBAF885854A919C7C7E671060478B9:[S          ]:LCT-3DF7AA9F:
Guest:506:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:
     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[DUX        ]:LCT-3E93A008:
billw:516:85380CA7C21B6EBE168C8150662AF11B:
     5D7478508293709937E55FB5FBA14C17:[UX         ]:LCT-3FED7CA1:
dork:514:78C70DDEC35A35B5AAD3B435B51404EE:
     0AD886E015AC595EC0AF40E6C9689E1A:[UX         ]:LCT-3E939F9A:
jacko:508:BC472F3BF9A0A5F63832C92FC614B7D1:
     0C6822AAF85E86600A40DC73E40D06D5:[UX         ]:LCT-3E8B4242:
maryk:509:3636AB7E12EBE79AB79AE2610DD89D4C:
     CF271B744F7A55AFDA277FF88D80C527:[UX         ]:LCT-3E8B4270:

\end{Verbatim}
}

\item{\index{pdbedit} An expanded view of a user account entry shows more of what was obtained from the NT4 PDC: 
\begin{Verbatim}[]

sleeth:~ # pdbedit -Lv maryk
Unix username:        maryk
NT username:          maryk
Account Flags:        [UX         ]
User SID:             S-1-5-21-1988699175-926296742-1295600288-1003
Primary Group SID:    S-1-5-21-1988699175-926296742-1295600288-1007
Full Name:            Mary Kathleen
Home Directory:       \\diamond\maryk
HomeDir Drive:        X:
Logon Script:         scripts\logon.bat
Profile Path:         \\diamond\profiles\maryk
Domain:               MEGANET
Account desc:         Peace Maker
Workstations:
Munged dial:
Logon time:           0
Logoff time:          Mon, 18 Jan 2038 20:14:07 GMT
Kickoff time:         Mon, 18 Jan 2038 20:14:07 GMT
Password last set:    Wed, 02 Apr 2003 13:05:04 GMT
Password can change:  0
Password must change: Mon, 18 Jan 2038 20:14:07 GMT

\end{Verbatim}
}

\item{\index{net!group} The following command lists the long names of the groups that have been imported (vampired) from the NT4 PDC: 
\begin{Verbatim}[]

root#  net group -l -Uroot%not24get -Smassive

Group name            Comment
-----------------------------
Engineers             Snake Oil Engineers
Marketoids            Untrustworthy Hype Vendors
Gnomes                Plain Vanilla Garden Gnomes
Replicator            Supports file replication in a domain
Guests                Users granted guest access to the computer/domain
Administrators        Members can fully administer the computer/domain
Users                 Ordinary users

\end{Verbatim}
 Everything looks well and in order.}

\item{\index{domain master}\index{PDC} Edit the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file to reset the parameter \smbconfoption{domain master} = Yes so the Samba server functions as a PDC for the purpose of migration.}
\end{enumerate}
\subsection{Key Points Learned}
\label{id2554220}\hypertarget{id2554220}{}%

Migration of an NT4 PDC database to a Samba-3 PDC is possible.

\begin{itemize}
%--- Item
\item 
An LDAP backend is a suitable vehicle for NT4 migrations.


%--- Item
\item 
A tdbsam backend can be used to perform a migration.


%--- Item
\item 
Multiple NT4 domains can be merged into a single Samba-3 domain.


%--- Item
\item 
The net Samba-3 domain most likely requires some administration and updating before going live.

\end{itemize}

% ------------------------   
% Section 
\section{Questions and Answers}
\label{id2554258}\hypertarget{id2554258}{}%


% -------------------------------------------------------------
% QandASet                                                     
% -------------------------------------------------------------
\subsection*{F.A.Q.}
\label{id2554266}
\vspace{1em}
\noindent{}1.~\textbf{Q:}~\textit{\index{clean database} Why must I start each migration with a clean database?}
\newline
\noindent\textbf{A:}~
\index{merge} This is a recommendation that permits the data from each NT4 domain to be kept separate until you are ready to merge them. Also, if you do not start with a clean database, you may find errors due to users or groups from multiple domains having the same name but different SIDs. It is better to permit each migration to complete without undue errors and then to handle the merging of vampired data under proper supervision.


\vspace{1em}
\vspace{1em}
\noindent{}2.~\textbf{Q:}~\textit{\index{Domain SID} Is it possible to set my domain SID to anything I like?}
\newline
\noindent\textbf{A:}~
\index{auto-generated SID}\index{SID}\index{Domain SID} Yes, so long as the SID you create has the same structure as an autogenerated SID. The typical SID looks like this: S-1-5-21-XXXXXXXXXX-XXXXXXXXXX-XXXXXXXXXX, where the XXXXXXXXXX can be any number with from 6 to 10 digits. On the other hand, why would you really want to create your own SID? I cannot think of a good reason. You may want to set the SID to one that is already in use somewhere on your network, but that is a little different from straight out creating your own domain SID.


\vspace{1em}
\vspace{1em}
\noindent{}3.~\textbf{Q:}~\textit{\index{/etc/passwd}\index{/etc/group}\index{tdbsam}\index{passdb backend}\index{accounts!user}\index{accounts!group}\index{accounts!Domain} When using a tdbsam passdb backend, why must I have all domain user and group accounts in {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} and {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}group}}}?}
\newline
\noindent\textbf{A:}~
\index{UID}\index{GID}\index{smbpasswd}\index{/etc/passwd}\index{Posix}\index{LDAP database} Samba-3 must be able to tie all user and group account SIDs to a UNIX UID or GID. Samba does not fabricate the UNIX IDs from thin air, but rather requires them to be located in a suitable place.

When migrating a {\texttt{\docbookhyphenatefilename{smbpasswd}}} file to an LDAP backend, the UID of each account is taken together with the account information in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}}, and both sets of data are used to create the account entry in the LDAP database.

If you elect to create the POSIX account also, the entire UNIX account is copied to the LDAP backend. The same occurs with NT groups and UNIX groups. At the conclusion of migration to the LDAP database, the accounts may be removed from the UNIX database files. In short then, all UNIX and Windows networking accounts, both in tdbsam as well as in LDAP, require UIDs/GIDs.


\vspace{1em}
\vspace{1em}
\noindent{}4.~\textbf{Q:}~\textit{\index{validate}\index{connectivity}\index{migration} Why did you validate connectivity before attempting migration?}
\newline
\noindent\textbf{A:}~
Access validation before attempting to migrate NT4 domain accounts helps to pinpoint potential problems that may otherwise affect or impede account migration. I am always mindful of the 4 P's of migration: Planning Prevents Poor Performance.


\vspace{1em}
\vspace{1em}
\noindent{}5.~\textbf{Q:}~\textit{How would you merge 10 tdbsam-based domains into an LDAP database?}
\newline
\noindent\textbf{A:}~
\index{risk}\index{dump}\index{tdbsam}\index{Samba Domain}\index{UID}\index{GID}\index{pdbedit}\index{transfer}\index{smbpasswd}\index{LDAP}\index{tool} If you have 10 tdbsam Samba domains, there is considerable risk that there are a number of accounts that have the same UNIX identifier (UID/GID). This means that you almost certainly have to edit a lot of data. It would be easiest to dump each database in smbpasswd file format and then manually edit all records to ensure that each has a unique UID. Each file can then be imported a number of ways. You can use the {\bfseries{pdbedit}} tool to affect a transfer from the smbpasswd file to LDAP, or you can migrate them en masse to tdbsam and then to LDAP. The final choice is yours. Just remember to verify all accounts that you have migrated before handing over access to a user. After all, too many users with a bad migration experience may threaten your career.


\vspace{1em}
\vspace{1em}
\noindent{}6.~\textbf{Q:}~\textit{\index{machine accounts}\index{accounts!machine} I want to change my domain name after I migrate all accounts from an NT4 domain to a Samba-3 domain. Does it make any sense to migrate the machine accounts in that case?}
\newline
\noindent\textbf{A:}~
\index{registry}\index{un-join}\index{rejoin}\index{tattooing} I would recommend not to migrate the machine account. The machine accounts should still work, but there are registry entries on each Windows NT4 and upward client that have a tattoo of the old domain name. If you unjoin the domain and then rejoin the newly renamed Samba-3 domain, you can be certain to avoid this tattooing effect.


\vspace{1em}
\vspace{1em}
\noindent{}7.~\textbf{Q:}~\textit{\index{multiple group mappings} After merging multiple NT4 domains into a Samba-3 domain, I lost all multiple group mappings. Why?}
\newline
\noindent\textbf{A:}~
\index{/etc/passwd}\index{/etc/group} Samba-3 currently does not implement multiple group membership internally. If you use the Windows NT4 Domain User Manager to manage accounts and you have an LDAP backend, the multiple group membership is stored in the POSIX groups area. If you use either tdbsam or smbpasswd backend, then multiple group membership is handled through the UNIX groups file. When you dump the user accounts, no group account information is provided. When you edit (change) UIDs and GIDs in each file to which you migrated the NT4 Domain data, do not forget to edit the UNIX {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} and {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}group}}} information also. That is where the multiple group information is most closely at your fingertips.


\vspace{1em}
\vspace{1em}
\noindent{}8.~\textbf{Q:}~\textit{How can I reset group membership after loading the account information into the LDAP database?}
\newline
\noindent\textbf{A:}~
\index{SRVTOOLS.EXE} You can use the NT4 Domain User Manager that can be downloaded from the Microsoft Web site. The installation file is called {\texttt{\docbookhyphenatefilename{SRVTOOLS.\dbz{}EXE}}}.


\vspace{1em}
\vspace{1em}
\noindent{}9.~\textbf{Q:}~\textit{\index{group names} What are the limits or constraints that apply to group names?}
\newline
\noindent\textbf{A:}~
\index{limit}\index{shadow-utils}\index{groupadd}\index{groupdel}\index{groupmod}\index{account names} A Windows 200x group name can be up to 254 characters long, while in Windows NT4 the group name is limited to 20 characters. Most UNIX systems limit this to 32 characters. Windows groups can contain upper- and lowercase characters, as well as spaces. Many UNIX system do not permit the use of uppercase characters, and some do not permit the space character either. A number of systems (i.e., Linux) work fine with both uppercase and space characters in group names, but the shadow-utils package that provides the group control functions ({\bfseries{groupadd}}, {\bfseries{groupmod}}, {\bfseries{groupdel}}, and so on) do not permit them. Also, a number of UNIX systems management tools enforce their own particular interpretation of the POSIX standards and likewise do not permit uppercase or space characters in group or user account names. You have to experiment with your system to find what its peculiarities are.


\vspace{1em}
\vspace{1em}
\noindent{}10.~\textbf{Q:}~\textit{\index{vampire} My Windows NT4 PDC has 323,000 user accounts. How long will it take to migrate them to a Samba-3 LDAP backend system using the vampire process?}
\newline
\noindent\textbf{A:}~
UNIX UIDs and GIDs on most UNIX systems use an unsigned short or an unsigned integer. Recent Linux kernels support at least a much larger number. On systems that have a 16-bit constraint on UID/GIDs, you would not be able to migrate 323,000 accounts because this number cannot fit into a 16-bit unsigned integer. UNIX/Linux systems that have a 32-bit UID/GID can easily handle this number of accounts. Please check this carefully before you attempt to effect a migration using the vampire process.

\index{Migration speed} Migration speed depends much on the processor speed, the network speed, disk I/O capability, and LDAP update overheads. On a dual processor AMD MP1600+ with 1 GB memory that was mirroring LDAP to a second identical system over 1 Gb Ethernet, I was able to migrate around 180 user accounts per minute. Migration would obviously go much faster if LDAP mirroring were turned off during the migration.


\vspace{1em}
\cleardoublepage 
% -------------------------------------------------------------
% Chapter Migrating NetWare Server to Samba-3 
% ------------------------------------------------------------- 	
\chapter{Migrating NetWare Server to Samba-3}
\label{nw4migration}\hypertarget{nw4migration}{}%

\index{Novell} \index{SUSE} Novell is a company any seasoned IT manager has to admire. It has become increasingly Linux-friendly and is emerging out of a deep regression that almost saw the company disappear into obscurity. Novell's SUSE Linux hosts the NetWare server and it is the platform of choice to which many older NetWare servers are being migrated. It will be interesting to see what becomes of NetWare over time. Meanwhile, there can be no denying that Novell is a Linux company.

\index{Red Hat} \index{Debian} \index{Gentoo} \index{Mandrake} Whatever flavor of Linux is preferred in your environment, whether Red Hat, Debian, Gentoo, Mandrake, or SUSE (Novell), the information in this chapter should be read with the knowledge that file locations may vary a little; even so, the information in this chapter should provide something of value.

\index{migration} Contributions to this chapter were made by Misty Stanley-Jones, a UNIX administrator of many years who surfaced on the Samba mailing list with a barrage of questions and who regularly helps other administrators to solve thorny Samba migration questions.

\index{NetWare} \index{NLM} \index{NetWare} \index{Mars\_NWE} One wonders how many NetWare servers remain in active service. Many are being migrated to Samba on Linux. Red Hat Linux, SUSE Linux 9.x, and SUSE Linux Enterprise Server 9 are ideal target platforms to which a NetWare server may be migrated. The migration method of choice is much dependent on the tools that the administrator finds most natural to use. The old-hand NetWare guru will likely want to use tools like the NetWare NLM for {\bfseries{rsync}} to migrate files from the NetWare server to the Samba server. The UNIX administrator might prefer tools that are part of the Mars\_NWE (Martin Stovers' NetWare Emulator) open source package. The MS Windows network administrator will likely make use of the NWConv utility that is a part of Windows NT4 Server. Whatever your tool of choice, migration will be filled with joyous and challenging moments ---  though probably not concurrently.

The priority that Misty faced was one of migration of the data files off the NetWare 4.11 server and onto a Samba-based Windows file and print server. This chapter does not pretend to document all the different methods that could be used to migrate user and group accounts off a NetWare server. Its focus is on migration of data files.

This chapter tells its own story, so ride along. Maybe the information presented here will help to smooth over a similar migration challenge in your favorite networking environment.

File paths have been modified to permit use of RPM packages provided by Novell. In the original documentation contributed by Misty, the Courier-IMAP package had been built directly from the original source tarball.

% ------------------------   
% Section 
\section{Introduction}
\label{id2483990}\hypertarget{id2483990}{}%

\index{Novell} Misty Stanley-Jones was recruited by Abmas to administer a network that had not received much attention for some years and was much in need of a makeover. As a brand-new sysadmin to this company, she inherited a very old Novell file server and came with a determination to change things for the better.

A site survey turned up the following details for the old NetWare server:

\begin{tabular}{l}


200 MHz MMX processor
  \\

512K RAM
  \\

24 GB disk space in RAID1
  \\

Novell 4.11 patched to service pack 7
  \\

60+ users
  \\

7 network-attached printers
  \\
\end{tabular}

The company had outgrown this server several years before and was dealing with severe growing pains. Some of the problems experienced were:

\begin{itemize}
%--- Item
\item 
Very slow performance


%--- Item
\item 
Available storage hovering around the 5\% range

\begin{itemize}
%--- Item
\item 
Extremely slow print spooling.


%--- Item
\item 
Users storing information on their local hard drives, causing backup integrity problems

\end{itemize}

\end{itemize}

\index{payroll} At one point disk space had filled up to 100 percent, causing the payroll database to become corrupt. This caused the accounting department to be down for over a week and necessitated deployment of another file server. The replacement server was created with very poor security and design considerations from a discarded desktop PC.
\subsection{Assignment Tasks}
\label{id2492957}\hypertarget{id2492957}{}%

Misty has provided this summary of her migration experience in the hope that it will help someone to avoid the challenges she faced. Perhaps her configuration files and background will accelerate your learning as you grapple with a similar migration challenge. Let there be no confusion, the information presented in this chapter is provided to demonstrate how Misty dealt with a particular NetWare migration requirement, and it provides an overall approach to the implementation of a Samba-3 environment that is significantly divergent from that presented in \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}}.

The complete removal of all site-specific information in order to produce a generic migration solution would rob this chapter of its character. It should be recognized, therefore, that the examples given require significant adaptation to suit local needs and thus there are some gaps in the example files. That is not Misty's fault;it is the result of treatment given to her files in an attempt to make the overall information more useful to you.

\index{cost-benefit} After management reviewed a cost-benefit report as well as an estimated time-to-completion, approval was given proceed with the solution proposed. The server was built from purchased components. The total project cost was \$3,000. A brief description of the configuration follows:

\begin{tabular}{l}


3.0 GHz P4 Processor
  \\

1 GB RAM
  \\

120 GB SATA operating system drive
  \\

4 x 80 GB SATA data drives (RAID5 240 GB capacity)
  \\

2 x 80 GB SATA removable drives for online backup
  \\

A DLT drive for asynchronous offline backup
  \\

SUSE Linux Professional 9.1
  \\
\end{tabular}

The new system has operated for 6 months without problems. Over the past months much attention has been focused on cleaning up desktops and user profiles.

% ------------------------   
% Section 
\section{Dissection and Discussion}
\label{id2507157}\hypertarget{id2507157}{}%

\index{LDAP} \index{e-Directory} \index{authentication} \index{identity management} A decision to use LDAP was made even though I knew nothing about LDAP except that I had been reading the book {``}LDAP System Administration,{''} by Gerald Carter. LDAP seemed to provide some of the functionality of Novell's e-Directory Services and would provide centralized authentication and identity management.

\index{database} \index{RPM} \index{tree} Building the LDAP database took a while and a lot of trial and error. Following the guidance I obtained from {``}LDAP System Administration,{''} I installed OpenLDAP (from RPM; later I compiled a more current version from source) and built my initial LDAP tree.
\subsection{Technical Issues}
\label{id2507235}\hypertarget{id2507235}{}%

\index{white-pages} \index{inetOrgPerson} \index{OpenLDAP} \index{/etc/passwd} \index{/etc/shadow} \index{LDIF} \index{IMAP} \index{POP3} \index{SMTP} The first challenge was to create a company white pages, followed by manually entering everything from the printed company directory. This used only the inetOrgPerson object class from the OpenLDAP schemas. The next step was to write a shell script that would look at the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} and {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}shadow}}} files on our mail server and create an LDIF file from which the information could be imported into LDAP. This would allow use of LDAP for Linux authentication, IMAP, POP3, and SMTP.

Because a decision was made to use Courier-IMAP the schema {``}authldap.schema{''} from the Courier-IMAP source, tarball is necessary to resolve Courier-specific LDAP directory needs. Where the Courier-IMAP file provided by SUSE is used, this file is named {\texttt{\docbookhyphenatefilename{courier.\dbz{}schema}}}.

Looking back, it would have been much easier to populate the LDAP directory using a convenient tool such as {\bfseries{phpLDAPAdmin}} from the outset. An excessive amount of time was spent trying to generate LDIF files that could be parsed using the {\bfseries{ldapmodify}} so that necessary changes could be written to the directory. This was a learning experience!

An attempt was made to use the PADL POSIX account migration scripts, but I gave up trying to make them work. Instead, even though it is most inelegant, I wrote a simple script that did what I needed. It is enclosed as a simple example to demonstrate that you do not need to be a guru to make light of otherwise painful repetition. This file is listed in \hyperlink{sbeamg}{Example {\ref{sbeamg}}}.

\begin{example}%
\hypertarget{sbeamg}{}%
\captionswapskip{}{{\caption{A Rough Tool to Create an LDIF File from the System Account Files}\label{sbeamg}}}
\captionswapskip{}
\begin{Verbatim}[]

#!/bin/bash

cat /etc/passwd | while read l; do
  uid=`echo $l | cut -d : -f 1`
  uidNumber=`echo $l | cut -d : -f 3`
  gidNumber=`echo $1 | cut -d : -f 4`
  gecos=`echo $l | cut -d : -f 5`
  homeDirectory=`echo $l | cut -d : -f 6`
  loginShell=`echo $l | cut -d : -f 6`
  userPassword=`cat /etc/shadow | grep $uid | cut -d : -f 2`

  echo "dn: cn=$gecos,ou=people,dc=mycompany,dc=com"
  echo "objectClass: account"
  echo "objectClass: posixAccount"
  echo "cn: $gecos"
  echo "uid: $uid"
  echo "uidNumber: $uidNumber"
  echo "gidNumber: $gidNumber"
  echo "homeDirectory: $homeDirectory"
  echo "loginShell: $loginShell"
  echo "userPassword: $userPassword"
done

\end{Verbatim}
\end{example}


\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

The PADL MigrationTools are recommended for migration of the UNIX account information into the LDAP directory. The tools consist of a set of Perl scripts for migration of users, groups, aliases, hosts, netgroups, networks, protocols, PRCs, and services from the existing ASCII text files (or from a name service such as NIS). This too set can be obtained from the PADL Web site\label{id2465722}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.padl.com}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2465722}.
\end{admonition}


% ------------------------   
% Section 
\section{Implementation}
\label{id2465732}\hypertarget{id2465732}{}%


\subsection{NetWare Migration Using LDAP Backend}
\label{id2465742}\hypertarget{id2465742}{}%

The following software must be installed on the SUSE Linux Enterprise Server to perform this migration:

\begin{tabular}{l}


courier-imap
  \\

courier-imap-ldap
  \\

nss\_ldap
  \\

openldap2-client
  \\

openldap2-devel (only for Samba compilation)
  \\

openldap2
  \\

pam\_ldap
  \\

samba-3.0.20 or later
  \\

samba-client-3.0.20 or later
  \\

samba-winbind-3.0.20 or later
  \\

smbldap-tools Version 0.9.1
  \\
\end{tabular}

Each software application must be carefully configured in preparation for migration. The configuration files used at Abmas are provided as a guide and should be modified to meet needs at your site.
\subsubsection{LDAP Server Configuration}
\label{id2465819}\hypertarget{id2465819}{}%

The {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap/\dbz{}slapd.\dbz{}conf}}} file Misty used is shown here: 
\begin{Verbatim}[]

#/etc/openldap/slapd.conf
#
# See slapd.conf(5) for details on configuration options.
# This file should NOT be world readable.
#
include   /etc/openldap/schema/core.schema
include   /etc/openldap/schema/cosine.schema
include   /etc/openldap/schema/inetorgperson.schema
include   /etc/openldap/schema/nis.schema
include   /etc/openldap/schema/samba3.schema
include   /etc/openldap/schema/dhcp.schema
include   /etc/openldap/schema/misc.schema
include   /etc/openldap/schema/idpool.schema
include   /etc/openldap/schema/eduperson.schema
include   /etc/openldap/schema/commURI.schema
include   /etc/openldap/schema/local.schema
include   /etc/openldap/schema/courier.schema

pidfile   /var/run/slapd/run/slapd.pid
argsfile  /var/run/slapd/run/slapd.args

replogfile  /data/ldap/log/slapd.replog

# Load dynamic backend modules:
modulepath  /usr/lib/openldap/modules

#######################################################################
# Logging parameters
#######################################################################
loglevel 256

#######################################################################
# SASL and TLS options
#######################################################################
sasl-host     ldap.corp.abmas.org
sasl-realm    DIGEST-MD5
sasl-secprops   none
TLSCipherSuite HIGH:MEDIUM:+SSLV2
TLSCertificateFile    /etc/ssl/certs/private/abmas-cert.pem
TLSCertificateKeyFile /etc/ssl/certs/private/abmas-key.pem
password-hash   {SSHA}
defaultsearchbase "dc=abmas,dc=biz"

#######################################################################
# bdb database definitions
#######################################################################
database          bdb
suffix            "dc=abmas,dc=biz"
rootdn            "cn=manager,dc=abmas,dc=biz"
rootpw            {SSHA}gdo/dUvoT4ZJmULz3rUt6A3H/hBEduJ5
directory         /data/ldap
mode    0600
# The following is for BDB to make it flush its data to disk every
# 500 seconds or 5kb of data
checkpoint 500 5

## For running slapindex
#readonly on

## Indexes for often-requested attributes
index   objectClass             eq
index   cn                      eq,sub
index   sn                      eq,sub
index   uid                     eq,sub
index   uidNumber               eq
index   gidNumber               eq
index   sambaSID                eq
index   sambaPrimaryGroupSID    eq
index   sambaDomainName         eq
index   default                 sub
cachesize 2000

replica         host=baa.corp.abmas.org:389
                suffix="dc=abmas,dc=biz"
                binddn="cn=replica,dc=abmas,dc=biz"
                credentials=verysecret
                bindmethod=simple
                tls=yes
replica         host=ns.abmas.org:389
                suffix="dc=abmas,dc=biz"
                binddn="cn=replica,dc=abmas,dc=biz"
                credentials=verysecret
                bindmethod=simple
                tls=yes

#######################################################################
# ACL section
#######################################################################
## MOST RESTRICTIVE RULES MUST GO FIRST!
# Admins get access to everything. This way I do not have to rename.
access to *
  by group/groupOfUniqueNames/uniqueMember="cn=LDAP
Administrators,ou=groups,dc=abmas,dc=biz" write
  by * break

## Users can change their own passwords. 
access to 
attrs=userPassword,sambaNTPassword,sambaLMPassword,sambaPwdLastSet,
sambaPwdMustChange,sambaPwdCanChange
  by self write
  by * auth

## Home contact info restricted to the logged-in user and the HR dept
access to attrs=hometelephoneNumber,homePostalAddress,
mobileTelephoneNumber,pagerTelephoneNumber
  by group/groupOfUniqueNames/uniqueMember="cn=hr_admin,
ou=groups,dc=abmas,dc=biz" 
write
  by self write
  by * none

## Everyone can read email aliases
access to dn.sub="ou=Email Aliases,dc=abmas,dc=biz"
  by * read

## Only admins can manage email aliases
## If someone is the role occupant of an alias they can change it -- this
## is accomplished by the "organizationalRole" objectclass and is
## pretty cool -- like a groupOfUniqueNames but for individual
## users.
access to dn.children="ou=Email Aliases,dc=abmas,dc=biz"
  by dnattr=roleOccupant write
  by * read

## Admins and HR can add and delete users
access to dn.sub="ou=people,dc=abmas,dc=biz"
  by group/groupOfUniqueNames/uniqueMember="cn=hr_admin,
ou=groups,dc=abmas,dc=biz" 
write
  by * read

## Admins and HR can add and delete bizputers
access to dn.sub="ou=bizputers,dc=abmas,dc=biz"
  by group/groupOfUniqueNames/uniqueMember="cn=hr_admin,
ou=groups,dc=abmas,dc=biz" 
write
  by * read

## Admins and HR can add and delete groups
access to dn.sub="ou=groups,dc=abmas,dc=biz"
  by group/groupOfUniqueNames/uniqueMember="cn=hr_admin,
ou=groups,dc=abmas,dc=biz" 
write
  by * read

## This is used to quickly deactivate any LDAP object only 
##  Admins have access.
access to dn.sub="ou=inactive,dc=abmas,dc=biz"
  by * none

## This is for programs like Windows Address Book that can 
## detect the default search base.
access to attrs=namingcontexts,supportedControl
  by anonymous =cs
  by * read

## Default to read-only access
access to *
  by dn.base="cn=replica,ou=people,dc=abmas,dc=biz" write
  by * read

\end{Verbatim}


\index{/etc/ldap.conf} The {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}ldap.\dbz{}conf}}} file used is listed in \hyperlink{ch8ldap}{Example {\ref{ch8ldap}}}.

\begin{example}%
\hypertarget{ch8ldap}{}%
\captionswapskip{}{{\caption{NSS LDAP Control File ---  /etc/ldap.conf}\label{ch8ldap}}}
\captionswapskip{}
\begin{Verbatim}[]

# /etc/ldap.conf
# This file is present on every *NIX client that authenticates to LDAP.
# For me, most of the defaults are fine. There is an amazing amount of
# customization that can be done see the man page for info.

# Your LDAP server. Must be resolvable without using LDAP. The following
# is for the LDAP server all others use the FQDN of the server
URI ldap://127.0.0.1

# The distinguished name of the search base.
base ou=corp,dc=abmas,dc=biz

# The LDAP version to use (defaults to 3 if supported by client library)
ldap_version 3

# The distinguished name to bind to the server with if the effective
# user ID is root. Password is stored in /etc/ldap.secret (mode 600)
rootbinddn cn=Manager,dc=abmas,dc=biz

# Filter to AND with uid=%s
pam_filter objectclass=posixAccount

# The user ID attribute (defaults to uid)
pam_login_attribute uid

# Group member attribute
pam_member_attribute memberUID

# Use the OpenLDAP password change
# extended operation to update the password.
pam_password exop

# OpenLDAP SSL mechanism
# start_tls mechanism uses the normal LDAP port, LDAPS typically 636
ssl start_tls

tls_cacertfile /etc/ssl/certs/private/abmas-cert.pem
...

\end{Verbatim}
\end{example}


The NSS control file {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} has the following contents: 
\begin{Verbatim}[]

# /etc/nsswitch.conf
# This file controls the resolve order for system databases.

# the following two lines obviate the "+" entry in /etc/passwd and /etc/group.
passwd:   compat ldap
group:    compat ldap
# The above are all that I store in LDAP at this point. There are 
# possibilities to store hosts, services, ethers, and lots of other things.

\end{Verbatim}


\index{PAM} \index{NSS} In my setup, users authenticate via PAM and NSS using LDAP-based accounts. The configuration file that controls the behavior of the PAM {\bfseries{pam\_unix2}} module is shown in \hyperlink{sbepu2}{Example {\ref{sbepu2}}} file. This works out of the box with the configuration files in this chapter. It enables you to have no local accounts for users (it is highly advisable to have a local account for the root user). Traps for the unwary include the following:

\begin{example}%
\hypertarget{sbepu2}{}%
\captionswapskip{}{{\caption{The PAM Control File /\dbz{}etc/\dbz{}security/\dbz{}pam\_\dbz{}unix2.\dbz{}conf}\label{sbepu2}}}
\captionswapskip{}
\begin{Verbatim}[]

# pam_unix2 config file
#
# This file contains options for the pam_unix2.so module.
# It contains a list of options for every type of management group,
# which will be used for authentication, account management and
# password management. Not all options will be used from all types of
# management groups.
#
# At first, pam_unix2 will read this file and then uses the local
# options. Not all options can be set her global.
#
# Allowed options are:
#
# debug                 (account, auth, password, session)
# nullok                (auth)
# md5                   (password / overwrites /etc/default/passwd)
# bigcrypt              (password / overwrites /etc/default/passwd)
# blowfish              (password / overwrites /etc/default/passwd)
# crypt_rounds=XX
# none                  (session)
# trace                 (session)
# call_modules=x,y,z    (account, auth, password)
#
#  Example:
#  auth:        nullok
#  account:
#  password:    nullok blowfish crypt_rounds=8
#  session:     none
#
auth: use_ldap
account: use_ldap
password: use_ldap
session: none

\end{Verbatim}
\end{example}

\index{LDAP}\index{authenticate}\index{DNS}
\begin{itemize}
%--- Item
\item 
If your LDAP database goes down, nobody can authenticate except for root.


%--- Item
\item 
If failover is configured incorrectly, weird behavior can occur. For example, DNS can fail to resolve.

\end{itemize}

I do have two LDAP slave servers configured. That subject is beyond the scope of this document, and steps for implementing it are well documented.

The following services authenticate using LDAP:
\index{UNIX}\index{Postfix}\index{Courier-IMAP}
\begin{tabular}{l}


UNIX login/ssh
  \\

Postfix (SMTP)
  \\

Courier-IMAP/IMAPS/POP3/POP3S
  \\
\end{tabular}

\index{white-pages} \index{Windows Address Book} Companywide white pages can be searched using an LDAP client such as the one in the Windows Address Book.

\index{LDAP} \index{smbldap-tools} Having gained a solid understanding of LDAP and a relatively workable LDAP tree thus far, it was time to configure Samba. I compiled the latest stable Samba and also installed the latest {\bfseries{smbldap-tools}} from Idealx\label{id2473588}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://idealx.com}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2473588}.

The Samba {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file was configured as shown in \hyperlink{ch8smbconf}{Example {\ref{ch8smbconf}}}.

\begin{example}%
\hypertarget{ch8smbconf}{}%
\captionswapskip{}{{\caption{Samba Configuration File ---  smb.conf Part A}\label{ch8smbconf}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
# Global parameters
 [global]
 	workgroup = MEGANET2
 	netbios name = MASSIVE
 	server string = Corp File Server
 	passdb backend = ldapsam:ldap://localhost
 	pam password change = Yes
 	username map = /etc/samba/smbusers
 	log level = 1
 	log file = /data/samba/log/%m.log
 	name resolve order = wins host bcast
 	time server = Yes
 	printcap name = cups
 	show add printer wizard = No
 	cups options = Raw
 	add user script = /opt/IDEALX/sbin/smbldap-useradd -m "%u"
 	add group script = /opt/IDEALX/sbin/smbldap-groupadd -p "%g"
 	add user to group script = /opt/IDEALX/sbin/smbldap-groupmod -m "%u" "%g"
 	delete user from group script = /opt/IDEALX/sbin/smbldap-groupmod -x "%u" "%g"
 	set primary group script = /opt/IDEALX/sbin/smbldap-usermod -g "%g" "%u"
 	add machine script = /usr/local/sbin/smbldap-useradd -w "%m"
 	logon script = logon.bat
 	logon path = \\%L\profiles\%U\%a
 	logon drive = H:
 	logon home = \\%L\%U
 	domain logons = Yes
 	wins support = Yes
 	ldap admin dn = cn=Manager,dc=abmas,dc=biz
 	ldap group suffix = ou=Groups
 	ldap idmap suffix = ou=People
 	ldap machine suffix = ou=People
 	ldap passwd sync = Yes
 	ldap suffix = ou=MEGANET2,dc=abmas,dc=biz
 	ldap ssl = no
 	ldap user suffix = ou=People
 	admin users = root, "@Domain Admins"
 	printer admin = "@Domain Admins"
 	force printername = Yes
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch8smbconf2}{}%
\captionswapskip{}{{\caption{Samba Configuration File ---  smb.conf Part B}\label{ch8smbconf2}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[netlogon]
 	comment = Network logon service
 	path = /data/samba/netlogon
 	write list = "@Domain Admins"
 	guest ok = Yes
 [profiles]
 	comment = Roaming Profile Share
 	path = /data/samba/profiles/
 	read only = No
 	profile acls = Yes
 	veto files = desktop.ini
 	browseable = No
 [homes]
 	comment = Home Directories
 	valid users = %S
 	read only = No
 	create mask = 0770
 	veto files = desktop.ini
 	hide files = desktop.ini
 	browseable = No
 [software]
 	comment = Software for %a computers
 	path = /data/samba/shares/software/%a
 	guest ok = Yes
 [public]
 	comment = Public Files
 	path = /data/samba/shares/public
 	read only = No
 	guest ok = Yes
 [PDF]
 	comment = Location of documents printed to PDFCreator printer
 	path = /data/samba/shares/pdf
 	guest ok = Yes
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch8smbconf3}{}%
\captionswapskip{}{{\caption{Samba Configuration File ---  smb.conf Part C}\label{ch8smbconf3}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[EVERYTHING]
 	comment = All shares
 	path = /data/samba
 	valid users = "@Domain Admins"
 	read only = No
 [CDROM]
 	comment = CD-ROM on MASSIVE
 	path = /mnt
 	guest ok = Yes
 [print$]
 	comment = Printer Drivers Share
 	path = /data/samba/drivers
 	write list = root
 	browseable = No
 [printers]
 	comment = All Printers
 	path = /data/samba/spool
 	create mask = 0644
 	printable = Yes
 	browseable = No
 [acct_hp8500]
 	comment = "Accounting Color Laser Printer"
 	path = /data/samba/spool/private
 	valid users = @acct, @acct_admin, @hr, "@Domain Admins",@Receptionist, dwayne, terri, danae, jerry
 	create mask = 0644
 	printable = Yes
 	copy = printers
 [plotter]
 	comment = Engineering Plotter
 	path = /data/samba/spool
 	create mask = 0644
 	printable = Yes
 	use client driver = Yes
 	copy = printers
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch8smbconf4}{}%
\captionswapskip{}{{\caption{Samba Configuration File ---  smb.conf Part D}\label{ch8smbconf4}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[APPS]
 	path = /data/samba/shares/Apps
 	force group = "Domain Users"
 	read only = No
 [ACCT]
 	path = /data/samba/shares/Accounting
 	valid users = @acct, "@Domain Admins"
 	force group = acct
 	read only = No
 	create mask = 0660
 	directory mask = 0770
 [ACCT_ADMIN]
 	path = /data/samba/shares/Acct_Admin
 	valid users = @”acct_admin”
 	force group = acct_admin
 [HR_PR]
 	path = /data/samba/shares/HR_PR
 	valid users = @hr, @acct_admin
 	force group = hr
 [ENGR]
 	path = /data/samba/shares/Engr
 	valid users = @engr, @receptionist, @truss, "@Domain Admins", cheri
 	force group = engr
 	read only = No
 	create mask = 0770
 [DATA]
 	path = /data/samba/shares/DATA
 	valid users = @engr, @receptionist, @truss, "@Domain Admins", cheri
 	force group = engr
 	read only = No
 	create mask = 0770
 	copy = engr
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch8smbconf5}{}%
\captionswapskip{}{{\caption{Samba Configuration File ---  smb.conf Part E}\label{ch8smbconf5}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[X]
 	path = /data/samba/shares/X
 	valid users = @engr, @acct
 	force group = engr
 	read only = No
 	create mask = 0770
 	copy = engr
 [NETWORK]
 	path = /data/samba/shares/network
 	valid users = "@Domain Users"
 	read only = No
 	create mask = 0770
 	guest ok = Yes
 [UTILS]
 	path = /data/samba/shares/Utils
 	write list = "@Domain Admins"
 [SYS]
 	path = /data/samba/shares/SYS
 	valid users = chad
 	read only = No
 	browseable = No
\end{lstlisting}
\end{example}


\index{Qbasic} \index{Rbase} \index{drive letters} Most of these shares are only used by one company group, but they are required because of some ancient Qbasic and Rbase applications were that written expecting their own drive letters.

\index{rsync} \index{rsyncd.conf} \index{synchronize} Note: During the process of building the new server, I kept data files up to date with the Novell server via use of {\bfseries{rsync}}. On a separate system (my workstation in fact), which could be rebooted whenever necessary, I set up a mount point to the Novell server via {\bfseries{ncpmount}}. I then created a {\texttt{\docbookhyphenatefilename{rsyncd.\dbz{}conf}}} to share that mount point out to my new server, and synchronized once an hour. The script I used to synchronize is shown in \hyperlink{sbersync}{Example {\ref{sbersync}}}. The files exclusion list I used is shown in \hyperlink{sbexcld}{Example {\ref{sbexcld}}}. The reason I had to have the {\bfseries{rsync}} daemon running on a system that could be rebooted frequently is because {\texttt{\docbookhyphenatedot{ncpfs}}} (part of the MARS NetWare Emulation package) has a nasty habit of creating stale mount points that cannot be recovered without a reboot. The reason for hourly synchronization is because some part of the chain was very slow and performance-heavy (whether {\bfseries{rsync}} itself, the network, or the Novell server, I am not sure, but it was probably the Novell server).

\begin{example}%
\hypertarget{sbersync}{}%
\captionswapskip{}{{\caption{Rsync Script}\label{sbersync}}}
\captionswapskip{}
\begin{Verbatim}[]

#!/bin/bash
# Part 1 - rsync the Novell directories to the new server
echo "#############################################"
echo "New sync operation starting at `date`"
if ! pgrep -fl '^rsync\> ; then
        echo "Good, no rsync is running!"
  echo "Synchronizing oink to BHPRO"
        rsync -av --exclude-from=/root/excludes.txt 
baa.corp:/BHPRO/SYS1/ /data/samba/shares/SYS1
        retval=$?
        [ ${retval} = 0 ] && echo "Sync operation completed at `date`"
        echo "Fixing permissions"
        # I had a whole lot more permission-fixing stuff here.  It got
        # pared down as groups got moved over.  The problem
        # was that the way I was mounting the directory, everything
        # was owned by the Novell administrator which translated to
        # Root.  This is also why I could only do one-way sync because
        # I could not fix the ACLs on the Novell side.
        find /data/samba/shares/Engr/ -perm +770 -exec chmod 770 {} \;
        find /data/samba/shares/Engr/ ! -group engr -exec chgrp engr {} \;
else
        # This rsync took ages and ages -- I had it set to run every hour but
        # I needed a way to prevent it running into itself.
        echo "Oh no, rsync is already running!"
echo "#############################################"
fi

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{sbexcld}{}%
\captionswapskip{}{{\caption{Rsync Files Exclusion List ---  /\dbz{}root/\dbz{}excludes.\dbz{}txt}\label{sbexcld}}}
\captionswapskip{}
\begin{Verbatim}[]

/Acct/
/Apps/
/DATA/
/Engr/*.pc3
/Engr/plotter
/Engr/APPOLO/
/Engr/LIBRARY/
/Home/Accounting/
/Home/Angie/
/Home/AngieY/
/Home/Brandon/
/Home/Carl/

\end{Verbatim}
\end{example}


After Samba was configured, I initialized the LDAP database. The first thing I had to do was store the LDAP password in the Samba configuration by issuing the command (as root): 
\begin{Verbatim}[]

root#  smbpasswd -w verysecret

\end{Verbatim}
 where {``}verysecret{''} is replaced by the LDAP bind password.

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

The Idealx smbldap-tools package can be configured using a script called {\bfseries{configure.pl}} that is provided as part of the tool. See \hyperlink{happy}{Chapter {\ref{happy}}, {``}Making Happy Users{''}} for an example of its use. Many administrators, like Misty, choose to do this manually so as to maintain greater awareness of how the tool-chain works and possibly to avoid undesirable actions from occurring unnoticed.
\end{admonition}


Now Samba was ready for use and it was time to configure the smbldap-tools. There are two relevant files, which are usually put into the directory {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}smbldap-\dbz{}tools}}}. The main file, {\texttt{\docbookhyphenatefilename{smbldap.\dbz{}conf}}} is shown in \hyperlink{ch8ideal}{Example {\ref{ch8ideal}}}.

\begin{example}%
\hypertarget{ch8ideal}{}%
\captionswapskip{}{{\caption{Idealx smbldap-tools Control File ---  Part A}\label{ch8ideal}}}
\captionswapskip{}
\begin{Verbatim}[]

#########
#
# located in /etc/smbldap-tools/smbldap.conf
#
######################################################################
#
# General Configuration
#
######################################################################

# Put your own SID
# to obtain this number do: net getlocalsid
SID="S-1-5-21-725326080-1709766072-2910717368"

######################################################################
#
# LDAP Configuration
#
######################################################################

# Notes: to use to dual ldap servers backend for Samba, you must patch
# Samba with the dual-head patch from IDEALX. If not using this patch
# just use the same server for slaveLDAP and masterLDAP.
# Those two servers declarations can also be used when you have
# . one master LDAP server where all writing operations must be done
# . one slave LDAP server where all reading operations must be done
#   (typically a replication directory)

# Ex: slaveLDAP=127.0.0.1
slaveLDAP="127.0.0.1"
slavePort="389"

# Master LDAP : needed for write operations
# Ex: masterLDAP=127.0.0.1
masterLDAP="127.0.0.1"
masterPort="389"

# Use TLS for LDAP
# If set to 1, this option will use start_tls for connection
# (you should also used the port 389)
ldapTLS="0"

# How to verify the server's certificate (none, optional or require)
# see "man Net::LDAP" in start_tls section for more details
verify=""

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{ch8ideal2}{}%
\captionswapskip{}{{\caption{Idealx smbldap-tools Control File ---  Part B}\label{ch8ideal2}}}
\captionswapskip{}
\begin{Verbatim}[]

# CA certificate
# see "man Net::LDAP" in start_tls section for more details
cafile=""
 certificate to use to connect to the ldap server
# see "man Net::LDAP" in start_tls section for more details
clientcert=""

# key certificate to use to connect to the ldap server
# see "man Net::LDAP" in start_tls section for more details
clientkey=""

# LDAP Suffix
# Ex: suffix=dc=IDEALX,dc=ORG
suffix="ou=MEGANET2,dc=abmas,dc=biz"

# Where are stored Users
# Ex: usersdn="ou=Users,dc=IDEALX,dc=ORG"
usersdn="ou=People,${suffix}"

# Where are stored Computers
# Ex: computersdn="ou=Computers,dc=IDEALX,dc=ORG"
computersdn="ou=People,${suffix}"

# Where are stored Groups
# Ex groupsdn="ou=Groups,dc=IDEALX,dc=ORG"
groupsdn="ou=Groups,${suffix}"

# Where are stored Idmap entries
# (used if samba is a domain member server)
# Ex groupsdn="ou=Idmap,dc=IDEALX,dc=ORG"
idmapdn="ou=Idmap,${suffix}"

# Where to store next uidNumber and gidNumber available
sambaUnixIdPooldn="sambaDomainName=MEGANET2,${suffix}"

# Default scope Used
scope="sub"

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{ch8ideal3}{}%
\captionswapskip{}{{\caption{Idealx smbldap-tools Control File ---  Part C}\label{ch8ideal3}}}
\captionswapskip{}
\begin{Verbatim}[]

# Unix password encryption (CRYPT, MD5, SMD5, SSHA, SHA)
hash_encrypt="MD5"

# if hash_encrypt is set to CRYPT, you may set a salt format.
# default is "%s", but many systems will generate MD5 hashed
# passwords if you use "$1$%.8s". This parameter is optional!
crypt_salt_format="%s"

######################################################################
#
# Unix Accounts Configuration
#
######################################################################

# Login defs
# Default Login Shell
# Ex: userLoginShell="/bin/bash"
userLoginShell="/bin/false"

# Home directory
# Ex: userHome="/home/%U"
userHome="/home/%U"

# Gecos
userGecos="Samba User"

# Default User (POSIX and Samba) GID
defaultUserGid="513"

# Default Computer (Samba) GID
defaultComputerGid="515"

# Skel dir
skeletonDir="/etc/skel"

# Default password validation time (time in days) Comment the next
# line if you don't want password to be enable for
# defaultMaxPasswordAge days (be careful to the sambaPwdMustChange
# attribute's value)
defaultMaxPasswordAge="45"

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{ch8ideal4}{}%
\captionswapskip{}{{\caption{Idealx smbldap-tools Control File ---  Part D}\label{ch8ideal4}}}
\captionswapskip{}
\begin{Verbatim}[]

######################################################################
#
# SAMBA Configuration
#
######################################################################

# The UNC path to home drives location (%U username substitution)
# Ex: \\My-PDC-netbios-name\homes\%U
# Just set it to a null string if you want to use the smb.conf
# 'logon home' directive and/or disable roaming profiles
userSmbHome=""

# The UNC path to profiles locations (%U username substitution)
# Ex: \\My-PDC-netbios-name\profiles\%U
# Just set it to a null string if you want to use the smb.conf
# 'logon path' directive and/or disable roaming profiles
userProfile=""

# The default Home Drive Letter mapping
# (will be automatically mapped at logon time if home directory exist)
# Ex: H: for H:
userHomeDrive=""

# The default user netlogon script name (%U username substitution)
# if not used, will be automatically username.cmd
# make sure script file is edited under DOS
# Ex: %U.cmd
# userScript="startup.cmd" # make sure script file is edited under DOS
userScript=""

# Domain appended to the users "mail"-attribute
# when smbldap-useradd -M is used
mailDomain="abmas.org"

######################################################################
#
# SMBLDAP-TOOLS Configuration (default are ok for a RedHat)
#
######################################################################
# Allows not to use smbpasswd
# (if with_smbpasswd == 0 in smbldap_conf.pm) but
# prefer Crypt::SmbHash library
with_smbpasswd="0"
smbpasswd="/usr/bin/smbpasswd"

\end{Verbatim}
\end{example}


\index{TLS} Note: I chose not to take advantage of the TLS capability of this. Eventually I may go back and tweak it. Also, I chose not to take advantage of the master/slave configuration as I heard horror stories that it was unstable. My slave servers are replicas only.

The {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}smbldap-\dbz{}tools/\dbz{}smbldap\_\dbz{}bind.\dbz{}conf}}} file is shown here: 
\begin{Verbatim}[]

# smbldap_bind.conf
#
# This file simply tells smbldap-tools how to bind to your LDAP server.
# It has to be a DN with full write access to the Samba portion of
# the database.

############################
# Credential Configuration #
############################
# Notes: you can specify two different configurations if you use a
# master ldap for writing access and a slave ldap server for reading access
# By default, we will use the same DN (so it will work for standard Samba
# release)
slaveDN="cn=Manager,dc=abmas,dc=biz"
slavePw="verysecret"
masterDN="cn=Manager,dc=abmas,dc=biz"
masterPw="verysecret"

\end{Verbatim}


The next step was to run the {\bfseries{smbldap-populate}} command, which populates the LDAP tree with the appropriate default users, groups, and UID and GID pools. It creates a user called Administrator with UID=0 and GID=0 matching the Domain Admins group. This is fine because you can still log on as root to a Windows system, but it will break cached credentials if you need to log on as the administrator to a system that is not on the network.

After the LDAP database has been preloaded, it is prudent to validate that the information needed is in the LDAP directory. This can be done done by restarting the LDAP server, then performing an LDAP search by executing: 
\begin{Verbatim}[]

root#  ldapsearch -W -x -b "dc=abmas,dc=biz"\
	 -D "cn=Manager,dc=abmas,dc=biz" \
	"(Objectclass=*)"
Enter LDAP Password:
# extended LDIF
#
# LDAPv3
# base <dc=abmas,dc=biz> with scope sub
# filter: (ObjectClass=*)
# requesting: ALL
#

# abmas.biz
dn: dc=abmas,dc=biz
objectClass: dcObject
objectClass: organization
o: abmas
dc: abmas

# People, abmas.biz
dn: ou=People,dc=abmas,dc=biz
objectClass: organizationalUnit
ou: People

# Groups, abmas.biz
dn: ou=Groups,dc=abmas,dc=biz
objectClass: organizationalUnit
ou: Groups

# Idmap, abmas.biz
dn: ou=Idmap,dc=abmas,dc=biz
objectClass: organizationalUnit
ou: Idmap
...

\end{Verbatim}


\index{Windows} \index{POSIX} \index{smbldap-groupadd} \index{RID} \index{sambaGroupMapping} With the LDAP directory now initialized, it was time to create the Windows and POSIX (UNIX) group accounts as well as the mappings from Windows groups to UNIX groups. The easiest way to do this was to use {\bfseries{smbldap-groupadd}} command. It creates the group with the posixGroup and sambaGroupMapping attributes, a unique GID, and an automatically determined RID. I learned the hard way not to try to do this by hand.

\index{group mapping} \index{smbldap-groupmod} \index{memberUID} After I had my group mappings in place, I added users to the groups (the users don't really have to exist yet). I used the {\bfseries{smbldap-groupmod}} command to accomplish this. It can also be done manually by adding memberUID attributes to the group entries in LDAP.

\index{sambaSamAccount} \index{posixAccount} \index{smbldap-usermod} The most monumental task of all was adding the sambaSamAccount information to each already existent posixAccount entry. I did it one at a time as I moved people onto the new server, by issuing the command: 
\begin{Verbatim}[]

root#  smbldap-usermod -a -P username

\end{Verbatim}
 \index{NetWare} \index{LDIF} \index{slapcat} I completed that step for every user after asking the person what his or her current NetWare password was. The wiser way to have done it would probably have been to dump the entire database to an LDIF file. This can be done by executing: 
\begin{Verbatim}[]

root#  slapcat > somefile.ldif

\end{Verbatim}
 \index{Perl} \index{objectClass} Then update the LDIF file created by using a Perl script to parse and add the appropriate attributes and objectClasses to each entry, followed by re-importing the entire database into the LDAP directory.

Rebuilding of the LDAP directory can be done as follows: 
\begin{Verbatim}[]

root#  rcldap stop
root#  cd /data/ldap
root#  rm *bdb _* log*
root#  su - ldap -c "slapadd -l somefile.ldif"
root#  rcldap start

\end{Verbatim}
 This can be done at any time and for any reason, with no harm to the database.

I first added a test user, of course. The LDIF for this test user looks like this, to give you an idea: 
\begin{Verbatim}[]

# Entry 1: cn=Test User,ou=people,ou=corp,dc=abmas,dc=biz
dn:cn=Test User,ou=people,ou=corp,dc=abmas,dc=biz
cn: Test User
gecos: Test User
gidNumber: 513
givenName: Test
homeDirectory: /home/test.user
homePhone: 555
l: Somewhere
l: ST
mail: test.user
o: Corp
objectClass: top
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: sambaSamAccount
postalCode: 12345
sn: User
street: 10 Some St.
uid: test.user
uidNumber: 1074
sambaLogonTime: 0
sambaLogoffTime: 2147483647
sambaKickoffTime: 2147483647
sambaPwdCanChange: 0
displayName: Samba User
sambaSID: S-1-5-21-725326080-1709766072-2910717368-3148
sambaLMPassword: 9D29C287C58448F9AAD3B435B51404EE
sambaAcctFlags: [U]
sambaNTPassword: D062088E99C95E37D7702287BB35E770
sambaPwdLastSet: 1102537694
sambaPwdMustChange: 1106425694
userPassword: {SSHA}UzFZ2VxRGdwUueLnTGtsTBtnsvMO1oj8
loginShell: /bin/false

\end{Verbatim}


Then I went over to a spare Windows NT machine and joined it to the MEGANET2 domain. It worked, and the machine's account entry under ou=Computers looks like this: 
\begin{Verbatim}[]

dn:uid=w2kengrspare$,ou=Computers,ou=MEGANET2,dc=abmas,dc=biz
objectClass: top
objectClass: inetOrgPerson
objectClass: posixAccount
objectClass: sambaSamAccount
cn: w2kengrspare$
sn: w2kengrspare$
uid: w2kengrspare$
uidNumber: 1104
gidNumber: 515
homeDirectory: /dev/null
loginShell: /bin/false
description: Computer
gecos: Computer
sambaSID: S-1-5-21-725326080-1709766072-2910717368-3208
sambaPrimaryGroupSID: S-1-5-21-725326080-1709766072-2910717368-2031
displayName: W2KENGRSPARE$
sambaPwdCanChange: 1103149236
sambaPwdMustChange: 2147483647
sambaNTPassword: CA199C45CB6737035DB6D9D9F6CD1834
sambaPwdLastSet: 1103149236
sambaAcctFlags: [W          ]

\end{Verbatim}


\index{netlogon} So now I could log on with a test user from the machine w2kengrspare. It was all well and good, but that user was in no groups yet and so had pretty boring access. I fixed that by writing the login script! To write the login script, I used Kixtart\label{id2557802}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.kixtart.org}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2557802} because it will work with every architecture of Windows, has an active and helpful user base, and was both easier to learn and more powerful than the standard netlogon scripts I have seen. I also did not have to do a logon script per user or per group.

\index{Kixtart} I downloaded Kixtart and put the following files in my netlogon share: 
\begin{Verbatim}[]

KIX32.EXE
KX32.dll
KX95.dll  <-- Not needed unless you are running Win9x clients.
kx16.dll  <-- Probably not needed unless you are running DOS clients.
kxrpc.exe <-- Probably useless as it has to run on the server and can
          only be run on NT.  It's for Windows 95 to become group-aware.
          We can get around the need.

\end{Verbatim}


\index{logon.kix} I then wrote the {\texttt{\docbookhyphenatefilename{logon.\dbz{}kix}}} file that is shown in \hyperlink{ch8kix}{Example {\ref{ch8kix}}}. I chose to keep it all in one file, but it can be split up and linked via include directives.

\begin{example}%
\hypertarget{ch8kix}{}%
\captionswapskip{}{{\caption{Kixtart Control File ---  File: logon.kix}\label{ch8kix}}}
\captionswapskip{}
\begin{Verbatim}[]

; This script just calls the other scripts.

; First we want to get things done for everyone.

; Second, we do first-time login stuff.

; Third, we go through the group-oriented scripts one at a time.


; We want to check for group membership here to avoid the overhead of running
; scripts which don't apply.
call "\\massive\netlogon\scripts\main.kix"
call "\\massive\netlogon\scripts\setup.kix"
IF INGROUP("MEGANET2\ACCT")
  call "scripts\acct.kix"
ENDIF
IF INGROUP("MEGANET2\ENGR","MEGANET2\RECEPTIONIST")
call "\\massive\netlogon\scripts\engr.kix"
ENDIF
IF INGROUP("MEGANET2\FURN")
  call "\\massive\netlogon\scripts\furn.kix"
ENDIF
IF INGROUP("MEGANET2\TRUSS")
  call "\\massive\netlogon\scripts\truss.kix"
ENDIF

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{ch8kix2}{}%
\captionswapskip{}{{\caption{Kixtart Control File ---  File: main.kix}\label{ch8kix2}}}
\captionswapskip{}
\begin{Verbatim}[]

break on

; Choose whether to hide the login window or not
IF INGROUP("MEGANET2\Domain Admins")
  USE Z: \\massive\everything
  SETCONSOLE("show")
ELSE
  ; Nobody cares about seeing the login script except admins
  SETCONSOLE("hide")
ENDIF

; Delete all previously connected shares
USE * /delete

SETTITLE("Logging on @USERID to @LDOMAIN at @TIME")

; Set the time on the workstation
$Timeserver = "\\massive"
Settime $TimeServer

; Map the home directory
USE H: @HOMESHR ; connect to user's home share
IF @ERROR = 0

  H:
  CD @HOMEDIR ; change directory to user's home directory
ENDIF

; Everyone gets the N drive
USE N: \\massive\network

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{ch8kix3}{}%
\captionswapskip{}{{\caption{Kixtart Control File ---  File: setup.kix, Part A}\label{ch8kix3}}}
\captionswapskip{}
\begin{Verbatim}[]

; My setup.kix is where all of the redirection stuff happens.  Note that with 
; the use of registry keys, this only happens the first time they log in ,or if 
; I delete the pertinent registry keys which triggers it to happen again:

; Check to see if we have written the abmas sub-key before
$RETURNCODE = EXISTKEY("HKEY_CURRENT_USER\abmas")
IF NOT $RETURNCODE = 0
; Add key for abmas-specific things on the first login
  ADDKEY("HKEY_CURRENT_USER\abmas")
  ; The following key gets deleted at the end of the first login
  ADDKEY("HKEY_CURRENT_USER\abmas\FIRST_LOGIN")
ENDIF

; People with laptops need My Documents to be in their profile.  People with
; desktops can have My Documents redirected to their home directory to avoid
; long delays with logging out and out-of-sync files.

; Check to see if this is the first login -- doesn't make sense to do this
; at the very first login

$RETURNCODE = EXISTKEY("HKEY_CURRENT_USER\abmas\FIRST_LOGIN")
IF NOT $RETURNCODE = 0

; We don't want to do this stuff for people with laptops or people in the FURN
; group.  (They store their profiles in a different server)

  IF NOT INGROUP("MASSIVE\Laptop","MASSIVE\FURN")
    $RETURNCODE=EXISTKEY("HKEY_CURRENT_USER\abmas\profile_copied")

; A  crude way to tell what OS our profile is for and copy the "My Documents"
; to the redirected folder on the server.  It works because the profiles
; are stored as \\server\profiles\user\architecture
    IF NOT $RETURNCODE = 0
      IF EXIST("\\massive\profiles\@userID\WinXP")
        copy "\\massive\profiles\@userID\WinXP\My Documents\*" 
"\\massive\@userID\"
      ENDIF
      IF EXIST("\\massive\profiles\@userID\Win2K")
        copy "\\massive\profiles\@userID\Win2K\My Documents\*" 
"\\massive\@userID\"
      ENDIF
      IF EXIST("\\massive\profiles\@userID\WinNT")
        copy "\\massive\profiles\@userID\WinNT\My Documents\*" 
"\\massive\@userID\"
      ENDIF

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{ch8kix3b}{}%
\captionswapskip{}{{\caption{Kixtart Control File ---  File: setup.kix, Part B}\label{ch8kix3b}}}
\captionswapskip{}
\begin{Verbatim}[]

; Now we will write the registry values to redirect the locations of "My 
Documents"
; and other folders.
      ADDKEY("HKEY_CURRENT_USER\abmas\profile_copied")
      WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\
Windows\CurrentVersion\Explorer\User 
Shell Folders", "Personal","\\massive\@userID","REG_SZ")
      WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\
Windows\CurrentVersion\Explorer\User 
Shell Folders", "My Pictures", "\\massive\@userID\My Pictures", "REG_SZ")
      IF @PRODUCTTYPE="Windows 2000 Professional" or @PRODUCTTYPE="Windows XP
Professional"
      WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\
Windows\CurrentVersion\Explorer\User 
Shell Folders", "My Videos", "\\massive\@userID\My Videos", "REG_SZ")
      WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\
Windows\CurrentVersion\Explorer\User 
Shell Folders", "My Music", "\\massive\@userID\My Music", "REG_SZ")
      WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\
Windows\CurrentVersion\Explorer\User 
Shell Folders", "My eBooks", "\\massive\@userID\My eBooks", "REG_SZ")
      ENDIF
    ENDIF
  ENDIF

; Now we will delete the FIRST_LOGIN sub-key that we made before.
; Note - to run this script again you will want to delete the HKCU\abmas
; sub-key, log out, and log back in.
$RETURNVALUE = EXISTKEY("HKEY_CURRENT_USER\abmas\FIRST_LOGIN")
IF $RETURNVALUE = 0
  DELKEY("HKEY_CURRENT_USER\abmas\FIRST_LOGIN")
ENDIF

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{ch8kix4}{}%
\captionswapskip{}{{\caption{Kixtart Control File ---  File: acct.kix}\label{ch8kix4}}}
\captionswapskip{}
\begin{Verbatim}[]

; And here is one group-oriented script to show what can be
; done that way: acct.kix:

IF INGROUP("MASSIVE\Acct_Admin","MASSIVE\HR")
  USE I: \\MEGANET2\HR_PR
ENDIF

; Set up printer
$RETURNVALUE = existkey("HKEY_CURRENT_USER\Printers\,,massive,acct_hp8500")
IF NOT $RETURNVALUE = 0
  ADDPRINTERCONNECTION("\\massive\acct_hp8500")
  SETDEFAULTPRINTER("\\massive\acct_hp8500")
ENDIF
; Set up drive mappings
  USE M: \\massive\ACCT
  IF INGROUP("MEGANET2\ABRA")
    USE T: \\trussrv\abra
  ENDIF

\end{Verbatim}
\end{example}


As you can see in the script, I redirected the My Documents to the user's home share if he or she were not in the Laptop group. I also added printers on a group-by-group basis, and if applicable I set the group printer. For this to be effective, the print drivers must be installed on the Samba server in the {\texttt{\docbookhyphenatefilename{[print\$]}}} share. Ample documentation exists about how to do that, so it is not covered here.

I call this script via the logon.bat script in the [netlogon] directory: 
\begin{Verbatim}[]

\\corpsrv\netlogon\kix32 \\corpsrv\netlogon\logon.kix /f

\end{Verbatim}
 I only had to fully qualify the paths for Windows 9x, as Windows NT and greater automatically add [NETLOGON] to the path.

Also of note for Win9x is that the drive mappings and printer setup will not work because they rely on RPC. You merely have to put the appropriate settings into the {\texttt{\docbookhyphenatefilename{c:\docbooktolatexgobble\string\\autoexec.\dbz{}bat}}} file or map the drives manually. One option is to check the OS as part of the Kixtart script, and if it is Win9x and is the first login, copy a premade {\texttt{\docbookhyphenatefilename{autoexec.\dbz{}bat}}} to the {\texttt{\docbookhyphenatefilename{C:}}} drive. I have only three such machines, and one is going away in the very near future, so it was easier to do it by hand.

\index{upgrade} At this point I was able to add the users. This is the part that really falls into upgrade. I moved the users over one group at a time, starting with the people who used the least amount of resources on the network. With each group that I moved, I first logged on as a standard user in that group and took careful note of the environment, mainly the printers he or she used, the PATH, and what network resources he or she had access to (most importantly, which ones the user actually needed access to).

I then added the user's SambaSamAccount information as mentioned earlier, and join the computer to the domain. The very first thing I had to do was to copy the user's profile to the new server. This was very important, and I really struggled with the most effective way to do it. Here is the method that worked for every one of my users on Windows NT, 2000, and XP:
\begin{enumerate}

\item{Log in as the user on the domain. This creates the local copy of the user's profile and copies it to the server as he or she logs out.}

\item{Reboot the computer and log in as the local machine administrator.}

\item{Right-click My Computer, click Properties, and navigate to the user profiles tab (varies per version of Windows).}

\item{Select the user's local profile {\texttt{\docbookhyphenatedot{(COMPUTERNAME\textbackslash username)}}}, and click the {\bfseries{Copy To}} button.}

\item{In the next dialog, copy it directly to the profiles share on the Samba server (in my case \textbackslash \textbackslash PDCname\textbackslash profiles\textbackslash user\textbackslash \textless{}architecture\textgreater{}. You will have had to make a connection to the share as that user (e.g., Windows Explorer type \textbackslash \textbackslash PDCname\textbackslash profiles\textbackslash username).}

\item{When the copy is complete (it can take a while) log out, and log back in as the user. All of his or her settings and all contents of My Documents, Favorites, and the registry should have been copied successfully.}

\item{If it doesn't look right (the dead giveaway is the desktop background), shut down the computer without logging out (power cycle) and try logging in as the user again. If it still doesn't work, repeat the steps above. I only had to ever repeat it once.}
\end{enumerate}

Words to the Wise:

\begin{itemize}
%--- Item
\item 
If the user was anything other than a standard user on his or her system before, you will save yourself some headaches by giving him or her identical permissions (on the local machine) as his or her domain account {\em{before}} copying the profile over. Do this through the User Administrator in the Control Panel, after joining the computer to the domain and before logging on as that user for the first time. Otherwise the user will have trouble with permissions on his or her registry keys.


%--- Item
\item 
If any application was installed for the user only, rather than for the entire system, it will probably not work without being reinstalled.

\end{itemize}

After all these steps are accomplished, only cleanup details are left. Make sure user's shortcuts and Network Places point to the appropriate place on the new server, check the important applications to be sure they work as expected and troubleshoot any problems that might arise, and check to be sure the user's printers are present and working. By the way, if there are any network printers installed as system printers (the Novell way), you will need to log in as a local administrator and delete them.

For my non-laptop systems, I would then log in and out a couple times as the user to be sure that his or her registry settings were modified, and then I was finished.

Some compatibility issues that cropped up included the following:

Blackberry client: It did not like having its registry settings moved around and so had to be reinstalled. Also, it needed write permissions to a portion of the hard drive, and I had to give it those manually on the one system where this was an issue.

CAMedia: Digital camera software for Canon cameras caused all kinds of trouble with the registry. I had to use the Run as service to open the registry of the local user while logged in as the domain user, and give the domain user the appropriate permissions to some registry keys, then export that portion of the registry to a file. Then, as the domain user, I had to import that file into the registry.

Crystal Reports version 7: More registry problems that were solved by recopying the user's profile.

Printing from legacy applications: I found out that Novell sends its jobs to the printer in a raw format. CUPS sends them in PostScript by default. I had to make a second printer definition for one printer and tell CUPS specifically to send raw data to the printer, then assign this printer to the LPT port with Kixtart's version of the net use command.

These were all eventually solved by elbow grease, queries to the Samba mailing list and others, and diligence. The complete migration took about 5 weeks. My userbase is relatively small but includes multiple versions of Windows, multiple Linux member servers, a mechanized saw, a pen plotter, and legacy applications written in Qbasic and R:Base, just to name a few. I actually ended up making some of these applications work better (or work again, as some of them had stopped functioning on the old server) because as part of the process I had to find out how things were supposed to work.

The one thing I have not been able to get working is a very old database that we had around for reference purposes; it uses Novell's Btrieve engine.

As the resources compare, I went from 95 percent disk usage to just around 10 percent. I went from a very high load on the server to an average load of between one and two runnable processes on the server. I have improved the security and robustness of the system. I have also implemented ClamAV\label{id2558290}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.clamav.net}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2558290} antivirus software, which scans the entire Samba server for viruses every 2 hours and quarantines them. I have found it much less problematic than our ancient version of Norton Antivirus Corporate Edition, and much more up-to-date.

In short, my users are much happier now that the new server is running, and that is what is important to me.
\cleardoublepage % ------------------------------------------------------------- 
% 
% PART Reference Section
% 
% ------------------------------------------------------------- 
\part{Reference Section}
\label{RefSection}\hypertarget{RefSection}{}%

% -------------------------------------------------------------
% PartIntro Reference Section 
% ------------------------------------------------------------- 	
\chapter*{Reference Section}
\label{id2408515}\hypertarget{id2408515}{}%

This section {\em{Samba-3 by Example}} provides important reference material that may help you to solve network performance issues, to answer some of the critiques published regarding Samba, or just to gain a more broad understanding of how Samba can play in a Windows networking world.
\cleardoublepage 
% -------------------------------------------------------------
% Chapter Active Directory, Kerberos, and Security 
% ------------------------------------------------------------- 	
\chapter{Active Directory, Kerberos, and Security}
\label{kerberos}\hypertarget{kerberos}{}%

\index{experiment} By this point in the book, you have been exposed to many Samba-3 features and capabilities. More importantly, if you have implemented the examples given, you are well on your way to becoming a Samba-3 networking guru who knows a lot about Microsoft Windows. If you have taken the time to practice, you likely have thought of improvements and scenarios with which you can experiment. You are rather well plugged in to the many flexible ways Samba can be used.

\index{criticism} This is a book about Samba-3. Understandably, its intent is to present it in a positive light. The casual observer might conclude that this book is one-eyed about Samba. It is ---  what would you expect? This chapter exposes some criticisms that have been raised concerning the use of Samba. For each criticism, there are good answers and appropriate solutions.

Some criticism always comes from deep inside ranks that one would expect to be supportive of a particular decision. Criticism can be expected from the outside. Let's see how the interesting dynamic of criticism develops with respect to Abmas.

\index{straw-man} This chapter provides a shameless self-promotion of Samba-3. The objections raised were not pulled out of thin air. They were drawn from comments made by Samba users and from criticism during discussions with Windows network administrators. The tone of the objections reflects as closely as possible that of the original. The case presented is a straw-man example that is designed to permit each objection to be answered as it might occur in real life.

% ------------------------   
% Section 
\section{Introduction}
\label{id2466045}\hypertarget{id2466045}{}%

\index{acquisitions}\index{risk}\index{assessment}\index{Active Directory}\index{Windows 2003 Serve} Abmas is continuing its meteoric growth with yet further acquisitions. The investment community took note of the spectacular projection of Abmas onto the global business stage. Abmas is building an interesting portfolio of companies that includes accounting services, financial advice, investment portfolio management, property insurance, risk assessment, and the recent addition of a a video rental business. The pieces do not always appear to fit together, but Mr. Meany is certainly executing an interesting business growth and development plan. Abmas Video Rentals was recently acquired. During the time that the acquisition was closing, the Video Rentals business upgraded its Windows NT4-based network to Windows 2003 Server and Active Directory.

\index{Active Directory} You have accepted the fact that Abmas Video Rentals will use Microsoft Active Directory. The IT team, led by Stan Soroka, is committed to Samba-3 and to maintaining a uniform technology platform. Stan Soroka's team voiced its disapproval over the decision to permit this business to continue to operate with a solution that is viewed by Christine and her group as {``}an island of broken technologies.{''} This comment was made by one of Christine's staff as they were installing a new Samba-3 server at the new business.

\index{consultant}\index{hypothetical} Abmas Video Rentals' head of IT heard of this criticism. He was offended that a junior engineer should make such a comment. He felt that he had to prepare in case he might be criticized for his decision to use Active Directory. He decided he would defend his decision by hiring the services of an outside security systems consultant to report\label{id2531682}\begingroup\catcode`\#=12\footnote{This report is entirely fictitious. Any resemblance to a factual report is purely coincidental.}\endgroup\docbooktolatexmakefootnoteref{id2531682} on his unit's operations and to investigate the role of Samba at his site. Here are key extracts from this hypothetical report:
\begin{quote}

\index{vulnerabilities}\index{integrity}\index{practices}\index{Active Directory} ... the implementation of Microsoft Active Directory at the Abmas Video Rentals, Bamingsham site, has been examined. We find no evidence to support a notion that vulnerabilities exist at your site. ... we took additional steps to validate the integrity of the installation and operation of Active Directory and are pleased that your staff are following sound practices.

...

\index{accounts!user}\index{accounts!group}\index{Backup}\index{disaster recovery}\index{validated}\index{off-site storage} User and group accounts, and respective privileges, have been well thought out. File system shares are appropriately secured. Backup and disaster recovery plans are well managed and validated regularly, and effective off-site storage practices are considered to exceed industry norms.

\index{compromise}\index{secure}\index{network!secure} Your staff are justifiably concerned that the use of Samba may compromise their good efforts to maintain a secure network.

\index{winbind}\index{security}\index{secure}\index{network!management} The recently installed Linux file and application server uses a tool called {\bfseries{winbind}} that is indiscriminate about security. All user accounts in Active Directory can be used to access data stored on the Linux system. We are alarmed that secure information is accessible to staff who should not even be aware that it exists. We share the concerns of your network management staff who have gone to great lengths to set fine-grained controls that limit information access to those who need access. It seems incongruous to us that Samba winbind should be permitted to be used considering that it voids this fine work.

\index{isolated}\index{firewall}\index{best practices} Graham Judd [head of network administration] has locked down the security of all systems and is following the latest Microsoft guidelines. ... null session connections have been disabled ... the internal network is isolated from the outside world, the [product name removed] firewall is under current contract maintenance support from [the manufacturer]. ... our attempts to penetrate security of your systems failed to find problems common to Windows networking sites. We commend your staff on their attention to detail and for following Microsoft recommended best practices.

...

\index{security}\index{disable}\index{essential}\index{trusted computing} Regarding the use of Samba, we offer the following comments: Samba is in use in nearly half of all sites we have surveyed. ... It is our opinion that Samba offers no better security than Microsoft ... what worries us regarding Samba is the need to disable essential Windows security features such as secure channel support, digital sign'n'seal on all communication traffic, and running Active Directory in mixed mode so that Samba clients and servers can authenticate all of it. Additionally, we are concerned that Samba is not at the full capabilities of Microsoft Windows NT4 server. Microsoft has moved well beyond that with trusted computing initiatives that the Samba developers do not participate in.

\index{integrity}\index{hackers}\index{accountable}\index{flaws}\index{updates}\index{bug fixes}\index{alarm} One wonders about the integrity of an open source program that is developed by a team of hackers who cannot be held accountable for the flaws in their code. The sheer number of updates and bug fixes they have released should ring alarm bells in any business.

\index{employment}\index{jobs}\index{risk} Another factor that should be considered is that buying Microsoft products and services helps to provide employment in the IT industry. Samba and Open Source software place those jobs at risk.
\end{quote}

\index{Active Directory}\index{independent expert} This is also a challenge to rise above the trouble spot. You call Stan's team together for a simple discussion, but it gets further out of hand. When you return to your office, you find the following email in your in-box:

Good afternoon,
\begin{quote}

I apologize for the leak of internal discussions to the new business. It reflects poorly on our professionalism and has put you in an unpleasant position. I regret the incident.

I also wish to advise that two of the recent recruits want to implement Kerberos authentication across all systems. I concur with the desire to improve security. One of the new guys who is championing the move to Kerberos was responsible for the comment that caused the embarrassment.

\index{Kerberos}\index{OpenLDAP}\index{Active Directory}\index{consultant} I am experiencing difficulty in handling the sharp push for Kerberos. He claims that Kerberos, OpenLDAP, plus Samba-3 will seamlessly replace Microsoft Active Directory. I am a little out of my depth with respect to the feasibility of such a move, but have taken steps to pull both of them into line. With your consent, I would like to hire the services of a well-known Samba consultant to set the record straight.

\index{criticism}\index{policy}\index{Windows Servers}\index{Active Directory}\index{budgetted}\index{financial responsibility} I intend to use this report to answer the criticism raised and would like to establish a policy that we will approve the use of Microsoft Windows Servers (and Active Directory) subject to all costs being covered out of the budget of the division that wishes to go its own way. I propose that dissenters will still remain responsible to meet the budgeted contribution to IT operations as a whole. I believe we should not coerce use of any centrally proposed standards, but make all noncompliance the financial responsibility of the out-of-step division. Hopefully, this will encourage all divisions to walk with us and not alone.

\hspace*\fill---Stan\end{quote}
\subsection{Assignment Tasks}
\label{id2552143}\hypertarget{id2552143}{}%

You agreed with Stan's recommendations and hired a consultant to help defuse the powder keg. The consultant's task is to provide a tractable answer to each of the issues raised. The consultant must be able to support his or her claims, keep emotions to the side, and answer technically.

% ------------------------   
% Section 
\section{Dissection and Discussion}
\label{id2506693}\hypertarget{id2506693}{}%

\index{tool}\index{benefit}\index{choice}\index{consultant}\index{installation}\index{income}\index{employment} Samba-3 is a tool. No one is pounding your door to make you use Samba. That is a choice that you are free to make or reject. It is likely that your decision to use Samba can greatly benefit your company. The Samba Team obviously believes that the Samba software is a worthy choice. If you hire a consultant to assist with the installation and/or deployment of Samba, or if you hire someone to help manage your Samba installation, you can create income and employment. Alternately, money saved by not spending in the IT area can be spent elsewhere in the business. All money saved or spent creates employment.

\index{economically sustainable}\index{inter-operability}\index{file and print service}\index{cost}\index{alternative} In the long term, the use of Samba must be economically sustainable. In some situations, Samba is adopted purely to provide file and print service interoperability on platforms that otherwise cannot provide access to data and to printers for Microsoft Windows clients. Samba is used by some businesses to effect a reduction in the cost of providing IT services. Obviously, it is also used by some as an alternative to the use of a Microsoft file and print serving platforms with no consideration of costs.

\index{documentation}\index{responsibility}\index{fix}\index{broken} It would be foolish to adopt a technology that might put any data or users at risk. Security affects everyone. The Samba-Team is fully cognizant of the responsibility they have to their users. The Samba documentation clearly reveals that full responsibility is accepted to fix anything that is broken.

\index{commercial}\index{software}\index{commercial software}\index{End User License Agreement|textit{see} {EULA} }\index{accountable}\index{!liability}\index{accepts liability}\index{price paid}\index{product defects}\index{reimburse}\index{extent} There is a mistaken perception in the IT industry that commercial software providers are fully accountable for the defects in products. Open Source software comes with no warranty, so it is often assumed that its use confers a higher degree of risk. Everyone should read commercial software End User License Agreements (EULAs). You should determine what real warranty is offered and the extent of liability that is accepted. Doing so soon dispels the popular notion that commercial software vendors are willingly accountable for product defects. In many cases, the commercial vendor accepts liability only to reimburse the price paid for the software.

\index{consumer}\index{EULA}\index{track record}\index{commercial software}\index{support}\index{vendor} The real issues that a consumer (like you) needs answered are What is the way of escape from technical problems, and how long will it take? The average problem turnaround time in the Open Source community is approximately 48 hours. What does the EULA offer? What is the track record in the commercial software industry? What happens when your commercial vendor decides to cease providing support?

\index{source code}\index{Open Source}\index{hire}\index{programmer}\index{solve}\index{fix}\index{!problem} Open Source software at least puts you in possession of the source code. This means that when all else fails, you can hire a programmer to solve the problem.
\subsection{Technical Issues}
\label{id2555238}\hypertarget{id2555238}{}%

Each issue is now discussed and, where appropriate, example implementation steps are provided.

\begin{description}
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Winbind and Security}]\null{}
\index{Winbind}\index{Security}\index{network!administrators}\index{Domain users}\index{!Domain account}\index{credentials}\index{Network Neighborhood}\index{UNIX/Linux server}\index{browse}\index{shares} Windows network administrators may be dismayed to find that {\bfseries{winbind}} exposes all domain users so that they may use their domain account credentials to log on to a UNIX/Linux system. The fact that all users in the domain can see the UNIX/Linux server in their Network Neighborhood and can browse the shares on the server seems to excite them further.

\index{Domain Member server}\index{familiar}\index{fear}\index{unknown} {\bfseries{winbind}} provides for the UNIX/Linux domain member server or client, the same as one would obtain by adding a Microsoft Windows server or client to the domain. The real objection is the fact that Samba is not MS Windows and therefore requires handling a little differently from the familiar Windows systems. One must recognize fear of the unknown.

\index{network administrators}\index{recognize}\index{winbind}\index{over-ride}\index{Active Directory!management tools}\index{fears} Windows network administrators need to recognize that {\bfseries{winbind}} does not, and cannot, override account controls set using the Active Directory management tools. The control is the same. Have no fear.

\index{ADS Domain}\index{account!ADS Domain}\index{winbind}\index{browsing}\index{permits}\index{access}\index{drive mapping}\index{protected}\index{security controls}\index{access controls} Where Samba and the ADS domain account information obtained through the use of {\bfseries{winbind}} permits access, by browsing or by the drive mapping to a share, to data that should be better protected. This can only happen when security controls have not been properly implemented. Samba permits access controls to be set on:

\begin{itemize}
%--- Item
\item 
Shares themselves (i.e., the logical share itself)


%--- Item
\item 
The share definition in {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}}


%--- Item
\item 
The shared directories and files using UNIX permissions


%--- Item
\item 
Using Windows 2000 ACLs ---  if the file system is POSIX enabled

\end{itemize}

Examples of each are given in \hyperlink{ch10expl}{Section {\ref{ch10expl}}}.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{User and Group Controls}]\null{}
\index{User and Group Controls}\index{management!User}\index{management!group}\index{ADS}\index{permissions}\index{privileges}\index{flexibility}\index{access controls}\index{share definition} User and group management facilities as known in the Windows ADS environment may be used to provide equivalent access control constraints or to provide equivalent permissions and privileges on Samba servers. Samba offers greater flexibility in the use of user and group controls because it has additional layers of control compared to Windows 200x/XP. For example, access controls on a Samba server may be set within the share definition in a manner for which Windows has no equivalent.

\index{analysis}\index{system security}\index{safe-guards}\index{permissions!excessive}\index{file system}\index{shared resource}\index{share definition} In any serious analysis of system security, it is important to examine the safeguards that remain when all other protective measures fail. An administrator may inadvertently set excessive permissions on the file system of a shared resource, or he may set excessive privileges on the share itself. If that were to happen in a Windows 2003 Server environment, the data would indeed be laid bare to abuse. Yet, within a Samba share definition, it is possible to guard against that by enforcing controls on the share definition itself. You see a practical example of this a little later in this chapter.

\index{diligence}\index{weakness} The report that is critical of Samba really ought to have exercised greater due diligence: the real weakness is on the side of a Microsoft Windows environment.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Security Overall}]\null{}
\index{defects} Samba is designed in such a manner that weaknesses inherent in the design of Microsoft Windows networking ought not to expose the underlying UNIX/Linux file system in any way. All software has potential defects, and Samba is no exception. What matters more is how defects that are discovered get dealt with.

\index{security}\index{protection}\index{compromise}\index{consequential risk} The Samba Team totally agrees with the necessity to observe and fully implement every security facility to provide a level of protection and security that is necessary and that the end user (or network administrator) needs. Never would the Samba Team recommend a compromise to system security, nor would deliberate defoliation of security be publicly condoned; yet this is the practice by many Windows network administrators just to make happy users who have no notion of consequential risk.

\index{condemns}\index{security fixes}\index{updates}\index{development}\index{documentation}\index{security updates}\index{turn-around time} The report condemns Samba for releasing updates and security fixes, yet Microsoft online updates need to be applied almost weekly. The answer to the criticism lies in the fact that Samba development is continuing, documentation is improving, user needs are being increasingly met or exceeded, and security updates are issued with a short turnaround time.

\index{modularization}\index{next generation}\index{responsible}\index{dependability}\index{road-map!published} The release of Samba-4 is expected around late 2004 to early 2005 and involves a near complete rewrite to permit extensive modularization and to prepare Samba for new functionality planned for addition during the next-generation series. The Samba Team is responsible and can be depended upon; the history to date suggests a high degree of dependability and on charter development consistent with published roadmap projections.

\index{foundation members}\index{Common Internet File System|textit{see} {CIFS} }\index{network attached storage|textit{see} {NAS} }\index{conferences}\index{presence and leadership}\index{leadership}\index{inter-operability} Not well published is the fact that Microsoft was a foundation member of the Common Internet File System (CIFS) initiative, together with the participation of the network attached storage (NAS) industry. Unfortunately, for the past few years, Microsoft has been absent from active involvement at CIFS conferences and has not exercised the leadership expected of a major force in the networking technology space. The Samba Team has maintained consistent presence and leadership at all CIFS conferences and at the interoperability laboratories run concurrently with them.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Cryptographic Controls (schannel, sign'n'seal)}]\null{}
\index{Cryptographic}\index{schannel}\index{digital sign'n'seal} The report correctly mentions that Samba did not support the most recent {\texttt{\docbookhyphenatedot{schannel}}} and {\texttt{\docbookhyphenatedot{digital sign'n'seal}}} features of Microsoft Windows NT/200x/XPPro products. This is one of the key features of the Samba-3 release. Market research reports take so long to generate that they are seldom a reflection of current practice, and in many respects reports are like a pathology report ---  they reflect accurately (at best) status at a snapshot in time. Meanwhile, the world moves on.

\index{public specifications}\index{protocols}\index{algorithm}\index{compatible}\index{network!traffic!observation}\index{defensible standards}\index{secure networking} It should be pointed out that had clear public specifications for the protocols been published, it would have been much easier to implement these features and would have taken less time to do. The sole mechanism used to find an algorithm that is compatible with the methods used by Microsoft has been based on observation of network traffic and trial-and-error implementation of potential techniques. The real value of public and defensible standards is obvious to all and would have enabled more secure networking for everyone.

\index{Critics}\index{digital sign'n'seal} Critics of Samba often ignore fundamental problems that may plague (or may have plagued) the users of Microsoft's products also. Those who are first to criticize Samba for not rushing into release of {\texttt{\docbookhyphenatedot{digital sign'n'seal}}} support often dismiss the problems that Microsoft has acknowledged\label{id2562486}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://support.microsoft.com/default.aspx?kbid=321733}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2562486} and for which a fix was provided. In fact, Tangent Systems\label{id2562494}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.tangent-systems.com/support/delayedwrite.html}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2562494} have documented a significant problem with delays writes that can be connected with the implementation of sign'n'seal. They provide a work-around that is not trivial for many Windows networking sites. From notes such as this it is clear that there are benefits from not rushing new technology out of the door too soon.

\index{secure networking protocols}\index{refereed standards}\index{proprietary}\index{digital rights}\index{protection}\index{networking protocols}\index{diffusion}\index{consumer}\index{choice} One final comment is warranted. If companies want more secure networking protocols, the most effective method by which this can be achieved is by users seeking and working together to help define open and publicly refereed standards. The development of closed source, proprietary methods that are developed in a clandestine framework of secrecy, under claims of digital rights protection, does not favor the diffusion of safe networking protocols and certainly does not help the consumer to make a better choice.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{Active Directory Replacement with Kerberos, LDAP, and Samba}]\null{}
\null{}
\begin{Verbatim}[,fontfamily=default]
    
\end{Verbatim}
 The Microsoft networking protocols extensively make use of remote procedure call (RPC) technology. Active Directory is not a simple mixture of LDAP and Kerberos together with file and print services, but rather is a complex, intertwined implementation of them that uses RPCs that are not supported by any of these component technologies and yet by which they are made to interoperate in ways that the components do not support.

\index{Active Directory!Server}\index{OpenLDAP}\index{Kerberos}\index{project maintainers}\index{LDAP} In order to make the popular request for Samba to be an Active Directory Server a reality, it is necessary to add to OpenLDAP, Kerberos, as well as Samba, RPC calls that are not presently supported. The Samba Team has not been able to gain critical overall support for all project maintainers to work together on the complex challenge of developing and integrating the necessary technologies. Therefore, if the Samba Team does not make it a priority to absorb Kerberos and LDAP functionality into the Samba project, this dream request cannot become a reality.

\index{missing RPC's}\index{road-map}\index{ADS!server}\index{MMC}\index{managed} At this time, the integration of LDAP, Kerberos, and the missing RPCs is not on the Samba development roadmap. If it is not on the published roadmap, it cannot be delivered anytime soon. Ergo, ADS server support is not a current goal for Samba development. The Samba Team is most committed to permitting Samba to be a full ADS domain member that is increasingly capable of being managed using Microsoft Windows MMC tools.
\end{description}
\subsubsection{Kerberos Exposed}
\label{id2562754}\hypertarget{id2562754}{}%

\index{kerberos}\index{unauthorized activities}\index{authorized location} Kerberos is a network authentication protocol that provides secure authentication for client-server applications by using secret-key cryptography. Firewalls are an insufficient barrier mechanism in today's networking world; at best they only restrict incoming network traffic but cannot prevent network traffic that comes from authorized locations from performing unauthorized activities.

\index{strong cryptography}\index{identity}\index{integrity} Kerberos was created by MIT as a solution to network security problems. The Kerberos protocol uses strong cryptography so that a client can prove its identity to a server (and vice versa) across an insecure network connection. After a client and server has used Kerberos to prove their identity, they can also encrypt all of their communications to assure privacy and data integrity as they go about their business.

\index{trusted third-party}\index{principals}\index{trusting}\index{kerberos!server}\index{secret} Kerberos is a trusted third-party service. That means that there is a third party (the kerberos server) that is trusted by all the entities on the network (users and services, usually called principals). All principals share a secret password (or key) with the kerberos server and this enables principals to verify that the messages from the kerberos server are authentic. Therefore, trusting the kerberos server, users and services can authenticate each other.

\index{restricted export} \index{MIT Kerberos} \index{Heimdal Kerberos} Kerberos was, until recently, a technology that was restricted from being exported from the United States. For many years that hindered global adoption of more secure networking technologies both within the United States and abroad. A free and unencumbered implementation of MIT Kerberos has been produced in Europe and is available from the Royal Institute\label{id2562902}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.pdc.kth.se/heimdal/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2562902} of Technology (KTH), Sweden. It is known as the Heimdal Kerberos project. In recent times the U.S. government has removed sanctions affecting the global distribution of MIT Kerberos. It is likely that there will be a significant surge forward in the development of Kerberos-enabled applications and in the general deployment and use of Kerberos across the spectrum of the information technology industry.

\index{Kerberos!interoperability} A storm has broken out concerning interoperability between MIT Kerberos and Microsofts' implementation of it. For example, a 2002 IDG\label{id2562928}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.idg.com.sg/idgwww.nsf/0/5DDA8D153A7505A748256BAB000D992A?OpenDocument}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2562928} report\label{id2562935}\begingroup\catcode`\#=12\footnote{Note: This link is no longer active. The same article is still available from ITWorld.com {\textless}\url{http://199.105.191.226/Man/2699/020430msdoj/}{\textgreater} (July 5, 2005)}\endgroup\docbooktolatexmakefootnoteref{id2562935} by states:
\begin{quote}

A Microsoft Corp. executive testified at the software giant's remedy hearing that the company goes to great lengths to disclose interfaces and protocols that allow third-party software products to interact with Windows. But a lawyer with the states suing Microsoft pointed out that when it comes to the company's use of the Kerberos authentication specification, not everyone agrees.

\index{Kerberos!unspecified fields} Robert Short, vice president of Windows core technology at Microsoft, wrote in his direct testimony prepared before his appearance that non-Microsoft operating systems can disregard the portion of the Kerberos version 5 specification that Windows clients use for proprietary purposes and still achieve interoperability with the Microsoft OS. Microsoft takes advantage of unspecified fields in the Kerberos specification for storing Windows-specific authorization data, Short wrote. The designers of Kerberos left these fields undefined so that software developers could add their own authorization information, he said.
\end{quote}

\index{DCE} \index{RPC} It so happens that Microsoft Windows clients depend on and expect the contents of the {\em{unspecified fields}} in the Kerberos 5 communications data stream for their Windows interoperability, particularly when Samba is expected to emulate a Windows Server 200x domain controller. But the interoperability issue goes far deeper than this. In the domain control protocols that are used by MS Windows XP Professional, there is a tight interdependency between the Kerberos protocols and the Microsoft distributed computing environment (DCE) RPCs that themselves are an integral part of the SMB/CIFS protocols as used by Microsoft.

Microsoft makes the following comment in a reference in a technet\label{id2563013}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.microsoft.com/technet/itsolutions/interop/mgmt/kerberos.asp}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2563013} article:
\begin{quote}

\index{Privilege Attribute Certificates|textit{see} {PAC} }\index{access control} The DCE Security Services are also layered on the Kerberos protocol. DCE authentication services use RPC representation of Kerberos protocol messages. In addition, DCE uses the authorization data field in Kerberos tickets to convey Privilege Attribute Certificates (PACs) that define user identity and group membership. The DCE PAC is used in a similar manner as Windows NT Security IDs for user authorization and access control. Windows NT services will not be able to translate DCE PACs into Windows NT user and group identifiers. This is not an issue with Kerberos interoperability, but rather an issue of interoperability between DCE and Windows NT access control information.
\end{quote}

% ------------------------   
% Section 
\section{Implementation}
\label{ch10expl}\hypertarget{ch10expl}{}%

The following procedures outline the implementation of the security measures discussed so far.
\subsection{Share Access Controls}
\label{id2563070}\hypertarget{id2563070}{}%

\index{Share Access Controls}\index{filter}\index{connection} Access control entries placed on the share itself act as a filter at the time a when CIFS/SMB client (such as Windows XP Pro) attempts to make a connection to the Samba server.
Create/Edit/Delete Share ACLs\begin{enumerate}

\item{\index{Domain Administrator}\index{account} From a Windows 200x/XP Professional workstation, log on to the domain using the Domain Administrator account (on Samba domains, this is usually the account called {\texttt{\docbookhyphenatedot{root}}}).}

\item{Click {\sffamily \bfseries Start} $\to$ {\sffamily \bfseries Settings} $\to$ {\sffamily \bfseries Control Panel} $\to$ {\sffamily \bfseries Administrative Tools} $\to$ {\sffamily \bfseries Computer Management}.}

\item{In the left panel, {\sffamily \bfseries [Right mouse menu item] Computer Management (Local)} $\to$ {\sffamily \bfseries Connect to another computer ...} $\to$ {\sffamily \bfseries Browse...} $\to$ {\sffamily \bfseries Advanced} $\to$ {\sffamily \bfseries Find Now}. In the lower panel, click on the name of the server you wish to administer. Click {\sffamily \bfseries OK} $\to$ {\sffamily \bfseries OK} $\to$ {\sffamily \bfseries OK}.\index{Computer Management} In the left panel, the entry {\sffamily \bfseries Computer Management (Local)} should now reflect the change made. For example, if the server you are administering is called {\texttt{\docbookhyphenatedot{FRODO}}}, the Computer Management entry should now say {\sffamily \bfseries Computer Management (FRODO)}.}

\item{In the left panel, click {\sffamily \bfseries Computer Management (FRODO)} $\to$ {\sffamily \bfseries [+] Shared Folders} $\to$ {\sffamily \bfseries Shares}.}

\item{\index{ACLs}\index{Share Permissions} In the right panel, double-click on the share on which you wish to set/edit ACLs. This will bring up the Properties panel. Click the {\sffamily \bfseries Share Permissions} tab.}

\item{\index{access control settings}\index{Everyone}\index{full control}\index{over-rule}\index{permissions}\index{rejected} You may now edit/add/remove access control settings. Be very careful. Many problems have been created by people who decided that everyone should be rejected but one particular group should have full control. This is a catch-22 situation because members of that particular group also belong to the group {\texttt{\docbookhyphenatedot{Everyone}}}, which therefore overrules any permissions set for the permitted group.}

\item{When you are done with editing, close all panels by clicking through the {\sffamily \bfseries OK} buttons.}
\end{enumerate}
\subsection{Share Definition Controls}
\label{id2563390}\hypertarget{id2563390}{}%

\index{Share Definition!Controls}\index{check-point}\index{pile-driver}\index{credential}\index{powers}\index{privileges} Share-definition-based access controls can be used like a checkpoint or like a pile-driver. Just as a checkpoint can be used to require someone who wants to get through to meet certain requirements, so it is possible to require the user (or group the user belongs to) to meet specified credential-related objectives. It can be likened to a pile-driver by overriding default controls in that having met the credential-related objectives, the user can be granted powers and privileges that would not normally be available under default settings.

\index{access controls}\index{ACLs}\index{share definition controls}\index{hierarchy of control} It must be emphasized that the controls discussed here can act as a filter or give rights of passage that act as a superstructure over normal directory and file access controls. However, share-level ACLs act at a higher level than do share definition controls because the user must filter through the share-level controls to get to the share-definition controls. The proper hierarchy of controls implemented by Samba and Windows networking consists of:

\begin{enumerate}
%--- Item
\item 
Share-level ACLs


%--- Item
\item 
Share-definition controls


%--- Item
\item 
Directory and file permissions


%--- Item
\item 
Directory and file POSIX ACLs

\end{enumerate}
\subsubsection{Checkpoint Controls}
\label{id2563519}\hypertarget{id2563519}{}%

\index{Checkpoint Controls} Consider the following extract from a {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file defining the share called {\texttt{\docbookhyphenatedot{Apps}}}: 
\begin{Verbatim}[]

[Apps]
	comment = Application Share
	path = /data/apps
	read only = Yes
	valid users = @Employees

\end{Verbatim}
 This definition permits only those who are members of the group called {\texttt{\docbookhyphenatedot{Employees}}} to access the share.

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

\index{Domain Member!servers}\index{winbind use default domain}\index{fully qualified}\index{valid users}\index{delimiter} On domain member servers and clients, even when the {\ttfamily\itshape{\docbookhyphenatedot{winbind use default domain}}} has been specified, the use of domain accounts in security controls requires fully qualified domain specification, for example, \smbconfoption{valid users} = @"MEGANET\textbackslash Northern Engineers". Note the necessity to use the double quotes to avoid having the space in the Windows group name interpreted as a delimiter.
\end{admonition}


\index{ACL}\index{access}\index{validate} If there is an ACL on the share itself to permit read/write access for all {\texttt{\docbookhyphenatedot{Employees}}} as well as read/write for the group {\texttt{\docbookhyphenatedot{Doctors}}}, both groups are permitted through to the share. However, at the moment an attempt is made to set up a connection to the share, a member of the group {\texttt{\docbookhyphenatedot{Doctors}}}, who is not also a member of the group {\texttt{\docbookhyphenatedot{Employees}}}, would immediately fail to validate.

\index{share definition controls} Consider another example. In this case, you want to permit all members of the group {\texttt{\docbookhyphenatedot{Employees}}} except the user {\texttt{\docbookhyphenatedot{patrickj}}} to access the {\texttt{\docbookhyphenatedot{Apps}}} share. This can be easily achieved by setting a share-level ACL permitting only {\texttt{\docbookhyphenatedot{Employees}}} to access the share, and then in the share definition controls excluding just {\texttt{\docbookhyphenatedot{patrickj}}}. Here is how that might be done: 
\begin{Verbatim}[]

[Apps]
        comment = Application Share
        path = /data/apps
        read only = Yes
        invalid users = patrickj

\end{Verbatim}
 \index{permissions} Let us assume that you want to permit the user {\texttt{\docbookhyphenatedot{gbshaw}}} to manage any file in the UNIX/Linux file system directory {\texttt{\docbookhyphenatefilename{/\dbz{}data/\dbz{}apps}}}, but you do not want to grant any write permissions beyond that directory tree. Here is one way this can be done: 
\begin{Verbatim}[]

[Apps]
        comment = Application Share
        path = /data/apps
        read only = Yes
        invalid users = patrickj
        admin users = gbshaw

\end{Verbatim}
 \index{administrative rights} Now we have a set of controls that permits only {\texttt{\docbookhyphenatedot{Employees}}} who are also members of the group {\texttt{\docbookhyphenatedot{Doctors}}}, excluding the user {\texttt{\docbookhyphenatedot{patrickj}}}, to have read-only privilege, but the user {\texttt{\docbookhyphenatedot{gbshaw}}} is granted administrative rights. The administrative rights conferred upon the user {\texttt{\docbookhyphenatedot{gbshaw}}} permit operation as if that user has logged in as the user {\texttt{\docbookhyphenatedot{root}}} on the UNIX/Linux system and thus, for access to the directory tree that has been shared (exported), permit the user to override controls that apply to all other users on that resource.

There are additional checkpoint controls that may be used. For example, if for the same share we now want to provide the user {\texttt{\docbookhyphenatedot{peters}}} with the ability to write to one directory to which he has write privilege in the UNIX file system, you can specifically permit that with the following settings: 
\begin{Verbatim}[]

[Apps]
        comment = Application Share
        path = /data/apps
        read only = Yes
        invalid users = patrickj
        admin users = gbshaw
        write list = peters

\end{Verbatim}
 \index{check-point controls} This is a particularly complex example at this point, but it begins to demonstrate the possibilities. You should refer to the online manual page for the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file for more information regarding the checkpoint controls that Samba implements.
\subsubsection{Override Controls}
\label{id2563800}\hypertarget{id2563800}{}%

\index{over-ride controls} Override controls implemented by Samba permit actions like the adoption of a different identity during file system operations, the forced overwriting of normal file and directory permissions, and so on. You should refer to the online manual page for the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file for more information regarding the override controls that Samba implements.

In the following example, you want to create a Windows networking share that any user can access. However, you want all read and write operations to be performed as if the user {\texttt{\docbookhyphenatedot{billc}}} and member of the group {\texttt{\docbookhyphenatedot{Mentors}}} read/write the files. Here is one way this can be done: 
\begin{Verbatim}[]

[someshare]
	comment = Some Files Everyone May Overwrite
	path = /data/somestuff
	read only = No
	force user = billc
	force group = Mentors

\end{Verbatim}
 \index{forced settings}\index{overheads} That is all there is to it. Well, it is almost that simple. The downside of this method is that users are logged onto the Windows client as themselves, and then immediately before accessing the file, Samba makes system calls to change the effective user and group to the forced settings specified, completes the file transaction, and then reverts to the actually logged-on identity. This imposes significant overhead on Samba. The alternative way to effectively achieve the same result (but with lower system CPU overheads) is described next.

\index{force user}\index{force group}\index{opportunistic!locking}\index{oplock break}\index{performance degradation} The use of the {\ttfamily\itshape{\docbookhyphenatedot{force user}}} or the {\ttfamily\itshape{\docbookhyphenatedot{force group}}} may also have a severe impact on system (particularly on Windows client) performance. If opportunistic locking is enabled on the share (the default), it causes an {\texttt{\docbookhyphenatedot{oplock break}}} to be sent to the client even if the client has not opened the file. On networks that have high traffic density, or on links that are routed to a remote network segment, {\texttt{\docbookhyphenatedot{oplock breaks}}} can be lost. This results in possible retransmission of the request, or the client may time-out while waiting for the file system transaction (read or write) to complete. The result can be a profound apparent performance degradation as the client continually attempts to reconnect to overcome the effect of the lost {\texttt{\docbookhyphenatedot{oplock break}}}, or time-out.
\subsection{Share Point Directory and File Permissions}
\label{id2563950}\hypertarget{id2563950}{}%

\index{security}\index{privilege controls}\index{permission}\index{share definition controls} Samba has been designed and implemented so that it respects as far as is feasible the security and user privilege controls that are built into the UNIX/Linux operating system. Samba does nothing with respect to file system access that violates file system permission settings, unless it is explicitly instructed to do otherwise through share definition controls. Given that Samba obeys UNIX file system controls, this chapter does not document simple information that can be obtained from a basic UNIX training guide. Instead, one common example of a typical problem is used to demonstrate the most effective solution referred to in the immediately preceding paragraph.

\index{Microsoft Office}\index{Word}\index{Excel} One of the common issues that repeatedly pops up on the Samba mailing lists involves the saving of Microsoft Office files (Word and Excel) to a network drive. Here is the typical sequence:

\begin{enumerate}
%--- Item
\item 
A user opens a Work document from a network drive. The file was owned by user {\texttt{\docbookhyphenatedot{janetp}}} and  [users], and was set read/write-enabled for everyone.


%--- Item
\item 
File changes and edits are made.


%--- Item
\item 
The file is saved, and MS Word is closed.


%--- Item
\item 
The file is now owned by the user {\texttt{\docbookhyphenatedot{billc}}} and group {\texttt{\docbookhyphenatedot{doctors}}}, and is set read/write by {\texttt{\docbookhyphenatedot{billc}}}, read-only by {\texttt{\docbookhyphenatedot{doctors}}}, and no access by everyone.


%--- Item
\item 
The original owner cannot now access her own file and is {``}justifiably{''} upset.

\end{enumerate}

There have been many postings over the years that report the same basic problem. Frequently Samba users want to know when this {``}bug{''} will be fixed. The fact is, this is not a bug in Samba at all. Here is the real sequence of what happens in this case.

\index{MS Word}\index{ownership}\index{permissions} When the user saves a file, MS Word creates a new (temporary) file. This file is naturally owned by the user who creates the file ({\texttt{\docbookhyphenatedot{billc}}}) and has the permissions that follow that user's default settings within the operating system (UNIX/Linux). When MS Word has finished writing the file to disk, it then renames the new (temporary) file to the name of the old one. MS Word does not change the ownership or permissions to what they were on the original file. The file is thus a totally new file, and the old one has been deleted in the process.

Samba received a request to create a new file, and then to rename the file to a new name. The old file that has the same name is now automatically deleted. Samba has no way of knowing that the new file should perhaps have the same ownership and permissions as the old file. To Samba, these are entirely independent operations.

The question is, {``}How can we solve the problem?{''}

The solution is simple. Use UNIX file system permissions and controls to your advantage. Follow these simple steps to create a share in which all files will consistently be owned by the same user and the same group:
Using Directory Permissions to Force File User and Group Ownership\begin{enumerate}

\item{Change your share definition so that it matches this pattern: 
\begin{Verbatim}[]

[finance]
        path = /usr/data/finance
        browseable = Yes
        read only = No

\end{Verbatim}
}

\item{\index{permissions!user}\index{permissions!group} Set consistent user and group permissions recursively down the directory tree as shown here: 
\begin{Verbatim}[]

root#  chown -R janetp.users /usr/data/finance

\end{Verbatim}
}

\item{\index{accessible} Set the files and directory permissions to be read/write for owner and group, and not accessible to others (everyone), using the following command: 
\begin{Verbatim}[]

root#  chmod ug+rwx,o-rwx /usr/data/finance

\end{Verbatim}
}

\item{\index{SGID} Set the SGID (supergroup) bit on all directories from the top down. This means all files can be created with the permissions of the group set on the directory. It means all users who are members of the group {\texttt{\docbookhyphenatedot{finance}}} can read and write all files in the directory. The directory is not readable or writable by anyone who is not in the {\texttt{\docbookhyphenatedot{finance}}} group. Simply follow this example: 
\begin{Verbatim}[]

root#  find /usr/data/finance -type d -exec chmod ug+s {}\;

\end{Verbatim}
}

\item{\index{group membership}\index{primary group}\index{/etc/passwd} Make sure all users that must have read/write access to the directory have {\texttt{\docbookhyphenatedot{finance}}} group membership as their primary group, for example, the group they belong to in {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}}.}
\end{enumerate}
\subsection{Managing Windows 200x ACLs}
\label{id2564332}\hypertarget{id2564332}{}%

\index{translate}\index{Windows 2000 ACLs}\index{Posix ACLs}\index{side effects} Samba must translate Windows 2000 ACLs to UNIX POSIX ACLs. This has some interesting side effects because there is not a one-to-one equivalence between them. The as-close-as-possible ACLs match means that some transactions are not possible from MS Windows clients. One of these is to reset the ownership of directories and files. If you want to reset ownership, this must be done from a UNIX/Linux login.

There are two possible ways to set ACLs on UNIX/Linux file systems from a Windows network workstation, either via File Manager or via the Microsoft Management Console (MMC) Computer Management interface.
\subsubsection{Using the MMC Computer Management Interface}
\label{id2564383}\hypertarget{id2564383}{}%
\begin{enumerate}

\item{From a Windows 200x/XP Professional workstation, log on to the domain using the Domain Administrator account (on Samba domains, this is usually the account called {\texttt{\docbookhyphenatedot{root}}}).}

\item{Click {\sffamily \bfseries Start} $\to$ {\sffamily \bfseries Settings} $\to$ {\sffamily \bfseries Control Panel} $\to$ {\sffamily \bfseries Administrative Tools} $\to$ {\sffamily \bfseries Computer Management}.}

\item{In the left panel, {\sffamily \bfseries [Right mouse menu item] Computer Management (Local)} $\to$ {\sffamily \bfseries Connect to another computer ...} $\to$ {\sffamily \bfseries Browse...} $\to$ {\sffamily \bfseries Advanced} $\to$ {\sffamily \bfseries Find Now}. In the lower panel, click on the name of the server you wish to administer. Click {\sffamily \bfseries OK} $\to$ {\sffamily \bfseries OK} $\to$ {\sffamily \bfseries OK}. In the left panel, the entry {\sffamily \bfseries Computer Management (Local)} should now reflect the change made. For example, if the server you are administering is called {\texttt{\docbookhyphenatedot{FRODO}}}, the Computer Management entry should now say: {\sffamily \bfseries Computer Management (FRODO)}.}

\item{In the left panel, click {\sffamily \bfseries Computer Management (FRODO)} $\to$ {\sffamily \bfseries [+] Shared Folders} $\to$ {\sffamily \bfseries Shares}.}

\item{\index{Security}\index{Properties}\index{Permissions}\index{Samba Domain server} In the right panel, double-click on the share on which you wish to set/edit ACLs. This brings up the Properties panel. Click the {\sffamily \bfseries Security} tab. It is best to edit ACLs using the {\texttt{\docbookhyphenatedot{Advanced}}} editing features. Click the {\sffamily \bfseries Advanced} button. This opens a panel that has four tabs. Only the functionality under the {\texttt{\docbookhyphenatedot{Permissions}}} tab can be utilized with respect to a Samba domain server.}

\item{\index{access control}\index{permitted group} You may now edit/add/remove access control settings. Be very careful. Many problems have been created by people who decided that everyone should be rejected but one particular group should have full control. This is a catch-22 situation because members of that particular group also belong to the group {\texttt{\docbookhyphenatedot{Everyone}}}, which therefore overrules any permissions set for the permitted group.}

\item{When you are done with editing, close all panels by clicking through the {\sffamily \bfseries OK} buttons until the last panel closes.}
\end{enumerate}
\subsubsection{Using MS Windows Explorer (File Manager)}
\label{id2564653}\hypertarget{id2564653}{}%

The following alternative method may be used from a Windows workstation. In this example we work with a domain called {\texttt{\docbookhyphenatedot{MEGANET}}}, a server called {\texttt{\docbookhyphenatedot{MASSIVE}}}, and a share called {\texttt{\docbookhyphenatedot{Apps}}}. The underlying UNIX/Linux share point for this share is {\texttt{\docbookhyphenatefilename{/\dbz{}data/\dbz{}apps}}}.
\begin{enumerate}

\item{Click {\sffamily \bfseries Start} $\to$ {\sffamily \bfseries [right-click] My Computer} $\to$ {\sffamily \bfseries Explore} $\to$ {\sffamily \bfseries [left panel] [+] My Network Places} $\to$ {\sffamily \bfseries [+] Entire Network} $\to$ {\sffamily \bfseries [+] Microsoft Windows Network} $\to$ {\sffamily \bfseries [+] Meganet} $\to$ {\sffamily \bfseries [+] Massive} $\to$ {\sffamily \bfseries [right-click] Apps} $\to$ {\sffamily \bfseries Properties} $\to$ {\sffamily \bfseries Security} $\to$ {\sffamily \bfseries Advanced}. This opens a panel that has four tabs. Only the functionality under the {\texttt{\docbookhyphenatedot{Permissions}}} tab can be utilized for a Samba domain server.}

\item{\index{full control}\index{over-rule} You may now edit/add/remove access control settings. Be very careful. Many problems have been created by people who decided that everyone should be rejected but one particular group should have full control. This is a catch-22 situation because members of that particular group also belong to the group {\texttt{\docbookhyphenatedot{Everyone}}}, which therefore overrules any permissions set for the permitted group.}

\item{When you are done with editing, close all panels by clicking through the {\sffamily \bfseries OK} buttons until the last panel closes.}
\end{enumerate}
\subsubsection{Setting Posix ACLs in UNIX/Linux}
\label{id2564812}\hypertarget{id2564812}{}%

\index{desired security setting}\index{shared resource} Yet another alternative method for setting desired security settings on the shared resource files and directories can be achieved by logging into UNIX/Linux and setting POSIX ACLs directly using command-line tools. Here is an example session on the same resource as in the immediately preceding example on a SUSE 9 Linux system:
\begin{enumerate}

\item{Log into the Linux system as the user {\texttt{\docbookhyphenatedot{root}}}.}

\item{Change directory to the location of the exported (shared) Windows file share (Apps), which is in the directory {\texttt{\docbookhyphenatefilename{/\dbz{}data}}}. Execute the following: 
\begin{Verbatim}[]

root#  cd /data

\end{Verbatim}
 Retrieve the existing POSIX ACLs entry by executing: 
\begin{Verbatim}[]

root#  getfacl apps
# file: apps
# owner: root
# group: root
user::rwx
group::rwx
other::r-x

\end{Verbatim}
}

\item{\index{recursively} You want to add permission for {\texttt{\docbookhyphenatedot{AppsMgrs}}} to enable them to manage the applications (apps) share. It is important to set the ACL recursively so that the AppsMgrs have this capability throughout the directory tree that is being shared. This is done using the {\texttt{\docbookhyphenatedot{-R}}} option as shown. Execute the following: 
\begin{Verbatim}[]

root#  setfacl -m -R group:AppsMgrs:rwx /data/apps

\end{Verbatim}
 Because setting an ACL does not provide a response, you immediately validate the command executed as follows: 
\begin{Verbatim}[]

root#  getfacl /data/apps
# file: apps
# owner: root
# group: root
user::rwx
group::rwx
group:AppsMgrs:rwx
mask::rwx
other::r-x

\end{Verbatim}
 This confirms that the change of POSIX ACL permissions has been effective.}

\item{\index{setfacl}\index{getfacl}\index{directory tree}\index{Windows ACLs}\index{inheritance} It is highly recommended that you read the online manual page for the {\bfseries{setfacl}} and {\bfseries{getfacl}} commands. This provides information regarding how to set/read the default ACLs and how that may be propagated through the directory tree. In Windows ACLs terms, this is the equivalent of setting {\texttt{\docbookhyphenatedot{inheritance}}} properties.}
\end{enumerate}
\subsection{Key Points Learned}
\label{id2565009}\hypertarget{id2565009}{}%

The mish-mash of issues were thrown together into one chapter because it seemed like a good idea. Looking back, this chapter could be broken into two, but it's too late now. It has been done. The highlights covered are as follows:

\begin{itemize}
%--- Item
\item 
\index{Winbind}\index{Active Directory}\index{password change}\index{logon hours} Winbind honors and does not override account controls set in Active Directory. This means that password change, logon hours, and so on, are (or soon will be) enforced by Samba winbind. At this time, an out-of-hours login is denied and password change is enforced. At this time, if logon hours expire, the user is not forcibly logged off. That may be implemented at some later date.


%--- Item
\item 
\index{Sign'n'seal}\index{schannel} Sign'n'seal (plus schannel support) has been implemented in Samba-3. Beware of potential problems acknowledged by Microsoft as having been fixed but reported by some as still possibly an open issue.


%--- Item
\item 
\index{Kerberos}\index{OpenLDAP}\index{Active Directory}\index{inter-operability} The combination of Kerberos 5, plus OpenLDAP, plus Samba, cannot replace Microsoft Active Directory. The possibility to do this is not planned in the current Samba-3 roadmap. Samba-3 does aim to provide further improvements in interoperability so that UNIX/Linux systems may be fully integrated into Active Directory domains.


%--- Item
\item 
This chapter reviewed mechanisms by which Samba servers may be kept secure. Each of the four key methodologies was reviewed with specific reference to example deployment techniques.

\end{itemize}

% ------------------------   
% Section 
\section{Questions and Answers}
\label{id2565137}\hypertarget{id2565137}{}%


% -------------------------------------------------------------
% QandASet                                                     
% -------------------------------------------------------------
\subsection*{F.A.Q.}
\label{id2565145}
\vspace{1em}
\noindent{}1.~\textbf{Q:}~\textit{\index{Sign'n'seal}\index{registry hacks} Does Samba-3 require the {\texttt{\docbookhyphenatedot{Sign'n'seal}}} registry hacks needed by Samba-2?}
\newline
\noindent\textbf{A:}~
\index{schannel}\index{Sign'n'seal}\index{registry change} No. Samba-3 fully supports {\texttt{\docbookhyphenatedot{Sign'n'seal}}} as well as {\texttt{\docbookhyphenatedot{schannel}}} operation. The registry change should not be applied when Samba-3 is used as a domain controller.


\vspace{1em}
\vspace{1em}
\noindent{}2.~\textbf{Q:}~\textit{Does Samba-3 support Active Directory?}
\newline
\noindent\textbf{A:}~
\index{Active Directory} Yes. Samba-3 can be a fully participating native mode Active Directory client. Samba-3 does not provide Active Directory services. It cannot be used to replace a Microsoft Active Directory server implementation. Samba-3 can function as an Active Directory client (workstation) toolkit, and it can function as an Active Directory domain member server.


\vspace{1em}
\vspace{1em}
\noindent{}3.~\textbf{Q:}~\textit{\index{mixed-mode} When Samba-3 is used with Active Directory, is it necessary to run mixed-mode operation, as was necessary with Samba-2?}
\newline
\noindent\textbf{A:}~
\index{native} No. Samba-3 can be used with NetBIOS over TCP/IP disabled, just as can be done with Windows 200x Server and 200x/XPPro client products. It is no longer necessary to run mixed-mode operation, because Samba-3 can join a native Windows 2003 Server ADS domain.


\vspace{1em}
\vspace{1em}
\noindent{}4.~\textbf{Q:}~\textit{\index{share level access controls} Is it safe to set share-level access controls in Samba?}
\newline
\noindent\textbf{A:}~
Yes. Share-level access controls have been supported since early versions of Samba-2. This is very mature technology. Not enough sites make use of this powerful capability, neither on Windows server or with Samba servers.


\vspace{1em}
\vspace{1em}
\noindent{}5.~\textbf{Q:}~\textit{\index{share ACLs} Is it mandatory to set share ACLs to get a secure Samba-3 server?}
\newline
\noindent\textbf{A:}~
\index{file system security}\index{Windows 200x ACLs}\index{share definition controls}\index{share level ACL}\index{security} No. Samba-3 honors UNIX/Linux file system security, supports Windows 200x ACLs, and provides means of securing shares through share definition controls in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file. The additional support for share-level ACLs is like frosting on the cake. It adds to security but is not essential to it.


\vspace{1em}
\vspace{1em}
\noindent{}6.~\textbf{Q:}~\textit{\index{valid users} The {\ttfamily\itshape{\docbookhyphenatedot{valid users}}} did not work on the \smbconfsection{[homes]}. Has this functionality been restored yet?}
\newline
\noindent\textbf{A:}~
\index{meta-service} Yes. This was fixed in Samba-3.0.2. The use of this parameter is strongly recommended as a safeguard on the \smbconfsection{[homes]} meta-service. The correct way to specify this is: \smbconfoption{valid users} = \%S.


\vspace{1em}
\vspace{1em}
\noindent{}7.~\textbf{Q:}~\textit{\index{force user}\index{force group}\index{bias} Is the bias against use of the {\ttfamily\itshape{\docbookhyphenatedot{force user}}} and {\ttfamily\itshape{\docbookhyphenatedot{force group}}} really warranted?}
\newline
\noindent\textbf{A:}~
\index{performance} There is no bias. There is a determination to recommend the right tool for the task at hand. After all, it is better than putting users through performance problems, isn't it?


\vspace{1em}
\vspace{1em}
\noindent{}8.~\textbf{Q:}~\textit{The example given for file and directory access control forces all files to be owned by one particular user. I do not like that. Is there any way I can see who created the file?}
\newline
\noindent\textbf{A:}~
\index{SUID} Sure. You do not have to set the SUID bit on the directory. Simply execute the following command to permit file ownership to be retained by the user who created it: 
\begin{Verbatim}[]

root#  find /usr/data/finance -type d -exec chmod g+s {}\;

\end{Verbatim}
 Note that this required no more than removing the {\texttt{\docbookhyphenatedot{u}}} argument so that the SUID bit is not set for the owner.


\vspace{1em}
\vspace{1em}
\noindent{}9.~\textbf{Q:}~\textit{\index{Computer Management} In the book, {``}The Official Samba-3 HOWTO and Reference Guide{''}, you recommended use of the Windows NT4 Server Manager (part of the {\texttt{\docbookhyphenatefilename{SRVTOOLS.\dbz{}EXE}}}) utility. Why have you mentioned only the use of the Windows 200x/XP MMC Computer Management utility?}
\newline
\noindent\textbf{A:}~
\index{MMC}\index{SRVTOOLS.EXE} Either tool can be used with equal effect. There is no benefit of one over the other, except that the MMC utility is present on all Windows 200x/XP systems and does not require additional software to be downloaded and installed. Note that if you want to manage user and group accounts in your Samba-controlled domain, the only tool that permits that is the NT4 Domain User Manager, which is provided as part of the {\texttt{\docbookhyphenatefilename{SRVTOOLS.\dbz{}EXE}}} utility.


\vspace{1em}
\vspace{1em}
\noindent{}10.~\textbf{Q:}~\textit{\index{valid users}\index{Active Directory}\index{Domain Member server} I tried to set {\ttfamily\itshape{\docbookhyphenatedot{valid users = @Engineers}}}, but it does not work. My Samba server is an Active Directory domain member server. Has this been fixed now?}
\newline
\noindent\textbf{A:}~
The use of this parameter has always required the full specification of the domain account, for example, {\ttfamily\itshape{\docbookhyphenatedot{valid users = @"MEGANET2\textbackslash Domain Admins"}}}.


\vspace{1em}
\cleardoublepage 
% -------------------------------------------------------------
% Chapter Integrating Additional Services 
% ------------------------------------------------------------- 	
\chapter{Integrating Additional Services}
\label{DomApps}\hypertarget{DomApps}{}%

\index{authentication} \index{backends} \index{smbpasswd} \index{ldapsam} \index{Active Directory} You've come a long way now. You have pretty much mastered Samba-3 for most uses it can be put to. Up until now, you have cast Samba-3 in the leading role, and where authentication was required, you have used one or another of Samba's many authentication backends (from flat text files with smbpasswd to LDAP directory integration with ldapsam). Now you can design a solution for a new Abmas business. This business is running Windows Server 2003 and Active Directory, and these are to stay. It's time to master implementing Samba and Samba-supported services in a domain controlled by the latest Windows authentication technologies. Let's get started ---  this is leading edge.

% ------------------------   
% Section 
\section{Introduction}
\label{id2489276}\hypertarget{id2489276}{}%

Abmas has continued its miraculous growth; indeed, nothing seems to be able to stop its diversification into multiple (and seemingly unrelated) fields. Its latest acquisition is Abmas Snack Foods, a big player in the snack-food business.

With this acquisition comes new challenges for you and your team. Abmas Snack Foods is a well-developed business with a huge and heterogeneous network. It already has Windows, NetWare, and Proprietary UNIX, but as yet no Samba or Linux. The network is mature and well-established, and there is no question of its chosen user authentication scheme being changed for now. You need to take a wise new approach.

You have decided to set the ball rolling by introducing Samba-3 into the network gradually, taking over key services and easing the way to a full migration and, therefore, integration into Abmas's existing business later.
\subsection{Assignment Tasks}
\label{id2480110}\hypertarget{id2480110}{}%

\index{web!proxying} \index{web!caching} You've promised the skeptical Abmas Snack Foods management team that you can show them how Samba can ease itself and other Open Source technologies into their existing infrastructure and deliver sound business advantages. Cost cutting is high on their agenda (a major promise of the acquisition). You have chosen Web proxying and caching as your proving ground.

\index{bandwidth} \index{Microsoft ISA} Abmas Snack Foods has several thousand users housed at its head office and multiple regional offices, plants, and warehouses. A high proportion of the business's work is done online, so Internet access for most of these users is essential. All Internet access, including for all regional offices, is funneled through the head office and is the job of the (now your) networking team. The bandwidth requirements were horrific (comparable to a small ISP), and the team soon discovered proxying and caching. In fact, they became one of the earliest commercial users of Microsoft ISA.

\index{Active Directory} \index{authenticated} \index{proxy} The team is not happy with ISA. Because it never lived up to its marketing promises, it underperformed and had reliability problems. You have pounced on the opportunity to show what Open Source can do. The one thing they do like, however, is ISA's integration with Active Directory. They like that their users, once logged on, are automatically authenticated against the proxy. If your alternative to ISA can operate completely seamlessly in their Active Directory domain, it will be approved.

This is a hands-on exercise. You build software applications so that you obtain the functionality Abmas needs.

% ------------------------   
% Section 
\section{Dissection and Discussion}
\label{id2464978}\hypertarget{id2464978}{}%

The key requirements in this business example are straightforward. You are not required to do anything new, just to replicate an existing system, not lose any existing features, and improve performance. The key points are:

\begin{itemize}
%--- Item
\item 
Internet access for most employees


%--- Item
\item 
Distributed system to accommodate load and geographical distribution of users


%--- Item
\item 
Seamless and transparent interoperability with the existing Active Directory domain

\end{itemize}
\subsection{Technical Issues}
\label{id2465012}\hypertarget{id2465012}{}%

\index{browsing} \index{Squid proxy} \index{proxy} \index{authentication} \index{Internet Explorer} \index{winbind} \index{NTLM} \index{NTLM authentication daemon} \index{authentication} \index{daemon} \index{Active Directory} \index{domain!Active Directory} \index{Kerberos}\index{token} Functionally, the user's Internet Explorer requests a browsing session with the Squid proxy, for which it offers its AD authentication token. Squid hands off the authentication request to the Samba-3 authentication helper application called {\bfseries{ntlm\_auth}}. This helper is a hook into winbind, the Samba-3 NTLM authentication daemon. Winbind enables UNIX services to authenticate against Microsoft Windows domains, including Active Directory domains. As Active Directory authentication is a modified Kerberos authentication, winbind is assisted in this by local Kerberos 5 libraries configured to check passwords with the Active Directory server. Once the token has been checked, a browsing session is established. This process is entirely transparent and seamless to the user.

Enabling this consists of:

\begin{itemize}
%--- Item
\item 
Preparing the necessary environment using preconfigured packages


%--- Item
\item 
Setting up raw Kerberos authentication against the Active Directory domain


%--- Item
\item 
Configuring, compiling, and then installing the supporting Samba-3 components


%--- Item
\item 
Tying it all together

\end{itemize}
\subsection{Political Issues}
\label{id2511308}\hypertarget{id2511308}{}%

You are a stranger in a strange land, and all eyes are upon you. Some would even like to see you fail. For you to gain the trust of your newly acquired IT people, it is essential that your solution does everything the old one did, but does it better in every way. Only then will the entrenched positions consider taking up your new way of doing things on a wider scale.

% ------------------------   
% Section 
\section{Implementation}
\label{id2511327}\hypertarget{id2511327}{}%

\index{Squid} First, your system needs to be prepared and in a known good state to proceed. This consists of making sure that everything the system depends on is present and that everything that could interfere or conflict with the system is removed. You will be configuring the Squid and Samba-3 packages and updating them if necessary. If conflicting packages of these programs are installed, they must be removed.

\index{Red Hat Linux} The following packages should be available on your Red Hat Linux system:

\begin{itemize}
%--- Item
\item 
\index{krb5} \index{Kerberos} krb5-libs


%--- Item
\item 
krb5-devel


%--- Item
\item 
krb5-workstation


%--- Item
\item 
krb5-server


%--- Item
\item 
pam\_krb5

\end{itemize}

\index{SUSE Linux} In the case of SUSE Linux, these packages are called:

\begin{itemize}
%--- Item
\item 
heimdal-lib


%--- Item
\item 
heimdal-devel


%--- Item
\item 
\index{Heimdal} heimdal


%--- Item
\item 
pam\_krb5

\end{itemize}

If the required packages are not present on your system, you must install them from the vendor's installation media. Follow the administrative guide for your Linux system to ensure that the packages are correctly updated.

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

\index{MS Windows Server 2003} \index{Kerberos} \index{MIT} If the requirement is for interoperation with MS Windows Server 2003, it will be necessary to ensure that you are using MIT Kerberos version 1.3.1 or later. Red Hat Linux 9 ships with MIT Kerberos 1.2.7 and thus requires updating.

\index{Heimdal} \index{SUSE Enterprise Linux Server} Heimdal 0.6 or later is required in the case of SUSE Linux. SUSE Enterprise Linux Server 8 ships with Heimdal 0.4. SUSE 9 ships with the necessary version.
\end{admonition}

\subsection{Removal of Pre-Existing Conflicting RPMs}
\label{ch10-one}\hypertarget{ch10-one}{}%

\index{Squid} If Samba and/or Squid RPMs are installed, they should be updated. You can build both from source.

\index{rpm} \index{samba} \index{squid} Locating the packages to be un-installed can be achieved by running: 
\begin{Verbatim}[]

root#  rpm -qa | grep -i samba
root#  rpm -qa | grep -i squid

\end{Verbatim}
 The identified packages may be removed using: 
\begin{Verbatim}[]

root#  rpm -e samba-common

\end{Verbatim}

\subsection{Kerberos Configuration}
\label{id2551738}\hypertarget{id2551738}{}%

\index{Kerberos} \index{Active Directory!server} \index{ADS} \index{KDC} The systems Kerberos installation must be configured to communicate with your primary Active Directory server (ADS KDC).

Strictly speaking, MIT Kerberos version 1.3.4 currently gives the best results, although the current default Red Hat MIT version 1.2.7 gives acceptable results unless you are using Windows 2003 servers.

\index{MIT} \index{Heimdal} \index{Kerberos} \index{/etc/krb5.conf} \index{DNS!SRV records} \index{KDC} \index{DNS!lookup} Officially, neither MIT (1.3.4) nor Heimdal (0.63) Kerberos needs an {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}krb5.\dbz{}conf}}} file in order to work correctly. All ADS domains automatically create SRV records in the DNS zone {\texttt{\docbookhyphenatedot{Kerberos.REALM.NAME}}} for each KDC in the realm. Since both MIT and Heimdal, KRB5 libraries default to checking for these records, so they automatically find the KDCs. In addition, {\texttt{\docbookhyphenatefilename{krb5.\dbz{}conf}}} allows specifying only a single KDC, even if there is more than one. Using the DNS lookup allows the KRB5 libraries to use whichever KDCs are available.
Kerberos Configuration Steps\begin{enumerate}

\item{\index{krb5.conf} If you find the need to manually configure the {\texttt{\docbookhyphenatefilename{krb5.\dbz{}conf}}}, you should edit it to have the contents shown in \hyperlink{ch10-krb5conf}{Example {\ref{ch10-krb5conf}}}. The final fully qualified path for this file should be {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}krb5.\dbz{}conf}}}.}

\item{\index{Kerberos} \index{realm} \index{case-sensitive} \index{KDC} \index{synchronization} \index{initial credentials} \index{Clock skew} \index{NTP} \index{DNS!lookup} \index{reverse DNS} \index{NetBIOS name} \index{/etc/hosts} \index{mapping} The following gotchas often catch people out. Kerberos is case sensitive. Your realm must be in UPPERCASE, or you will get an error: {``}Cannot find KDC for requested realm while getting initial credentials{''}. Kerberos is picky about time synchronization. The time according to your participating servers must be within 5 minutes or you get an error: {``}kinit(v5): Clock skew too great while getting initial credentials{''}. Clock skew limits are, in fact, configurable in the Kerberos protocols (the default is 5 minutes). A better solution is to implement NTP throughout your server network. Kerberos needs to be able to do a reverse DNS lookup on the IP address of your KDC. Also, the name that this reverse lookup maps to must either be the NetBIOS name of the KDC (i.e., the hostname with no domain attached) or the NetBIOS name followed by the realm. If all else fails, you can add a {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}} entry mapping the IP address of your KDC to its NetBIOS name. If Kerberos cannot do this reverse lookup, you will get a local error when you try to join the realm.}

\item{\index{kinit} You are now ready to test your installation by issuing the command: 
\begin{Verbatim}[]

root#  kinit [USERNAME@REALM]

\end{Verbatim}
 You are asked for your password, which you should enter. The following is a typical console sequence: 
\begin{Verbatim}[]

root#  kinit ADMINISTRATOR@LONDON.ABMAS.BIZ
Password for ADMINISTRATOR@LONDON.ABMAS.BIZ: 

\end{Verbatim}
 Make sure that your password is accepted by the Active Directory KDC.}
\end{enumerate}

\begin{example}%
\hypertarget{ch10-krb5conf}{}%
\captionswapskip{}{{\caption{Kerberos Configuration ---  File: /\dbz{}etc/\dbz{}krb5.\dbz{}conf}\label{ch10-krb5conf}}}
\captionswapskip{}
\begin{Verbatim}[]

[libdefaults]
	default_realm = LONDON.ABMAS.BIZ

[realms] 
	LONDON.ABMAS.BIZ = {
	kdc = w2k3s.london.abmas.biz
	}

\end{Verbatim}
\end{example}


\index{klist} The command 
\begin{Verbatim}[]

root#  klist -e 

\end{Verbatim}
 shows the Kerberos tickets cached by the system.
\subsubsection{Samba Configuration}
\label{id2555458}\hypertarget{id2555458}{}%

\index{Active Directory} Samba must be configured to correctly use Active Directory. Samba-3 must be used, since it has the necessary components to interface with Active Directory.
Securing Samba-3 With ADS Support Steps\begin{enumerate}

\item{\index{Red Hat Linux} \index{Samba Tea} \index{Red Hat Fedora Linux} \index{MIT KRB5} \index{ntlm\_auth} Download the latest stable Samba-3 for Red Hat Linux from the official Samba Team FTP site.\label{id2555526}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://ftp.samba.org}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2555526} The official Samba Team RPMs for Red Hat Fedora Linux contain the {\bfseries{ntlm\_auth}} tool needed, and are linked against MIT KRB5 version 1.3.1 and therefore are ready for use.  \index{SerNet} \index{RPMs} The necessary, validated RPM packages for SUSE Linux may be obtained from the SerNet\label{id2555559}\begingroup\catcode`\#=12\footnote{ {\textless}\url{ftp://ftp.sernet.de/pub/samba}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2555559} FTP site that is located in Germany. All SerNet RPMs are validated, have the necessary {\bfseries{ntlm\_auth}} tool, and are statically linked against suitably patched Heimdal 0.6 libraries.}

\item{Using your favorite editor, change the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba/\dbz{}smb.\dbz{}conf}}} file so it has contents similar to the example shown in \hyperlink{ch10-smbconf}{Example {\ref{ch10-smbconf}}}.}

\item{\index{computer account} \index{Active Directory} \index{net!ads!join}i \index{Kerberos ticket} \index{ticket} Next you need to create a computer account in the Active Directory. This sets up the trust relationship needed for other clients to authenticate to the Samba server with an Active Directory Kerberos ticket. This is done with the {``}net ads join -U [Administrator\%Password]{''} command, as follows: 
\begin{Verbatim}[]

root#  net ads join -U administrator%vulcon

\end{Verbatim}
}

\item{\index{smbd} \index{nmbd} \index{winbindd} \index{Active Directory} \index{Samba} Your new Samba binaries must be started in the standard manner as is applicable to the platform you are running on. Alternatively, start your Active Directory-enabled Samba with the following commands: 
\begin{Verbatim}[]

root#  smbd -D
root#  nmbd -D
root#  winbindd -B

\end{Verbatim}
}

\item{\index{winbind} \index{Active Directory!domain} \index{wbinfo} \index{enumerating} \index{Active Directory!tree} We now need to test that Samba is communicating with the Active Directory domain; most specifically, we want to see whether winbind is enumerating users and groups. Issue the following commands: 
\begin{Verbatim}[]

root#  wbinfo -t
checking the trust secret via RPC calls succeeded

\end{Verbatim}
 This tests whether we are authenticating against Active Directory: 
\begin{Verbatim}[]

root#  wbinfo -u
LONDON+Administrator
LONDON+Guest
LONDON+SUPPORT_388945a0
LONDON+krbtgt
LONDON+jht
LONDON+xjht

\end{Verbatim}
 This enumerates all the users in your Active Directory tree: 
\begin{Verbatim}[]

root#  wbinfo -g
LONDON+Domain Computers
LONDON+Domain Controllers
LONDON+Schema Admins
LONDON+Enterprise Admins
LONDON+Domain Admins
LONDON+Domain Users
LONDON+Domain Guests
LONDON+Group Policy Creator Owners
LONDON+DnsUpdateProxy

\end{Verbatim}
 This enumerates all the groups in your Active Directory tree.}

\item{\index{Squid} \index{ntlm\_auth} Squid uses the {\bfseries{ntlm\_auth}} helper build with Samba-3. You may test {\bfseries{ntlm\_auth}} with the command: 
\begin{Verbatim}[]

root#  /usr/bin/ntlm_auth --username=jht
password: XXXXXXXX

\end{Verbatim}
 You are asked for your password, which you should enter. You are rewarded with: 
\begin{Verbatim}[]

root#  NT_STATUS_OK: Success (0x0)

\end{Verbatim}
}

\item{\index{ntlm\_auth} \index{authenticate} \index{winbind} \index{privileged pipe} \index{squid} \index{chgrp} \index{chmod} \index{failure} The {\bfseries{ntlm\_auth}} helper, when run from a command line as the user {``}root{''}, authenticates against your Active Directory domain (with the aid of winbind). It manages this by reading from the winbind privileged pipe. Squid is running with the permissions of user {``}squid{''} and group {``}squid{''} and is not able to do this unless we make a vital change. Squid cannot read from the winbind privilege pipe unless you change the permissions of its directory. This is the single biggest cause of failure in the whole process. Remember to issue the following command (for Red Hat Linux): 
\begin{Verbatim}[]

root#  chgrp squid /var/cache/samba/winbindd_privileged
root#  chmod 750 /var/cache/samba/winbindd_privileged

\end{Verbatim}
 For SUSE Linux 9, execute the following: 
\begin{Verbatim}[]

root#  chgrp squid /var/lib/samba/winbindd_privileged
root#  chmod 750 /var/lib/samba/winbindd_privileged

\end{Verbatim}
}
\end{enumerate}
\subsubsection{NSS Configuration}
\label{id2561100}\hypertarget{id2561100}{}%

\index{NSS} \index{winbind} \index{authentication} For Squid to benefit from Samba-3, NSS must be updated to allow winbind as a valid route to user authentication.

Edit your {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}}} file so it has the parameters shown in \hyperlink{ch10-etcnsscfg}{Example {\ref{ch10-etcnsscfg}}}.

\begin{example}%
\hypertarget{ch10-smbconf}{}%
\captionswapskip{}{{\caption{Samba Configuration ---  File: /\dbz{}etc/\dbz{}samba/\dbz{}smb.\dbz{}conf}\label{ch10-smbconf}}}
\captionswapskip{}
\begin{lstlisting}[language=smbconf,style=smbconfblock]
[global]
 	workgroup = LONDON
 	netbios name = W2K3S
 	realm = LONDON.ABMAS.BIZ
 	security = ads
 	encrypt passwords = yes
 	password server = w2k3s.london.abmas.biz
 # separate domain and username with '/', like DOMAIN/username
 	winbind separator = /
 # use UIDs from 10000 to 20000 for domain users
 	idmap uid = 10000-20000
 # use GIDs from 10000 to 20000 for domain groups
 	idmap gid = 10000-20000
 # allow enumeration of winbind users and groups
 	winbind enum users = yes
 	winbind enum groups = yes
 	winbind user default domain = yes
\end{lstlisting}
\end{example}


\begin{example}%
\hypertarget{ch10-etcnsscfg}{}%
\captionswapskip{}{{\caption{NSS Configuration File Extract ---  File: /\dbz{}etc/\dbz{}nsswitch.\dbz{}conf}\label{ch10-etcnsscfg}}}
\captionswapskip{}
\begin{Verbatim}[]

passwd: files winbind
shadow: files
group: files winbind

\end{Verbatim}
\end{example}

\subsubsection{Squid Configuration}
\label{id2561290}\hypertarget{id2561290}{}%

\index{Squid} \index{Active Directory!authentication} Squid must be configured correctly to interact with the Samba-3 components that handle Active Directory authentication.
\subsection{Configuration}
\label{id2561322}\hypertarget{id2561322}{}%
Squid Configuration Steps\begin{enumerate}

\item{\index{SUSE Linux} \index{Squid} \index{helper agent} If your Linux distribution is SUSE Linux 9, the version of Squid supplied is already enabled to use the winbind helper agent. You can therefore omit the steps that would build the Squid binary programs.}

\item{\index{nobody} \index{squid} \index{rpms} \index{/etc/passwd} \index{/etc/group} Squid, by default, runs as the user {\texttt{\docbookhyphenatedot{nobody}}}. You need to add a system user {\texttt{\docbookhyphenatedot{squid}}} and a system group {\texttt{\docbookhyphenatedot{squid}}} if they are not set up already (if the default Red Hat squid rpms were installed, they will be). Set up a {\texttt{\docbookhyphenatedot{squid}}} user in {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} and a {\texttt{\docbookhyphenatedot{squid}}} group in {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}group}}} if these aren't there already.}

\item{\index{permissions} \index{chown} You now need to change the permissions on Squid's {\texttt{\docbookhyphenatedot{var}}} directory. Enter the following command: 
\begin{Verbatim}[]

root#  chown -R squid /var/cache/squid

\end{Verbatim}
}

\item{\index{logging} \index{Squid} Squid must also have control over its logging. Enter the following commands: 
\begin{Verbatim}[]

root#  chown -R chown squid:squid /var/log/squid
root#  chmod 770 /var/log/squid

\end{Verbatim}
}

\item{Finally, Squid must be able to write to its disk cache! Enter the following commands: 
\begin{Verbatim}[]

root#  chown -R chown squid:squid /var/cache/squid
root#  chmod 770 /var/cache/squid

\end{Verbatim}
}

\item{\index{/etc/squid/squid.conf} The {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}squid/\dbz{}squid.\dbz{}conf}}} file must be edited to include the lines from \hyperlink{etcsquidcfg}{Example {\ref{etcsquidcfg}}} and \hyperlink{etcsquid2}{Example {\ref{etcsquid2}}}.}

\item{\index{cache directories} You must create Squid's cache directories before it may be run. Enter the following command: 
\begin{Verbatim}[]

root#  squid -z

\end{Verbatim}
}

\item{Finally, start Squid and enjoy transparent Active Directory authentication. Enter the following command: 
\begin{Verbatim}[]

root#  squid

\end{Verbatim}
}
\end{enumerate}

\begin{example}%
\hypertarget{etcsquidcfg}{}%
\captionswapskip{}{{\caption{Squid Configuration File Extract ---  /\dbz{}etc/\dbz{}squid.\dbz{}conf [ADMINISTRATIVE PARAMETERS Section]}\label{etcsquidcfg}}}
\captionswapskip{}
\begin{Verbatim}[]

	cache_effective_user squid
	cache_effective_group squid

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{etcsquid2}{}%
\captionswapskip{}{{\caption{Squid Configuration File extract ---  File: /\dbz{}etc/\dbz{}squid.\dbz{}conf [AUTHENTICATION PARAMETERS Section]}\label{etcsquid2}}}
\captionswapskip{}
\begin{Verbatim}[]

	auth_param ntlm program /usr/bin/ntlm_auth \
                                --helper-protocol=squid-2.5-ntlmssp
	auth_param ntlm children 5
	auth_param ntlm max_challenge_reuses 0
	auth_param ntlm max_challenge_lifetime 2 minutes
	auth_param basic program /usr/bin/ntlm_auth \
                                --helper-protocol=squid-2.5-basic
	auth_param basic children 5
	auth_param basic realm Squid proxy-caching web server
	auth_param basic credentialsttl 2 hours
	acl AuthorizedUsers proxy_auth REQUIRED
	http_access allow all AuthorizedUsers

\end{Verbatim}
\end{example}

\subsection{Key Points Learned}
\label{id2565710}\hypertarget{id2565710}{}%

\index{Web browsers} \index{services} \index{authentication protocols} \index{Web!proxy!access} \index{NTLMSSP} Microsoft Windows networking protocols permeate the spectrum of technologies that Microsoft Windows clients use, even when accessing traditional services such as Web browsers. Depending on whom you discuss this with, this is either good or bad. No matter how you might evaluate this, the use of NTLMSSP as the authentication protocol for Web proxy access has some advantages over the cookie-based authentication regime used by all competing browsers. It is Samba's implementation of NTLMSSP that makes it attractive to implement the solution that has been demonstrated in this chapter.

% ------------------------   
% Section 
\section{Questions and Answers}
\label{id2565766}\hypertarget{id2565766}{}%

\index{ntlm\_auth} \index{SambaXP conference} \index{Goettingen} \index{Italian} The development of the {\bfseries{ntlm\_auth}} module was first discussed in many Open Source circles in 2002. At the SambaXP conference in Goettingen, Germany, Mr. Francesco Chemolli demonstrated the use of {\bfseries{ntlm\_auth}} during one of the late developer meetings that took place. Since that time, the adoption of {\bfseries{ntlm\_auth}} has spread considerably.

The largest report from a site that uses Squid with {\bfseries{ntlm\_auth}}-based authentication support uses a dual processor server that has 2 GB of memory. It provides Web and FTP proxy services for 10,000 users. Approximately 2,000 of these users make heavy use of the proxy services. According to the source, who wishes to remain anonymous, the sustained transaction load on this server hovers around 140 hits/sec. The following comments were made with respect to questions regarding the performance of this installation:
\begin{quote}

[In our] EXTREMELY optimized environment . . . [the] performance impact is almost [nothing]. The {``}almost{''} part is due to the brain damage of the ntlm-over-http protocol definition. Suffice to say that its worst-case scenario triples the number of hits needed to perform the same transactions versus basic or digest auth[entication].
\end{quote}

You would be well-advised to recognize that all cache-intensive proxying solutions demand a lot of memory. Make certain that your Squid proxy server is equipped with sufficient memory to permit all proxy operations to run out of memory without invoking the overheads involved in the use of memory that has to be swapped to disk.
% -------------------------------------------------------------
% QandASet                                                     
% -------------------------------------------------------------
\subsection*{F.A.Q.}
\label{id2565860}
\vspace{1em}
\noindent{}1.~\textbf{Q:}~\textit{What does Samba have to do with Web proxy serving?}
\newline
\noindent\textbf{A:}~
\index{!transparent inter-operability} \index{Windows clients} \index{network!services} \index{authentication} \index{wrapper} To provide transparent interoperability between Windows clients and the network services that are used from them, Samba had to develop tools and facilities that deliver that feature. The benefit of Open Source software is that it can readily be reused. The current {\bfseries{ntlm\_auth}} module is basically a wrapper around authentication code from the core of the Samba project.

\index{plain-text} \index{authentication!plain-text} \index{Web!proxy} \index{FTP!proxy} \index{NTLMSSP} \index{logon credentials} \index{Windows explorer} \index{Internet Information Server} \index{Apache Web server} The {\bfseries{ntlm\_auth}} module supports basic plain-text authentication and NTLMSSP protocols. This module makes it possible for Web and FTP proxy requests to be authenticated without the user being interrupted via his or her Windows logon credentials. This facility is available with MS Windows Explorer and is one of the key benefits claimed for Microsoft Internet Information Server. There are a few open source initiatives to provide support for these protocols in the Apache Web server also.

\index{wrapper} The short answer is that by adding a wrapper around key authentication components of Samba, other projects (like Squid) can benefit from the labors expended in meeting user interoperability needs.


\vspace{1em}
\vspace{1em}
\noindent{}2.~\textbf{Q:}~\textit{What other services does Samba provide?}
\newline
\noindent\textbf{A:}~
\index{winbindd} \index{Identity resolver} \index{daemon} \index{smbd} \index{file and print server} Samba-3 is a file and print server. The core components that provide this functionality are {\bfseries{smbd}}, {\bfseries{nmbd}}, and the identity resolver daemon, {\bfseries{winbindd}}.

\index{SMB/CIFS} \index{smbclient} Samba-3 is an SMB/CIFS client. The core component that provides this is called {\bfseries{smbclient}}.

\index{modules} \index{utilities} \index{validation} \index{inter-operability} \index{authentication} Samba-3 includes a number of helper tools, plug-in modules, utilities, and test and validation facilities. Samba-3 includes glue modules that help provide interoperability between MS Windows clients and UNIX/Linux servers and clients. It includes Winbind agents that make it possible to authenticate UNIX/Linux access attempts as well as logins to an SMB/CIFS authentication server backend. Samba-3 includes name service switch (NSS) modules to permit identity resolution via SMB/CIFS servers (Windows NT4/200x, Samba, and a host of other commercial server products).


\vspace{1em}
\vspace{1em}
\noindent{}3.~\textbf{Q:}~\textit{Does use of Samba ({\bfseries{ntlm\_auth}}) improve the performance of Squid?}
\newline
\noindent\textbf{A:}~
Not really. Samba's {\bfseries{ntlm\_auth}} module handles only authentication. It requires that Squid make an external call to {\bfseries{ntlm\_auth}} and therefore actually incurs a little more overhead. Compared with the benefit obtained, that overhead is well worth enduring. Since Squid is a proxy server, and proxy servers tend to require lots of memory, it is good advice to provide sufficient memory when using Squid. Just add a little more to accommodate {\bfseries{ntlm\_auth}}.


\vspace{1em}
\cleardoublepage 
% -------------------------------------------------------------
% Chapter Performance, Reliability, and Availability 
% ------------------------------------------------------------- 	
\chapter{Performance, Reliability, and Availability}
\label{HA}\hypertarget{HA}{}%

\index{performance} \index{reliability} \index{availability} Well, you have reached one of the last chapters of this book. It is customary to attempt to wrap up the theme and contents of a book in what is generally regarded as the chapter that should draw conclusions. This book is a suspense thriller, and since the plot of the stories told mostly lead you to bigger, better Samba-3 networking solutions, it is perhaps appropriate to close this book with a few pertinent comments regarding some of the things everyone can do to deliver a reliable Samba-3 network.
\begin{quote}

In a world so full of noise, how can the sparrow be heard?

\hspace*\fill---Anonymous\end{quote}

% ------------------------   
% Section 
\section{Introduction}
\label{id2468383}\hypertarget{id2468383}{}%

\index{clustering} The sparrow is a small bird whose sounds are drowned out by the noise of the busy world it lives in. Likewise, the simple steps that can be taken to improve the reliability and availability of a Samba network are often drowned out by the volume of discussions about grandiose Samba clustering designs. This is not intended to suggest that clustering is not important, because clearly it is. This chapter does not devote itself to discussion of clustering because each clustering methodology uses its own custom tools and methods. Only passing comments are offered concerning these methods.

\index{cluster} \index{samba cluster} \index{scalability} A search\label{id2493629}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.google.com/search?hl=en\string&lr=\string&ie=ISO-8859-1\string&q=samba+cluster\string&btnG=Google+Search}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2493629} for {``}samba cluster{''} produced 71,600 hits. And a search for {``}highly available samba{''} and {``}highly available windows{''} produced an amazing number of references. It is clear from the resources on the Internet that Windows file and print services availability, reliability, and scalability are of vital interest to corporate network users.

\index{performance} So without further background, you can review a checklist of simple steps that can be taken to ensure acceptable network performance while keeping costs of ownership well under control.

% ------------------------   
% Section 
\section{Dissection and Discussion}
\label{id2503942}\hypertarget{id2503942}{}%

\index{simple} \index{complexities} If it is your purpose to get the best mileage out of your Samba servers, there is one rule that must be obeyed. If you want the best, keep your implementation as simple as possible. You may well be forced to introduce some complexities, but you should do so only as a last resort.

Simple solutions are likely to be easier to get right than are complex ones. They certainly make life easier for your successor. Simple implementations can be more readily audited than can complex ones.

\index{broken behavior} \index{poor performance} Problems reported by users fall into three categories: configurations that do not work, those that have broken behavior, and poor performance. The term {\em{broken behavior}} means that the function of a particular Samba component appears to work sometimes, but not at others. The resulting intermittent operation is clearly unacceptable. An example of {\em{broken behavior}} known to many Windows networking users occurs when the list of Windows machines in MS Explorer changes, sometimes listing machines that are running and at other times not listing them even though the machines are in use on the network.

\index{smbfs} \index{smbmnt} \index{smbmount} \index{smbumnt} \index{smbumount} \index{front-end} A significant number of reports concern problems with the {\bfseries{smbfs}} file system driver that is part of the Linux kernel, not part of Samba. Users continue to interpret that {\bfseries{smbfs}} is part of Samba, simply because Samba includes the front-end tools that are used to manage {\bfseries{smbfs}}-based file service connections. So, just for the record, the tools {\bfseries{smbmnt}}, {\bfseries{smbmount}}, {\bfseries{smbumount}}, and {\bfseries{smbumnt}} are front-end facilities to core drivers that are supplied as part of the Linux kernel. These tools share a common infrastructure with some Samba components, but they are not maintained as part of Samba and are really foreign to it.

\index{cifsfs} The new project, {\bfseries{cifsfs}}, is destined to replace {\bfseries{smbfs}}. It, too, is not part of Samba, even though one of the Samba Team members is a prime mover in this project.

Table 13.1 lists typical causes of:

\begin{itemize}
%--- Item
\item 
Not Working (NW)


%--- Item
\item 
Broken Behavior (BB)


%--- Item
\item 
Poor Performance (PP)

\end{itemize}

% table ------------------------------------------------------
\begin{table}[htb]
\begin{center}%
\hypertarget{ProbList}{}%
\captionswapskip{}{{\caption{Effect of Common Problems}\label{ProbList}}}
\captionswapskip{}\begin{tabular}{|l|c|c|c|}
\hline 
{{{\bfseries Problem}}} & {{{\bfseries NW}}} & {{{\bfseries BB}}} & {{{\bfseries PP}}} \tabularnewline
 \hline 
{{File locking}} & {{-}} & {{X}} & {{-}} \tabularnewline
 \hline 
{{Hardware problems}} & {{X}} & {{X}} & {{X}} \tabularnewline
 \hline 
{{Incorrect authentication}} & {{X}} & {{X}} & {{-}} \tabularnewline
 \hline 
{{Incorrect configuration}} & {{X}} & {{X}} & {{X}} \tabularnewline
 \hline 
{{LDAP problems}} & {{X}} & {{X}} & {{-}} \tabularnewline
 \hline 
{{Name resolution}} & {{X}} & {{X}} & {{X}} \tabularnewline
 \hline 
{{Printing problems}} & {{X}} & {{X}} & {{-}} \tabularnewline
 \hline 
{{Slow file transfer}} & {{-}} & {{-}} & {{X}} \tabularnewline
 \hline 
{{Winbind problems}} & {{X}} & {{X}} & {{-}} \tabularnewline
\hline 
\end{tabular}
\end{center}
\end{table}


\index{network hygiene} It is obvious to all that the first requirement (as a matter of network hygiene) is to eliminate problems that affect basic network operation. This book has provided sufficient working examples to help you to avoid all these problems.

% ------------------------   
% Section 
\section{Guidelines for Reliable Samba Operation}
\label{id2560317}\hypertarget{id2560317}{}%

\index{resilient} \index{extreme demand} Your objective is to provide a network that works correctly, can grow at all times, is resilient at times of extreme demand, and can scale to meet future needs. The following subject areas provide pointers that can help you today.
\subsection{Name Resolution}
\label{id2560344}\hypertarget{id2560344}{}%

There are three basic current problem areas: bad hostnames, routed networks, and network collisions. These are covered in the following discussion.
\subsubsection{Bad Hostnames}
\label{id2560356}\hypertarget{id2560356}{}%

\index{DHCP!client} \index{netbios name} \index{localhost} \index{/etc/hosts} \index{NetBIOS} When configured as a DHCP client, a number of Linux distributions set the system hostname to {\texttt{\docbookhyphenatedot{localhost}}}. If the parameter {\ttfamily\itshape{\docbookhyphenatedot{netbios name}}} is not specified to something other than {\texttt{\docbookhyphenatedot{localhost}}}, the Samba server appears in the Windows Explorer as {\texttt{\docbookhyphenatedot{LOCALHOST}}}. Moreover, the entry in the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}hosts}}} on the Linux server points to IP address {\texttt{\docbookhyphenatedot{127.0.0.1}}}. This means that when the Windows client obtains the IP address of the Samba server called {\texttt{\docbookhyphenatedot{LOCALHOST}}}, it obtains the IP address {\texttt{\docbookhyphenatedot{127.0.0.1}}} and then proceeds to attempt to set up a NetBIOS over TCP/IP connection to it. This cannot work, because that IP address is the local Windows machine itself. Hostnames must be valid for Windows networking to function correctly.

\index{digits} A few sites have tried to name Windows clients and Samba servers with a name that begins with the digits 1-9. This does not work either because it may result in the client or server attempting to use that name as an IP address.

\index{DNS!name lookup} \index{resolve} A Samba server called {\texttt{\docbookhyphenatedot{FRED}}} in a NetBIOS domain called {\texttt{\docbookhyphenatedot{COLLISION}}} in a network environment that is part of the fully-qualified Internet domain namespace known as {\texttt{\docbookhyphenatedot{parrots.com}}}, results in DNS name lookups for {\texttt{\docbookhyphenatedot{fred.parrots.com}}} and {\texttt{\docbookhyphenatedot{collision.parrots.com}}}. It is therefore a mistake to name the domain (workgroup) {\texttt{\docbookhyphenatedot{collision.parrots.com}}}, since this results in DNS lookup attempts to resolve {\texttt{\docbookhyphenatedot{fred.parrots.com.parrots.com}}}, which most likely fails given that you probably do not have this in your DNS namespace.

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

\index{Active Directory!realm} \index{ADS} \index{DNS} An Active Directory realm called {\texttt{\docbookhyphenatedot{collision.parrots.com}}} is perfectly okay, although it too must be capable of being resolved via DNS, something that functions correctly if Windows 200x ADS has been properly installed and configured.
\end{admonition}

\subsubsection{Routed Networks}
\label{id2555863}\hypertarget{id2555863}{}%

\index{NetBIOS} \index{UDP!broadcast} \index{broadcast} NetBIOS networks (Windows networking with NetBIOS over TCP/IP enabled) makes extensive use of UDP-based broadcast traffic, as you saw during the exercises in \hyperlink{primer}{Chapter {\ref{primer}}, {``}Networking Primer{''}}.

\index{routers} \index{forwarded} \index{multi-subnet} UDP broadcast traffic is not forwarded by routers. This means that NetBIOS broadcast-based networking cannot function across routed networks (i.e., multi-subnet networks) unless special provisions are made:

\begin{itemize}
%--- Item
\item 
\index{LMHOSTS} \index{remote announce} \index{remote browse sync} Either install on every Windows client an LMHOSTS file (located in the directory {\texttt{\docbookhyphenatefilename{C:\docbooktolatexgobble\string\\windows\docbooktolatexgobble\string\\system32\docbooktolatexgobble\string\\drivers\docbooktolatexgobble\string\\etc}}}). It is also necessary to add to the Samba server {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file the parameters {\ttfamily\itshape{\docbookhyphenatedot{remote announce}}} and {\ttfamily\itshape{\docbookhyphenatedot{remote browse sync}}}. For more information, refer to the online manual page for the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file.


%--- Item
\item 
\index{WINS!server} Or configure Samba as a WINS server, and configure all network clients to use that WINS server in their TCP/IP configuration.

\end{itemize}

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

\index{WINS!name resolution} \index{DNS} The use of DNS is not an acceptable substitute for WINS. DNS does not store specific information regarding NetBIOS networking particulars that get stored in the WINS name resolution database and that Windows clients require and depend on.
\end{admonition}

\subsubsection{Network Collisions}
\label{id2550995}\hypertarget{id2550995}{}%

\index{network!collisions} \index{network!timeouts} \index{collision rates} \index{network!load} Excessive network activity causes NetBIOS network timeouts. Timeouts may result in blue screen of death (BSOD) experiences. High collision rates may be caused by excessive UDP broadcast activity, by defective networking hardware, or through excessive network loads (another way of saying that the network is poorly designed).

The use of WINS is highly recommended to reduce network broadcast traffic, as outlined in \hyperlink{primer}{Chapter {\ref{primer}}, {``}Networking Primer{''}}.

\index{netbios forwarding} \index{broadcast storms} \index{performance} Under no circumstances should the facility be supported by many routers, known as {\texttt{\docbookhyphenatedot{NetBIOS forwarding}}}, unless you know exactly what you are doing. Inappropriate use of this facility can result in UDP broadcast storms. In one case in 1999, a university network became unusable due to NetBIOS forwarding being enabled on all routers. The problem was discovered during performance testing of a Samba server. The maximum throughput on a 100-Base-T (100 MB/sec) network was less than 15 KB/sec. After the NetBIOS forwarding was turned off, file transfer performance immediately returned to 11 MB/sec.
\subsection{Samba Configuration}
\label{id2551096}\hypertarget{id2551096}{}%

As a general rule, the contents of the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file should be kept as simple as possible. No parameter should be specified unless you know it is essential to operation.

\index{document the settings} \index{documented} \index{optimized} Many UNIX administrators like to fully document the settings in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file. This is a bad idea because it adds content to the file. The {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file is re-read by every {\bfseries{smbd}} process every time the file timestamp changes (or, on systems where this does not work, every 20 seconds or so).

As the size of the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file grows, the risk of introducing parsing errors also increases. It is recommended to keep a fully documented {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file on hand, and then to operate Samba only with an optimized file.

\index{testparm} The preferred way to maintain a documented file is to call it something like {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf.\dbz{}master}}}. You can generate the optimized file by executing: 
\begin{Verbatim}[]

root#  testparm -s smb.conf.master > smb.conf

\end{Verbatim}
 You should carefully observe all warnings issued. It is also a good practice to execute the following command to confirm correct interpretation of the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file contents: 
\begin{Verbatim}[]

root#  testparm
Load smb config files from /etc/samba/smb.conf
Can't find include file /etc/samba/machine.
Processing section "[homes]"
Processing section "[print$]"
Processing section "[netlogon]"
Processing section "[Profiles]"
Processing section "[printers]"
Processing section "[media]"
Processing section "[data]"
Processing section "[cdr]"
Processing section "[apps]"
Loaded services file OK.
'winbind separator = +' might cause problems with group membership.
Server role: ROLE_DOMAIN_PDC
Press enter to see a dump of your service definitions

\end{Verbatim}
 \index{fatal problem} You now, of course, press the enter key to complete the command, or else abort it by pressing Ctrl-C. The important thing to note is the noted Server role, as well as warning messages. Noted configuration conflicts must be remedied before proceeding. For example, the following error message represents a common fatal problem: 
\begin{Verbatim}[]

ERROR: both 'wins support = true' and 'wins server = <server list>' 
cannot be set in the smb.conf file. nmbd will abort with this setting.

\end{Verbatim}


\index{performance degradation} \index{socket options} \index{socket address} There are two parameters that can cause severe network performance degradation: {\ttfamily\itshape{\docbookhyphenatedot{socket options}}} and {\ttfamily\itshape{\docbookhyphenatedot{socket address}}}. The {\ttfamily\itshape{\docbookhyphenatedot{socket options}}} parameter was often necessary when Samba was used with the Linux 2.2.x kernels. Later kernels are largely self-tuning and seldom benefit from this parameter being set. Do not use either parameter unless it has been proven necessary to use them.

\index{strict sync} \index{sync always} \index{severely degrade} \index{network!performance} Another {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} parameter that may cause severe network performance degradation is the {\ttfamily\itshape{\docbookhyphenatedot{strict sync}}} parameter. Do not use this at all. There is no good reason to use this with any modern Windows client. The {\ttfamily\itshape{\docbookhyphenatedot{strict sync}}} is often used with the {\ttfamily\itshape{\docbookhyphenatedot{sync always}}} parameter. This, too, can severely degrade network performance, so do not set it; if you must, do so with caution.

\index{opportunistic locking} \index{file caching} \index{caching} \index{oplocks} Finally, many network administrators deliberately disable opportunistic locking support. While this does not degrade Samba performance, it significantly degrades Windows client performance because this disables local file caching on Windows clients and forces every file read and written to invoke a network read or write call. If for any reason you must disable oplocks (opportunistic locking) support, do so only on the share on which it is required. That way, all other shares can provide oplock support for operations that are tolerant of it. See \hyperlink{ch12dblck}{Section {\ref{ch12dblck}}} for more information.
\subsection{Use and Location of BDCs}
\label{id2558509}\hypertarget{id2558509}{}%

\index{BDC} \index{PDC} \index{routed network} \index{wide-area network} \index{network segment} On a network segment where there is a PDC and a BDC, the BDC carries the bulk of the network logon processing. If the BDC is a heavily loaded server, the PDC carries a greater proportion of authentication and logon processing. When a sole BDC on a routed network segment gets heavily loaded, it is possible that network logon requests and authentication requests may be directed to a BDC on a distant network segment. This significantly hinders WAN operations and is undesirable.

\index{Domain Member} \index{Domain Controller} As a general guide, instead of adding domain member servers to a network, you would be better advised to add BDCs until there are fewer than 30 Windows clients per BDC. Beyond that ratio, you should add domain member servers. This practice ensures that there are always sufficient domain controllers to handle logon requests and authentication traffic.
\subsection{Use One Consistent Version of MS Windows Client}
\label{id2558587}\hypertarget{id2558587}{}%

Every network client has its own peculiarities. From a management perspective, it is easier to deal with one version of MS Windows that is maintained to a consistent update level than it is to deal with a mixture of clients.

On a number of occasions, particular Microsoft service pack updates of a Windows server or client have necessitated special handling from the Samba server end. If you want to remain sane, keep you client workstation configurations consistent.
\subsection{For Scalability, Use SAN-Based Storage on Samba Servers}
\label{id2558611}\hypertarget{id2558611}{}%

\index{SAN} \index{synchronization} Many SAN-based storage systems permit more than one server to share a common data store. Use of a shared SAN data store means that you do not need to use time- and resource-hungry data synchronization techniques.

\index{load distribution} \index{clustering} The use of a collection of relatively low-cost front-end Samba servers that are coupled to a shared backend SAN data store permits load distribution while containing costs below that of installing and managing a complex clustering facility.
\subsection{Distribute Network Load with MSDFS}
\label{id2558662}\hypertarget{id2558662}{}%

\index{MSDFS} \index{distributed} Microsoft DFS (distributed file system) technology has been implemented in Samba. MSDFS permits data to be accessed from a single share and yet to actually be distributed across multiple actual servers. Refer to {\em{TOSHARG2}}, Chapter 19, for information regarding implementation of an MSDFS installation.

\index{front-end!server} \index{MSDFS} The combination of multiple backend servers together with a front-end server and use of MSDFS can achieve almost the same as you would obtain with a clustered Samba server.
\subsection{Replicate Data to Conserve Peak-Demand Wide-Area Bandwidth}
\label{id2558719}\hypertarget{id2558719}{}%

\index{replicate} \index{rsync} \index{wide-area network} Consider using {\bfseries{rsync}} to replicate data across the WAN during times of low utilization. Users can then access the replicated data store rather than needing to do so across the WAN. This works best for read-only data, but with careful planning can be implemented so that modified files get replicated back to the point of origin. Be careful with your implementation if you choose to permit modification and return replication of the modified file; otherwise, you may inadvertently overwrite important data.
\subsection{Hardware Problems}
\label{id2558766}\hypertarget{id2558766}{}%

\index{hardware prices} \index{hardware problems} \index{NICs} \index{defective!HUBs} \index{defective!switches} \index{defective!cables} Networking hardware prices have fallen sharply over the past 5 years. A surprising number of Samba networking problems over this time have been traced to defective network interface cards (NICs) or defective HUBs, switches, and cables.

\index{corrective action} Not surprising is the fact that network administrators do not like to be shown to have made a bad decision. Money saved in buying low-cost hardware may result in high costs incurred in corrective action.

\index{intermittent} \index{data corruption} \index{slow network} \index{low performance} \index{data integrity} Defective NICs, HUBs, and switches may appear as intermittent network access problems, intermittent or persistent data corruption, slow network throughput, low performance, or even as BSOD problems with MS Windows clients. In one case, a company updated several workstations with newer, faster Windows client machines that triggered problems during logon as well as data integrity problems on an older PC that was unaffected so long as the new machines were kept shut down.

Defective hardware problems may take patience and persistence before the real cause can be discovered.

\index{RAID controllers} Networking hardware defects can significantly impact perceived Samba performance, but defective RAID controllers as well as SCSI and IDE hard disk controllers have also been known to impair Samba server operations. One business came to this realization only after replacing a Samba installation with MS Windows Server 2000 running on the same hardware. The root of the problem completely eluded the network administrator until the entire server was replaced. While you may well think that this would never happen to you, experience shows that given the right (unfortunate) circumstances, this can happen to anyone.
\subsection{Large Directories}
\label{id2558920}\hypertarget{id2558920}{}%

There exist applications that create or manage directories containing many thousands of files. Such applications typically generate many small files (less than 100 KB). At the best of times, under UNIX, listing of the files in a directory that contains many files is slow. By default, Windows NT, 200x, and XP Pro cause network file system directory lookups on a Samba server to be performed for both the case preserving file name as well as for the mangled (8.3) file name. This incurs a huge overhead on the Samba server that may slow down the system dramatically.

In an extreme case, the performance impact was dramatic. File transfer from the Samba server to a Windows XP Professional workstation over 1 Gigabit Ethernet for 250-500 KB files was measured at approximately 30 MB/sec. But when tranferring a directory containing 120,000 files, all from 50KB to 60KB in size, the transfer rate to the same workstation was measured at approximately 1.5 KB/sec. The net transfer was on the order of a factor of 20-fold slower.

The symptoms that will be observed on the Samba server when a large directory is accessed will be that aggregate I/O (typically blocks read) will be relatively low, yet the wait I/O times will be incredibly long while at the same time the read queue is large. Close observation will show that the hard drive that the file system is on will be thrashing wildly.

Samba-3.0.12 and later, includes new code that radically improves Samba perfomance. The secret to this is really in the \smbconfoption{case sensitive} = True line. This tells smbd never to scan for case-insensitive versions of names. So if an application asks for a file called {\texttt{\docbookhyphenatefilename{FOO}}}, and it can not be found by a simple stat call, then smbd will return "file not found" immediately without scanning the containing directory for a version of a different case.

Canonicalize all the files in the directory to have one case, upper or lower - either will do. Then set up a new custom share for the application as follows: 
\begin{Verbatim}[]

	[bigshare]
			path = /data/xrayfiles/neurosurgeons/
			read only = no
			case sensitive = True
			default case = upper
			preserve case = no
			short preserve case = no
	
\end{Verbatim}


All files and directories under the {\ttfamily\itshape{\docbookhyphenatedot{path}}} directory must be in the same case as specified in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} stanza. This means that smbd will not be able to find lower case filenames with these settings. Note, this is done on a per-share basis.

% ------------------------   
% Section 
\section{Key Points Learned}
\label{id2559019}\hypertarget{id2559019}{}%

This chapter has touched in broad sweeps on a number of simple steps that can be taken to ensure that your Samba network is resilient, scalable, and reliable, and that it performs well.

Always keep in mind that someone is responsible to maintain and manage your design. In the long term, that may not be you. Spare a thought for your successor and give him or her an even break.

\index{assumptions} Last, but not least, you should not only keep the network design simple, but also be sure it is well documented. This book may serve as your pattern for documenting every aspect of your design, its implementation, and particularly the objects and assumptions that underlie it.
\cleardoublepage 
% -------------------------------------------------------------
% Chapter Samba Support 
% ------------------------------------------------------------- 	
\chapter{Samba Support}
\label{id2518283}\hypertarget{id2518283}{}%

\index{support} One of the most difficult to answer questions in the information technology industry is, {``}What is support?{''}. That question irritates some folks, as much as common answers may annoy others.

\index{customers} The most aggravating situation pertaining to support is typified when, as a Linux user, a call is made to an Internet service provider who, instead of listening to the problem to find a solution, blandly replies: {``}Oh, Linux? We do not support Linux!{''}. It has happened to me, and similar situations happen through-out the IT industry. Answers like that are designed to inform us that there are some customers that a business just does not want to deal with, and well may we feel the anguish of the rejection that is dished out.

One way to consider support is to view it as consisting of the right answer, in the right place, at the right time, no matter the situation. Support is all that it takes to take away pain, disruption, inconvenience, loss of productivity, disorientation, uncertainty, and real or perceived risk.

\index{provided services} \index{services provided} \index{customer expected} One of the forces that has become a driving force for the adoption of open source software is the fact that many IT businesses have provided services that have perhaps failed to deliver what the customer expected, or that have been found wanting for other reasons.

\index{consumer expects} \index{problem resolution} In recognition of the need for needs satisfaction as the primary experience an information technology user or consumer expects, the information provided in this chapter may help someone to avoid an unpleasant experience in respect of problem resolution.

\index{free support} \index{paid-for support} \index{commercial support} In the open source software arena there are two support options: free support and paid-for (commercial) support.

% ------------------------   
% Section 
\section{Free Support}
\label{id2519431}\hypertarget{id2519431}{}%

\index{user groups} \index{mailing lists} \index{interactive help} \index{help} \index{mutual assistance} \index{assistance} Free support may be obtained from friends, colleagues, user groups, mailing lists, and interactive help facilities. An example of an interactive dacility is the Internet relay chat (IRC) channels that host user supported mutual assistance.

\index{mailing list} \index{deployment} \index{subscription} \index{IRC} \index{project} The Samba project maintains a mailing list that is commonly used to discuss solutions to Samba deployments. Information regarding subscription to the Samba mailing list can be found on the Samba web\label{id2485238}\begingroup\catcode`\#=12\footnote{ {\textless}\url{https://lists.samba.org/mailman/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2485238} site. The public mailing list that can be used to obtain free, user contributed, support is called the {\texttt{\docbookhyphenatedot{samba}}} list. The email address for this list is at {\texttt{\docbookhyphenatedot{mail:samba@samba.\dbz{}org}}}. Information regarding the Samba IRC channels may be found on the Samba IRC\label{id2485259}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.samba.org/samba.irc.html}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2485259} web page.

\index{free support} \index{qualified problem} \index{requesting payment} \index{professional support} As a general rule, it is considered poor net behavior to contact a Samba Team member directly for free support. Most active members of the Samba Team work exceptionally long hours to assist users who have demonstrated a qualified problem. Some team members may respond to direct email or telephone contact, with requests for assistance, by requesting payment. A few of the Samba Team members actually provide professional paid-for Samba support and it is therefore wise to show appropriate discretion and reservation in all direct contact.

\index{bug report} \index{problem report} \index{code maintainer} When you stumble across a Samba bug, often the quickest way to get it resolved is by posting a bug report\label{id2489522}\begingroup\catcode`\#=12\footnote{ {\textless}\url{https://bugzilla.samba.org/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2489522}. All such reports are mailed to the responsible code maintainer for action. The better the report, and the more serious it is, the sooner it will be dealt with. On the other hand, if the responsible person can not duplicate the reported bug it is likely to be rejected. It is up to you to provide sufficient information that will permit the problem to be reproduced.

\index{purchase support} We all recognize that sometimes free support does not provide the answer that is sought within the time-frame required. At other times the problem is elusive and you may lack the experience necessary to isolate the problem and thus to resolve it. This is a situation where is may be prudent to purchase paid-for support.

% ------------------------   
% Section 
\section{Commercial Support}
\label{id2457469}\hypertarget{id2457469}{}%

There are six basic support oriented services that are most commonly sought by Samba sites:

\begin{itemize}
%--- Item
\item 
Assistance with network design


%--- Item
\item 
Staff Training


%--- Item
\item 
Assistance with Samba network deployment and installation


%--- Item
\item 
Priority telephone or email Samba configuration assistance


%--- Item
\item 
Trouble-shooting and diagnostic assistance


%--- Item
\item 
Provision of quality assured ready-to-install Samba binary packages

\end{itemize}

\index{commercial support} \index{country of origin} Information regarding companies that provide professional Samba support can be obtained by performing a Google search, as well as by reference to the Samba Support\label{id2468466}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.samba.org/samba/support.html}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2468466} web page. Companies who notify the Samba Team that they provide commercial support are given a free listing that is sorted by the country of origin. Multiple listings are permitted, however no guarantee is offered. It is left to you to qualify a support provider and to satisfy yourself that both the company and its staff are able to deliver what is required of them.

\index{commercial support} The policy within the Samba Team is to treat all commercial support providers equally and to show no preference. As a result, Samba Team members who provide commercial support are lumped in with everyone else. You are encouraged to obtain the services needed from a company in your local area. The open source movement is pro-community; so do what you can to help a local business to prosper.

\index{unsupported software} Open source software support can be found in any quality, at any price and in any place you can to obtain it. Over 180 companies around the world provide Samba support, there is no excuse for suffering in the mistaken belief that Samba is unsupported software ---  it is supported.
\cleardoublepage 
% -------------------------------------------------------------
% Chapter A Collection of Useful Tidbits 
% ------------------------------------------------------------- 	
\chapter{A Collection of Useful Tidbits}
\label{appendix}\hypertarget{appendix}{}%

\index{material} \index{domain!joining} Information presented here is considered to be either basic or well-known material that is informative yet helpful. Over the years, I have observed an interesting behavior. There is an expectation that the process for joining a Windows client to a Samba-controlled Windows domain may somehow involve steps different from doing so with Windows NT4 or a Windows ADS domain. Be assured that the steps are identical, as shown in the example given below.

% ------------------------   
% Section 
\section{Joining a Domain: Windows 200x/XP Professional}
\label{domjoin}\hypertarget{domjoin}{}%

\index{joining a domain} Microsoft Windows NT/200x/XP Professional platforms can participate in Domain Security. This section steps through the process for making a Windows 200x/XP Professional machine a member of a Domain Security environment. It should be noted that this process is identical when joining a domain that is controlled by Windows NT4/200x as well as a Samba PDC.
Steps to Join a Domain\begin{enumerate}

\item{Click {\sffamily \bfseries Start}.}

\item{Right-click {\sffamily \bfseries My Computer}, and then select {\sffamily \bfseries Properties}.}

\item{The opening panel is the same one that can be reached by clicking {\sffamily \bfseries System} on the Control Panel. See \hyperlink{swxpp001}{Figure {\ref{swxpp001}}}. 
% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{swxpp001}{}%
\includegraphics[scale=.50]{Samba3-ByExample/images/wxpp001}
{{\caption[{The General Panel.}]{{{The General Panel.}}}\label{swxpp001}}}
\end{center}
\end{figure}

}

\item{Click the {\sffamily \bfseries Computer Name} tab. This panel shows the {\sffamily \bfseries Computer Description}, the {\sffamily \bfseries Full computer name}, and the {\sffamily \bfseries Workgroup} or {\sffamily \bfseries Domain name}.  Clicking the {\sffamily \bfseries Network ID} button launches the configuration wizard. Do not use this with Samba-3. If you wish to change the computer name, or join or leave the domain, click the {\sffamily \bfseries Change} button. See \hyperlink{swxpp004}{Figure {\ref{swxpp004}}}. 
% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{swxpp004}{}%
\includegraphics[scale=.50]{Samba3-ByExample/images/wxpp004}
{{\caption[{The Computer Name Panel.}]{{{The Computer Name Panel.}}}\label{swxpp004}}}
\end{center}
\end{figure}

}

\item{Click on {\sffamily \bfseries Change}. This panel shows that our example machine (TEMPTATION) is in a workgroup called WORKGROUP. We join the domain called MIDEARTH. See \hyperlink{swxpp006}{Figure {\ref{swxpp006}}}. 
% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{swxpp006}{}%
\includegraphics[scale=.50]{Samba3-ByExample/images/wxpp006}
{{\caption[{The Computer Name Changes Panel}]{{{The Computer Name Changes Panel}}}\label{swxpp006}}}
\end{center}
\end{figure}

}

\item{Enter the name {\sffamily \bfseries MIDEARTH} in the field below the Domain radio button.  This panel shows that our example machine (TEMPTATION) is set to join the domain called MIDEARTH. See \hyperlink{swxpp007}{Figure {\ref{swxpp007}}}. 
% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{swxpp007}{}%
\includegraphics[scale=.50]{Samba3-ByExample/images/wxpp007}
{{\caption[{The Computer Name Changes Panel ---  Domain MIDEARTH}]{{{The Computer Name Changes Panel ---  Domain MIDEARTH}}}\label{swxpp007}}}
\end{center}
\end{figure}

}

\item{Now click the {\sffamily \bfseries OK} button. A dialog box should appear to allow you to provide the credentials (username and password) of a domain administrative account that has the rights to add machines to the domain.  Enter the name {``}root{''} and the root password from your Samba-3 server. See \hyperlink{swxpp008}{Figure {\ref{swxpp008}}}. 
% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{swxpp008}{}%
\includegraphics[scale=.50]{Samba3-ByExample/images/wxpp008}
{{\caption[{Computer Name Changes ---  User name and Password Panel}]{{{Computer Name Changes ---  User name and Password Panel}}}\label{swxpp008}}}
\end{center}
\end{figure}

}

\item{Click {\sffamily \bfseries OK}.  The {``}Welcome to the MIDEARTH domain{''} dialog box should appear. At this point, the machine must be rebooted. Joining the domain is now complete.}
\end{enumerate}

\index{Active Directory} \index{DNS} The screen capture shown in \hyperlink{swxpp007}{Figure {\ref{swxpp007}}} has a button labeled {\sffamily \bfseries More...}. This button opens a panel in which you can set (or change) the Primary DNS suffix of the computer. This is a parameter that mainly affects members of Microsoft Active Directory. Active Directory is heavily oriented around the DNS namespace.

\index{Netlogon} \index{DNS!dynamic} Where NetBIOS technology uses WINS as well as UDP broadcast as key mechanisms for name resolution, Active Directory servers register their services with the Microsoft Dynamic DNS server. Windows clients must be able to query the correct DNS server to find the services (like which machines are domain controllers or which machines have the Netlogon service running).

\index{DNS!suffix} The default setting of the Primary DNS suffix is the Active Directory domain name. When you change the Primary DNS suffix, this does not affect domain membership, but it can break network browsing and the ability to resolve your computer name to a valid IP address.

The Primary DNS suffix parameter principally affects MS Windows clients that are members of an Active Directory domain. Where the client is a member of a Samba domain, it is preferable to leave this field blank.

\index{Group Policy} According to Microsoft documentation, {``}If this computer belongs to a group with {\texttt{\docbookhyphenatedot{Group Policy}}} enabled on {\bfseries{Primary DNS suffice of this computer}}, the string specified in the Group Policy is used as the primary DNS suffix and you might need to restart your computer to view the correct setting. The local setting is used only if Group Policy is disabled or unspecified.{''}

% ------------------------   
% Section 
\section{Samba System File Location}
\label{id2568316}\hypertarget{id2568316}{}%

\index{default installation}\index{/usr/local/samba}\index{/usr/local} One of the frustrations expressed by subscribers to the Samba mailing lists revolves around the choice of where the default Samba Team build and installation process locates its Samba files. The location, chosen in the early 1990s, for the default installation is in the {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}local/\dbz{}samba}}} directory. This is a perfectly reasonable location, particularly given all the other Open Source software that installs into the {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}local}}} subdirectories.

Several UNIX vendors, and Linux vendors in particular, elected to locate the Samba files in a location other than the Samba Team default.

\index{Free Standards Group|textit{see} {FSG} }\index{FSG}\index{Linux Standards Base|textit{see} {LSB} }\index{LSB}\index{File Hierarchy System|textit{see} {FHS} }\index{FHS}\index{file locations}\index{/etc/samba}\index{/usr/sbin}\index{/usr/bin}\index{/usr/share}\index{/usr/share/swat}\index{/usr/lib/samba}\index{/usr/share/samba/swat}\index{SWAT}\index{VFS modules} Linux vendors, working in conjunction with the Free Standards Group (FSG), Linux Standards Base (LSB), and File Hierarchy System (FHS), have elected to locate the configuration files under the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}samba}}} directory, common binary files (those used by users) in the {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}bin}}} directory, and the administrative files (daemons) in the {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}sbin}}} directory. Support files for the Samba Web Admin Tool (SWAT) are located under the {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}share}}} directory, either in {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}share/\dbz{}samba/\dbz{}swat}}} or in {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}share/\dbz{}swat}}}. There are additional support files for {\bfseries{smbd}} in the {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}lib/\dbz{}samba}}} directory tree. The files located there include the dynamically loadable modules for the passdb backend as well as for the VFS modules.

\index{/var/lib/samba}\index{/var/log/samba}\index{run-time control files} Samba creates runtime control files and generates log files. The runtime control files (tdb and dat files) are stored in the {\texttt{\docbookhyphenatefilename{/\dbz{}var/\dbz{}lib/\dbz{}samba}}} directory. Log files are created in {\texttt{\docbookhyphenatefilename{/\dbz{}var/\dbz{}log/\dbz{}samba.\dbz{}}}}

When Samba is built and installed using the default Samba Team process, all files are located under the {\texttt{\docbookhyphenatefilename{/\dbz{}usr/\dbz{}local/\dbz{}samba}}} directory tree. This makes it simple to find the files that Samba owns.

\index{smbd!location of files} One way to find the Samba files that are installed on your UNIX/Linux system is to search for the location of all files called {\bfseries{smbd}}. Here is an example: 
\begin{Verbatim}[]

root#  find / -name smbd -print

\end{Verbatim}
 You can find the location of the configuration files by running: 
\begin{Verbatim}[]

root#  /path-to-binary-file/smbd -b | more
...
Paths:
   SBINDIR: /usr/sbin
   BINDIR: /usr/bin
   SWATDIR: /usr/share/samba/swat
   CONFIGFILE: /etc/samba/smb.conf
   LOGFILEBASE: /var/log/samba
   LMHOSTSFILE: /etc/samba/lmhosts
   LIBDIR: /usr/lib/samba
   SHLIBEXT: so
   LOCKDIR: /var/lib/samba
   PIDDIR: /var/run/samba
   SMB_PASSWD_FILE: /etc/samba/smbpasswd
   PRIVATE_DIR: /etc/samba
...

\end{Verbatim}
 If you wish to locate the Samba version, just run: 
\begin{Verbatim}[]

root#  /path-to-binary-file/smbd -V
Version 3.0.20-SUSE

\end{Verbatim}


Many people have been caught by installation of Samba using the default Samba Team process when it was already installed by the platform vendor's method. If your platform uses RPM format packages, you can check to see if Samba is installed by executing:\index{rpm} 
\begin{Verbatim}[]

root#  rpm -qa | grep samba
samba3-pdb-3.0.20-1
samba3-vscan-0.3.6-0
samba3-winbind-3.0.20-1
samba3-3.0.20-1
samba3-python-3.0.20-1
samba3-utils-3.0.20-1
samba3-doc-3.0.20-1
samba3-client-3.0.20-1
samba3-cifsmount-3.0.20-1
	
\end{Verbatim}
\index{package names} The package names, of course, vary according to how the vendor, or the binary package builder, prepared them.

% ------------------------   
% Section 
\section{Starting Samba}
\label{id2556196}\hypertarget{id2556196}{}%

\index{daemon} Samba essentially consists of two or three daemons. A daemon is a UNIX application that runs in the background and provides services. An example of a service is the Apache Web server for which the daemon is called {\bfseries{httpd}}. In the case of Samba, there are three daemons, two of which are needed as a minimum.

The Samba server is made up of the following daemons:

\begin{example}%
\hypertarget{ch12SL}{}%
\captionswapskip{}{{\caption{A Useful Samba Control Script for SUSE Linux}\label{ch12SL}}}
\captionswapskip{}
\begin{Verbatim}[]

#!/bin/bash
#
# Script to start/stop samba
# Locate this in /sbin as a file called 'samba'

RCD=/etc/rc.d

if [ z$1 == 'z' ]; then
        echo $0 - No arguments given; must be start or stop.
        exit
fi

if [ $1 == 'start' ]; then
        ${RCD}/nmb start
        ${RCD}/smb start
        ${RCD}/winbind start

fi
if [ $1 == 'stop' ]; then
        ${RCD}/smb stop
        ${RCD}/winbind stop
        ${RCD}/nmb stop
fi
if [ $1 == 'restart' ]; then
        ${RCD}/smb stop
        ${RCD}/winbind stop
        ${RCD}/nmb stop
        sleep 5
        ${RCD}/nmb start
        ${RCD}/smb start
        ${RCD}/winbind start
fi
exit 0

\end{Verbatim}
\end{example}


\begin{description}
% \null and \mbox are tricks to induce different typesetting decisions
\item[{nmbd}]\null{}
\index{smbd} \index{starting samba!smbd} This daemon handles all name registration and resolution requests. It is the primary vehicle involved in network browsing. It handles all UDP-based protocols. The {\bfseries{nmbd}} daemon should be the first command started as part of the Samba startup process.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{smbd}]\null{}
\index{nmbd} \index{starting samba!nmbd} This daemon handles all TCP/IP-based connection services for file- and print-based operations. It also manages local authentication. It should be started immediately following the startup of {\bfseries{nmbd}}.
% \null and \mbox are tricks to induce different typesetting decisions
\item[{winbindd}]\null{}
\index{winbindd} \index{starting samba!winbindd} This daemon should be started when Samba is a member of a Windows NT4 or ADS domain. It is also needed when Samba has trust relationships with another domain. The {\bfseries{winbindd}} daemon will check the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file for the presence of the {\ttfamily\itshape{\docbookhyphenatedot{idmap uid}}} and {\ttfamily\itshape{\docbookhyphenatedot{idmap gid}}} parameters. If they are not found, {\bfseries{winbindd}} bails out and refuses to start.
\end{description}

When Samba has been packaged by an operating system vendor, the startup process is typically a custom feature of its integration into the platform as a whole. Please refer to your operating system platform administration manuals for specific information pertaining to correct management of Samba startup.

\begin{example}%
\hypertarget{ch12RHscript}{}%
\captionswapskip{}{{\caption{A Sample Samba Control Script for Red Hat Linux}\label{ch12RHscript}}}
\captionswapskip{}
\begin{Verbatim}[]

#!/bin/sh
#
# chkconfig: 345 81 35
# description: Starts and stops the Samba smbd and nmbd daemons \
#              used to provide SMB network services.

# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
CONFIG=/etc/samba/smb.conf
# Check that smb.conf exists.
[ -f $CONFIG ] || exit 0

# See how we were called.
case "$1" in
  start)
        echo -n "Starting SMB services: "
        daemon smbd -D; daemon nmbd -D; echo;
        touch /var/lock/subsys/smb
        ;;
  stop)
        echo -n "Shutting down SMB services: "
        smbdpids=`ps guax | grep smbd | grep -v grep | awk '{print $2}'`
        for pid in $smbdpids; do
                kill -TERM $pid
        done
        killproc nmbd -TERM; rm -f /var/lock/subsys/smb
        echo ""
        ;;
  status)
        status smbd; status nmbd;
        ;;
  restart)
        echo -n "Restarting SMB services: "
        $0 stop; $0 start;
        echo "done."
        ;;
  *)
        echo "Usage: smb {start|stop|restart|status}"
        exit 1
esac

\end{Verbatim}
\end{example}


\index{samba control script} SUSE Linux implements individual control over each Samba daemon. A Samba control script that can be conveniently executed from the command line is shown in \hyperlink{ch12SL}{Example {\ref{ch12SL}}}. This can be located in the directory {\texttt{\docbookhyphenatefilename{/\dbz{}sbin}}} in a file called {\texttt{\docbookhyphenatefilename{samba}}}. This type of control script should be owned by user root and group root, and set so that only root can execute it.

\index{startup script} A sample startup script for a Red Hat Linux system is shown in \hyperlink{ch12RHscript}{Example {\ref{ch12RHscript}}}. This file could be located in the directory {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}rc.\dbz{}d}}} and can be called {\texttt{\docbookhyphenatefilename{samba}}}. A similar startup script is required to control {\bfseries{winbind}}. If you want to find more information regarding startup scripts please refer to the packaging section of the Samba source code distribution tarball. The packaging files for each platform include a startup control file.

% ------------------------   
% Section 
\section{DNS Configuration Files}
\label{id2560609}\hypertarget{id2560609}{}%

The following files are common to all DNS server configurations. Rather than repeat them multiple times, they are presented here for general reference.
\subsection{The Forward Zone File for the Loopback Adaptor}
\label{id2560622}\hypertarget{id2560622}{}%

The forward zone file for the loopback address never changes. An example file is shown in \hyperlink{loopback}{Example {\ref{loopback}}}. All traffic destined for an IP address that is hosted on a physical interface on the machine itself is routed to the loopback adaptor. This is a fundamental design feature of the TCP/IP protocol implementation. The loopback adaptor is called {\texttt{\docbookhyphenatedot{localhost}}}.

\begin{example}%
\hypertarget{loopback}{}%
\captionswapskip{}{{\caption{DNS Localhost Forward Zone File: /\dbz{}var/\dbz{}lib/\dbz{}named/\dbz{}localhost.\dbz{}zone}\label{loopback}}}
\captionswapskip{}
\begin{Verbatim}[]

$TTL 1W
@		IN SOA	@   root (
				42		; serial
				2D		; refresh
				4H		; retry
				6W		; expiry
				1W )		; minimum

		IN NS		@
		IN A		127.0.0.1

\end{Verbatim}
\end{example}

\subsection{The Reverse Zone File for the Loopback Adaptor}
\label{id2560670}\hypertarget{id2560670}{}%

The reverse zone file for the loopback address as shown in \hyperlink{dnsloopy}{Example {\ref{dnsloopy}}} is necessary so that references to the address {\texttt{\docbookhyphenatedot{127.0.0.1}}} can be resolved to the correct name of the interface.

\begin{example}%
\hypertarget{dnsloopy}{}%
\captionswapskip{}{{\caption{DNS Localhost Reverse Zone File: /\dbz{}var/\dbz{}lib/\dbz{}named/\dbz{}127.\dbz{}0.\dbz{}0.\dbz{}zone}\label{dnsloopy}}}
\captionswapskip{}
\begin{Verbatim}[]

$TTL 1W
@		IN SOA		localhost.   root.localhost. (
				42		; serial
				2D		; refresh
				4H		; retry
				6W		; expiry
				1W )		; minimum

		IN NS		localhost.
1		IN PTR		localhost.

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{roothint}{}%
\captionswapskip{}{{\caption{DNS Root Name Server Hint File: /\dbz{}var/\dbz{}lib/\dbz{}named/\dbz{}root.\dbz{}hint}\label{roothint}}}
\captionswapskip{}
\begin{Verbatim}[]

; This file is made available by InterNIC under anonymous FTP as
;       file                /domain/named.root
;       on server           FTP.INTERNIC.NET
; last update: Nov 5, 2002. Related version of root zone: 2002110501
; formerly NS.INTERNIC.NET
.                        3600000  IN  NS    A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET.      3600000      A     198.41.0.4
; formerly NS1.ISI.EDU
.                        3600000      NS    B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET.      3600000      A     128.9.0.107
; formerly C.PSI.NET
.                        3600000      NS    C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET.      3600000      A     192.33.4.12
; formerly TERP.UMD.EDU
.                        3600000      NS    D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET.      3600000      A     128.8.10.90
; formerly NS.NASA.GOV
.                        3600000      NS    E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET.      3600000      A     192.203.230.10
; formerly NS.ISC.ORG
.                        3600000      NS    F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET.      3600000      A     192.5.5.241
; formerly NS.NIC.DDN.MIL
.                        3600000      NS    G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET.      3600000      A     192.112.36.4
; formerly AOS.ARL.ARMY.MIL
.                        3600000      NS    H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET.      3600000      A     128.63.2.53
; formerly NIC.NORDU.NET
.                        3600000      NS    I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET.      3600000      A     192.36.148.17
; operated by VeriSign, Inc. 
.                        3600000      NS    J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET.      3600000      A     192.58.128.30
; housed in LINX, operated by RIPE NCC
.                        3600000      NS    K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET.      3600000      A     193.0.14.129 
; operated by IANA
.                        3600000      NS    L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET.      3600000      A     198.32.64.12
; housed in Japan, operated by WIDE
.                        3600000      NS    M.ROOT-SERVERS.NET.
M.ROOT-SERVERS.NET.      3600000      A     202.12.27.33
; End of File

\end{Verbatim}
\end{example}

\subsection{DNS Root Server Hint File}
\label{id2571074}\hypertarget{id2571074}{}%

The content of the root hints file as shown in \hyperlink{roothint}{Example {\ref{roothint}}} changes slowly over time. Periodically this file should be updated from the source shown. Because of its size, this file is located at the end of this chapter.

% ------------------------   
% Section 
\section{Alternative LDAP Database Initialization}
\label{altldapcfg}\hypertarget{altldapcfg}{}%

\index{LDAP!database}\index{LDAP!initial configuration} The following procedure may be used as an alternative means of configuring the initial LDAP database. Many administrators prefer to have greater control over how system files get configured.
\subsection{Initialization of the LDAP Database}
\label{id2571127}\hypertarget{id2571127}{}%

\index{LDIF}\index{Domain Groups!well-known}\index{SID} The first step to get the LDAP server ready for action is to create the LDIF file from which the LDAP database will be preloaded. This is necessary to create the containers into which the user, group, and other accounts are written. It is also necessary to preload the well-known Windows NT Domain Groups, as they must have the correct SID so that they can be recognized as special NT Groups by the MS Windows clients.
LDAP Directory Pre-Load Steps\begin{enumerate}

\item{Create a directory in which to store the files you use to generate the LDAP LDIF file for your system. Execute the following: 
\begin{Verbatim}[]

root#  mkdir /etc/openldap/SambaInit
root#  chown root:root /etc/openldap/SambaInit
root#  chmod 700 /etc/openldap/SambaInit

\end{Verbatim}
}

\item{Install the files shown in \hyperlink{sbehap-ldapreconfa}{Example {\ref{sbehap-ldapreconfa}}}, \hyperlink{sbehap-ldapreconfb}{Example {\ref{sbehap-ldapreconfb}}}, and \hyperlink{sbehap-ldapreconfc}{Example {\ref{sbehap-ldapreconfc}}} into the directory {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap/\dbz{}SambaInit/\dbz{}SMBLDAP-\dbz{}ldif-\dbz{}preconfig.\dbz{}sh.\dbz{}}}} These three files are, respectively, parts A, B, and C of the {\texttt{\docbookhyphenatefilename{SMBLDAP-\dbz{}ldif-\dbz{}preconfig.\dbz{}sh}}} file.}

\item{Install the files shown in \hyperlink{sbehap-ldifpata}{Example {\ref{sbehap-ldifpata}}} and \hyperlink{sbehap-ldifpatb}{Example {\ref{sbehap-ldifpatb}}} into the directory {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap/\dbz{}SambaInit/\dbz{}.\dbz{}}}} These two files are parts A and B, respectively, of the {\texttt{\docbookhyphenatefilename{init-\dbz{}ldif.\dbz{}pat}}} file.}

\item{Change to the {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}openldap/\dbz{}SambaInit}}} directory. Execute the following: 
\begin{Verbatim}[]

root#  sh SMBLDAP-ldif-preconfig.sh

How do you wish to refer to your organization?
Suggestions:
        Black Tire Company, Inc.
        Cat With Hat Ltd.
How would you like your organization name to appear?
Your organization name is: My Organization
Enter a new name is this is not what you want, press Enter to Continue.
Name [My Organization]: Abmas Inc.

Samba Config File Location [/etc/samba/smb.conf]:
Enter a new full path or press Enter to continue.
Samba Config File Location [/etc/samba/smb.conf]:
Domain Name: MEGANET2
Domain SID: S-1-5-21-3504140859-1010554828-2431957765

The name of your Internet domain is now needed in a special format
as follows, if your domain name is mydomain.org, what we need is
the information in the form of:
        Domain ID: mydomain
        Top level: org
If your fully qualified hostname is: snoopy.bazaar.garagesale.net
where "snoopy" is the name of the machine,
Then the information needed is:
        Domain ID: garagesale
        Top Level: net

Found the following domain name: abmas.biz
I think the bit we are looking for might be: abmas
Enter the domain name or press Enter to continue:

The top level organization name I will use is: biz
Enter the top level org name or press Enter to continue:
root# 

\end{Verbatim}
 This creates a file called {\texttt{\docbookhyphenatefilename{MEGANET2.\dbz{}ldif}}}.}

\item{It is now time to preload the LDAP database with the following command: 
\begin{Verbatim}[]

root#  slapadd -v -l MEGANET2.ldif
added: "dc=abmas,dc=biz" (00000001)
added: "cn=Manager,dc=abmas,dc=biz" (00000002)
added: "ou=People,dc=abmas,dc=biz" (00000003)
added: "ou=Computers,dc=abmas,dc=biz" (00000004)
added: "ou=Groups,dc=abmas,dc=biz" (00000005)
added: "ou=Domains,dc=abmas,dc=biz" (00000006)
added: "sambaDomainName=MEGANET2,ou=Domains,dc=abmas,dc=biz" (00000007)
added: "cn=domadmins,ou=Groups,dc=abmas,dc=biz" (00000008)
added: "cn=domguests,ou=Groups,dc=abmas,dc=biz" (00000009)
added: "cn=domusers,ou=Groups,dc=abmas,dc=biz" (0000000a)

\end{Verbatim}
 You should verify that the account information was correctly loaded by executing: 
\begin{Verbatim}[]

root#  slapcat
dn: dc=abmas,dc=biz
objectClass: dcObject
objectClass: organization
dc: abmas
o: Abmas Inc.
description: Posix and Samba LDAP Identity Database
structuralObjectClass: organization
entryUUID: af552f8e-c4a1-1027-9002-9421e01bf474
creatorsName: cn=manager,dc=abmas,dc=biz
modifiersName: cn=manager,dc=abmas,dc=biz
createTimestamp: 20031217055747Z
modifyTimestamp: 20031217055747Z
entryCSN: 2003121705:57:47Z#0x0001#0#0000
...

dn: cn=domusers,ou=Groups,dc=abmas,dc=biz
objectClass: posixGroup
objectClass: sambaGroupMapping
gidNumber: 513
cn: domusers
sambaSID: S-1-5-21-3504140859-1010554828-2431957765-513
sambaGroupType: 2
displayName: Domain Users
description: Domain Users
structuralObjectClass: posixGroup
entryUUID: af7e98ba-c4a1-1027-900b-9421e01bf474
creatorsName: cn=manager,dc=abmas,dc=biz
modifiersName: cn=manager,dc=abmas,dc=biz
createTimestamp: 20031217055747Z
modifyTimestamp: 20031217055747Z
entryCSN: 2003121705:57:47Z#0x000a#0#0000

\end{Verbatim}
}

\item{Your LDAP database is ready for testing. You can now start the LDAP server using the system tool for your Linux operating system. For SUSE Linux, you can do this as follows: 
\begin{Verbatim}[]

root#  rcldap start

\end{Verbatim}
}

\item{It is now a good idea to validate that the LDAP server is running correctly. Execute the following: 
\begin{Verbatim}[]

root#  ldapsearch -x -b "dc=abmas,dc=biz" "(ObjectClass=*)"
# extended LDIF
#
# LDAPv3
# base <dc=abmas,dc=biz> with scope sub
# filter: (ObjectClass=*)
# requesting: ALL
#

# abmas.biz
dn: dc=abmas,dc=biz
objectClass: dcObject
objectClass: organization
dc: abmas
o: Abmas Inc.
description: Posix and Samba LDAP Identity Database
...
# domusers, Groups, abmas.biz
dn: cn=domusers,ou=Groups,dc=abmas,dc=biz
objectClass: posixGroup
objectClass: sambaGroupMapping
gidNumber: 513
cn: domusers
sambaSID: S-1-5-21-3504140859-1010554828-2431957765-513
sambaGroupType: 2
displayName: Domain Users
description: Domain Users

# search result
search: 2
result: 0 Success

# numResponses: 11
# numEntries: 10

\end{Verbatim}
 Your LDAP server is ready for creation of additional accounts.}
\end{enumerate}

\begin{example}%
\hypertarget{sbehap-ldapreconfa}{}%
\captionswapskip{}{{\caption{LDAP Pre-configuration Script: SMBLDAP-\dbz{}ldif-\dbz{}preconfig.\dbz{}sh ---  Part A}\label{sbehap-ldapreconfa}}}
\captionswapskip{}
\begin{Verbatim}[]

#!/bin/bash
#
# This script prepares the ldif LDAP load file only
#

# Pattern File Name
file=init-ldif.pat

# The name of my organization
ORGNAME="My Organization"

# My Internet domain. ie: if my domain is: buckets.org, INETDOMAIN="buckets"
INETDOMAIN="my-domain"

# In the above case, md domain is: buckets.org, TLDORG="org"
TLDORG="org"

# This is the Samba Domain/Workgroup Name
DOMNAME="MYWORKGROUP"

#
# Here We Go ...
#

cat <<EOF

How do you wish to refer to your organization?

Suggestions:
	Black Tire Company, Inc.
	Cat With Hat Ltd.

How would you like your organization name to appear?

EOF

echo "Your organization name is: $ORGNAME"
echo
echo "Enter a new name or, press Enter to Continue."
echo

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{sbehap-ldapreconfb}{}%
\captionswapskip{}{{\caption{LDAP Pre-configuration Script: SMBLDAP-\dbz{}ldif-\dbz{}preconfig.\dbz{}sh ---  Part B}\label{sbehap-ldapreconfb}}}
\captionswapskip{}
\begin{Verbatim}[]

echo -e -n "Name [$ORGNAME]: "
	read name

if [ ! -z "$name" ]; then 
	ORGNAME=${name}
fi
echo
sed "s/ORGNAME/${ORGNAME}/g" < $file > $file.tmp1

# Try to find smb.conf

if [ -e /usr/local/samba/lib/smb.conf ]; then
	CONF=/usr/local/samba/lib/smb.conf
elif [ -e /etc/samba/smb.conf ]; then
	CONF=/etc/samba/smb.conf
fi

echo "Samba Config File Location [$CONF]: "
echo
echo "Enter a new full path or press Enter to continue."
echo
echo -n "Samba Config File Location [$CONF]: "
	read name
if [ ! -z "$name" ]; then
	CONF=$name
fi
echo

# Find the name of our Domain/Workgroup
DOMNAME=`grep -i workgroup ${CONF} | sed "s/ //g" | cut -f2 -d=`
echo Domain Name: $DOMNAME
echo

sed "s/DOMNAME/${DOMNAME}/g" < $file.tmp1 > $file.tmp2

DOMSID=`net getlocalsid ${DOMNAME} | cut -f2 -d: | sed "s/ //g"`
echo Domain SID: $DOMSID

sed "s/DOMSID/${DOMSID}/g" < $file.tmp2 > $file.tmp1

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{sbehap-ldapreconfc}{}%
\captionswapskip{}{{\caption{LDAP Pre-configuration Script: SMBLDAP-\dbz{}ldif-\dbz{}preconfig.\dbz{}sh ---  Part C}\label{sbehap-ldapreconfc}}}
\captionswapskip{}
\begin{Verbatim}[]

cat <<EOL
The name of your Internet domain is now needed in a special format
as follows, if your domain name is mydomain.org, what we need is
the information in the form of:
	Domain ID: mydomain
	Top level: org

If your fully qualified hostname is: snoopy.bazaar.garagesale.net
where "snoopy" is the name of the machine,
Then the information needed is:
	Domain ID: garagesale
	Top Level: net

EOL
INETDOMAIN=`hostname -d | cut -f1 -d.`
echo Found the following domain name: `hostname -d`
echo "I think the bit we are looking for might be: $INETDOMAIN"
echo
echo -n "Enter the domain name or press Enter to continue: "
	read domnam
if [ ! -z $domnam ]; then
	INETDOMAIN=$domnam
fi
echo
sed "s/INETDOMAIN/${INETDOMAIN}/g" < $file.tmp1 > $file.tmp2
TLDORG=`hostname -d | sed "s/${INETDOMAIN}.//g"`
echo "The top level organization name I will use is: ${TLDORG}"
echo
echo -n "Enter the top level org name or press Enter to continue: "
	read domnam
if [ ! -z $domnam ]; then
        TLDORG=$domnam
fi
sed "s/TLDORG/${TLDORG}/g" < $file.tmp2 > $DOMNAME.ldif
rm $file.tmp*
exit 0

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{sbehap-ldifpata}{}%
\captionswapskip{}{{\caption{LDIF Pattern File Used to Pre-configure LDAP ---  Part A}\label{sbehap-ldifpata}}}
\captionswapskip{}
\begin{Verbatim}[]

dn: dc=INETDOMAIN,dc=TLDORG
objectClass: dcObject
objectClass: organization
dc: INETDOMAIN
o: ORGNAME
description: Posix and Samba LDAP Identity Database

dn: cn=Manager,dc=INETDOMAIN,dc=TLDORG
objectClass: organizationalRole
cn: Manager
description: Directory Manager

dn: ou=People,dc=INETDOMAIN,dc=TLDORG
objectClass: top
objectClass: organizationalUnit
ou: People

dn: ou=Computers,dc=INETDOMAIN,dc=TLDORG
objectClass: top
objectClass: organizationalUnit
ou: Computers

dn: ou=Groups,dc=INETDOMAIN,dc=TLDORG
objectClass: top
objectClass: organizationalUnit
ou: Groups

dn: ou=Idmap,dc=INETDOMAIN,dc=TLDORG
objectClass: top
objectClass: organizationalUnit
ou: Idmap

dn: ou=Domains,dc=INETDOMAIN,dc=TLDORG
objectClass: top
objectClass: organizationalUnit
ou: Domains

dn: sambaDomainName=DOMNAME,ou=Domains,dc=INETDOMAIN,dc=TLDORG
objectClass: sambaDomain
sambaDomainName: DOMNAME
sambaSID: DOMSID
sambaAlgorithmicRidBase: 1000
structuralObjectClass: sambaDomain

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{sbehap-ldifpatb}{}%
\captionswapskip{}{{\caption{LDIF Pattern File Used to Pre-configure LDAP ---  Part B}\label{sbehap-ldifpatb}}}
\captionswapskip{}
\begin{Verbatim}[]

dn: cn=domadmins,ou=Groups,dc=INETDOMAIN,dc=TLDORG
objectClass: posixGroup
objectClass: sambaGroupMapping
gidNumber: 512
cn: domadmins
sambaSID: DOMSID-512
sambaGroupType: 2
displayName: Domain Admins
description: Domain Administrators

dn: cn=domguests,ou=Groups,dc=INETDOMAIN,dc=TLDORG
objectClass: posixGroup
objectClass: sambaGroupMapping
gidNumber: 514
cn: domguests
sambaSID: DOMSID-514
sambaGroupType: 2
displayName: Domain Guests
description: Domain Guests Users

dn: cn=domusers,ou=Groups,dc=INETDOMAIN,dc=TLDORG
objectClass: posixGroup
objectClass: sambaGroupMapping
gidNumber: 513
cn: domusers
sambaSID: DOMSID-513
sambaGroupType: 2
displayName: Domain Users
description: Domain Users

\end{Verbatim}
\end{example}


% ------------------------   
% Section 
\section{The LDAP Account Manager}
\label{id2571599}\hypertarget{id2571599}{}%

\index{LAM} \index{LDAP Account Manager|textit{see} {LAM} } \index{PHP} \index{unencrypted} \index{SSL} \index{Posix} \index{accounts!manage} The LDAP Account Manager (LAM) is an application suite that has been written in PHP. LAM can be used with any Web server that has PHP4 support. It connects to the LDAP server either using unencrypted connections or via SSL/TLS. LAM can be used to manage Posix accounts as well as SambaSAMAccounts for users, groups, and Windows machines (hosts).

LAM is available from the LAM\label{id2571664}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://sourceforge.net/projects/lam/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2571664} home page and from its mirror sites. LAM has been released under the GNU GPL version 2. The current version of LAM is 0.4.9. Release of version 0.5 is expected in the third quarter of 2005.

\index{PHP4} \index{OpenLDAP} \index{Perl} Requirements:

\begin{itemize}
%--- Item
\item 
A web server that will work with PHP4.


%--- Item
\item 
PHP4 (available from the PHP\label{id2571707}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.php.net/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2571707} home page.)


%--- Item
\item 
OpenLDAP 2.0 or later.


%--- Item
\item 
A Web browser that supports CSS.


%--- Item
\item 
Perl.


%--- Item
\item 
The gettext package.


%--- Item
\item 
mcrypt + mhash (optional).


%--- Item
\item 
It is also a good idea to install SSL support.

\end{itemize}

LAM is a useful tool that provides a simple Web-based device that can be used to manage the contents of the LDAP directory to: \index{organizational units} \index{operating profiles} \index{account policies}

\begin{itemize}
%--- Item
\item 
Display user/group/host and Domain entries.


%--- Item
\item 
Manage entries (Add/Delete/Edit).


%--- Item
\item 
Filter and sort entries.


%--- Item
\item 
Store and use multiple operating profiles.


%--- Item
\item 
Edit organizational units (OUs).


%--- Item
\item 
Upload accounts from a file.


%--- Item
\item 
Is compatible with Samba-2.2.x and Samba-3.

\end{itemize}

When correctly configured, LAM allows convenient management of UNIX (Posix) and Samba user, group, and windows domain member machine accounts.

\index{default password} \index{secure connections} \index{LAM} \index{SSL} The default password is {``}lam.{''} It is highly recommended that you use only an SSL connection to your Web server for all remote operations involving LAM. If you want secure connections, you must configure your Apache Web server to permit connections to LAM using only SSL.
Apache Configuration Steps for LAM\begin{enumerate}

\item{Extract the LAM package by untarring it as shown here: 
\begin{Verbatim}[]

root#  tar xzf ldap-account-manager_0.4.9.tar.gz

\end{Verbatim}
 Alternatively, install the LAM DEB for your system using the following command: 
\begin{Verbatim}[]

root#  dpkg -i ldap-account-manager_0.4.9.all.deb

\end{Verbatim}
}

\item{Copy the extracted files to the document root directory of your Web server. For example, on SUSE Linux Enterprise Server 9, copy to the {\texttt{\docbookhyphenatefilename{/\dbz{}srv/\dbz{}www/\dbz{}htdocs}}} directory.}

\item{\index{file permissions} Set file permissions using the following commands: 
\begin{Verbatim}[]

root#  chown -R wwwrun:www /srv/www/htdocs/lam
root#  chmod 755 /srv/www/htdocs/lam/sess
root#  chmod 755 /srv/www/htdocs/lam/tmp
root#  chmod 755 /srv/www/htdocs/lam/config
root#  chmod 755 /srv/www/htdocs/lam/lib/*pl

\end{Verbatim}
}

\item{\index{LAM!configuration file} Using your favorite editor create the following {\texttt{\docbookhyphenatefilename{config.\dbz{}cfg}}} LAM configuration file: 
\begin{Verbatim}[]

root#  cd /srv/www/htdocs/lam/config
root#  cp config.cfg_sample config.cfg
root#  vi config.cfg

\end{Verbatim}
 \index{LAM!profile} \index{LAM!wizard} An example file is shown in \hyperlink{lamcfg}{Example {\ref{lamcfg}}}. This is the minimum configuration that must be completed. The LAM profile file can be created using a convenient wizard that is part of the LAM configuration suite.}

\item{Start your Web server then, using your Web browser, connect to LAM\label{id2572021}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://localhost/lam}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2572021} URL. Click on the the {\ttfamily\itshape{\docbookhyphenatedot{Configuration Login}}} link then click on the Configuration Wizard link to begin creation of the default profile so that LAM can connect to your LDAP server. Alternately, copy the {\texttt{\docbookhyphenatefilename{lam.\dbz{}conf\_\dbz{}sample}}} file to a file called {\texttt{\docbookhyphenatefilename{lam.\dbz{}conf}}} then, using your favorite editor, change the settings to match local site needs.}
\end{enumerate}

\index{pitfalls} An example of a working file is shown here in \hyperlink{lamconf}{Example {\ref{lamconf}}}. This file has been stripped of comments to keep the size small. The comments and help information provided in the profile file that the wizard creates is very useful and will help many administrators to avoid pitfalls. Your configuration file obviously reflects the configuration options that are preferred at your site.

\index{LAM!login screen} It is important that your LDAP server is running at the time that LAM is being configured. This permits you to validate correct operation. An example of the LAM login screen is provided in \hyperlink{lam-login}{Figure {\ref{lam-login}}}.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{lam-login}{}%
\includegraphics[scale=0.5]{Samba3-ByExample/images/lam-login}
{{\caption[{The LDAP Account Manager Login Screen}]{{{The LDAP Account Manager Login Screen}}}\label{lam-login}}}
\end{center}
\end{figure}


\index{LAM!configuration editor} The LAM configuration editor has a number of options that must be managed correctly. An example of use of the LAM configuration editor is shown in \hyperlink{lam-config}{Figure {\ref{lam-config}}}. It is important that you correctly set the minimum and maximum UID/GID values that are permitted for use at your site. The default values may not be compatible with a need to modify initial default account values for well-known Windows network users and groups. The best work-around is to temporarily set the minimum values to zero (0) to permit the initial settings to be made. Do not forget to reset these to sensible values before using LAM to add additional users and groups.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{lam-config}{}%
\includegraphics[scale=0.5]{Samba3-ByExample/images/lam-config}
{{\caption[{The LDAP Account Manager Configuration Screen}]{{{The LDAP Account Manager Configuration Screen}}}\label{lam-config}}}
\end{center}
\end{figure}


\index{PDF} LAM has some nice, but unusual features. For example, one unexpected feature in most application screens permits the generation of a PDF file that lists configuration information. This is a well thought out facility. This option has been edited out of the following screen shots to conserve space.

\index{LAM!opening screen} When you log onto LAM the opening screen drops you right into the user manager as shown in \hyperlink{lam-user}{Figure {\ref{lam-user}}}. This is a logical action as it permits the most-needed facility to be used immediately. The editing of an existing user, as with the addition of a new user, is easy to follow and very clear in both layout and intent. It is a simple matter to edit generic settings, UNIX specific parameters, and then Samba account requirements. Each step involves clicking a button that intuitively drives you through the process. When you have finished editing simply press the {\sffamily \bfseries Final} button.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{lam-user}{}%
\includegraphics[scale=0.5]{Samba3-ByExample/images/lam-users}
{{\caption[{The LDAP Account Manager User Edit Screen}]{{{The LDAP Account Manager User Edit Screen}}}\label{lam-user}}}
\end{center}
\end{figure}


The edit screen for groups is shown in \hyperlink{lam-group}{Figure {\ref{lam-group}}}. As with the edit screen for user accounts, group accounts may be rapidly dealt with. \hyperlink{lam-group-mem}{Figure {\ref{lam-group-mem}}} shows a sub-screen from the group editor that permits users to be assigned secondary group memberships.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{lam-group}{}%
\includegraphics[scale=0.5]{Samba3-ByExample/images/lam-groups}
{{\caption[{The LDAP Account Manager Group Edit Screen}]{{{The LDAP Account Manager Group Edit Screen}}}\label{lam-group}}}
\end{center}
\end{figure}


% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{lam-group-mem}{}%
\includegraphics[scale=0.5]{Samba3-ByExample/images/lam-group-members}
{{\caption[{The LDAP Account Manager Group Membership Edit Screen}]{{{The LDAP Account Manager Group Membership Edit Screen}}}\label{lam-group-mem}}}
\end{center}
\end{figure}


\index{smbldap-tools}\index{scripts} The final screen presented here is one that you should not normally need to use. Host accounts will be automatically managed using the smbldap-tools scripts. This means that the screen \hyperlink{lam-host}{Figure {\ref{lam-host}}} will, in most cases, not be used.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{lam-host}{}%
\includegraphics[scale=0.5]{Samba3-ByExample/images/lam-hosts}
{{\caption[{The LDAP Account Manager Host Edit Screen}]{{{The LDAP Account Manager Host Edit Screen}}}\label{lam-host}}}
\end{center}
\end{figure}


One aspect of LAM that may annoy some users is the way it forces certain conventions on the administrator. For example, LAM does not permit the creation of Windows user and group accounts that contain spaces even though the underlying UNIX/Linux operating system may exhibit no problems with them. Given the propensity for using upper-case characters and spaces (particularly in the default Windows account names) this may cause some annoyance. For the rest, LAM is a very useful administrative tool.

The next major release, LAM 0.5, will have fewer restrictions and support the latest Samba features (e.g., logon hours). The new plugin-based architecture also allows management of much more different account types like plain UNIX accounts. The upload can now handle groups and hosts, too. Another important point is the tree view which allows browsing and editing LDAP objects directly.

\begin{example}%
\hypertarget{lamcfg}{}%
\captionswapskip{}{{\caption{Example LAM Configuration File ---  config.\dbz{}cfg}\label{lamcfg}}}
\captionswapskip{}
\begin{Verbatim}[]

# password to add/delete/rename configuration profiles
password: not24get

# default profile, without ".conf"
default: lam

\end{Verbatim}
\end{example}


\begin{example}%
\hypertarget{lamconf}{}%
\captionswapskip{}{{\caption{LAM Profile Control File ---  lam.\dbz{}conf}\label{lamconf}}}
\captionswapskip{}
\begin{Verbatim}[]

ServerURL: ldap://massive.abmas.org:389
Admins: cn=Manager,dc=abmas,dc=biz
Passwd: not24get
usersuffix: ou=People,dc=abmas,dc=biz
groupsuffix: ou=Groups,dc=abmas,dc=biz
hostsuffix: ou=Computers,dc=abmas,dc=biz
domainsuffix: ou=Domains,dc=abmas,dc=biz
MinUID: 0
MaxUID: 65535
MinGID: 0
MaxGID: 65535
MinMachine: 20000
MaxMachine: 25000
userlistAttributes: #uid;#givenName;#sn;#uidNumber;#gidNumber
grouplistAttributes: #cn;#gidNumber;#memberUID;#description
hostlistAttributes: #cn;#description;#uidNumber;#gidNumber
maxlistentries: 30
defaultLanguage: en_GB:ISO-8859-1:English (Great Britain)
scriptPath: 
scriptServer: 
samba3: yes
cachetimeout: 5
pwdhash: SSHA

\end{Verbatim}
\end{example}


% ------------------------   
% Section 
\section{IDEALX Management Console}
\label{id2572374}\hypertarget{id2572374}{}%

IMC (the IDEALX Mamagement Console) is a tool that can be used as the basis for a comprehensive web-based management interface for UNIX and Linux systems.

The Samba toolset is the first console developped for IMC. It offers a simple and ergonomic interface for managing a Samba domain controler. The goal is to give Linux administrators who need to manage production Samba servers an effective, intuitive and consistent management experience. An IMC screenshot of the user management tool is shown in \hyperlink{imcidealx}{Figure {\ref{imcidealx}}}.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{imcidealx}{}%
\includegraphics[scale=0.4]{Samba3-ByExample/images/imc-usermanager2}
{{\caption[{The IMC Samba User Account Screen}]{{{The IMC Samba User Account Screen}}}\label{imcidealx}}}
\end{center}
\end{figure}


IMC is built on a set of Perl modules. Most modules are standard CPAN modules. Some are bundled with IMC, but will soon to be hosted on the CPAN independently, like Struts4P, a port of Struts to the Perl language.

For further information regarding IMC refer to the web site.\label{id2572425}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://imc.sourceforge.net/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2572425} Prebuilt RPM packages are also available.\label{id2572431}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://imc.sourceforge.net/download.html}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2572431}

% ------------------------   
% Section 
\section{Effect of Setting File and Directory SUID/SGID Permissions Explained}
\label{ch12-SUIDSGID}\hypertarget{ch12-SUIDSGID}{}%
\index{SUID}\index{SGID}
The setting of the SUID/SGID bits on the file or directory permissions flag has particular consequences. If the file is executable and the SUID bit is set, it executes with the privilege of (with the UID of) the owner of the file. For example, if you are logged onto a system as a normal user (let's say as the user {\texttt{\docbookhyphenatedot{bobj}}}), and you execute a file that is owned by the user {\texttt{\docbookhyphenatedot{root}}} (uid = 0), and the file has the SUID bit set, then the file is executed as if you had logged in as the user {\texttt{\docbookhyphenatedot{root}}} and then executed the file. The SUID bit effectively gives you (as {\texttt{\docbookhyphenatedot{bobj}}}) administrative privilege for the use of that executable file.

The setting of the SGID bit does precisely the same as the effect of the SUID bit, except that it applies the privilege to the UNIX group setting. In other words, the file executes with the force of capability of the group.

When the SUID/SGID permissions are set on a directory, all files that are created within that directory are automatically given the ownership of the SUID user and the SGID group, as per the ownership of the directory in which the file is created. This means that the system level {\bfseries{create()}} function executes with the SUID user and/or SGID group of the directory in which the file is created.

If you want to obtain the SUID behavior, simply execute the following command: 
\begin{Verbatim}[]

root#  chmod u+s file-or-directory

\end{Verbatim}
 To set the SGID properties on a file or a directory, execute this command: 
\begin{Verbatim}[]

root#  chmod g+s file-or-directory

\end{Verbatim}
 And to set both SUID and SGID properties, execute the following: 
\begin{Verbatim}[]

root#  chmod ug+s file-or-directory

\end{Verbatim}


Let's consider the example of a directory {\texttt{\docbookhyphenatefilename{/\dbz{}data/\dbz{}accounts}}}. The permissions on this directory before setting both SUID and SGID on this directory are: 
\begin{Verbatim}[]

root#  ls -al /data/accounts
total 1
drwxr-xr-x   10 root     root          232 Dec 18 17:08 .
drwxr-xr-x   21 root     root          600 Dec 17 23:15 ..
drwxrwxrwx    2 bobj     Domain Users  48 Dec 18 17:08 accounts/
drwx------    2 root     root           48 Jan 26  2002 lost+found

\end{Verbatim}
 In this example, if the user {\texttt{\docbookhyphenatedot{maryv}}} creates a file, it is owned by her. If {\texttt{\docbookhyphenatedot{maryv}}} has the primary group of {\texttt{\docbookhyphenatedot{Accounts}}}, the file is owned by the group {\texttt{\docbookhyphenatedot{Accounts}}}, as shown in this listing: 
\begin{Verbatim}[]

root#  ls -al /data/accounts/maryvfile.txt
drw-rw-r--    2 maryv    Accounts     12346 Dec 18 17:53

\end{Verbatim}


Now you set the SUID and SGID and check the result as follows: 
\begin{Verbatim}[]

root#  chmod ug+s /data/accounts
root#  ls -al /data/accounts
total 1
drwxr-xr-x   10 root     root          232 Dec 18 17:08 .
drwxr-xr-x   21 root     root          600 Dec 17 23:15 ..
drwsrwsr-x    2 bobj     Domain Users  48 Dec 18 17:08 accounts
drwx------    2 root     root           48 Jan 26  2002 lost+found

\end{Verbatim}
 If {\texttt{\docbookhyphenatedot{maryv}}} creates a file in this directory after this change has been made, the file is owned by the user {\texttt{\docbookhyphenatedot{bobj}}}, and the group is set to the group {\texttt{\docbookhyphenatedot{Domain Users}}}, as shown here: 
\begin{Verbatim}[]

root#  chmod ug+s /data/accounts
root#  ls -al /data/accounts/maryvfile.txt
total 1
drw-rw-r--    2 bobj     Domain Users  12346 Dec 18 18:11 maryvfile.txt

\end{Verbatim}


% ------------------------   
% Section 
\section{Shared Data Integrity}
\label{ch12dblck}\hypertarget{ch12dblck}{}%

\index{data integrity}\index{multi-user!data access} The integrity of shared data is often viewed as a particularly emotional issue, especially where there are concurrent problems with multiuser data access. Contrary to the assertions of some who have experienced problems in either area, the cause has nothing to do with the phases of the moons of Jupiter.

The solution to concurrent multiuser data access problems must consider three separate areas from which the problem may stem:\index{locking!Application level}\index{locking!Client side}\index{locking!Server side}

\begin{itemize}
%--- Item
\item 
application-level locking controls


%--- Item
\item 
client-side locking controls


%--- Item
\item 
server-side locking controls

\end{itemize}

\index{database applications}\index{Microsoft Access} Many database applications use some form of application-level access control. An example of one well-known application that uses application-level locking is Microsoft Access. Detailed guidance is provided here because this is the most common application for which problems have been reported.

\index{Microsoft Excel}\index{Act"!} Common applications that are affected by client- and server-side locking controls include MS Excel and Act!. Important locking guidance is provided here.
\subsection{Microsoft Access}
\label{id2572794}\hypertarget{id2572794}{}%

The best advice that can be given is to carefully read the Microsoft knowledgebase articles that cover this area. Examples of relevant documents include:

\begin{itemize}
%--- Item
\item 
http://support.microsoft.com/default.aspx?scid=kb;en-us;208778


%--- Item
\item 
http://support.microsoft.com/default.aspx?scid=kb;en-us;299373

\end{itemize}

\index{multi-user!access}\index{exclusive open} Make sure that your MS Access database file is configured for multiuser access (not set for exclusive open). Open MS Access on each client workstation, then set the following: {\sffamily \bfseries (Menu bar) Tools}+{\sffamily \bfseries Options}+{\sffamily \bfseries [tab] General}. Set network path to Default database folder: {\texttt{\docbookhyphenatefilename{\docbooktolatexgobble\string\\\docbooktolatexgobble\string\\server\docbooktolatexgobble\string\\share\docbooktolatexgobble\string\\folder}}}.

You can configure MS Access file sharing behavior as follows: click {\sffamily \bfseries [tab] Advanced}. Set:\index{record locking}

\begin{itemize}
%--- Item
\item 
Default open mode: Shared


%--- Item
\item 
Default Record Locking: Edited Record


%--- Item
\item 
Open databases using record\_level locking

\end{itemize}

\index{MS Access!validate} You must now commit the changes so that they will take effect. To do so, click {\sffamily \bfseries Apply}{\sffamily \bfseries Ok}. At this point, you should exit MS Access, restart it, and then validate that these settings have not changed.
\subsection{Act! Database Sharing}
\label{id2572932}\hypertarget{id2572932}{}%

\index{ACT"! database}\index{data corruption} Where the server sharing the ACT! database(s) is running Samba,or Windows NT, 200x, or XP, you must disable opportunistic locking on the server and all workstations. Failure to do so results in data corruption. This information is available from the Act! Web site knowledgebase articles 1998223162925\label{id2572959}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://itdomino.saleslogix.com/act.nsf/docid/1998223162925}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2572959} as well as from article 200110485036\label{id2572965}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://itdomino.saleslogix.com/act.nsf/docid/200110485036}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2572965}.

\index{opportunistic locking}\index{Act"!Diag} These documents clearly state that opportunistic locking must be disabled on both the server (Samba in the case we are interested in here), as well as on every workstation from which the centrally shared Act! database will be accessed. Act! provides a tool called {\bfseries{Act!Diag}} that may be used to disable all workstation registry settings that may otherwise interfere with the operation of Act! Registered Act! users may download this utility from the Act! Web site.\label{id2573002}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.act.com/support/updates/index.cfm}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2573002}
\subsection{Opportunistic Locking Controls}
\label{id2573011}\hypertarget{id2573011}{}%

\index{file caching} Third-party Windows applications may not be compatible with the use of opportunistic file and record locking. For applications that are known not to be compatible,\label{id2573029}\begingroup\catcode`\#=12\footnote{Refer to the application manufacturer's installation guidelines and knowledge base for specific information regarding compatibility. It is often safe to assume that if the software manufacturer does not specifically mention incompatibilities with opportunistic file and record locking, or with Windows client file caching, the application is probably compatible with Windows (as well as Samba) default settings.}\endgroup\docbooktolatexmakefootnoteref{id2573029} oplock support may need to be disabled both on the Samba server and on the Windows workstations.

\index{cache}\index{write lock}\index{flush!cache memory} Oplocks enable a Windows client to cache parts of a file that are being edited. Another windows client may then request to open the file with the ability to write to it. The server will then ask the original workstation that had the file open with a write lock to release its lock. Before doing so, that workstation must flush the file from cache memory to the disk or network drive.

\index{Oplocks!disabled} Disabling of Oplocks usage may require server and client changes. Oplocks may be disabled by file, by file pattern, on the share, or on the Samba server.

The following are examples showing how Oplock support may be managed using Samba {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file settings: 
\begin{Verbatim}[]

By file:        veto oplock files = myfile.mdb

By Pattern:     veto oplock files = /*.mdb/

On the Share:   oplocks = No
                level2 oplocks = No

On the server:
(in [global])   oplocks = No
                level2 oplocks = No

\end{Verbatim}


The following registry entries on Microsoft Windows XP Professional, 2000 Professional, and Windows NT4 workstation clients must be configured as shown here: 
\begin{Verbatim}[]

REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\
            Services\LanmanServer\Parameters]
      "EnableOplocks"=dword:00000000

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\
            Services\LanmanWorkstation\Parameters]
      "UseOpportunisticLocking"=dword:00000000

\end{Verbatim}


Comprehensive coverage of file and record-locking controls is provided in TOSHARG2, Chapter 13. The information in that chapter was obtained from a wide variety of sources.
\cleardoublepage 
% -------------------------------------------------------------
% Chapter Networking Primer 
% ------------------------------------------------------------- 	
\chapter{Networking Primer}
\label{primer}\hypertarget{primer}{}%

You are about to use the equivalent of a microscope to look at the information that runs through the veins of a Windows network. We do more to observe the information than to interrogate it. When you are done with this primer, you should have a good understanding of the types of information that flow over the network. Do not worry, this is not a biology lesson. We won't lose you in unnecessary detail. Think to yourself, {``}This is easy,{''} then tackle each exercise without fear.

Samba can be configured with a minimum of complexity. Simplicity should be mastered before you get too deeply into complexities. Let's get moving: we have work to do.

% ------------------------   
% Section 
\section{Requirements and Notes}
\label{id2472192}\hypertarget{id2472192}{}%

Successful completion of this primer requires two Microsoft Windows 9x/Me Workstations as well as two Microsoft Windows XP Professional Workstations, each equipped with an Ethernet card connected using a hub. Also required is one additional server (either Windows NT4 Server, Windows 2000 Server, or a Samba-3 on UNIX/Linux server) running a network sniffer and analysis application (Wireshark is a good choice). All work should be undertaken on a quiet network where there is no other traffic. It is best to use a dedicated hub with only the machines under test connected at the time of the exercises.

\index{Wireshark} Wireshark (formerly Ethereal) has become the network protocol analyzer of choice for many network administrators. You may find more information regarding this tool from the Wireshark\label{id2479820}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.wireshark.org}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2479820} Web site. Wireshark installation files for Windows may be obtained from the Wireshark Web site. Wireshark is provided with SUSE and Red Hat Linux distributions, as well as with many other Linux distributions. It may not be installed on your system by default. If it is not installed, you may also need to install the {\bfseries{libpcap}} software before you can install or use Wireshark. Please refer to the instructions for your operating system or to the Wireshark Web site for information regarding the installation and operation of Wireshark.

To obtain {\bfseries{Wireshark}} for your system, please visit the Wireshark download site\label{id2472888}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.wireshark.org/download.html}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2472888}.

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

The successful completion of this chapter requires that you capture network traffic using {\bfseries{Wireshark}}. It is recommended that you use a hub, not an Ethernet switch. It is necessary for the device used to act as a repeater, not as a filter. Ethernet switches may filter out traffic that is not directed at the machine that is used to monitor traffic; this would not allow you to complete the projects.
\end{admonition}


\index{network!captures} Do not worry too much if you do not have access to all this equipment; network captures from the exercises are provided on the enclosed CD-ROM. This makes it possible to dive directly into the analytical part of the exercises if you so desire.

\index{network!sniffer}\index{protocol analysis} Please do not be alarmed at the use of a high-powered analysis tool (Wireshark) in this primer. We expose you only to a minimum of detail necessary to complete the exercises. If you choose to use any other network sniffer and protocol analysis tool, be advised that it may not allow you to examine the contents of recently added security protocols used by Windows 200x/XP.

You could just skim through the exercises and try to absorb the key points made. The exercises provide all the information necessary to convince the die-hard network engineer. You possibly do not require so much convincing and may just want to move on, in which case you should at least read \hyperlink{chap01conc}{Section {\ref{chap01conc}}}.

\hyperlink{chap01qa}{Section {\ref{chap01qa}}} also provides useful information that may help you to avoid significantly time-consuming networking problems.

% ------------------------   
% Section 
\section{Introduction}
\label{id2472981}\hypertarget{id2472981}{}%

The purpose of this chapter is to create familiarity with key aspects of Microsoft Windows network computing. If you want a solid technical grounding, do not gloss over these exercises. The points covered are recurrent issues on the Samba mailing lists.

\index{network!broadcast} You can see from these exercises that Windows networking involves quite a lot of network broadcast traffic. You can look into the contents of some packets, but only to see some particular information that the Windows client sends to a server in the course of establishing a network connection.

To many people, browsing is everything that happens when one uses Microsoft Internet Explorer. It is only when you start looking at network traffic and noting the protocols and types of information that are used that you can begin to appreciate the complexities of Windows networking and, more importantly, what needs to be configured so that it can work. Detailed information regarding browsing is provided in the recommended preparatory reading.

Recommended preparatory reading: {\em{The Official Samba-3 HOWTO and Reference Guide, Second Edition}} (TOSHARG2) Chapter 9, {``}Network Browsing,{''} and Chapter 3, {``}Server Types and Security Modes.{''}
\subsection{Assignment Tasks}
\label{id2567528}\hypertarget{id2567528}{}%

\index{browsing} You are about to witness how Microsoft Windows computer networking functions. The exercises step through identification of how a client machine establishes a connection to a remote Windows server. You observe how Windows machines find each other (i.e., how browsing works) and how the two key types of user identification (share mode security and user mode security) are affected.

\index{network!analyzer} The networking protocols used by MS Windows networking when working with Samba use TCP/IP as the transport protocol. The protocols that are specific to Windows networking are encapsulated in TCP/IP. The network analyzer we use (Wireshark) is able to show you the contents of the TCP/IP packets (or messages).
Diagnostic Tasks\begin{enumerate}

\item{\index{network!trace}\index{host announcement}\index{name resolution} Examine network traces to witness SMB broadcasts, host announcements, and name resolution processes.}

\item{Examine network traces to witness how share mode security functions.}

\item{Examine network traces to witness the use of user mode security.}

\item{Review traces of network logons for a Windows 9x/Me client as well as a domain logon for a Windows XP Professional client.}
\end{enumerate}

% ------------------------   
% Section 
\section{Exercises}
\label{id2567650}\hypertarget{id2567650}{}%

\index{wireshark} You are embarking on a course of discovery. The first part of the exercise requires two MS Windows 9x/Me systems. We called one machine {\texttt{\docbookhyphenatedot{WINEPRESSME}}} and the other {\texttt{\docbookhyphenatedot{MILGATE98}}}. Each needs an IP address; we used {\texttt{\docbookhyphenatedot{10.\dbz{}1.\dbz{}1.\dbz{}10}}} and {\texttt{\docbookhyphenatedot{10.\dbz{}1.\dbz{}1.\dbz{}11}}}. The test machines need to be networked via a {\em{hub}}. A UNIX/Linux machine is required to run {\bfseries{Wireshark}} to enable the network activity to be captured. It is important that the machine from which network activity is captured must not interfere with the operation of the Windows workstations. It is helpful for this machine to be passive (does not send broadcast information) to the network.

For these exercises, our test environment consisted of a SUSE 9.2 Professional Linux Workstation running VMWare 4.5. The following VMWare images were prepared:

\begin{itemize}
%--- Item
\item 
Windows 98 ---  name: MILGATE98


%--- Item
\item 
Windows Me ---  name: WINEPRESSME


%--- Item
\item 
Windows XP Professional ---  name: LightrayXP


%--- Item
\item 
Samba-3.0.20 running on a SUSE Enterprise Linux 9

\end{itemize}

Choose a workgroup name (MIDEARTH) for each exercise.

\index{ethereal} The network captures provided on the CD-ROM included with this book were captured using {\texttt{\docbookhyphenatedot{Ethereal}}} version {\texttt{\docbookhyphenatedot{0.\dbz{}10.\dbz{}6}}}. A later version suffices without problems (i.e. you should be using Wireshark), but an earlier version may not expose all the information needed. Each capture file has been decoded and listed as a trace file. A summary of all packets has also been included. This makes it possible for you to do all the studying you like without the need to perform the time-consuming equipment configuration and test work. This is a good time to point out that the value that can be derived from this book really does warrant your taking sufficient time to practice each exercise with care and attention to detail.
\subsection{Single-Machine Broadcast Activity}
\label{id2457521}\hypertarget{id2457521}{}%

In this section, we start a single Windows 9x/Me machine, then monitor network activity for 30 minutes.
Monitoring Windows 9x Steps\begin{enumerate}

\item{Start the machine from which network activity will be monitored (using {\bfseries{Wireshark}}). Launch {\bfseries{Wireshark}}, click {\sffamily \bfseries Capture} $\to$ {\sffamily \bfseries Start}.  Click the following: 
\begin{enumerate}
%--- Item
\item 
Update list of packets in real time


%--- Item
\item 
Automatic scrolling in live capture


%--- Item
\item 
Enable MAC name resolution


%--- Item
\item 
Enable network name resolution


%--- Item
\item 
Enable transport name resolution

\end{enumerate}
 Click {\sffamily \bfseries OK}.}

\item{Start the Windows 9x/Me machine to be monitored. Let it run for a full 30 minutes. While monitoring, do not press any keyboard keys, do not click any on-screen icons or menus, and do not answer any dialog boxes.}

\item{At the conclusion of 30 minutes, stop the capture. Save the capture to a file so you can go back to it later. Leave this machine running in preparation for the task in \hyperlink{secondmachine}{Section {\ref{secondmachine}}}.}

\item{Analyze the capture. Identify each discrete message type that was captured. Note what transport protocol was used. Identify the timing between messages of identical types.}
\end{enumerate}
\subsubsection{Findings}
\label{id2559173}\hypertarget{id2559173}{}%

The summary of the first 10 minutes of the packet capture should look like \hyperlink{pktcap01}{Figure {\ref{pktcap01}}}. A screenshot of a later stage of the same capture is shown in \hyperlink{pktcap02}{Figure {\ref{pktcap02}}}.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{pktcap01}{}%
\includegraphics[scale=0.4]{Samba3-ByExample/images/WINREPRESSME-Capture}
{{\caption[{Windows Me ---  Broadcasts ---  The First 10 Minutes}]{{{Windows Me ---  Broadcasts ---  The First 10 Minutes}}}\label{pktcap01}}}
\end{center}
\end{figure}


% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{pktcap02}{}%
\includegraphics[scale=0.42]{Samba3-ByExample/images/WINREPRESSME-Capture2}
{{\caption[{Windows Me ---  Later Broadcast Sample}]{{{Windows Me ---  Later Broadcast Sample}}}\label{pktcap02}}}
\end{center}
\end{figure}


\index{Local Master Browser|textit{see} {LMB} }\index{LMB} Broadcast messages observed are shown in \hyperlink{capsstats01}{Table {\ref{capsstats01}}}. Actual observations vary a little, but not by much. Early in the startup process, the Windows Me machine broadcasts its name for two reasons: first to ensure that its name would not result in a name clash, and second to establish its presence with the Local Master Browser (LMB).

% table ------------------------------------------------------
\begin{table}[htb]
\begin{center}%
\hypertarget{capsstats01}{}%
\captionswapskip{}{{\caption{Windows Me ---  Startup Broadcast Capture Statistics}\label{capsstats01}}}
\captionswapskip{}\begin{tabularx}{\linewidth}{|>{\hsize=0.999999999999999\hsize\RaggedRight}X|c|c|>{\hsize=0.999999999999999\hsize\RaggedRight}X|}
\hline 
{{{\bfseries Message}}} & {{{\bfseries Type}}} & {{{\bfseries Num}}} & {{{\bfseries Notes}}} \tabularnewline
 \hline 
{{WINEPRESSME\textless{}00\textgreater{}}} & {{Reg}} & {{8}} & {{4 lots of 2, 0.6 sec apart}} \tabularnewline
 \hline 
{{WINEPRESSME\textless{}03\textgreater{}}} & {{Reg}} & {{8}} & {{4 lots of 2, 0.6 sec apart}} \tabularnewline
 \hline 
{{WINEPRESSME\textless{}20\textgreater{}}} & {{Reg}} & {{8}} & {{4 lots of 2, 0.75 sec apart}} \tabularnewline
 \hline 
{{MIDEARTH\textless{}00\textgreater{}}} & {{Reg}} & {{8}} & {{4 lots of 2, 0.75 sec apart}} \tabularnewline
 \hline 
{{MIDEARTH\textless{}1d\textgreater{}}} & {{Reg}} & {{8}} & {{4 lots of 2, 0.75 sec apart}} \tabularnewline
 \hline 
{{MIDEARTH\textless{}1e\textgreater{}}} & {{Reg}} & {{8}} & {{4 lots of 2, 0.75 sec apart}} \tabularnewline
 \hline 
{{MIDEARTH\textless{}1b\textgreater{}}} & {{Qry}} & {{84}} & {{300 sec apart at stable operation}} \tabularnewline
 \hline 
{{\_\_MSBROWSE\_\_}} & {{Reg}} & {{8}} & {{Registered after winning election to Browse Master}} \tabularnewline
 \hline 
{{JHT\textless{}03\textgreater{}}} & {{Reg}} & {{8}} & {{4 x 2. This is the name of the user that logged onto Windows}} \tabularnewline
 \hline 
{{Host Announcement WINEPRESSME}} & {{Ann}} & {{2}} & {{Observed at 10 sec}} \tabularnewline
 \hline 
{{Domain/Workgroup Announcement MIDEARTH}} & {{Ann}} & {{18}} & {{300 sec apart at stable operation}} \tabularnewline
 \hline 
{{Local Master Announcement WINEPRESSME}} & {{Ann}} & {{18}} & {{300 sec apart at stable operation}} \tabularnewline
 \hline 
{{Get Backup List Request}} & {{Qry}} & {{12}} & {{6 x 2 early in startup, 0.5 sec apart}} \tabularnewline
 \hline 
{{Browser Election Request}} & {{Ann}} & {{10}} & {{5 x 2 early in startup}} \tabularnewline
 \hline 
{{Request Announcement WINEPRESSME}} & {{Ann}} & {{4}} & {{Early in startup}} \tabularnewline
\hline 
\end{tabularx}
\end{center}
\end{table}


\index{election}\index{browse master} From the packet trace, it should be noted that no messages were propagated over TCP/IP; all messages employed UDP/IP. When steady-state operation has been achieved, there is a cycle of various announcements, re-election of a browse master, and name queries. These create the symphony of announcements by which network browsing is made possible.

\index{CIFS} For detailed information regarding the precise behavior of the CIFS/SMB protocols, refer to the book {``}Implementing CIFS: The Common Internet File System,{''} by Christopher Hertel, (Prentice Hall PTR, ISBN: 013047116X).
\subsection{Second Machine Startup Broadcast Interaction}
\label{secondmachine}\hypertarget{secondmachine}{}%

At this time, the machine you used to capture the single-system startup trace should still be running. The objective of this task is to identify the interaction of two machines in respect to broadcast activity.
Monitoring of Second Machine Activity\begin{enumerate}

\item{On the machine from which network activity will be monitored (using {\bfseries{Wireshark}}), launch {\bfseries{Wireshark}} and click {\sffamily \bfseries Capture} $\to$ {\sffamily \bfseries Start}.  Click: 
\begin{enumerate}
%--- Item
\item 
Update list of packets in real time


%--- Item
\item 
Automatic scrolling in live capture


%--- Item
\item 
Enable MAC name resolution


%--- Item
\item 
Enable network name resolution


%--- Item
\item 
Enable transport name resolution

\end{enumerate}
 Click {\sffamily \bfseries OK}.}

\item{Start the second Windows 9x/Me machine. Let it run for 15 to 20 minutes. While monitoring, do not press any keyboard keys, do not click any on-screen icons or menus, and do not answer any dialog boxes.}

\item{At the conclusion of the capture time, stop the capture. Be sure to save the captured data so you can examine the network data capture again at a later date should that be necessary.}

\item{Analyze the capture trace, taking note of the transport protocols used, the types of messages observed, and what interaction took place between the two machines. Leave both machines running for the next task.}
\end{enumerate}
\subsubsection{Findings}
\label{id2559802}\hypertarget{id2559802}{}%

\hyperlink{capsstats02}{Table {\ref{capsstats02}}} summarizes capture statistics observed. As in the previous case, all announcements used UDP/IP broadcasts. Also, as was observed with the last example, the second Windows 9x/Me machine broadcasts its name on startup to ensure that there exists no name clash (i.e., the name is already registered by another machine) on the network segment. Those wishing to explore the inner details of the precise mechanism of how this functions should refer to {``}Implementing CIFS: The Common Internet File System.{''}

% table ------------------------------------------------------
\begin{table}[htb]
\begin{center}%
\hypertarget{capsstats02}{}%
\captionswapskip{}{{\caption{Second Machine (Windows 98) ---  Capture Statistics}\label{capsstats02}}}
\captionswapskip{}\begin{tabularx}{\linewidth}{|>{\hsize=0.999999999999999\hsize\RaggedRight}X|c|c|>{\hsize=0.999999999999999\hsize\RaggedRight}X|}
\hline 
{{{\bfseries Message}}} & {{{\bfseries Type}}} & {{{\bfseries Num}}} & {{{\bfseries Notes}}} \tabularnewline
 \hline 
{{MILGATE98\textless{}00\textgreater{}}} & {{Reg}} & {{8}} & {{4 lots of 2, 0.6 sec apart}} \tabularnewline
 \hline 
{{MILGATE98\textless{}03\textgreater{}}} & {{Reg}} & {{8}} & {{4 lots of 2, 0.6 sec apart}} \tabularnewline
 \hline 
{{MILGATE98\textless{}20\textgreater{}}} & {{Reg}} & {{8}} & {{4 lots of 2, 0.75 sec apart}} \tabularnewline
 \hline 
{{MIDEARTH\textless{}00\textgreater{}}} & {{Reg}} & {{8}} & {{4 lots of 2, 0.75 sec apart}} \tabularnewline
 \hline 
{{MIDEARTH\textless{}1d\textgreater{}}} & {{Reg}} & {{8}} & {{4 lots of 2, 0.75 sec apart}} \tabularnewline
 \hline 
{{MIDEARTH\textless{}1e\textgreater{}}} & {{Reg}} & {{8}} & {{4 lots of 2, 0.75 sec apart}} \tabularnewline
 \hline 
{{MIDEARTH\textless{}1b\textgreater{}}} & {{Qry}} & {{18}} & {{900 sec apart at stable operation}} \tabularnewline
 \hline 
{{JHT\textless{}03\textgreater{}}} & {{Reg}} & {{2}} & {{This is the name of the user that logged onto Windows}} \tabularnewline
 \hline 
{{Host Announcement MILGATE98}} & {{Ann}} & {{14}} & {{Every 120 sec}} \tabularnewline
 \hline 
{{Domain/Workgroup Announcement MIDEARTH}} & {{Ann}} & {{6}} & {{900 sec apart at stable operation}} \tabularnewline
 \hline 
{{Local Master Announcement WINEPRESSME}} & {{Ann}} & {{6}} & {{Insufficient detail to determine frequency}} \tabularnewline
\hline 
\end{tabularx}
\end{center}
\end{table}


\index{host announcement} \index{Local Master Announcement} \index{Workgroup Announcement} Observation of the contents of Host Announcements, Domain/Workgroup Announcements, and Local Master Announcements is instructive. These messages convey a significant level of detail regarding the nature of each machine that is on the network. An example dissection of a Host Announcement is given in \hyperlink{hostannounce}{Figure {\ref{hostannounce}}}.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{hostannounce}{}%
\includegraphics[scale=0.41]{Samba3-ByExample/images/HostAnnouncment}
{{\caption[{Typical Windows 9x/Me Host Announcement}]{{{Typical Windows 9x/Me Host Announcement}}}\label{hostannounce}}}
\end{center}
\end{figure}

\subsection{Simple Windows Client Connection Characteristics}
\label{id2574732}\hypertarget{id2574732}{}%

The purpose of this exercise is to discover how Microsoft Windows clients create (establish) connections with remote servers. The methodology involves analysis of a key aspect of how Windows clients access remote servers: the session setup protocol.
Client Connection Exploration Steps\begin{enumerate}

\item{Configure a Windows 9x/Me machine (MILGATE98) with a share called {\texttt{\docbookhyphenatedot{Stuff}}}. Create a {\ttfamily\itshape{\docbookhyphenatedot{Full Access}}} control password on this share.}

\item{Configure another Windows 9x/Me machine (WINEPRESSME) as a client. Make sure that it exports no shared resources.}

\item{Start both Windows 9x/Me machines and allow them to stabilize for 10 minutes. Log on to both machines using a user name (JHT) of your choice. Wait approximately 2 minutes before proceeding.}

\item{Start Wireshark (or the network sniffer of your choice).}

\item{From the WINEPRESSME machine, right-click {\sffamily \bfseries Network Neighborhood}, select {\sffamily \bfseries Explore}, select {\sffamily \bfseries My Network Places} $\to$ {\sffamily \bfseries Entire Network} $\to$ {\sffamily \bfseries MIDEARTH} $\to$ {\sffamily \bfseries MILGATE98} $\to$ {\sffamily \bfseries Stuff}. Enter the password you set for the {\texttt{\docbookhyphenatedot{Full Control}}} mode for the {\texttt{\docbookhyphenatedot{Stuff}}} share.}

\item{When the share called {\texttt{\docbookhyphenatedot{Stuff}}} is being displayed, stop the capture. Save the captured data in case it is needed for later analysis.}

\item{\index{session setup} From the top of the packets captured, scan down to locate the first packet that has interpreted as {\texttt{\docbookhyphenatedot{Session Setup AndX, User: anonymous; Tree Connect AndX, Path: \textbackslash \textbackslash MILGATE98\textbackslash IPC\$}}}.}

\item{\index{Session Setup}\index{Tree Connect} In the dissection (analysis) panel, expand the {\texttt{\docbookhyphenatedot{SMB, Session Setup AndX Request, and Tree Connect AndX Request}}}. Examine both operations. Identify the name of the user Account and what password was used. The Account name should be empty. This is a {\texttt{\docbookhyphenatedot{NULL}}} session setup packet.}

\item{Return to the packet capture sequence. There will be a number of packets that have been decoded of the type {\texttt{\docbookhyphenatedot{Session Setup AndX}}}. Locate the last such packet that was targeted at the {\texttt{\docbookhyphenatedot{\textbackslash \textbackslash MILGATE98\textbackslash IPC\$}}} service.}

\item{\index{password length} \index{User Mode} Dissect this packet as per the previous one. This packet should have a password length of 24 (characters) and should have a password field, the contents of which is a long hexadecimal number. Observe the name in the Account field. This is a User Mode session setup packet.}
\end{enumerate}
\subsubsection{Findings and Comments}
\label{id2574953}\hypertarget{id2574953}{}%

\index{IPC\$} The {\texttt{\docbookhyphenatedot{IPC\$}}} share serves a vital purpose\label{id2574970}\begingroup\catcode`\#=12\footnote{
TOSHARG2, Sect 4.5.1
}\endgroup\docbooktolatexmakefootnoteref{id2574970} in SMB/CIFS-based networking. A Windows client connects to this resource to obtain the list of resources that are available on the server. The server responds with the shares and print queues that are available. In most but not all cases, the connection is made with a {\texttt{\docbookhyphenatedot{NULL}}} username and a {\texttt{\docbookhyphenatedot{NULL}}} password.

\index{account credentials} The two packets examined are material evidence of how Windows clients may interoperate with Samba. Samba requires every connection setup to be authenticated using valid UNIX account credentials (UID/GID). This means that even a {\texttt{\docbookhyphenatedot{NULL}}} session setup can be established only by automatically mapping it to a valid UNIX account.

\index{NULL session}\index{guest account} \index{nobody} Samba has a special name for the {\texttt{\docbookhyphenatedot{NULL}}}, or empty, user account: it calls it the \smbconfoption{guest account}. The default value of this parameter is {\texttt{\docbookhyphenatedot{nobody}}}; however, this can be changed to map the function of the guest account to any other UNIX identity. Some UNIX administrators prefer to map this account to the system default anonymous FTP account. A sample NULL Session Setup AndX packet dissection is shown in \hyperlink{nullconnect}{Figure {\ref{nullconnect}}}.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{nullconnect}{}%
\includegraphics[scale=0.41]{Samba3-ByExample/images/NullConnect}
{{\caption[{Typical Windows 9x/Me NULL SessionSetUp AndX Request}]{{{Typical Windows 9x/Me NULL SessionSetUp AndX Request}}}\label{nullconnect}}}
\end{center}
\end{figure}


\index{nobody} \index{/etc/passwd} \index{guest account} When a UNIX/Linux system does not have a {\texttt{\docbookhyphenatedot{nobody}}} user account ({\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}}), the operation of the {\texttt{\docbookhyphenatedot{NULL}}} account cannot validate and thus connections that utilize the guest account fail. This breaks all ability to browse the Samba server and is a common problem reported on the Samba mailing list. A sample User Mode session setup AndX is shown in \hyperlink{userconnect}{Figure {\ref{userconnect}}}.

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{userconnect}{}%
\includegraphics[scale=0.41]{Samba3-ByExample/images/UserConnect}
{{\caption[{Typical Windows 9x/Me User SessionSetUp AndX Request}]{{{Typical Windows 9x/Me User SessionSetUp AndX Request}}}\label{userconnect}}}
\end{center}
\end{figure}


\index{encrypted} The User Mode connection packet contains the account name and the domain name. The password is provided in Microsoft encrypted form, and its length is shown as 24 characters. This is the length of Microsoft encrypted passwords.
\subsection{Windows 200x/XP Client Interaction with Samba-3}
\label{id2575142}\hypertarget{id2575142}{}%

By now you may be asking, {``}Why did you choose to work with Windows 9x/Me?{''}

First, we want to demonstrate the simple case. This book is not intended to be a detailed treatise on the Windows networking protocols, but rather to provide prescriptive guidance for deployment of Samba. Second, by starting out with the simple protocol, it can be demonstrated that the more complex case mostly follows the same principles.

The following exercise demonstrates the case that even MS Windows XP Professional with up-to-date service updates also uses the {\texttt{\docbookhyphenatedot{NULL}}} account, as well as user accounts. Simply follow the procedure to complete this exercise.

To complete this exercise, you need a Windows XP Professional client that has been configured as a domain member of either a Samba-controlled domain or a Windows NT4 or 200x Active Directory domain. Here we do not provide details for how to configure this, as full coverage is provided earlier in this book.
Steps to Explore Windows XP Pro Connection Set-up\begin{enumerate}

\item{Start your domain controller. Also, start the Wireshark monitoring machine, launch Wireshark, and then wait for the next step to complete.}

\item{Start the Windows XP Client and wait 5 minutes before proceeding.}

\item{On the machine from which network activity will be monitored (using {\bfseries{Wireshark}}), launch {\bfseries{Wireshark}} and click {\sffamily \bfseries Capture} $\to$ {\sffamily \bfseries Start}.  Click: 
\begin{enumerate}
%--- Item
\item 
Update list of packets in real time


%--- Item
\item 
Automatic scrolling in live capture


%--- Item
\item 
Enable MAC name resolution


%--- Item
\item 
Enable network name resolution


%--- Item
\item 
Enable transport name resolution

\end{enumerate}
 Click {\sffamily \bfseries OK}.}

\item{On the Windows XP Professional client, press {\sffamily \bfseries Ctrl-Alt-Delete} to bring up the domain logon screen. Log in using valid credentials for a domain user account.}

\item{Now proceed to connect to the domain controller as follows: {\sffamily \bfseries Start} $\to$ {\sffamily \bfseries (right-click) My Network Places} $\to$ {\sffamily \bfseries Explore} $\to$ {\sffamily \bfseries \{Left Panel\} [+] Entire Network} $\to$ {\sffamily \bfseries \{Left Panel\} [+] Microsoft Windows Network} $\to$ {\sffamily \bfseries \{Left Panel\} [+] Midearth} $\to$ {\sffamily \bfseries \{Left Panel\} [+] Frodo} $\to$ {\sffamily \bfseries \{Left Panel\} [+] data}. Close the explorer window.  In this step, our domain name is {\texttt{\docbookhyphenatedot{Midearth}}}, the domain controller is called {\texttt{\docbookhyphenatedot{Frodo}}}, and we have connected to a share called {\texttt{\docbookhyphenatedot{data}}}.}

\item{Stop the capture on the {\bfseries{Wireshark}} monitoring machine. Be sure to save the captured data to a file so that you can refer to it again later.}

\item{If desired, the Windows XP Professional client and the domain controller are no longer needed for exercises in this chapter.}

\item{\index{NTLMSSP\_AUTH} \index{session setup} From the top of the packets captured, scan down to locate the first packet that has interpreted as {\texttt{\docbookhyphenatedot{Session Setup AndX Request, NTLMSSP\_AUTH}}}.}

\item{\index{GSS-API} \index{SPNEGO} \index{NTLMSSP} In the dissection (analysis) panel, expand the {\texttt{\docbookhyphenatedot{SMB, Session Setup AndX Request}}}. Expand the packet decode information, beginning at the {\texttt{\docbookhyphenatedot{Security Blob:}}} entry. Expand the {\texttt{\docbookhyphenatedot{GSS-API -\textgreater{} SPNEGO -\textgreater{} netTokenTarg -\textgreater{} responseToken -\textgreater{} NTLMSSP}}} keys. This should reveal that this is a {\texttt{\docbookhyphenatedot{NULL}}} session setup packet. The {\texttt{\docbookhyphenatedot{User name: NULL}}} so indicates. An example decode is shown in \hyperlink{XPCap01}{Figure {\ref{XPCap01}}}.}

\item{Return to the packet capture sequence. There will be a number of packets that have been decoded of the type {\texttt{\docbookhyphenatedot{Session Setup AndX Request}}}. Click the last such packet that has been decoded as {\texttt{\docbookhyphenatedot{Session Setup AndX Request, NTLMSSP\_AUTH}}}.}

\item{\index{encrypted password} In the dissection (analysis) panel, expand the {\texttt{\docbookhyphenatedot{SMB, Session Setup AndX Request}}}. Expand the packet decode information, beginning at the {\texttt{\docbookhyphenatedot{Security Blob:}}} entry. Expand the {\texttt{\docbookhyphenatedot{GSS-API -\textgreater{} SPNEGO -\textgreater{} netTokenTarg -\textgreater{} responseToken -\textgreater{} NTLMSSP}}} keys. This should reveal that this is a {\texttt{\docbookhyphenatedot{User Mode}}} session setup packet. The {\texttt{\docbookhyphenatedot{User name: jht}}} so indicates. An example decode is shown in \hyperlink{XPCap02}{Figure {\ref{XPCap02}}}. In this case the user name was {\texttt{\docbookhyphenatedot{jht}}}. This packet decode includes the {\texttt{\docbookhyphenatedot{Lan Manager Response:}}} and the {\texttt{\docbookhyphenatedot{NTLM Response:}}}. The values of these two parameters are the Microsoft encrypted password hashes: respectively, the LanMan password and then the NT (case-preserving) password hash.}

\item{\index{password length} \index{User Mode} The passwords are 24-character hexadecimal numbers. This packet confirms that this is a User Mode session setup packet.}
\end{enumerate}

% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{XPCap01}{}%
\includegraphics[scale=0.5]{Samba3-ByExample/images/WindowsXP-NullConnection}
{{\caption[{Typical Windows XP NULL Session Setup AndX Request}]{{{Typical Windows XP NULL Session Setup AndX Request}}}\label{XPCap01}}}
\end{center}
\end{figure}


% figure ------------------------------------------------------
\begin{figure}[hbt]
\begin{center}%
\hypertarget{XPCap02}{}%
\includegraphics[scale=0.5]{Samba3-ByExample/images/WindowsXP-UserConnection}
{{\caption[{Typical Windows XP User Session Setup AndX Request}]{{{Typical Windows XP User Session Setup AndX Request}}}\label{XPCap02}}}
\end{center}
\end{figure}

\subsubsection{Discussion}
\label{id2575597}\hypertarget{id2575597}{}%

\index{NULL-Session} This exercise demonstrates that, while the specific protocol for the Session Setup AndX is handled in a more sophisticated manner by recent MS Windows clients, the underlying rules or principles remain the same. Thus it is demonstrated that MS Windows XP Professional clients still use a {\texttt{\docbookhyphenatedot{NULL-Session}}} connection to query and locate resources on an advanced network technology server (one using Windows NT4/200x or Samba). It also demonstrates that an authenticated connection must be made before resources can be used.
\subsection{Conclusions to Exercises}
\label{id2575627}\hypertarget{id2575627}{}%

In summary, the following points have been established in this chapter:

\begin{itemize}
%--- Item
\item 
When NetBIOS over TCP/IP protocols are enabled, MS Windows networking employs broadcast-oriented messaging protocols to provide knowledge of network services.


%--- Item
\item 
Network browsing protocols query information stored on browse masters that manage information provided by NetBIOS Name Registrations and by way of ongoing host announcements and workgroup announcements.


%--- Item
\item 
All Samba servers must be configured with a mechanism for mapping the {\texttt{\docbookhyphenatedot{NULL-Session}}} to a valid but nonprivileged UNIX system account.


%--- Item
\item 
The use of Microsoft encrypted passwords is built right into the fabric of Windows networking operations. Such passwords cannot be provided from the UNIX {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}} database and thus must be stored elsewhere on the UNIX system in a manner that Samba can use. Samba-2.x permitted such encrypted passwords to be stored in the {\texttt{\docbookhyphenatedot{smbpasswd}}} file or in an LDAP database. Samba-3 permits use of multiple {\ttfamily\itshape{\docbookhyphenatedot{passdb backend}}} databases in concurrent deployment. Refer to {\em{TOSHARG2}}, Chapter 10, {``}Account Information Databases.{''}

\end{itemize}

% ------------------------   
% Section 
\section{Dissection and Discussion}
\label{chap01conc}\hypertarget{chap01conc}{}%

\index{guest account} The exercises demonstrate the use of the {\texttt{\docbookhyphenatedot{guest}}} account, the way that MS Windows clients and servers resolve computer names to a TCP/IP address, and how connections between a client and a server are established.

Those wishing background information regarding NetBIOS name types should refer to the Microsoft knowledgebase article Q102878.\label{id2575728}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://support.microsoft.com/support/kb/articles/Q102/78/8.asp}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2575728}
\subsection{Technical Issues}
\label{id2575735}\hypertarget{id2575735}{}%

\index{guest account} Network browsing involves SMB broadcast announcements, SMB enumeration requests, connections to the {\texttt{\docbookhyphenatedot{IPC\$}}} share, share enumerations, and SMB connection setup processes. The use of anonymous connections to a Samba server involve the use of the {\ttfamily\itshape{\docbookhyphenatedot{guest account}}} that must map to a valid UNIX UID.

% ------------------------   
% Section 
\section{Questions and Answers}
\label{chap01qa}\hypertarget{chap01qa}{}%

The questions and answers given in this section are designed to highlight important aspects of Microsoft Windows networking.
% -------------------------------------------------------------
% QandASet                                                     
% -------------------------------------------------------------
\subsection*{F.A.Q.}
\label{id2575779}
\vspace{1em}
\noindent{}1.~\textbf{Q:}~\textit{What is the significance of the MIDEARTH\textless{}1b\textgreater{} type query?}
\newline
\noindent\textbf{A:}~
\index{Domain Master Browser|textit{see} {DMB} } \index{DMB} This is a broadcast announcement by which the Windows machine is attempting to locate a Domain Master Browser (DMB) in the event that it might exist on the network. Refer to {\em{TOSHARG2,}} Chapter 9, Section 9.7, {``}Technical Overview of Browsing,{''} for details regarding the function of the DMB and its role in network browsing.


\vspace{1em}
\vspace{1em}
\noindent{}2.~\textbf{Q:}~\textit{What is the significance of the MIDEARTH\textless{}1d\textgreater{} type name registration?}
\newline
\noindent\textbf{A:}~
\index{Local Master Browser|textit{see} {LMB} } \index{LMB} This name registration records the machine IP addresses of the LMBs. Network clients can query this name type to obtain a list of browser servers from the master browser.

The LMB is responsible for monitoring all host announcements on the local network and for collating the information contained within them. Using this information, it can provide answers to other Windows network clients that request information such as:

\begin{itemize}
%--- Item
\item 
The list of machines known to the LMB (i.e., the browse list)


%--- Item
\item 
The IP addresses of all domain controllers known for the domain


%--- Item
\item 
The IP addresses of LMBs


%--- Item
\item 
The IP address of the DMB (if one exists)


%--- Item
\item 
The IP address of the LMB on the local segment

\end{itemize}


\vspace{1em}
\vspace{1em}
\noindent{}3.~\textbf{Q:}~\textit{What is the role and significance of the \textless{}01\textgreater{}\textless{}02\textgreater{}\_\_MSBROWSE\_\_\textless{}02\textgreater{}\textless{}01\textgreater{} name registration?}
\newline
\noindent\textbf{A:}~
\index{Browse Master} This name is registered by the browse master to broadcast and receive domain announcements. Its scope is limited to the local network segment, or subnet. By querying this name type, master browsers on networks that have multiple domains can find the names of master browsers for each domain.


\vspace{1em}
\vspace{1em}
\noindent{}4.~\textbf{Q:}~\textit{What is the significance of the MIDEARTH\textless{}1e\textgreater{} type name registration?}
\newline
\noindent\textbf{A:}~
\index{Browser Election Service} This name is registered by all browse masters in a domain or workgroup. The registration name type is known as the Browser Election Service. Master browsers register themselves with this name type so that DMBs can locate them to perform cross-subnet browse list updates. This name type is also used to initiate elections for Master Browsers.


\vspace{1em}
\vspace{1em}
\noindent{}5.~\textbf{Q:}~\textit{\index{guest account} What is the significance of the {\ttfamily\itshape{\docbookhyphenatedot{guest account}}} in smb.conf?}
\newline
\noindent\textbf{A:}~
This parameter specifies the default UNIX account to which MS Windows networking NULL session connections are mapped. The default name for the UNIX account used for this mapping is called {\texttt{\docbookhyphenatedot{nobody}}}. If the UNIX/Linux system that is hosting Samba does not have a {\texttt{\docbookhyphenatedot{nobody}}} account and an alternate mapping has not been specified, network browsing will not work at all.

It should be noted that the {\ttfamily\itshape{\docbookhyphenatedot{guest account}}} is essential to Samba operation. Either the operating system must have an account called {\texttt{\docbookhyphenatedot{nobody}}} or there must be an entry in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file with a valid UNIX account, such as \smbconfoption{guest account} = ftp.


\vspace{1em}
\vspace{1em}
\noindent{}6.~\textbf{Q:}~\textit{Is it possible to reduce network broadcast activity with Samba-3?}
\newline
\noindent\textbf{A:}~
\index{WINS} \index{NetBIOS} Yes, there are two ways to do this. The first involves use of WINS (See {\em{TOSHARG2}}, Chapter 9, Section 9.5, {``}WINS ---  The Windows Inter-networking Name Server{''}); the alternate method involves disabling the use of NetBIOS over TCP/IP. This second method requires a correctly configured DNS server (see {\em{TOSHARG2}}, Chapter 9, Section 9.3, {``}Discussion{''}).

\index{broadcast} \index{NetBIOS!Node Type} \index{Hybrid} The use of WINS reduces network broadcast traffic. The reduction is greatest when all network clients are configured to operate in {\ttfamily\itshape{\docbookhyphenatedot{Hybrid Mode}}}. This can be effected through use of DHCP to set the NetBIOS node type to type 8 for all network clients. Additionally, it is beneficial to configure Samba to use \smbconfoption{name resolve order} = wins host cast.

\begin{admonition}{xslt/figures/note}{Note}% NOTICE: see the db2latex FAQ w.r.t db2latex variable $latex.admonition.path

Use of SMB without NetBIOS is possible only on Windows 200x/XP Professional clients and servers, as well as with Samba-3.
\end{admonition}



\vspace{1em}
\vspace{1em}
\noindent{}7.~\textbf{Q:}~\textit{Can I just use plain-text passwords with Samba?}
\newline
\noindent\textbf{A:}~
Yes, you can configure Samba to use plain-text passwords, though this does create a few problems.

First, the use of {\texttt{\docbookhyphenatefilename{/\dbz{}etc/\dbz{}passwd}}}-based plain-text passwords requires that registry modifications be made on all MS Windows client machines to enable plain-text passwords support. This significantly diminishes the security of MS Windows client operation. Many network administrators are bitterly opposed to doing this.

Second, Microsoft has not maintained plain-text password support since the default setting was made disabling this. When network connections are dropped by the client, it is not possible to re-establish the connection automatically. Users need to log off and then log on again. Plain-text password support may interfere with recent enhancements that are part of the Microsoft move toward a more secure computing environment.

Samba-3 supports Microsoft encrypted passwords. Be advised not to reintroduce plain-text password handling. Just create user accounts by running {\bfseries{smbpasswd -a 'username'}}

It is not possible to add a user to the {\ttfamily\itshape{\docbookhyphenatedot{passdb backend}}} database unless there is a UNIX system account for that user. On systems that run {\bfseries{winbindd}} to access the Samba PDC/BDC to provide Windows user and group accounts, the {\ttfamily\itshape{\docbookhyphenatedot{idmap uid, idmap gid}}} ranges set in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file provide the local UID/GIDs needed for local identity management purposes.


\vspace{1em}
\vspace{1em}
\noindent{}8.~\textbf{Q:}~\textit{What parameter in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file is used to enable the use of encrypted passwords?}
\newline
\noindent\textbf{A:}~
The parameter in the {\texttt{\docbookhyphenatefilename{smb.\dbz{}conf}}} file that controls this behavior is known as {\ttfamily\itshape{\docbookhyphenatedot{encrypt passwords}}}. The default setting for this in Samba-3 is {\texttt{\docbookhyphenatedot{Yes (Enabled)}}}.


\vspace{1em}
\vspace{1em}
\noindent{}9.~\textbf{Q:}~\textit{Is it necessary to specify \smbconfoption{encrypt passwords} = Yes when Samba-3 is configured as a domain member?}
\newline
\noindent\textbf{A:}~
No. This is the default behavior.


\vspace{1em}
\vspace{1em}
\noindent{}10.~\textbf{Q:}~\textit{Is it necessary to specify a {\ttfamily\itshape{\docbookhyphenatedot{guest account}}} when Samba-3 is configured as a domain member server?}
\newline
\noindent\textbf{A:}~
Yes. This is a local function on the server. The default setting is to use the UNIX account {\texttt{\docbookhyphenatedot{nobody}}}. If this account does not exist on the UNIX server, then it is necessary to provide a \smbconfoption{guest account} = an\_account, where {\texttt{\docbookhyphenatedot{an\_account}}} is a valid local UNIX user account.


\vspace{1em}
\cleardoublepage 
\newcommand{\dbappendix}[1]{\chapter{#1}}%
% ------------------------------------------------------------- 
% Appendices start here
% -------------------------------------------------------------
\appendix

% -------------------------------------------------------------
% appendix:  GNU General Public License version 3 
% ------------------------------------------------------------- 	
\dbappendix{GNU General Public License version 3}
\label{id2508589}\hypertarget{id2508589}{}%

Version 3, 29 June 2007

Copyright © 2007 Free Software Foundation, Inc. {\textless}\url{http://fsf.org/}{\textgreater}

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

\section*{Preamble}\label{id2466871}

The GNU General Public License is a free, copyleft license for software and other kinds of works.

The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program—to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.

To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.

For the developers’ and authors’ protection, the GPL clearly explains that there is no warranty for this free software. For both users’ and authors’ sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.

Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users’ freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.

Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.

The precise terms and conditions for copying, distribution and modification follow.

\paragraph*{TERMS AND CONDITIONS}\label{id2487460}

\noindent

\section*{0. Definitions.}\label{id2477729}

“This License” refers to version 3 of the GNU General Public License.

“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.

“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.

To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.

A “covered work” means either the unmodified Program or a work based on the Program.

To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.

To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.

An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.

\section*{1. Source Code.}\label{id2578909}

The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.

A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.

The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.

The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work’s System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.

The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.

The Corresponding Source for a work in source code form is that same work.

\section*{2. Basic Permissions.}\label{id2472059}

All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.

You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.

Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.

\section*{3. Protecting Users’ Legal Rights From Anti-Circumvention Law.}\label{id2463280}

No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.

When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work’s users, your or third parties’ legal rights to forbid circumvention of technological measures.

\section*{4. Conveying Verbatim Copies.}\label{id2463274}

You may convey verbatim copies of the Program’s source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.

You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.

\section*{5. Conveying Modified Source Versions.}\label{id2458709}

You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:

\begin{enumerate}[a]
%--- Item
\item 
The work must carry prominent notices stating that you modified it, and giving a relevant date.


%--- Item
\item 
The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.


%--- Item
\item 
You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.


%--- Item
\item 
If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.

\end{enumerate}

A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation’s users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.

\section*{6. Conveying Non-Source Forms.}\label{id2479119}

You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:

\begin{enumerate}[a]
%--- Item
\item 
Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.


%--- Item
\item 
Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.


%--- Item
\item 
Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.


%--- Item
\item 
Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.


%--- Item
\item 
Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.

\end{enumerate}

A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.

A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.

“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.

If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).

The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.

Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.

\section*{7. Additional Terms.}\label{id2487259}

“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.

When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.

Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:

\begin{enumerate}[a]
%--- Item
\item 
Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or


%--- Item
\item 
Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or


%--- Item
\item 
Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or


%--- Item
\item 
Limiting the use for publicity purposes of names of licensors or authors of the material; or


%--- Item
\item 
Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or


%--- Item
\item 
Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.

\end{enumerate}

All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.

If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.

Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.

\section*{8. Termination.}\label{id2481479}

You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).

However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.

Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.

Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.

\section*{9. Acceptance Not Required for Having Copies.}\label{id2501220}

You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.

\section*{10. Automatic Licensing of Downstream Recipients.}\label{id2484375}

Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.

An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party’s predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.

You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.

\section*{11. Patents.}\label{id2509795}

A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor’s “contributor version”.

A contributor’s “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.

Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor’s essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.

In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.

If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient’s use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.

If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.

A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.

Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.

\section*{12. No Surrender of Others’ Freedom.}\label{id2476150}

If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.

\section*{13. Use with the GNU Affero General Public License.}\label{id2521984}

Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.

\section*{14. Revised Versions of this License.}\label{id2485723}

The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.

If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choose that version for the Program.

Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.

\section*{15. Disclaimer of Warranty.}\label{id2486923}

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

\section*{16. Limitation of Liability.}\label{id2577163}

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

\section*{17. Interpretation of Sections 15 and 16.}\label{id2460792}

If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.

\paragraph*{END OF TERMS AND CONDITIONS}\label{id2570413}

\noindent

\section*{How to Apply These Terms to Your New Programs}\label{id2521573}

If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.

\begin{Verbatim}[]

one line to give the program’s name and a brief idea of what it does.
Copyright (C) year name of author

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see http://www.gnu.org/licenses/.
  
\end{Verbatim}

Also add information on how to contact you by electronic and paper mail.

If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:

\begin{Verbatim}[]

program Copyright (C) year name of author
This program comes with ABSOLUTELY NO WARRANTY; for details type ‘{\verb show w}’.
This is free software, and you are welcome to redistribute it
under certain conditions; type ‘{\verb show c}’ for details.
  
\end{Verbatim}

The hypothetical commands ‘{\texttt{\docbookhyphenatedot{show w}}}’ and ‘{\texttt{\docbookhyphenatedot{show c}}}’ should show the appropriate parts of the General Public License. Of course, your program’s commands might be different; for a GUI interface, you would use an “about box”.

You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see {\textless}\url{http://www.gnu.org/licenses/}{\textgreater}.

The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read {\textless}\url{http://www.gnu.org/philosophy/why-not-lgpl.html}{\textgreater}.


\cleardoublepage % ------------------------------------------------------------- 
% 
% GLOSSARY Glossary
% 
% ------------------------------------------------------------- 
\dbglossary{Glossary}
\label{id2496544}\hypertarget{id2496544}{}%
\noindent%
\begin{description}
\item[{Access Control List}]  ( {\texttt{\docbookhyphenatedot{ACL}}} ) 

A detailed list of permissions granted to users or groups with respect to file and network resource access.


\item[{Active Directory Service}]  ( {\texttt{\docbookhyphenatedot{ADS}}} ) 

A service unique to Microsoft Windows 200x servers that provides a centrally managed directory for management of user identities and computer objects, as well as the permissions each user or computer may be granted to access distributed network resources. ADS uses Kerberos-based authentication and LDAP over Kerberos for directory access.


\item[{Common Internet File System}]  ( {\texttt{\docbookhyphenatedot{CIFS}}} ) 

The new name for SMB. Microsoft renamed the SMB protocol to CIFS during the Internet hype in the 1990s. At about the time that the SMB protocol was renamed to CIFS, an additional dialect of the SMB protocol was in development. The need for the deployment of the NetBIOS layer was also removed, thus paving the way for use of the SMB protocol natively over TCP/IP (known as NetBIOS-less SMB or {``}naked{''} TCP transport).


\item[{Common UNIX Printing System}]  ( {\texttt{\docbookhyphenatedot{CUPS}}} ) 

A recent implementation of a high-capability printing system for UNIX developed by Easy Software Inc.\label{id2532824}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.easysw.com/}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2532824}. The design objective of CUPS was to provide a rich print processing system that has built-in intelligence that is capable of correctly rendering (processing) a file that is submitted for printing even if it was formatted for an entirely different printer.


\item[{Domain Master Browser}]  ( {\texttt{\docbookhyphenatedot{DMB}}} ) 

The Domain Master Browser maintains a list of all the servers that have announced their services within a given workgroup or NT domain.


\item[{Domain Name Service}]  ( {\texttt{\docbookhyphenatedot{DNS}}} ) 

A protocol by which computer hostnames may be resolved to the matching IP address/es. DNS is implemented by the Berkeley Internet Name Daemon. There exists a recent version of DNS that allows dynamic name registration by network clients or by a DHCP server. This recent protocol is known as dynamic DNS (DDNS).


\item[{Dynamic Host Configuration Protocol}]  ( {\texttt{\docbookhyphenatedot{DHCP}}} ) 

A protocol that was based on the BOOTP protocol that may be used to dynamically assign an IP address, from a reserved pool of addresses, to a network client or device. Additionally, DHCP may assign all network configuration settings and may be used to register a computer name and its address with a dynamic DNS server.


\item[{Group IDentifier}]  ( {\texttt{\docbookhyphenatedot{GID}}} ) 

The UNIX system group identifier; on older systems, a 32-bit unsigned integer, and on newer systems, an unsigned 64-bit integer. The GID is used in UNIX-like operating systems for all group-level access control.


\item[{Key Distribution Center}]  ( {\texttt{\docbookhyphenatedot{KDC}}} ) 

The Kerberos authentication protocol makes use of security keys (also called a ticket) by which access to network resources is controlled. The issuing of Kerberos tickets is effected by a KDC.


\item[{Lightweight Directory Access Protocol}]  ( {\texttt{\docbookhyphenatedot{LDAP}}} ) 

The Lightweight Directory Access Protocol is a technology that originated from the development of X.500 protocol specifications and implementations. LDAP was designed as a means of rapidly searching through X.500 information. Later LDAP was adapted as an engine that could drive its own directory database. LDAP is not a database per se; rather it is a technology that enables high-volume search and locate activity from clients that wish to obtain simply defined information about a subset of records that are stored in a database. LDAP does not have a particularly efficient mechanism for storing records in the database, and it has no concept of transaction processing nor of mechanisms for preserving data consistency. LDAP is premised around the notion that the search and read activity far outweigh any need to add, delete, or modify records. LDAP does provide a means for replication of the database to keep slave servers up to date with a master. It also has built-in capability to handle external references and deferral.


\item[{Local Master Browser}]  ( {\texttt{\docbookhyphenatedot{LMB}}} ) 

The Local Master Browser maintains a list of all servers that have announced themselves within a given workgroup or NT domain on a particular broadcast isolated subnet.


\item[{Media Access Control}]  ( {\texttt{\docbookhyphenatedot{MAC}}} ) 

The hard-coded address of the physical-layer device that is attached to the network. All network interface controllers must have a hard-coded and unique MAC address. The MAC address is 48 bits long.


\item[{NetBIOS Extended User Interface}]  ( {\texttt{\docbookhyphenatedot{NetBEUI}}} ) 

Very simple network protocol invented by IBM and Microsoft. It is used to do NetBIOS over Ethernet with low overhead. NetBEUI is a non-routable protocol.


\item[{Network Address Translation}]  ( {\texttt{\docbookhyphenatedot{NAT}}} ) 

Network address translation is a form of IP address masquerading. It ensures that internal private (RFC1918) network addresses from packets inside the network are rewritten so that TCP/IP packets that leave the server over a public connection are seen to come only from the external network address.


\item[{Network Basic Input/Output System}]  ( {\texttt{\docbookhyphenatedot{NetBIOS}}} ) 

NetBIOS is a simple application programming interface (API) invented in the 1980s that allows programs to send data to certain network names. NetBIOS is always run over another network protocol such as IPX/SPX, TCP/IP, or Logical Link Control (LLC). NetBIOS run over LLC is best known as NetBEUI (the NetBIOS Extended User Interface ---  a complete misnomer!).


\item[{NetBT}]  ( {\texttt{\docbookhyphenatedot{NBT}}} ) 

Protocol for transporting NetBIOS frames over TCP/IP. Uses ports 137, 138, and 139. NetBT is a fully routable protocol.


\item[{NT/LanManager Security Support Provider}]  ( {\texttt{\docbookhyphenatedot{NTLMSSP}}} ) 

The NTLM Security Support Provider (NTLMSSP) service in Windows NT4/200x/XP is responsible for handling all NTLM authentication requests. It is the front end for protocols such as SPNEGO, Schannel, and other technologies. The generic protocol family supported by NTLMSSP is known as GSSAPI, the Generic Security Service Application Program Interface specified in RFC2078.


\item[{Server Message Block}]  ( {\texttt{\docbookhyphenatedot{SMB}}} ) 

SMB was the original name of the protocol spoken by Samba. It was invented in the 1980s by IBM and adopted and extended further by Microsoft. Microsoft renamed the protocol to CIFS during the Internet hype in the 1990s.


\item[{The Simple and Protected GSS-API Negotiation}]  ( {\texttt{\docbookhyphenatedot{SPNEGO}}} ) 

The purpose of SPNEGO is to allow a client and server to negotiate a security mechanism for authentication. The protocol is specified in RFC2478 and uses tokens as built via ASN.1 DER. DER refers to Distinguished Encoding Rules. These are a set of common rules for creating binary encodings in a platform-independent manner. Samba has support for SPNEGO.


\item[{The Official Samba-3 HOWTO and Reference Guide, Second Edition}]  ( {\texttt{\docbookhyphenatedot{TOSHARG2}}} ) 

This book makes repeated reference to {``}The Official Samba-3 HOWTO and Reference Guide, Second Edition{''} by John H. Terpstra and Jelmer R. Vernooij. This publication is available from Amazon.com. Publisher: Prentice Hall PTR (August 2005), ISBN: 013122282.


\item[{User IDentifier}]  ( {\texttt{\docbookhyphenatedot{UID}}} ) 

The UNIX system user identifier; on older systems, a 32-bit unsigned integer, and on newer systems, an unsigned 64-bit integer. The UID is used in UNIX-like operating systems for all user-level access control.


\item[{Universal Naming Convention}]  ( {\texttt{\docbookhyphenatedot{UNC}}} ) 

A syntax for specifying the location of network resources (such as file shares). The UNC syntax was developed in the early days of MS DOS 3.x and is used internally by the SMB protocol.


\item[{Wireshark}]  ( {\texttt{\docbookhyphenatedot{wireshark}}} ) 

A network analyzer, also known as a network sniffer or a protocol analyzer. Formerly known as Ethereal, Wireshark is freely available for UNIX/Linux and Microsoft Windows systems from the Wireshark Web site\label{id2576793}\begingroup\catcode`\#=12\footnote{ {\textless}\url{http://www.wireshark.org}{\textgreater}}\endgroup\docbooktolatexmakefootnoteref{id2576793}.


\end{description}
\cleardoublepage \setlength\saveparskip\parskip
\setlength\saveparindent\parindent
\begin{dbtolatexindex}{id2408598}
\setlength\tempparskip\parskip \setlength\tempparindent\parindent
\parskip\saveparskip \parindent\saveparindent
\noindent \indexspace
\parskip\tempparskip
\parindent\tempparindent
\makeatletter\@input@{\jobname.ind}\makeatother
\end{dbtolatexindex}

\end{document}