2
<body bgcolor="#ffffff">
4
<img src="samba2_xs.gif" border="0" alt=" " height="100" width="76"
5
hspace="10" align="left" />
7
<h1 class="head0">Chapter 11. Additional Samba Information</h1>
10
<p>This chapter wraps up our coverage of the
11
<em class="filename">smb.conf</em> configuration file with some
12
miscellaneous options that can perform a variety of tasks. We talk
13
briefly about options for time synchronization, internationalization,
14
messages, and common Windows bugs. For the most part, you will use
15
these options only in isolated circumstances.</p>
19
<div class="sect1"><a name="samba2-CHP-11-SECT-1"/>
21
<h2 class="head1">Time Synchronization</h2>
23
<p>In a network of computers, the systems on the network must agree on
24
the current time and also on what time files have been modified. One
25
example of the importance of synchronization is the
26
<a name="INDEX-1"/>roaming profiles we covered in
27
<a href="ch04.html">Chapter 4</a>. It is vital for all clients accessing a
28
roaming profile to agree on what time it is and which client last
29
modified the user's profile.</p>
31
<p><a name="INDEX-2"/>Time synchronization can also be
32
very important to programmers. A useful group of settings consists of
33
the following options:</p>
35
<blockquote><pre class="code">[global]
38
fake directory create times = yes
39
dos filetime resolution = yes
40
delete readonly = yes</pre></blockquote>
42
<p>If you set these options, Samba shares will provide compatibility of
43
file-modification times that Visual C++, <em class="emphasis">nmake</em>,
44
and other Microsoft programming tools require. Otherwise, PC
45
<em class="emphasis">make</em> programs might think that all the files in
46
a directory need to be recompiled every time. Obviously, this is not
47
the behavior you want.</p>
49
<p>In <a href="ch04.html">Chapter 4</a>, we showed you how to create a logon
50
script that used the <em class="emphasis">net
51
time</em><a name="INDEX-3"/> command to synchronize
52
clients' clocks automatically when they log on to
53
the domain. If your network is configured as a workgroup rather than
54
a domain, you can still make use of <em class="emphasis">net time</em> by
55
placing the command:</p>
57
<blockquote><pre class="code">net time \\<em class="replaceable">sambaserver</em> /set /yes</pre></blockquote>
59
<p>in a startup script on each client that is run when the system boots.
60
Samba always provides time service—regardless of whether it is
61
running as a primary domain controller—or the
62
<tt class="literal">time</tt> <tt class="literal">service</tt> configuration file
65
<p>Assuming that domain users log on to the domain at least once per day
66
and workgroup clients reboot frequently, the <em class="emphasis">net
67
time</em> command can keep client systems'
68
clocks fairly well synchronized. However, sometimes domain users stay
69
logged on for longer periods, and workgroup clients can run for days
70
between reboots. In the meantime, the systems'
71
hardware clocks can wander enough to become a problem. It might be
72
possible to work around this, depending on the version of Windows the
73
client system is running. On Windows 98/Me, you can use the Task
74
Scheduler to run the <em class="emphasis">net time</em> command at regular
75
intervals. Likewise, on Windows 2000/XP you can use the MS-DOS
76
<em class="emphasis">at</em> command. However, a better way to deal with
77
this issue is to use Network Time Protocol, which we will discuss
80
<p>Proper time synchronization is also important when operating in an
81
Active Directory domain because Active Directory uses
82
<a name="INDEX-4"/>Kerberos authentication.
83
When a Kerberos domain controller creates an authentication ticket
84
for a client, the time is encoded into the challenge-and-response
85
exchanges between the client and domain controller. If the
86
client's clock disagrees with the
87
server's clock, authentication can fail.</p>
89
<p>To provide proper time synchronization in <a name="INDEX-5"/>Active Directory domains, Microsoft has
90
adopted <a name="INDEX-6"/>Network Time Protocol (NTP), using the
91
name Windows Time Service for its implementation. For further
92
information, the Microsoft white paper entitled <em class="citetitle">The
93
Windows Time Service</em> can be downloaded from <a href="http://www.microsoft.com">http://www.microsoft.com</a>.</p>
95
<p>The nice thing about this is that NTP is the standard method for
96
synchronizing Unix hosts on a network, so you can synchronize all
97
your Unix systems (including the Samba server) and Windows systems
98
with the following method:</p>
101
<p>Run NTP on the Unix systems in your network. For more information on
102
using NTP, refer to <a href="http://www.ntp.org">http://www.ntp.org</a>.</p>
104
<p>Use one of the Unix systems (such as the Samba host system) as an NTP
105
server to serve Windows 2000/XP clients.</p>
107
<p>For other Windows clients, you might have to download an update from
108
Microsoft to add <a name="INDEX-7"/><a name="INDEX-8"/>Windows Time Service client support or
109
use a third-party application such as the free
110
<a name="INDEX-9"/>analogX Atomic TimeSync (<a href="http://www.analogx.com">http://www.analogx.com</a>). Or you can use the
111
<em class="emphasis">net time</em> command to update the
112
client's clock periodically, as discussed
116
<div class="sect2"><a name="samba2-CHP-11-SECT-1.1"/>
118
<h3 class="head2">Time-Synchronization Options</h3>
120
<p>To support roaming profiles, programmers accessing your Samba server,
121
and other time-sensitive functions on your network,
122
you'll want to be aware of the options listed in
123
<a href="ch11.html#samba2-CHP-11-TABLE-1">Table 11-1</a>.</p>
125
<a name="samba2-CHP-11-TABLE-1"/><h4 class="head4">Table 11-1. Time-synchronization options</h4><table border="1">
153
<p><tt class="literal">time server</tt></p>
159
<p>If <tt class="literal">yes</tt>, announces <em class="emphasis">nmbd</em> as an
160
SMB time service to Windows clients</p>
163
<p><tt class="literal">no</tt></p>
171
<p><tt class="literal">time offset</tt></p>
177
<p>Adds a specified number of minutes to the reported time</p>
180
<p><tt class="literal">0</tt></p>
188
<p><tt class="literal">dos filetimes</tt></p>
194
<p>Allows non-owners of a file to change its time if they can write to it</p>
197
<p><tt class="literal">no</tt></p>
205
<p><tt class="literal">dos filetime</tt></p>
207
<p><tt class="literal">resolution</tt></p>
213
<p>Causes file times to be rounded to the next even second</p>
216
<p><tt class="literal">no</tt></p>
224
<p><tt class="literal">fake directory</tt> <tt class="literal">create times</tt></p>
230
<p>Sets directory times to avoid an MS <em class="emphasis">nmake</em> bug</p>
233
<p><tt class="literal">no</tt></p>
243
<div class="sect3"><a name="samba2-CHP-11-SECT-1.1.1"/>
245
<a name="INDEX-12"/><h3 class="head3">time server</h3>
247
<p>Samba always operates as an SMB time server, matching the behavior of
248
Windows systems. However, Samba's default is not to
249
advertise itself as a time server to the network. When this option is
250
set to <tt class="literal">yes</tt>, Samba advertises itself as an SMB time
253
<blockquote><pre class="code">[global]
254
time service = yes</pre></blockquote>
261
<div class="sect3"><a name="samba2-CHP-11-SECT-1.1.2"/>
263
<a name="INDEX-13"/><h3 class="head3">time offset</h3>
265
<p>To deal with clients that don't properly process
266
daylight savings time, Samba provides the <tt class="literal">time</tt>
267
<tt class="literal">offset</tt> option. If set, it adds the specified
268
number of minutes to the current time. This is handy if
269
you're in Newfoundland and Windows
270
doesn't know about the 30-minute time difference
273
<blockquote><pre class="code">[global]
274
time offset = 30</pre></blockquote>
281
<div class="sect3"><a name="samba2-CHP-11-SECT-1.1.3"/>
283
<a name="INDEX-14"/><h3 class="head3">dos filetimes</h3>
285
<p>Traditionally, only the root user and the owner of a file can change
286
its last-modified date on a Unix system. The share-level
287
<tt class="literal">dos</tt> <tt class="literal">filetimes</tt> option allows the
288
Samba server to mimic the characteristics of a DOS or Windows system:
289
any user can change the last-modified date on a file in that share if
290
she has write permission to it. To do this, Samba uses its root
291
privileges to modify the timestamp on the file.</p>
293
<p>By default, this option is disabled. Setting this option to
294
<tt class="literal">yes</tt> is often necessary to allow PC
295
<em class="emphasis">make</em> programs to work properly. Without it, they
296
cannot change the last-modified date themselves. This often results
297
in the program thinking <em class="emphasis">all</em> files need
298
recompiling when they really don't.</p>
305
<div class="sect3"><a name="samba2-CHP-11-SECT-1.1.4"/>
307
<h3 class="head3">dos filetime resolution</h3>
309
<p>The <tt class="literal">dos</tt><a name="INDEX-15"/>
310
<tt class="literal">filetime</tt> <tt class="literal">resolution</tt> parameter
311
is a share-level option. If set to <tt class="literal">yes</tt>, Samba
312
rounds file times to the closest 2-second boundary. This option
313
exists primarily to satisfy a quirk in Windows that prevents Visual
314
C++ from correctly recognizing that a file has not changed. You can
315
enable it as follows:</p>
317
<blockquote><pre class="code">[data]
318
dos filetime resolution = yes</pre></blockquote>
320
<p>We recommend using this option only if you are using Microsoft Visual
321
C++ on a Samba share that supports opportunistic locking.</p>
328
<div class="sect3"><a name="samba2-CHP-11-SECT-1.1.5"/>
330
<h3 class="head3">fake directory create times</h3>
332
<p>The <tt class="literal">fake</tt><a name="INDEX-16"/>
333
<tt class="literal">directory</tt> <tt class="literal">create</tt>
334
<tt class="literal">times</tt> option exists to keep PC
335
<em class="emphasis">make</em> programs sane. VFAT and NTFS filesystems
336
record the creation date of a specific directory, while Unix does
337
not. Without this option, Samba takes the earliest recorded date it
338
has for the directory (often the last-modified date of a file) and
339
returns it to the client. If this is not sufficient, set the
340
following option under a share definition:</p>
342
<blockquote><pre class="code">[data]
343
fake directory create times = yes</pre></blockquote>
345
<p>If set, Samba will adjust the directory create time it reports to the
346
hardcoded value January 1, 1980. This is primarily used to convince
347
the Visual C++ <em class="emphasis">nmake</em> program that any object
348
files in its build directories are indeed younger than the creation
349
date of the directory itself and need to be recompiled. <a name="INDEX-17"/> <a name="INDEX-18"/><a name="INDEX-19"/></p>
362
<div class="sect1"><a name="samba2-CHP-11-SECT-2"/>
364
<h2 class="head1">Magic Scripts</h2>
366
<p><em class="firstterm">Magic scripts</em> are a method of running programs
367
on Unix and redirecting the output back to the SMB client. These are
368
essentially an experimental hack. However, some users and their
369
programs still rely on these two options for their programs to
370
function correctly. Magic scripts are not widely trusted, and their
371
use is highly discouraged by the Samba Team.</p>
374
<div class="sect2"><a name="samba2-CHP-11-SECT-2.1"/>
376
<h3 class="head2">Magic Script Options</h3>
378
<p><a href="ch11.html#samba2-CHP-11-TABLE-2">Table 11-2</a> lists the options that deal with
379
<a name="INDEX-20"/>magic scripts
380
on the Samba server.</p>
382
<a name="samba2-CHP-11-TABLE-2"/><h4 class="head4">Table 11-2. Magic script options</h4><table border="1">
410
<p><tt class="literal">magic</tt> <tt class="literal">script</tt></p>
413
<p>string (filename)</p>
416
<p>File to be executed by Samba, as the logged-on user, when closed</p>
427
<p><tt class="literal">magic</tt> <tt class="literal">output</tt></p>
430
<p>string (filename)</p>
433
<p>File to log output from the magic file</p>
436
<p><em class="emphasis">scriptname.out</em></p>
446
<div class="sect3"><a name="samba2-CHP-11-SECT-2.1.1"/>
448
<h3 class="head3">magic script</h3>
450
<p>If the <tt class="literal">magic</tt><a name="INDEX-21"/>
451
<tt class="literal">script</tt> option is set to a filename and the client
452
creates a file by that name in that share, Samba will run the file as
453
soon as the user has opened and closed it. For example,
454
let's assume that the following option was created
455
in the share <tt class="literal">[accounting]</tt>:</p>
457
<blockquote><pre class="code">[accounting]
458
magic script = tally.sh</pre></blockquote>
460
<p>Samba continually monitors the files in that share. If one by the
461
name of <em class="emphasis">tally.sh</em> is closed (after being opened)
462
by a user, Samba will execute the contents of that file locally. The
463
file will be passed to the shell to execute; it must therefore be a
464
legal Unix shell script. This means that it must have newline
465
characters as line endings instead of Windows CRLFs. In addition, you
466
need to use the <tt class="literal">#!</tt> directive at the beginning of
467
the file to indicate under which shell or interpreter the script
468
should run, unless the script is for the default shell on your
476
<div class="sect3"><a name="samba2-CHP-11-SECT-2.1.2"/>
478
<a name="INDEX-22"/><h3 class="head3">magic output</h3>
480
<p>This option specifies an output file to which the script specified by
481
the <tt class="literal">magic</tt> <tt class="literal">script</tt> option will
482
send output. You must specify a filename in a writable directory:</p>
484
<blockquote><pre class="code">[accounting]
485
magic script = tally.sh
486
magic output = /var/log/magicoutput</pre></blockquote>
488
<p>If this option is omitted, the default output file is the name of the
489
script (as stated in the <tt class="literal">magic</tt>
490
<tt class="literal">script</tt> option) with the extension
491
<em class="emphasis">.out</em> appended onto it.</p>
504
<div class="sect1"><a name="samba2-CHP-11-SECT-3"/>
506
<h2 class="head1">Internationalization</h2>
508
<p><a name="INDEX-23"/><a name="INDEX-24"/>Starting
509
with Samba 3.0, Samba supports Unicode "on the
510
wire," requiring no additional effort on your part
511
to support filenames and other text containing characters in
512
international character sets.</p>
515
<div class="sect2"><a name="samba2-CHP-11-SECT-3.1"/>
517
<h3 class="head2">Internationalization Options</h3>
519
<p>Samba 2.2.x has a limited ability to speak foreign tongues: if you
520
need to support filenames containing characters that
521
aren't in standard ASCII, some options that can help
522
you are shown in <a href="ch11.html#samba2-CHP-11-TABLE-3">Table 11-3</a>.</p>
524
<a name="samba2-CHP-11-TABLE-3"/><h4 class="head4">Table 11-3. Internationalization options</h4><table border="1">
552
<p><tt class="literal">client code</tt> <tt class="literal">page</tt></p>
555
<p>Described in this section</p>
558
<p>Sets a code page to expect from clients</p>
569
<p><tt class="literal">character set</tt></p>
572
<p>Described in this section</p>
575
<p>Translates code pages into alternate Unix character sets</p>
586
<p><tt class="literal">coding system</tt></p>
589
<p>Described in this section</p>
592
<p>Translates code page 932 into an Asian character set</p>
603
<p><tt class="literal">valid chars</tt></p>
606
<p>string (set of characters)</p>
609
<p>Adds individual characters to a code page</p>
622
<div class="sect3"><a name="samba2-CHP-11-SECT-3.1.1"/>
624
<h3 class="head3">client code page</h3>
626
<p>The character sets on Windows platforms hark back to the original
627
concept of a <em class="emphasis">code page</em><a name="INDEX-25"/>. These code pages are used by DOS and
628
Windows clients to determine rules for mapping lowercase letters to
629
uppercase letters. Samba can be instructed to use a variety of code
630
pages through the use of the global
631
<tt class="literal">client</tt><a name="INDEX-26"/> <tt class="literal">code</tt>
632
<tt class="literal">page</tt> option to match the corresponding code page
633
in use on the client. This option loads a code page definition file
634
and can take the values specified in <a href="ch11.html#samba2-CHP-11-TABLE-4">Table 11-4</a>.</p>
636
<a name="samba2-CHP-11-TABLE-4"/><h4 class="head4">Table 11-4. Valid code pages with Samba 2.0</h4><table border="1">
652
<p><tt class="literal">437</tt></p>
655
<p>MS-DOS Latin (United States)</p>
660
<p><tt class="literal">737</tt></p>
663
<p>Windows 95 Greek</p>
668
<p><tt class="literal">850</tt></p>
671
<p>MS-DOS Latin 1 (Western European)</p>
676
<p><tt class="literal">852</tt></p>
679
<p>MS-DOS Latin 2 (Eastern European)</p>
684
<p><tt class="literal">861</tt></p>
687
<p>MS-DOS Icelandic</p>
692
<p><tt class="literal">866</tt></p>
695
<p>MS-DOS Cyrillic (Russian)</p>
700
<p><tt class="literal">932</tt></p>
703
<p>MS-DOS Japanese Shift-JIS</p>
708
<p><tt class="literal">936</tt></p>
711
<p>MS-DOS Simplified Chinese</p>
716
<p><tt class="literal">949</tt></p>
719
<p>MS-DOS Korean Hangul</p>
724
<p><tt class="literal">950</tt></p>
727
<p>MS-DOS Traditional Chinese</p>
733
<p>You can set the client code page as follows:</p>
735
<blockquote><pre class="code">[global]
736
client code page = 852</pre></blockquote>
738
<p>The default value of this option is 850, for MS-DOS Latin 1. You can
739
use the <em class="emphasis">make_smbcodepage</em> tool that comes with
740
Samba (by default in <em class="filename">/usr/local/samba/bin</em> ) to
741
create your own SMB code pages, in the event that those listed
742
earlier are not sufficient.</p>
749
<div class="sect3"><a name="samba2-CHP-11-SECT-3.1.2"/>
751
<h3 class="head3">character set</h3>
753
<p>The global <tt class="literal">character</tt><a name="INDEX-27"/>
754
<tt class="literal">set</tt> option can be used to convert filenames
755
offered through a DOS code page (see the previous section, <a href="ch11.html#samba2-CHP-11-SECT-3.1.1">Section 11.3.1.1</a>) to equivalents that can be
756
represented by Unix character sets other than those in the United
757
States. For example, if you want to convert the Western European
758
MS-DOS character set on the client to a Western European Unix
759
character set on the server, you can use the following in your
760
configuration file:</p>
762
<blockquote><pre class="code">[global]
763
client code page = 850
764
character set = ISO8859-1</pre></blockquote>
766
<p>Note that you must include a <tt class="literal">client</tt>
767
<tt class="literal">code</tt> <tt class="literal">page</tt> option to specify the
768
character set from which you are converting. The valid character sets
769
(and their matching code pages) that Samba accepts are listed in
770
<a href="ch11.html#samba2-CHP-11-TABLE-5">Table 11-5</a>.</p>
772
<a name="samba2-CHP-11-TABLE-5"/><h4 class="head4">Table 11-5. Valid character sets</h4><table border="1">
782
<p>Matching code page</p>
792
<p><tt class="literal">ISO8859-1</tt></p>
795
<p><tt class="literal">850</tt></p>
798
<p>Western European Unix</p>
803
<p><tt class="literal">ISO8859-2</tt></p>
806
<p><tt class="literal">852</tt></p>
809
<p>Eastern European Unix</p>
814
<p><tt class="literal">ISO8859-5</tt></p>
817
<p><tt class="literal">866</tt></p>
820
<p>Russian Cyrillic Unix</p>
825
<p><tt class="literal">ISO8859-7</tt></p>
836
<p><tt class="literal">KOI8-R</tt></p>
839
<p><tt class="literal">866</tt></p>
842
<p>Alternate Russian Cyrillic Unix</p>
848
<p>Normally, the <tt class="literal">character</tt> <tt class="literal">set</tt>
849
option is disabled completely.</p>
856
<div class="sect3"><a name="samba2-CHP-11-SECT-3.1.3"/>
858
<h3 class="head3">coding system</h3>
860
<p>The <tt class="literal">coding</tt><a name="INDEX-28"/> <tt class="literal">system</tt>
861
option is similar to the <tt class="literal">character</tt>
862
<tt class="literal">set</tt> option. However, its purpose is to determine
863
how to convert a Japanese Shift JIS code page into an appropriate
864
Unix character set. To use this option, the <tt class="literal">client</tt>
865
<tt class="literal">code</tt> <tt class="literal">page</tt> option described
866
previously must be set to page <tt class="literal">932</tt>. The valid
867
coding systems that Samba accepts are listed in <a href="ch11.html#samba2-CHP-11-TABLE-6">Table 11-6</a>.</p>
869
<a name="samba2-CHP-11-TABLE-6"/><h4 class="head4">Table 11-6. Valid coding-system parameters</h4><table border="1">
885
<p><tt class="literal">SJIS</tt></p>
888
<p>Standard Shift JIS</p>
893
<p><tt class="literal">JIS8</tt></p>
896
<p>Eight-bit JIS codes</p>
901
<p><tt class="literal">J8BB</tt></p>
904
<p>Eight-bit JIS codes</p>
909
<p><tt class="literal">J8BH</tt></p>
912
<p>Eight-bit JIS codes</p>
917
<p><tt class="literal">J8@B</tt></p>
920
<p>Eight-bit JIS codes</p>
925
<p><tt class="literal">J8@J</tt></p>
928
<p>Eight-bit JIS codes</p>
933
<p><tt class="literal">J8@H</tt></p>
936
<p>Eight-bit JIS codes</p>
941
<p><tt class="literal">JIS7</tt></p>
944
<p>Seven-bit JIS codes</p>
949
<p><tt class="literal">J7BB</tt></p>
952
<p>Seven-bit JIS codes</p>
957
<p><tt class="literal">J7BH</tt></p>
960
<p>Seven-bit JIS codes</p>
965
<p><tt class="literal">J7@B</tt></p>
968
<p>Seven-bit JIS codes</p>
973
<p><tt class="literal">J7@J</tt></p>
976
<p>Seven-bit JIS codes</p>
981
<p><tt class="literal">J7@H</tt></p>
984
<p>Seven-bit JIS codes</p>
989
<p><tt class="literal">JUNET</tt></p>
997
<p><tt class="literal">JUBB</tt></p>
1005
<p><tt class="literal">JUBH</tt></p>
1013
<p><tt class="literal">JU@B</tt></p>
1021
<p><tt class="literal">JU@J</tt></p>
1029
<p><tt class="literal">JU@H</tt></p>
1037
<p><tt class="literal">EUC</tt></p>
1045
<p><tt class="literal">HEX</tt></p>
1048
<p>Three-byte hexadecimal code</p>
1053
<p><tt class="literal">CAP</tt></p>
1056
<p>Three-byte hexadecimal code (Columbia AppleTalk Program)</p>
1067
<div class="sect3"><a name="samba2-CHP-11-SECT-3.1.4"/>
1069
<h3 class="head3">valid chars</h3>
1071
<p>The <tt class="literal">valid</tt><a name="INDEX-29"/> <tt class="literal">chars</tt> option
1072
can be used to add individual characters to a code page. You can use
1073
this option as follows:</p>
1075
<blockquote><pre class="code">valid chars = Î
1076
valid chars = 0450:0420 0x0A20:0x0A00
1077
valid chars = A:a</pre></blockquote>
1079
<p>Each character in the list specified should be separated by spaces.
1080
If there is a colon between two characters or a numerical equivalent,
1081
the data to the left of the colon is considered an uppercase
1082
character, while the data to the right is considered the lowercase
1083
character. You can represent characters both by literals (if you can
1084
type them) and by octal, hexadecimal, or decimal Unicode equivalents.</p>
1086
<p>If you use this option, it must be listed after the
1087
<tt class="literal">client</tt> <tt class="literal">code</tt>
1088
<tt class="literal">page</tt> to which you wish to add the character.
1089
<a name="INDEX-30"/><a name="INDEX-31"/></p>
1102
<div class="sect1"><a name="samba2-CHP-11-SECT-4"/>
1104
<h2 class="head1">Windows Messenger Service</h2>
1106
<p>One of the odd features of SMB protocol is its ability to send text
1107
messages between computers. Although both the name and functionality
1108
are similar to that of Windows Messenger, the two are not the same.
1109
<a name="INDEX-32"/><a name="INDEX-33"/><a name="INDEX-34"/>Windows Messenger (also called MSN
1110
Messenger) is an Internet-oriented instant messenging service, while
1111
Windows Messenger Service is an older and simpler LAN-oriented
1112
service. Using the Windows Messenger Service, messages can be
1113
addressed to users, individual computers, or entire workgroups on the
1116
<p>The <a name="INDEX-35"/>WinPopup
1117
tool (<em class="filename">Winpopup.exe</em>), shown in <a href="ch11.html#samba2-CHP-11-FIG-1">Figure 11-1</a>, can be used on Windows 95/98/Me to send or
1118
receive messages. WinPopup is a handy tool for sending messages.
1119
However, to receive messages, it must already be running when the
1120
message is sent from the remote system.</p>
1122
<div class="figure"><a name="samba2-CHP-11-FIG-1"/><img src="figs/sam2_1101.gif"/></div><h4 class="head4">Figure 11-1. Sending a message from a Windows 95/98/Me system (left); receiving a message (right)</h4>
1124
<p>On Windows NT/2000/XP, the messenger service lets you receive
1125
messages without having an application already running; messages will
1126
automatically appear in a small dialog box on the screen when
1127
received, as shown in <a href="ch11.html#samba2-CHP-11-FIG-2">Figure 11-2</a>.</p>
1129
<div class="figure"><a name="samba2-CHP-11-FIG-2"/><img src="figs/sam2_1102.gif"/></div><h4 class="head4">Figure 11-2. Receiving a message on a Windows 2000 system</h4>
1131
<p>To send messages, it is necessary to use the <em class="emphasis">net
1132
send</em> command from a command-prompt window, like this:</p>
1134
<blockquote><pre class="code">C:\> <tt class="userinput"><b>net send maya "Who's There?"</b></tt>
1135
The message was successfully sent to MAYA.</pre></blockquote>
1138
<div class="sect2"><a name="samba2-CHP-11-SECT-4.1"/>
1140
<h3 class="head2">Windows Messenger Service Configuration Option</h3>
1142
<p>Samba has a single option to handle Windows Messenger Service,
1143
<tt class="literal">message</tt> <tt class="literal">command</tt>, as shown in
1144
<a href="ch11.html#samba2-CHP-11-TABLE-7">Table 11-7</a>.</p>
1146
<a name="samba2-CHP-11-TABLE-7"/><h4 class="head4">Table 11-7. Windows Messenger Service configuration option</h4><table border="1">
1174
<p><tt class="literal">message</tt> <tt class="literal">command</tt></p>
1177
<p>string (shell command)</p>
1180
<p>Sets a command to run on Unix when a WinPopup message is received</p>
1193
<div class="sect3"><a name="samba2-CHP-11-SECT-4.1.1"/>
1195
<h3 class="head3">message command</h3>
1198
<tt class="literal">message</tt><a name="INDEX-36"/> <tt class="literal">command</tt>
1199
option defines the command that will run on the server when a Windows
1200
Messenger Service message arrives. The command will be executed as
1201
the <tt class="literal">guest</tt> <tt class="literal">account</tt> user. What to
1202
do with messages is questionable because most Samba hosts run as
1203
unattended servers. One solution is to mail the messages to root like
1206
<blockquote><pre class="code">[global]
1207
message command = /bin/mail -s "SMB Message From %f on %m" root <%s; rm %s</pre></blockquote>
1209
<p>Note the use of variables here. The <tt class="literal">%s</tt> variable
1210
will be replaced by the name of the file in which the message
1211
resides. This file should be deleted when the command is finished
1212
with it; otherwise, a buildup of message files will collect on the
1213
Samba server. In addition, the command must either exit quickly or
1214
fork its own process (using an <tt class="literal">&</tt> after the
1215
command); otherwise, the client might suspend and wait for
1216
notification that the command was sent successfully before
1219
<p>In addition to the standard variables, <a href="ch11.html#samba2-CHP-11-TABLE-8">Table 11-8</a>
1220
shows the three unique variables that you can use in a
1221
<tt class="literal">message</tt> <tt class="literal">command</tt>.</p>
1223
<a name="samba2-CHP-11-TABLE-8"/><h4 class="head4">Table 11-8. message command variables</h4><table border="1">
1239
<p><tt class="literal">%s</tt></p>
1242
<p>The name of the file in which the message resides</p>
1247
<p><tt class="literal">%f</tt></p>
1250
<p>The name of the system that sent the message</p>
1255
<p><tt class="literal">%t</tt></p>
1258
<p>The name of the system that is the destination of the message
1259
<a name="INDEX-37"/><a name="INDEX-38"/><a name="INDEX-39"/></p>
1276
<div class="sect1"><a name="samba2-CHP-11-SECT-5"/>
1278
<h2 class="head1">Miscellaneous Options</h2>
1280
<p>Many Samba options are available to deal with operating system issues
1281
on either Unix or Windows. In particular, some of these options are
1282
used for setting limits for clients' use of
1283
resources on the Unix server. The options shown in <a href="ch11.html#samba2-CHP-11-TABLE-9">Table 11-9</a> deal with some of these issues.</p>
1285
<a name="samba2-CHP-11-TABLE-9"/><h4 class="head4">Table 11-9. Miscellaneous options</h4><table border="1">
1313
<p><tt class="literal">deadtime</tt></p>
1316
<p>numeric (minutes)</p>
1319
<p>Number of minutes of inactivity before a connection should be
1323
<p><tt class="literal">0</tt></p>
1331
<p><tt class="literal">dfree command</tt></p>
1334
<p>string (command)</p>
1337
<p>Used to specify a command that returns free disk space in a format
1338
recognized by Samba.</p>
1349
<p><tt class="literal">fstype</tt></p>
1352
<p><tt class="literal">NTFS</tt>, <tt class="literal">FAT</tt>, or
1353
<tt class="literal">Samba</tt></p>
1356
<p>Filesystem type reported by the server to the client.</p>
1359
<p><tt class="literal">NTFS</tt></p>
1367
<p><tt class="literal">keepalive</tt></p>
1370
<p>numeric (seconds)</p>
1373
<p>Number of seconds between checks for an inoperative client.</p>
1376
<p><tt class="literal">300</tt> (none)</p>
1384
<p><tt class="literal">max disk size</tt></p>
1390
<p>Largest disk size to return to a client, some of which have limits.
1391
Does not affect actual operations on the disk.</p>
1394
<p><tt class="literal">0</tt> (infinity)</p>
1402
<p><tt class="literal">max mux</tt></p>
1408
<p>Maximum number of simultaneous SMB operations that clients can make.</p>
1411
<p><tt class="literal">50</tt></p>
1419
<p><tt class="literal">max open files</tt></p>
1425
<p>Limits number of open files to be below Unix limits.</p>
1428
<p><tt class="literal">10000</tt></p>
1436
<p><tt class="literal">max xmit</tt></p>
1442
<p>Specifies the maximum packet size that Samba will send.</p>
1445
<p><tt class="literal">65535</tt> or <tt class="literal">16644</tt></p>
1453
<p><tt class="literal">nt pipe support</tt></p>
1459
<p>Turns off an NT/2000/XP support feature; for benchmarking or in case
1463
<p><tt class="literal">yes</tt></p>
1471
<p><tt class="literal">nt smb support</tt></p>
1477
<p>Turns off an NT/2000/XP support feature; for benchmarking or in case
1481
<p><tt class="literal">yes</tt></p>
1489
<p><tt class="literal">ole locking</tt> <tt class="literal">compatibility</tt></p>
1495
<p>Remaps out-of-range lock requests used on Windows to fit in allowable
1496
range on Unix. Turning it off causes Unix lock errors.</p>
1499
<p><tt class="literal">yes</tt></p>
1507
<p><tt class="literal">panic action</tt></p>
1513
<p>Command to run if Samba server fails; for debugging.</p>
1524
<p><tt class="literal">set directory</tt></p>
1530
<p>If <tt class="literal">yes</tt>, allows VMS clients to issue
1531
<tt class="literal">set</tt> <tt class="literal">dir</tt> commands.</p>
1534
<p><tt class="literal">no</tt></p>
1542
<p><tt class="literal">status</tt></p>
1548
<p>If <tt class="literal">yes</tt>, allows Samba to monitor status for
1549
<tt class="literal">smbstatus</tt> command.</p>
1552
<p><tt class="literal">yes</tt></p>
1560
<p><tt class="literal">strict sync</tt></p>
1566
<p>If <tt class="literal">no</tt>, ignores Windows application requests to
1567
perform a sync-to-disk.</p>
1570
<p><tt class="literal">no</tt></p>
1578
<p><tt class="literal">sync always</tt></p>
1584
<p>If <tt class="literal">yes</tt>, forces all client writes to be committed
1585
to disk before returning from the call.</p>
1588
<p><tt class="literal">no</tt></p>
1596
<p><tt class="literal">strip dot</tt></p>
1602
<p>If <tt class="literal">yes</tt>, strips trailing dots from Unix filenames.</p>
1605
<p><tt class="literal">no</tt></p>
1613
<p><tt class="literal">change notify timeout</tt></p>
1616
<p>numeric (seconds)</p>
1619
<p>Interval between checks when a client asks to wait for a change in a
1620
specified directory.</p>
1623
<p><tt class="literal">60</tt></p>
1631
<p><tt class="literal">stat cache</tt></p>
1637
<p>If <tt class="literal">yes</tt>, Samba will cache recent name mappings.</p>
1640
<p><tt class="literal">yes</tt></p>
1648
<p><tt class="literal">stat cache size</tt></p>
1654
<p>Number of entries in the stat cache.</p>
1657
<p><tt class="literal">50</tt></p>
1667
<div class="sect2"><a name="samba2-CHP-11-SECT-5.1"/>
1669
<a name="INDEX-40"/><h3 class="head2">deadtime</h3>
1671
<p>This global option sets the number of minutes that Samba will wait
1672
for an inactive client before closing its session with the Samba
1673
server. A client is considered inactive when it has no open files and
1674
no data is being sent from it. The default value for this option is
1675
0, which means that Samba never closes any connection, regardless of
1676
how long they have been inactive. This can lead to unnecessary
1677
consumption of the server's resources by inactive
1678
clients. We recommend that you override the default as follows:</p>
1680
<blockquote><pre class="code">[global]
1681
deadtime = 10</pre></blockquote>
1683
<p>This tells Samba to terminate any inactive client sessions after 10
1684
minutes. For most networks, setting this option as such will not
1685
inconvenience users because reconnections from the client are
1686
generally performed transparently to the user. See also the
1687
<tt class="literal">keepalive</tt> parameter.</p>
1690
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.1"/>
1692
<a name="INDEX-41"/><h3 class="head3">dfree command</h3>
1694
<p>This global option is used on systems that incorrectly determine the
1695
free space left on the disk. So far, the only confirmed system that
1696
needs this option set is Ultrix. There is no default value for this
1697
option, which means that Samba already knows how to compute the free
1698
disk space on its own and the results are considered reliable. You
1699
can override it as follows:</p>
1701
<blockquote><pre class="code">[global]
1702
dfree command = /usr/local/bin/dfree</pre></blockquote>
1704
<p>This option should point to a script that returns the total disk
1705
space in a block and the number of available blocks. The Samba
1706
documentation recommends the following as a usable script:</p>
1708
<blockquote><pre class="code">#!/bin/sh
1709
df $1 | tail -1 | awk '{print $2" "$4}'</pre></blockquote>
1711
<p>On System V machines, the following will work:</p>
1713
<blockquote><pre class="code">#!/bin/sh
1714
/usr/bin/df $1 | tail -1 | awk '{print $3" "$5}'</pre></blockquote>
1721
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.2"/>
1723
<a name="INDEX-42"/><h3 class="head3">fstype</h3>
1725
<p>This share-level option sets the type of filesystem that Samba
1726
reports when queried by the client. Three strings can be used as a
1727
value to this configuration option, as listed in <a href="ch11.html#samba2-CHP-11-TABLE-10">Table 11-10</a>.</p>
1729
<a name="samba2-CHP-11-TABLE-10"/><h4 class="head4">Table 11-10. Filesystem types</h4><table border="1">
1748
<p>Microsoft Windows NT filesystem</p>
1756
<p>DOS FAT filesystem</p>
1764
<p>Samba filesystem</p>
1770
<p>The default value for this option is <tt class="literal">NTFS</tt>, which
1771
represents a Windows NT filesystem. There probably
1772
isn't a need to specify any other type of
1773
filesystem. However, if you need to, you can override the default
1774
value per share as follows:</p>
1776
<blockquote><pre class="code">[data]
1777
fstype = FAT</pre></blockquote>
1784
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.3"/>
1786
<a name="INDEX-43"/><h3 class="head3">keepalive</h3>
1788
<p>This global option specifies the number of seconds that Samba waits
1789
between sending NetBIOS <em class="emphasis">keepalive packets</em>. These
1790
packets are used to ping a client to detect whether it is still alive
1791
and on the network. The default value for this option is
1792
<tt class="literal">300</tt> (5 minutes), which you can override as
1795
<blockquote><pre class="code">[global]
1796
keepalive = 600</pre></blockquote>
1798
<p>The value of <tt class="literal">600</tt> (10 minutes) is good for networks
1799
populated by reliable clients. If your network contains relatively
1800
unreliable clients, you might prefer to set
1801
<tt class="literal">keepalive</tt> to a lower value, such as
1802
<tt class="literal">30</tt>. If <tt class="literal">keepalive</tt> is set to 0,
1803
no NetBIOS keepalive packets will be sent. See also the
1804
<tt class="literal">deadtime</tt> parameter.</p>
1811
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.4"/>
1813
<a name="INDEX-44"/><h3 class="head3">max disk size</h3>
1815
<p>This global option specifies an illusory limit, in megabytes, for
1816
each share that Samba is offering. It only affects how much disk
1817
space Samba reports the share as having and does not prevent more
1818
disk space from actually being available for use. You would typically
1819
set this option to prevent clients with older operating
1820
systems—or running buggy applications—from being confused
1821
by large disk spaces. For example, some older Windows applications
1822
become confused when they encounter a share larger than 1 gigabyte.
1823
To work around this problem, <tt class="literal">max</tt>
1824
<tt class="literal">disk</tt> <tt class="literal">size</tt> can be set as
1827
<blockquote><pre class="code">[global]
1828
max disk size = 1000</pre></blockquote>
1830
<p>The default value for this option is <tt class="literal">0</tt>, which
1831
means there is no upper limit.</p>
1838
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.5"/>
1840
<a name="INDEX-45"/><h3 class="head3">max mux</h3>
1842
<p>This global option specifies the maximum number of concurrent SMB
1843
operations Samba allows. The default value for this option is
1844
<tt class="literal">50</tt>. You can override it as follows:</p>
1846
<blockquote><pre class="code">[global]
1847
max mux = 100</pre></blockquote>
1854
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.6"/>
1856
<a name="INDEX-46"/><h3 class="head3">max open files</h3>
1858
<p>This global option specifies the maximum number of open files that
1859
Samba should allow at any given time for all processes. This value
1860
must be equal to or less than the amount allowed by the operating
1861
system, which varies from system to system. The default value for
1862
this option is <tt class="literal">10000</tt>. You can override it as
1865
<blockquote><pre class="code">[global]
1866
max open files = 8000</pre></blockquote>
1873
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.7"/>
1875
<a name="INDEX-47"/><h3 class="head3">max xmit</h3>
1877
<p>This global option sets the maximum size of packets that Samba
1878
exchanges with a client. In rare cases, setting a smaller maximum
1879
packet size can increase performance, especially with Windows for
1880
Workgroups. In Samba versions up to 2.2.5, the default value for this
1881
option is <tt class="literal">65535</tt>. In 2.2.7 and later versions, the
1882
default was changed to <tt class="literal">16644</tt> to match the behavior
1883
of Windows 2000 and improve support for Windows NT 4.0. You can
1884
override the default as follows:</p>
1886
<blockquote><pre class="code">[global]
1887
max xmit = 4096</pre></blockquote>
1894
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.8"/>
1896
<a name="INDEX-48"/><h3 class="head3">nt pipe support</h3>
1898
<p>This global option is used by developers to allow or disallow Windows
1899
NT/2000/XP clients the ability to make connections to
1900
<a name="INDEX-49"/>NT-specific SMB IPC$ pipes. As a user, you
1901
should never need to override the default:</p>
1903
<blockquote><pre class="code">[global]
1904
nt pipe support = yes</pre></blockquote>
1911
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.9"/>
1913
<a name="INDEX-50"/><h3 class="head3">nt smb support</h3>
1915
<p>This global option is used by developers to negotiate NT-specific SMB
1916
options with Windows NT/2000/XP clients. The Samba Team has
1917
discovered that slightly better performance comes from setting this
1918
value to <tt class="literal">no</tt>. However, as a user, you should
1919
probably not override the default:</p>
1921
<blockquote><pre class="code">[global]
1922
nt smb support = yes</pre></blockquote>
1929
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.10"/>
1931
<a name="INDEX-51"/><h3 class="head3">ole locking compatibility</h3>
1933
<p>This global option turns off Samba's internal
1934
byte-range locking manipulation in files, which gives compatibility
1935
with Object Linking and Embedding (OLE) applications that use high
1936
byte-range locks as a method of interprocess communication. The
1937
default value for this option is <tt class="literal">yes</tt>. If you trust
1938
your Unix locking mechanisms, you can override it as follows:</p>
1940
<blockquote><pre class="code">[global]
1941
ole locking compatibility = no</pre></blockquote>
1948
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.11"/>
1950
<a name="INDEX-52"/><h3 class="head3">panic action</h3>
1952
<p>This global option specifies a command to execute in the event that
1953
Samba encounters a fatal error when loading or running. There is no
1954
default value for this option. You can specify an action as follows:</p>
1956
<blockquote><pre class="code">[global]
1957
panic action = /bin/csh -c
1958
'xedit <<: "Samba has shutdown unexpectedly";:'</pre></blockquote>
1965
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.12"/>
1967
<a name="INDEX-53"/><h3 class="head3">set directory</h3>
1969
<p>This Boolean share-level option allows <a name="INDEX-54"/>Digital Pathworks clients to
1970
use the <em class="emphasis">setdir</em> command to change directories on
1971
the server. If you are not using the Digital Pathworks client, you
1972
should not need to alter this option. The default value for this
1973
option is <tt class="literal">no</tt>. You can override it per share as
1976
<blockquote><pre class="code">[data]
1977
set directory = yes</pre></blockquote>
1984
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.13"/>
1986
<a name="INDEX-55"/><h3 class="head3">status</h3>
1988
<p>This global option indicates whether Samba should log all active
1989
connections to a status file. This file is used only by the
1990
<em class="emphasis">smbstatus</em> command. If you have no intentions of
1991
using this command, you can set this option to <tt class="literal">no</tt>,
1992
which can result in a small increase of speed on the server. The
1993
default value for this option is <tt class="literal">yes</tt>. You can
1994
override it as follows:</p>
1996
<blockquote><pre class="code">[global]
1997
status = no</pre></blockquote>
2004
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.14"/>
2006
<a name="INDEX-56"/><h3 class="head3">strict sync</h3>
2008
<p>This share-level option determines whether Samba honors all requests
2009
to perform a disk sync when requested to do so by a client. Many
2010
Windows clients request a disk sync when they are really just trying
2011
to flush data to their own open files. In this case, a disk sync is
2012
generally unnecessary on Unix due to its high reliability, and it
2013
mostly has the effect of substantially reducing the performance of
2014
the Samba host system. The default value for this option is
2015
<tt class="literal">no</tt>, which allows the superfluous disk sync
2016
requests to be ignored. You can override the default as follows:</p>
2018
<blockquote><pre class="code">[data]
2019
strict sync = yes</pre></blockquote>
2026
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.15"/>
2028
<a name="INDEX-57"/><h3 class="head3">sync always</h3>
2030
<p>This share-level option decides whether every write to disk should be
2031
followed by a disk synchronization before the write call returns
2032
control to the client. Even if the value of this option is
2033
<tt class="literal">no</tt>, clients can request a disk synchronization;
2034
see the earlier <tt class="literal">strict</tt> <tt class="literal">sync</tt>
2035
option. The default value for this option is <tt class="literal">no</tt>.
2036
You can override it per share as follows:</p>
2038
<blockquote><pre class="code">[data]
2039
sync always = yes</pre></blockquote>
2046
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.16"/>
2048
<a name="INDEX-58"/><h3 class="head3">strip dot</h3>
2050
<p>This global option determines whether to remove the trailing dot from
2051
Unix filenames that are formatted with a dot at the end. The default
2052
value for this option is <tt class="literal">no</tt>. You can override it
2053
per share as follows:</p>
2055
<blockquote><pre class="code">[global]
2056
strip dot = yes</pre></blockquote>
2063
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.17"/>
2065
<h3 class="head3">change notify timeout</h3>
2067
<p>The <tt class="literal">change</tt><a name="INDEX-59"/>
2068
<tt class="literal">notify</tt> <tt class="literal">timeout</tt> global option
2069
emulates a Windows NT/2000 SMB feature called <em class="firstterm">change
2070
notification</em><a name="INDEX-60"/>. This allows a client to request
2071
that a Windows NT/2000 server periodically monitor a specific
2072
directory on a share for any changes. If changes occur, the server
2073
will notify the client.</p>
2075
<p>Samba performs this function for its clients at an interval that
2076
defaults to 1 minute (60 seconds). Performing these checks too often
2077
can slow down the server considerably; however, you can use this
2078
option to specify an alternate time that Samba should wait between
2079
performing checks:</p>
2081
<blockquote><pre class="code">[global]
2082
change notify timeout = 30</pre></blockquote>
2089
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.18"/>
2091
<h3 class="head3">stat cache</h3>
2093
<p>The <tt class="literal">stat</tt><a name="INDEX-61"/> <tt class="literal">cache</tt> global
2094
option turns on caching of recent case-insensitive name mappings. The
2095
default is <tt class="literal">yes</tt>. The Samba Team recommends that you
2096
never change this parameter.</p>
2103
<div class="sect3"><a name="samba2-CHP-11-SECT-5.1.19"/>
2105
<h3 class="head3">stat cache size</h3>
2107
<p>The <tt class="literal">stat</tt><a name="INDEX-62"/> <tt class="literal">cache</tt>
2108
<tt class="literal">size</tt> global option sets the number of cache
2109
entries to be used for the <tt class="literal">stat</tt>
2110
<tt class="literal">cache</tt> option. The default here is
2111
<tt class="literal">50</tt>. Again, the Samba Team recommends that you
2112
never change this parameter.</p>
2123
<hr/><h4 class="head4"><a href="toc.html">TOC</a></h4></body></html>