summaryrefslogtreecommitdiff
path: root/docs-xml/using_samba/ch02.xml
blob: e632a42d237f30d5997aef18b93bbc5e51255eaf (plain)
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
<chapter label="2" id="SAMBA-CH-2">
<title>Installing Samba on a Unix System</title>




<para>
<indexterm id="ch02-idx-947293-0" class="startofrange"><primary>installing Samba</primary></indexterm>
<indexterm id="ch02-idx-947293-1"><primary>Samba</primary><secondary>installing</secondary><see>installing Samba</see></indexterm>Now that you know what Samba can do for you and your users, it's time to get your own network set up. Let's start with the installation of Samba itself on a Unix system. When dancing the samba, one learns by taking small steps. It's just the same when installing Samba; we need to teach it step by step. This chapter will help you to start off on the right foot.</para>


<para>For illustrative purposes, we will be installing the 2.0.4 version of the Samba server on a <indexterm id="ch02-idx-947307-0"><primary>Linux</primary><secondary>installing Samba on Linux system</secondary></indexterm>Linux<footnote label="1" id="ch02-pgfId-939741">


<para>If you haven't heard of Linux yet, then you're in for a treat. Linux is a freely distributed Unix-like operating system that runs on the Intel x86, Motorola PowerPC, and Sun Sparc platforms. The operating system is relatively easy to configure, extremely robust, and is gaining in popularity. You can get more information on the Linux operating system at <systemitem role="url">http://www.linux.org/</systemitem>.</para>


</footnote> system running version 2.0.31 of the kernel. However, the installation steps are the same for all of the platforms that Samba supports. A typical installation will take about an <indexterm id="ch02-idx-947305-0"><primary>installing Samba</primary><secondary>time required</secondary></indexterm>hour to complete, including downloading the source files and compiling them, setting up the configuration files, and testing the server.</para>


<para>
<indexterm id="ch02-idx-947306-0"><primary>installing Samba</primary><secondary>steps in</secondary></indexterm>Here is an overview of the steps:</para>


<orderedlist>
<listitem><para>Download the source or binary files.</para></listitem>
<listitem><para>Read the installation documentation.</para></listitem>
<listitem><para>Configure a makefile.</para></listitem>
<listitem><para>Compile the server code.</para></listitem>
<listitem><para>Install the server files.</para></listitem>
<listitem><para>Create a Samba configuration file.</para></listitem>
<listitem><para>Test the configuration file.</para></listitem>
<listitem><para>Start the Samba daemons.</para></listitem>
<listitem><para>Test the Samba daemons.</para></listitem>
</orderedlist>











<sect1 role="" label="2.1" id="ch02-85028">
<title>Downloading the Samba Distribution</title>


<para>
<indexterm id="ch02-idx-947308-0" class="startofrange"><primary>Samba</primary><secondary>downloading</secondary></indexterm>
<indexterm id="ch02-idx-947308-1" class="startofrange"><primary>Samba</primary><secondary>distribution</secondary></indexterm>

<!-- CD-ROM REFERENCE COMMENTED OUT FOR SAFARI VERSION OF THIS TITLE.

If
you want to get started quickly, the <indexterm
id="ch02-idx-947316-0" id="IXT-2-126769"><primary>CD-ROM with this
book</primary><secondary>Samba
distribution</secondary></indexterm>CD-ROM packaged with this book
contains both the sources and binaries of Samba that were available as
this book went to print. The CD is a mirror image of the files and
directories on the Samba download server: <systemitem
role="url">ftp.samba.org</systemitem> <indexterm
id="ch02-idx-947317-0" id="IXT-2-126770"><primary>FTP (File Transfer
Protocol)</primary><secondary>sites for Samba
downloads</secondary></indexterm> <indexterm
id="ch02-idx-947317-1" id="IXT-2-126771"><primary>downloads</primary><secondary>Samba</secondary></indexterm>.</para>

<para>On the other hand, if

--></para>


<para>If you want to download the latest version, the primary web site
for the Samba software is <indexterm id="ch02-idx-947318-0"><primary>URLs (uniform resource
locators)</primary><secondary>Samba</secondary></indexterm><systemitem role="url">http://www.samba.org</systemitem>. Once connected to this
page, you'll see links to several Samba mirror sites across the
world, both for the standard Samba web pages and sites devoted
exclusively to downloading Samba. For the best performance, choose a
site that is closest to your own geographic location.</para>


