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">Appendix F. Running Samba on Mac OS X Server</h1>
11
<p><a name="INDEX-1"/>Mac OS X Server is an Apple
12
operating-system product based on Mac OS X, with the addition of
13
administrative tools and server software. One area in which it
14
differs from Mac OS X is in the configuration of Samba-based
15
services. In this appendix, we'll tell you how to
16
set up SMB file and printer shares, enable client user access, and
17
monitor activity. Our specific focus is on Mac OS X Server 10.2.</p>
21
<div class="sect1"><a name="samba2-APP-F-SECT-1"/>
23
<h2 class="head1">Setup Procedures</h2>
25
<p>The first thing to note is that the procedure described in <a href="ch02.html">Chapter 2</a> using System Preferences to enable Samba does
26
not apply to Mac OS X Server. Unlike Mac OS X, the Sharing pane of
27
System Preferences does not include an option to turn on Windows File
28
Sharing. Instead, there is a set of applications to configure,
29
activate, and monitor services: Workgroup Manager, Server Settings,
30
Server Status, and Open Directory Assistant, all located in the
31
directory <em class="filename">/Applications/Utilities</em>.</p>
33
<a name="samba2-APP-F-NOTE-163"/><blockquote class="note"><h4 class="objtitle">NOTE</h4>
34
<p>In addition to being installed with Mac OS X Server, these and other
35
administrative applications are included on a separate installation
36
CD-ROM sold with the operating system. They can be used to manage Mac
37
OS X Server systems remotely from any Mac OS X machine.</p>
39
<p>For more information, refer to the <em class="citetitle">Mac OS X Server
41
Guide</em><a name="INDEX-2"/>, included as a PDF
42
file in the <em class="filename">/Library/Documentation/MacOSXServer</em>
43
directory, and also downloadable from Apple
44
Computer's web site at <a href="http://www.apple.com/server/">http://www.apple.com/server/</a>.</p>
47
<p>Briefly, the procedure for setting up SMB file and printer shares is
51
<p>Designate share points in Workgroup Manager for file sharing.</p>
53
<p>Set up print queues in Server Settings for printer sharing, and
54
activate Printer Service.</p>
56
<p>Configure and activate Windows Services in Server Settings.</p>
58
<p>Activate Password Server and enable SMB authentication in Open
59
Directory Assistant.</p>
61
<p>Enable Password Server authentication for user accounts in Workgroup
64
<p>Monitor file and print services with Server Status.</p>
67
<div class="sect2"><a name="samba2-APP-F-SECT-1.1"/>
69
<h3 class="head2">Sharing Files</h3>
71
<p><a name="INDEX-3"/><a name="INDEX-4"/>The
72
first step to enable SMB file sharing is to designate one or more
73
<em class="firstterm">share points</em>. Share points are folders that
74
form the root of shared volumes for any of the protocols supported by
75
Mac OS X Server: Apple Filesharing Protocol (AFP), Network Filesystem
76
(NFS), File Transfer Protocol (FTP), and SMB.</p>
78
<p>To designate a share point, launch Workgroup Manager. You will be
79
prompted for the local or remote server's hostname
80
or IP address, as well as for a username and password; this process
81
is required by all the Mac OS X Server administrative applications.
82
Once Workgroup Manager is open, click the Sharing button in the
83
toolbar. The list on the left, under the Share Points tab, displays
84
currently defined share points. To add a new one, click the All tab,
85
and navigate to the folder you want to share.</p>
87
<p>On the right, under the General tab, check the box labeled Share this
88
item and its contents, change the ownership and permissions if
89
desired, then click the Save button. Next, under the Protocols tab,
90
select Windows File Settings from the pop-up menu, and ensure that
91
the box labeled Share this item using SMB is checked. At this point,
92
you can also decide whether to allow guest access to the share,
93
change the name of the share displayed to SMB clients, or set
94
permissions for files and folders created by SMB clients. Click the
95
Save button when you're finished making changes. See
96
<a href="appf.html#samba2-APP-F-FIG-1">Figure F-1</a>.</p>
98
<div class="figure"><a name="samba2-APP-F-FIG-1"/><img src="figs/sam2_af01.gif"/></div><h4 class="head4">Figure F-1. Workgroup Manager: Share Points and Windows File Settings</h4>
104
<div class="sect2"><a name="samba2-APP-F-SECT-1.2"/>
106
<h3 class="head2">Sharing Printers</h3>
108
<p><a name="INDEX-5"/><a name="INDEX-6"/>Printer shares are set up
109
differently. First, launch Server Settings; under the File &
110
Print tab, select Print, then Configure Print Service.... Check the
111
box labeled Automatically share new queues for Windows printing.
112
Next, click the Print icon again and then Show Print Monitor. Make
113
sure the printers you want to share are listed. Printers directly
114
attached to the server should have queues created automatically, but
115
remote printers you wish to reshare must be added by clicking New
116
Queue and discovering or specifying the printers. When
117
you're finished, click Save, select the Print icon
118
one more time, and select Start Print Service. See <a href="appf.html#samba2-APP-F-FIG-2">Figure F-2</a>.</p>
120
<div class="figure"><a name="samba2-APP-F-FIG-2"/><img src="figs/sam2_af02.gif"/></div><h4 class="head4">Figure F-2. Server Settings: Print Service</h4>
122
<a name="samba2-APP-F-NOTE-164"/><blockquote class="note"><h4 class="objtitle">TIP</h4>
123
<p>Server Settings will make local printers available for sharing only
124
if they're PostScript compatible. Unfortunately,
125
many printers, including consumer-grade USB inkjet printers,
126
aren't. If you want to make one of these printers
127
available to SMB clients, you can still add the share to
128
<em class="filename">/etc/smb.conf</em> yourself with a text editor. See
129
"Rolling Your Own" later in this
130
chapter for instructions and caveats related to making manual changes
131
to <em class="filename">smb.conf</em>.</p>
138
<div class="sect2"><a name="samba2-APP-F-SECT-1.3"/>
140
<h3 class="head2">Configuring and Activating Services</h3>
142
<p><a name="INDEX-7"/>At this point, neither
143
the file shares nor the printer shares are available to SMB clients.
144
To activate them, click the Windows icon in Server Settings, and
145
click Configure Windows Services.... Under the General tab, you can
146
set the server's NetBIOS hostname, the workgroup or
147
Windows NT domain in which the server resides, and the description
148
that gets displayed in a browse list. You can also specify the code
149
page for an alternate character set. Finally, you can enable
150
boot-time startup of Samba. See <a href="appf.html#samba2-APP-F-FIG-3">Figure F-3</a>.</p>
152
<div class="figure"><a name="samba2-APP-F-FIG-3"/><img src="figs/sam2_af03.gif"/></div><h4 class="head4">Figure F-3. Server Settings: Windows Services</h4>
154
<p>The Windows Services Access tab offers options to enable guest access
155
and limit the number of simultaneous client connections; under the
156
Logging tab, you can specify the verbosity of your logging. With
157
options under the Neighborhood tab, you can configure your machine as
158
a WINS client or server or have it provide browser services locally
159
or across subnets.</p>
161
<a name="samba2-APP-F-SIDEBAR-1"/><blockquote><table border="1" cellpadding="6"><tr><td>
162
<h4 class="head4">Password Server</h4>
164
<p><a name="INDEX-8"/><a name="INDEX-9"/>Password Server is a feature
165
introduced with Mac OS X Server 10.2. In prior versions of Mac OS X
166
Server, Windows authentication was handled with Authentication
167
Manager, which stored a user's Windows password in
168
the <tt class="literal">tim_password</tt> property of the
169
user's NetInfo record. This can still be done in
170
Version 10.2, although it's strongly discouraged
171
because the encrypted password is visible to other users with access
172
to the NetInfo domain and can potentially be decrypted.</p>
174
<p>If you need to use Authentication Manager, use the following
175
procedure to enable it:</p>
178
<p>On every machine hosting a domain that will bind into the NetInfo
179
hierarchy, execute the command <tt class="literal">tim -init -auto</tt>
180
<em class="replaceable">tag</em> for each domain, where
181
<em class="replaceable">tag</em> is the name of the
182
domain's database.</p>
185
<p>When prompted, provide a password to be used as the encryption key
186
for the domain. This key is used to decrypt the Windows passwords and
187
is stored in an encrypted file readable only by root,
188
<em class="filename">/var/db/netinfo/.tag.tim</em>.</p>
191
<p>Set <tt class="literal">AUTHSERVER=-YES-</tt> in
192
<em class="filename">/etc/hostconfig</em>.</p>
195
<p>Start Authentication Manager by invoking <em class="emphasis">tim</em>.
196
This is also executed during the boot sequence by the AuthServer
200
<p>Reset the password of each user requiring SMB client access. In Mac
201
OS X Server 10.2 or later, make sure the user is set up for Basic
202
authentication, not Password Server authentication.</p>
203
</li></ol></td></tr></table></blockquote>
205
<p>When you've finished configuring Windows Services,
206
click the Save button, then click the Windows icon in Server
207
Settings, and select Start Windows Services. This starts the Samba
208
daemons, enabling access from SMB clients.</p>
214
<div class="sect2"><a name="samba2-APP-F-SECT-1.4"/>
216
<h3 class="head2">Activating Password Server</h3>
218
<p><a name="INDEX-10"/><a name="INDEX-11"/>Now that
219
you've set up file and printer shares, you need to
220
make sure users can properly authenticate to access them. In Mac OS X
221
Server, this is accomplished with the <a name="INDEX-12"/>Open Directory
222
Password Server, a service based on the <a name="INDEX-13"/>Simple Authentication and Security
223
Layer (SASL) standard and usable with many different authentication
224
protocols, including the LAN Manager and Windows NT LAN Manager
225
(NTLM) protocols. This section describes how to support SMB client
226
authentication, but for more information on what Password Server does
227
and how it works, see the Mac OS X Server
228
Administrator's Guide.</p>
230
<p>To enable Password Server or merely check its settings, start the
231
Open Directory Assistant. Unless you wish to change any of the
232
settings, just click the right arrow button in the lower-right corner
233
of the window until you get to the first Security step. At this
234
point, activate Password Server by selecting the option marked
235
Password and authentication information will be provided to other
236
systems. The next step displays the main administrative account, and
237
the one after that gives you a choice of authentication protocols to
238
enable (see <a href="appf.html#samba2-APP-F-FIG-4">Figure F-4</a>). Make sure that SMB-NT is
239
checked, and check SMB-Lan Manager if you have Windows 95/98/Me or
240
older clients. The final step saves the Password Server configuration
241
and prompts you to reboot.</p>
243
<div class="figure"><a name="samba2-APP-F-FIG-4"/><img src="figs/sam2_af04.gif"/></div><h4 class="head4">Figure F-4. Password Server authentication protocols</h4>
249
<div class="sect2"><a name="samba2-APP-F-SECT-1.5"/>
251
<h3 class="head2">Enabling Password Server</h3>
253
<p><a name="INDEX-14"/><a name="INDEX-15"/>To enable the
254
use of Password Server for a user account, launch Workgroup Manager,
255
and click the Accounts button in the toolbar. Under the Users tab on
256
the far left (with the silhouette of a single person), select the
257
account, and under the Advanced tab on the right, select Password
258
Server for the User Password Type (see <a href="appf.html#samba2-APP-F-FIG-5">Figure F-5</a>).
259
You are prompted to enter a new user password to be stored in the
260
Password Server database. After saving the account configuration, the
261
user can authenticate and access shares from an SMB client.</p>
263
<div class="figure"><a name="samba2-APP-F-FIG-5"/><img src="figs/sam2_af05.gif"/></div><h4 class="head4">Figure F-5. Workgroup Manager: Enabling Password Server authentication</h4>
269
<div class="sect2"><a name="samba2-APP-F-SECT-1.6"/>
271
<h3 class="head2">Monitoring Services</h3>
273
<p><a name="INDEX-16"/>Once you've got
274
everything working, you'll want to keep an eye on
275
things. The Server Status application gives you views into the
276
various services provided by Mac OS X Server. For Windows Services,
277
you can see the current state of the service, browse the logs
278
(located in the directory
279
<em class="filename">/Library/Logs/WindowsServices</em>), display and
280
terminate individual connections, and view a graph of connections
281
over time (see <a href="appf.html#samba2-APP-F-FIG-6">Figure F-6</a>). Similar information is
282
provided for Print Service.</p>
284
<div class="figure"><a name="samba2-APP-F-FIG-6"/><img src="figs/sam2_af06.gif"/></div><h4 class="head4">Figure F-6. Server Status: Windows Services</h4>
294
<div class="sect1"><a name="samba2-APP-F-SECT-2"/>
296
<h2 class="head1">Configuration Details</h2>
298
<p><a name="INDEX-17"/>Underneath the GUI, a lot of activity
299
takes place to offer Windows Services. In the non-Server version of
300
Mac OS X, selecting Windows File Sharing sets the
301
<tt class="literal">SMBSERVER</tt> parameter in
302
<em class="filename">/etc/hostconfig</em> and triggers the Samba startup
303
item. In Mac OS X Server, under normal circumstances the Samba
304
startup item and the <tt class="literal">SMBSERVER</tt> parameter are never
307
<p>Instead, a process named <em class="emphasis">sambadmind</em> generates
308
<em class="filename">/etc/smb.conf</em> from the configuration specified
309
in Server Settings and Workgroup Manager and handles starting and
310
restarting the Samba daemons as necessary. The
311
<em class="emphasis">sambadmind</em> process is in turn monitored by
312
<em class="emphasis">watchdog</em>, which keeps an eye on certain
313
processes and restarts those which fail. The
314
<em class="emphasis">watchdog</em> utility is configured in
315
<em class="filename">/etc/watchdog.conf</em>, a file similar to a System V
316
<em class="filename">inittab</em>, which specifies how the services under
317
<em class="emphasis">watchdog</em>'s purview are to be
318
treated. For example, the line for <em class="emphasis">sambadmind</em>
321
<blockquote><pre class="code">sambadmin:respawn:/usr/sbin/sambadmind -d # SMB Admin daemon</pre></blockquote>
323
<p>Using a <em class="emphasis">watchdog</em>-monitored process such as
324
<em class="emphasis">sambadmind</em> to start the Samba daemons, instead
325
of a one-time execution of a startup item, results in more reliable
326
service. In Mac OS X Server, if a Samba daemon dies unexpectedly, it
327
is quickly restarted. (Examples of other services monitored by
328
<em class="emphasis">watchdog</em> are Password Server, Print Service, and
329
the Server Settings daemon that allows remote management.)</p>
331
<p>There's another wrinkle in Mac OS X Server: the
332
Samba configuration settings are not written directly to
333
<em class="filename">/etc/smb.conf</em>, as they are in the non-Server
334
version of Mac OS X. Instead, they're stored in the
335
server's local Open Directory domain,<a name="FNPTR-1"/><a href="#FOOTNOTE-1">[1]</a> from which <em class="emphasis">sambadmind</em> retrieves them
336
and regenerates <em class="filename">smb.conf</em>. For example, the Samba
337
global parameters are stored in
338
<em class="filename">/config/SMBServer</em> (see <a href="appf.html#samba2-APP-F-FIG-7">Figure F-7</a>). Share point information is also kept in Open
339
Directory, under <em class="filename">/config/SharePoints</em>, while CUPS
340
takes responsibility for printer configuration in
341
<em class="filename">/etc/cups/printers.conf</em> (also creating stub
342
entries used by Samba in <em class="filename">/etc/printcap</em>).</p>
344
<div class="figure"><a name="samba2-APP-F-FIG-7"/><img src="figs/sam2_af07.gif"/></div><h4 class="head4">Figure F-7. NetInfo Manager: SMBServer properties</h4>
346
<p><a href="appf.html#samba2-APP-F-TABLE-1">Table F-1</a> summarizes the association of Windows
347
Services settings in the Server Settings application, properties
348
stored in Open Directory, and parameters in
349
<em class="filename">/etc/smb.conf</em>.</p>
351
<a name="samba2-APP-F-TABLE-1"/><h4 class="head4">Table F-1. Samba configuration settings in Mac OS X Server</h4><table border="1">
358
<p>Server Settings graphical element in Windows Services</p>
361
<p>Open Directory property in <em class="filename">/config/SMBServer</em></p>
364
<p>Samba global parameter in<em class="filename">/etc/smb.conf</em></p>
371
<p>General → Server Name</p>
374
<p><tt class="literal">netbios_name</tt></p>
377
<p><tt class="literal">netbios name</tt></p>
382
<p>General → Workgroup</p>
385
<p><tt class="literal">workgroup</tt></p>
388
<p><tt class="literal">workgroup</tt></p>
393
<p>General → Description</p>
396
<p><tt class="literal">description</tt></p>
399
<p><tt class="literal">server string</tt></p>
404
<p>General → Code Page</p>
407
<p><tt class="literal">code_page</tt></p>
410
<p><tt class="literal">client code page</tt></p>
415
<p>General → Start Windows Services on system startup</p>
418
<p><tt class="literal">auto_start</tt></p>
426
<p>Access → Allow Guest Access</p>
429
<p><tt class="literal">guest_access</tt>, <tt class="literal">map_to_guest</tt></p>
432
<p><tt class="literal">map to guest</tt></p>
440
<p><tt class="literal">guest_account</tt></p>
443
<p><tt class="literal">guest account</tt></p>
448
<p>Access → Maximum client connections</p>
451
<p><tt class="literal">max_connections</tt></p>
454
<p><tt class="literal">max smbd processes</tt></p>
459
<p>Logging → Detail Level</p>
462
<p><tt class="literal">logging</tt></p>
465
<p><tt class="literal">log level</tt></p>
470
<p>Neighborhood → WINS Registration →
474
<p><tt class="literal">WINS_enabled</tt>, <tt class="literal">WINS_register</tt></p>
477
<p><tt class="literal">wins support</tt></p>
482
<p>Neighborhood → WINS Registration →
483
Enable WINS server</p>
486
<p><tt class="literal">WINS_enabled</tt></p>
489
<p><tt class="literal">wins support</tt></p>
494
<p>Neighborhood → WINS Registration →
495
Register with WINS server</p>
498
<p><tt class="literal">WINS_register</tt>, <tt class="literal">WINS_address</tt></p>
501
<p><tt class="literal">wins server</tt></p>
506
<p>Neighborhood → Workgroup/Domain Services
507
→ Master Browser</p>
510
<p><tt class="literal">Local_Master</tt></p>
513
<p><tt class="literal">local master</tt></p>
518
<p>Neighborhood → Workgroup/Domain Services
519
→ Domain Master Browser</p>
522
<p><tt class="literal">Domain_Master</tt></p>
525
<p><tt class="literal">domain master</tt></p>
530
<p>Print → Start Print Service</p>
533
<p><tt class="literal">printing</tt></p>
544
<p><tt class="literal">lprm_command</tt></p>
547
<p><tt class="literal">lprm command</tt></p>
555
<p><tt class="literal">lppause_command</tt></p>
558
<p><tt class="literal">lppause command</tt></p>
566
<p><tt class="literal">lpresume_command</tt></p>
569
<p><tt class="literal">lpresume command</tt></p>
577
<p><tt class="literal">printer_admin</tt></p>
580
<p><tt class="literal">printer admin</tt></p>
588
<p><tt class="literal">encryption</tt></p>
591
<p><tt class="literal">encrypt passwords</tt></p>
599
<p><tt class="literal">coding_system</tt></p>
602
<p><tt class="literal">coding system</tt></p>
610
<p><tt class="literal">log_dir</tt></p>
621
<p><tt class="literal">smb_log</tt></p>
624
<p><tt class="literal">log file</tt></p>
632
<p><tt class="literal">nmb_log</tt></p>
643
<p><tt class="literal">samba_sbindir</tt></p>
654
<p><tt class="literal">samba_bindir</tt></p>
665
<p><tt class="literal">samba_libdir</tt></p>
676
<p><tt class="literal">samba_lockdir</tt></p>
687
<p><tt class="literal">samba_vardir</tt></p>
698
<p><tt class="literal">stop_time</tt></p>
701
<p>N/A <a name="INDEX-19"/></p>
712
<div class="sect1"><a name="samba2-APP-F-SECT-3"/>
714
<h2 class="head1">Rolling Your Own</h2>
716
<p><a name="INDEX-20"/>When making manual changes to the Samba
717
configuration file, take care to block changes initiated from
718
graphical applications by invoking this command:</p>
720
<blockquote><pre class="code"># <tt class="userinput"><b>chflags uchg /etc/smb.conf</b></tt></pre></blockquote>
722
<p>From that point on, the GUI will be useful only for starting,
723
stopping, and monitoring the service—not for configuring it.</p>
725
<p>If you install your own version of Samba, you can still manage it
726
from Server Settings by changing some of the Open Directory
727
properties in <em class="filename">/config/SMBServer</em>.</p>
729
<p>To do this, open NetInfo Manager and modify the
730
<tt class="literal">samba_sbindir</tt> and <tt class="literal">samba_bindir</tt>
731
properties to match the location of your Samba installation.
732
Optionally, you can modify <tt class="literal">samba_libdir</tt>,
733
<tt class="literal">samba_vardir</tt>, and
734
<tt class="literal">samba_lockdir</tt>. Assuming a default Samba
735
installation, you can also change these at the command line with the
736
following commands:</p>
738
<blockquote><pre class="code"># <tt class="userinput"><b>nicl . -create /config/SMBServer samba_sbindir /usr/local/samba/bin</b></tt>
739
# <tt class="userinput"><b>nicl . -create /config/SMBServer samba_bindir /usr/local/samba/bin</b></tt>
740
# <tt class="userinput"><b>nicl . -create /config/SMBServer samba_libdir /usr/local/samba/lib</b></tt>
741
# <tt class="userinput"><b>nicl . -create /config/SMBServer samba_vardir /usr/local/samba/var</b></tt>
742
# <tt class="userinput"><b>nicl . -create /config/SMBServer samba_lockdir /usr/local/samba/var/locks</b></tt></pre></blockquote>
744
<p>You can check your settings with this command:</p>
746
<blockquote><pre class="code"># <tt class="userinput"><b>nicl . -read /config/SMBServer</b></tt></pre></blockquote>
748
<p>In Server Settings, select Stop Windows Services, then run this
751
<blockquote><pre class="code"># <tt class="userinput"><b>killall sambadmind</b></tt></pre></blockquote>
753
<p>The <em class="emphasis">watchdog</em> utility restarts
754
<em class="emphasis">sambadmind</em> within seconds. Finally, go back to
755
Server Settings, and select Start Windows Services.</p>
757
<p>If you don't modify Open Directory properties to
758
match your active Samba installation (because you wish to manage your
759
configuration another way), be sure never to activate Windows
760
Services from the Server Settings application, or
761
you'll wind up with two sets of Samba daemons
762
running concurrently. <a name="INDEX-21"/></p>
767
<hr/><h4 class="head4">Footnotes</h4><blockquote><a name="FOOTNOTE-1"/>
768
<p><a href="#FNPTR-1">[1]</a> In versions of Mac OS X prior to 10.2, Open Directory domains
769
were called NetInfo domains. NetInfo Manager (located in
770
<em class="filename">/Applications/Utilities</em>) provides a graphical
771
interface to view and modify the contents of Open Directory
772
databases. For more information, see the <em class="citetitle">Mac OS X Server
773
Administrator's Guide</em>, as well as
774
<em class="citetitle">Understanding and Using NetInfo</em>, downloadable
775
from the Mac OS X Server resources web page at <a href="http://www.apple.com/server/resources.html">http://www.apple.com/server/resources.html</a>.</p>
779
<hr/><h4 class="head4"><a href="toc.html">TOC</a></h4>