<para>The standard <indexterm id="ch02-idx-947320-0"><primary>Samba</primary><secondary>web
site</secondary></indexterm> <indexterm id="ch02-idx-947320-1"><primary>resources for further
information</primary><secondary>Samba</secondary></indexterm>Samba web
sites have Samba documentation and tutorials, mailing list archives,
and the latest Samba news, as well as source and binary distributions
of Samba. The download sites (sometimes called <emphasis>FTP
sites</emphasis>) have only the source and binary
distributions. Unless you specifically want an older version of the
Samba server or are going to install a binary distribution, download
the latest source distribution from the closest mirror site. This
distribution is always named:</para>


<programlisting>samba-latest.tar.gz</programlisting>


<!-- CD-ROM REFERENCE COMMENTED OUT FOR SAFARI VERSION OF THIS TITLE.

<para>If you choose to use the version of Samba that is located on the
CD-ROM packaged with this book, you should find the latest Samba
distribution in the base directory.</para>

-->

<sect2 role="" label="2.1.1" id="ch02-SECT-1.1">
<title>Binary or Source?</title>


<para>
<indexterm id="ch02-idx-947323-0"><primary>binary vs. source files</primary></indexterm>
<indexterm id="ch02-idx-947323-1"><primary>source vs. binary files</primary></indexterm>Precompiled packages are also available for a large number of Unix platforms. These packages contain binaries for each of the Samba executables as well as the standard Samba documentation. Note that while installing a binary distribution can save you a fair amount of trouble and time, there are a couple of issues that you should keep in mind when deciding whether to use the binary or compile the source yourself:</para>


<itemizedlist>
<listitem><para>The binary packages can lag behind the latest version
of the software by one or two (maybe more) minor releases, especially
after a series of small changes and for less popular
platforms. Compare the release notes for the source and binary
packages to make sure that there aren't any new features that
you need on your platform.

<!-- CD-ROM REFERENCE COMMENTED OUT FOR SAFARI VERSION OF THIS TITLE.

This is especially true of the sources and
binaries on the CD-ROM: at the time this book went to print, they were
from the latest production release of Samba. However, development is
ongoing, so the beta-test versions on the Internet will be
newer.

--></para></listitem>
<listitem><para>If you use a precompiled binary, you will need to ensure that you have the correct libraries required by the executables. On some platforms the executables are statically linked so this isn't an issue, but on modern Unix operating systems (e.g., Linux, SGI Irix, Solaris, HP-UX, etc.), libraries are often <indexterm id="ch02-idx-947325-0"><primary>dynamically linked libraries</primary></indexterm>dynamically linked. This means that the binary looks for the right version of each library on your system, so you may have to install a new version of a library. The <filename>README</filename> file or <filename>makefile</filename>
<indexterm id="ch02-idx-947333-0"><primary>makefiles</primary></indexterm> that accompanies the binary distribution should list any special requirements.<footnote label="2" id="ch02-pgfId-943622">


<para>This is especially true with programs that use <emphasis>glibc-2.1</emphasis> (which comes standard with Red Hat Linux 6). This library caused quite a consternation in the development community when it was released because it was incompatable with previous versions of <emphasis>g</emphasis><filename>libc</filename>.</para>


</footnote></para>


<para>Many machines with shared libraries come with a nifty tool called <emphasis>ldd</emphasis>
<indexterm id="ch02-idx-947322-0"><primary>ldd tool</primary></indexterm>. This tool will tell you which libraries a specific binary requires and which libraries on the system satisfy that requirement. For example, checking the <emphasis>smbd</emphasis> program on our test machine gave us:</para></listitem>
</itemizedlist>

<programlisting>$ <emphasis role="bold">ldd smbd</emphasis>
libreadline.so.3 =&gt; /usr/lib/libreadline.so.3
libdl.so.2 =&gt; /lib/libdl.so.2
libcrypt.so.1 =&gt; /lib/libcrypt.so.1
libc.so.6 =&gt; /lib/libc.so.6
libtermcap.so.2 =&gt; /lib/libtermcap.so.2
/lib/ld-linux.so.2 =&gt; /lib/ld-linux.so.2</programlisting>


<itemizedlist>
<listitem><para>If there are any incompatibilities between Samba and specific libraries on your machine, the distribution-specific documentation should highlight those.</para></listitem>
<listitem><para>Keep in mind that each binary distribution carries preset values about the target platform, such as default directories and configuration option values. Again, check the documentation and the makefile included in the source directory to see which directives and variables were used when the binary was compiled. In some cases, these will not be appropriate for your situation.</para>


<para>A few configuration items can be reset with command-line options at runtime instead of at compile time. For example, if your binary tries to place any log, lock, or status files in the "wrong" place (for example, in <filename>/usr/local</filename>  ), you can override this without recompiling.</para></listitem>
</itemizedlist>

<para>One point worth mentioning is that the Samba source requires an <indexterm id="ch02-idx-947324-0"><primary>ANSI C compilers</primary></indexterm>
<indexterm id="ch02-idx-947324-1"><primary>non-ANSI compilers</primary></indexterm>
<indexterm id="ch02-idx-947324-2"><primary>compilers</primary></indexterm>ANSI C compiler. If you are on a platform with a non-ANSI compiler, such as the <emphasis>cc</emphasis> compiler on SunOS version 4, you'll have to install an ANSI-compliant compiler such as <emphasis>gcc</emphasis> before you do anything else.<footnote label="3" id="ch02-pgfId-939049">


<para><emphasis>gcc</emphasis> binaries are available for almost every modern machine. See <systemitem role="url">http://www.gnu.org/</systemitem> for a list of sites with <emphasis>gcc</emphasis> and other GNU software.</para>


</footnote> If installing a compiler isn't something you want to wrestle with, you can start off with a binary package. However, for the most flexibility and compatibility on your system, we always recommend compiling from the latest source.</para>
</sect2>





<sect2 role="" label="2.1.2" id="ch02-SECT-1.2">
<title>Read the Documentation</title>


<para>
<indexterm id="ch02-idx-947327-0"><primary>documentation for Samba</primary><secondary>importance of reading</secondary></indexterm>
<indexterm id="ch02-idx-947327-1"><primary>reading documentation, importance of</primary></indexterm>
<indexterm id="ch02-idx-947327-2"><primary>Samba</primary><secondary>documentation, importance of reading</secondary></indexterm>This sounds like an obvious thing to say, but there have probably been times where you have uncompressed a package, blindly typed <literal>configure</literal>, <literal>make</literal>, and <literal>make</literal> <literal>install</literal>, and walked away to get another cup of coffee. We'll be the first to admit that we do that, many more times than we should. It's a bad idea&mdash;especially when planning a network with Samba.</para>


<para>Samba 2.0 automatically configures itself prior to compilation. This reduces the likelihood of a machine-specific problem, but there may be an option mentioned in the <filename>README</filename> file that you end up wishing for after Samba's been installed. With both source and binary packages you'll find a large number of documents in the <filename>docs</filename>
<indexterm id="ch02-idx-947328-0"><primary>docs directory</primary></indexterm> directory, in a variety of formats. The most important files to look at in the distribution are:</para>


<programlisting><indexterm id="ch02-idx-947329-0"><primary>Samba</primary><secondary>new features file</secondary></indexterm>
<indexterm id="ch02-idx-947329-1"><primary>installing Samba</primary><secondary>common problems</secondary></indexterm>WHATSNEW.txt
docs/textdocs/UNIX_INSTALL.txt</programlisting>


<para>These files tell you what features you can expect in your Samba distribution, and will highlight common installation problems that you're likely to face. Be sure to look over both of them before you start the compilation process.<indexterm id="ch02-idx-947311-0" class="endofrange" startref="ch02-idx-947308-0"/></para>
</sect2>
</sect1>









<sect1 role="" label="2.2" id="ch02-28558">
<title>Configuring Samba</title>


<para>
<indexterm id="ch02-idx-947339-0" class="startofrange"><primary>configuring Samba</primary></indexterm>
<indexterm id="ch02-idx-947339-1"><primary>configuring Samba</primary><secondary>configuration file</secondary><seealso>smb.conf (Samba configuration) file</seealso></indexterm>The <indexterm id="ch02-idx-947330-0"><primary>Samba</primary><secondary>configuring</secondary><see>configuring Samba</see></indexterm>source distribution of Samba 2.0 and above doesn't initially have a <indexterm id="ch02-idx-947337-0"><primary>makefiles</primary></indexterm>makefile. Instead, one is generated through a GNU <filename>configure</filename>
<indexterm id="ch02-idx-947338-0"><primary>configuring Samba</primary><secondary>configure script</secondary><tertiary>GNU</tertiary></indexterm>
<indexterm id="ch02-idx-947338-1"><primary>GNU configure script</primary></indexterm> script, which is located in the <filename>samba-2.0.x /source/</filename> directory. The <firstterm>configure</firstterm> script, which must be run as root, takes care of the machine-specific issues of building Samba. However, you still may want to decide on some global options. Global options can be set by passing options on the command-line:</para>


<programlisting># ./configure --with-ssl</programlisting>


<para>For example, this will configure the Samba makefile with support for the<indexterm id="ch02-idx-947347-0"><primary>SSL (Secure Sockets Layer) protocol</primary><secondary>support for</secondary></indexterm>
<indexterm id="ch02-idx-947347-1"><primary>Secure Sockets Layer protocol</primary><see>SSL</see></indexterm> Secure Sockets Layer (SSL) encryption protocol. If you would like a complete list of <indexterm id="ch02-idx-947348-0" class="startofrange"><primary>configuring Samba</primary><secondary>options</secondary></indexterm>options, type the following:</para>


<programlisting>#./configure --help</programlisting>


<para>
<indexterm id="ch02-idx-947349-0"><primary>enabling/disabling features</primary></indexterm>
<indexterm id="ch02-idx-947349-1"><primary>disabling/enabling features</primary></indexterm>Each of these options enable or disable various features. You typically enable a feature by specifying the <literal>--with-</literal><replaceable>feature</replaceable> option, which will cause the feature to be compiled and installed. Likewise, if you specify a <literal>--without-</literal><replaceable>feature</replaceable> option, the feature will be disabled. As of Samba 2.0.5, each of the following features is disabled by default:</para>


<varlistentry><term><literal>--with-afs</literal></term>
<listitem><para>Include support of the <indexterm id="ch02-idx-947353-0"><primary>Andrew Filesystem</primary><see>AFS files</see></indexterm>Andrew Filesystem from <indexterm id="ch02-idx-947354-0"><primary>Carnegie Mellon University</primary></indexterm>Carnegie Mellon University. If you're going to serve <indexterm id="ch02-idx-947355-0"><primary>AFS files, support for</primary></indexterm>AFS files via Samba, we recommend compiling Samba once first without enabling this feature to ensure that everything runs smoothly. Once that version is working smoothly, recompile Samba with this feature enabled and compare any errors you might receive against the previous setup.</para></listitem>
</varlistentry>


<varlistentry><term><literal>--with-dfs</literal></term>
<listitem><para>Include support for <indexterm id="ch02-idx-947356-0"><primary>DFS, support for</primary></indexterm>DFS, a later version of AFS, used by <indexterm id="ch02-idx-947357-0"><primary>OSF/1 (Digital Unix)</primary></indexterm>OSF/1 (Digital Unix). Note that this is <emphasis>not</emphasis> the same as Microsoft DFS, which is an entirely different filesystem. Again, we recommend compiling Samba once first without this feature to ensure that everything runs smoothly, then recompile with this feature to compare any errors against the previous setup.</para></listitem>
</varlistentry>


<varlistentry><term><literal>--with-krb4</literal>=<replaceable>base-directory</replaceable></term>
<listitem><para>Include support for <indexterm id="ch02-idx-947358-0"><primary>Kerberos, support for</primary></indexterm>Kerberos version 4.0, explicitly specifying the base directory of the distribution. Kerberos is a network security protocol from <indexterm id="ch02-idx-947359-0"><primary>MIT</primary></indexterm>MIT that uses <indexterm id="ch02-idx-947360-0"><primary>private key cryptography</primary></indexterm>
<indexterm id="ch02-idx-947360-1"><primary>cryptography, private key</primary></indexterm>private key cryptography to provide strong security between nodes. Incidentally, Microsoft has announced that Kerberos 5.0 will be the standard <indexterm id="ch02-idx-947362-0"><primary>authentication</primary><secondary>mechanisms for</secondary></indexterm>authentication mechanism for Microsoft Windows 2000 (NT 5.0). However, the Kerberos 5.0 authentication mechanisms are quite different from the Kerberos 4.0 <indexterm id="ch02-idx-947363-0"><primary>security</primary></indexterm>security mechanisms. If you have Kerberos version 4 on your system, the Samba team recommends that you upgrade and use the <literal>--with-krb5</literal> option (see the next item). You can find more information on <indexterm id="ch02-idx-947364-0"><primary>URLs (uniform resource locators)</primary><secondary>Kerberos</secondary></indexterm>Kerberos at <systemitem role="url">http://web.mit.edu/kerberos/www</systemitem>.</para></listitem>
</varlistentry>


<varlistentry><term><literal>--with-krb5</literal>=<replaceable>base-directory</replaceable></term>
<listitem><para>Include support for Kerberos version 5.0, explicitly specifying the base directory of the distribution. Microsoft has announced that Kerberos 5.0 will be the standard authentication mechanism for Microsoft Windows 2000 (NT 5.0). However, there is no guarantee that Microsoft will not extend Kerberos for their own needs in the future. Currently, Samba's Kerberos support only uses a plaintext password interface and not an encrypted one. You can find more information on Kerberos at its home page: <systemitem role="url">http://web.mit.edu/kerberos/www</systemitem>.</para></listitem>
</varlistentry>


<varlistentry><term><literal>--with-automount</literal></term>
<listitem><para>Include support for <indexterm id="ch02-idx-947365-0"><primary>automounter, support for</primary></indexterm>automounter, a feature often used on sites that offer NFS.</para></listitem>
</varlistentry>


<varlistentry><term><literal>--with-pam</literal></term>
<listitem><para>Include support for <indexterm id="ch02-idx-947368-0"><primary>pluggable authentication modules (