1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <chapter id="FastStart">
8 <title>Fast Start: Cure for Impatience</title>
11 When we first asked for suggestions for inclusion in the Samba HOWTO documentation,
12 someone wrote asking for example configurations &smbmdash; and lots of them. That is remarkably
13 difficult to do without losing a lot of value that can be derived from presenting
14 many extracts from working systems. That is what the rest of this document does.
15 It does so with extensive descriptions of the configuration possibilities within the
16 context of the chapter that covers it. We hope that this chapter is the medicine
17 that has been requested.
21 The information in this chapter is very sparse compared with the book <quote>Samba-3 by Example</quote>
22 that was written after the original version of this book was nearly complete. <quote>Samba-3 by Example</quote>
23 was the result of feedback from reviewers during the final copy editing of the first edition. It
24 was interesting to see that reader feedback mirrored that given by the original reviewers.
25 In any case, a month and a half was spent in doing basic research to better understand what
26 new as well as experienced network administrators would best benefit from. The book <quote>Samba-3 by Example</quote>
27 is the result of that research. What is presented in the few pages of this book is covered
28 far more comprehensively in the second edition of <quote>Samba-3 by Example</quote>. The second edition
29 of both books will be released at the same time.
33 So in summary, the book <quote>The Official Samba-3 HOWTO & Reference Guide</quote> is intended
34 as the equivalent of an auto mechanic's repair guide. The book <quote>Samba-3 by Example</quote> is the
35 equivalent of the driver's guide that explains how to drive the car. If you want complete network
36 configuration examples, go to <ulink url="http://www.samba.org/samba/docs/Samba3-ByExample.pdf">Samba-3 by
41 <title>Features and Benefits</title>
44 Samba needs very little configuration to create a basic working system.
45 In this chapter we progress from the simple to the complex, for each providing
46 all steps and configuration file changes needed to make each work. Please note
47 that a comprehensively configured system will likely employ additional smart
48 features. These additional features are covered in the remainder of this document.
52 The examples used here have been obtained from a number of people who made
53 requests for example configurations. All identities have been obscured to protect
54 the guilty, and any resemblance to unreal nonexistent sites is deliberate.
60 <title>Description of Example Sites</title>
63 In the first set of configuration examples we consider the case of exceptionally simple system requirements.
64 There is a real temptation to make something that should require little effort much too complex.
68 <link linkend="anon-ro"></link> documents the type of server that might be sufficient to serve CD-ROM images,
69 or reference document files for network client use. This configuration is also discussed in <link
70 linkend="StandAloneServer"></link>, <link linkend="RefDocServer"></link>. The purpose for this configuration
71 is to provide a shared volume that is read-only that anyone, even guests, can access.
75 The second example shows a minimal configuration for a print server that anyone can print to as long as they
76 have the correct printer drivers installed on their computer. This is a mirror of the system described in
77 <link linkend="StandAloneServer"></link>, <link linkend="SimplePrintServer"></link>.
81 The next example is of a secure office file and print server that will be accessible only to users who have an
82 account on the system. This server is meant to closely resemble a workgroup file and print server, but has to
83 be more secure than an anonymous access machine. This type of system will typically suit the needs of a small
84 office. The server provides no network logon facilities, offers no domain control; instead it is just a
85 network-attached storage (NAS) device and a print server.
89 The later example consider more complex systems that will either integrate into existing MS Windows networks
90 or replace them entirely. These cover domain member servers as well as Samba domain control (PDC/BDC) and
91 finally describes in detail a large distributed network with branch offices in remote locations.
97 <title>Worked Examples</title>
100 The configuration examples are designed to cover everything necessary to get Samba
101 running. They do not cover basic operating system platform configuration, which is
102 clearly beyond the scope of this text.
106 It is also assumed that Samba has been correctly installed, either by way of installation
107 of the packages that are provided by the operating system vendor or through other means.
111 <title>Standalone Server</title>
114 <indexterm><primary>Server Type</primary><secondary>Stand-alone</secondary></indexterm>
115 A standalone server implies no more than the fact that it is not a domain controller
116 and it does not participate in domain control. It can be a simple, workgroup-like
117 server, or it can be a complex server that is a member of a domain security context.
121 As the examples are developed, every attempt is made to progress the system toward greater capability, just as
122 one might expect would happen in a real business office as that office grows in size and its needs change.
126 <title>Anonymous Read-Only Document Server</title>
129 <indexterm><primary>read only</primary><secondary>server</secondary></indexterm>
130 The purpose of this type of server is to make available to any user
131 any documents or files that are placed on the shared resource. The
132 shared resource could be a CD-ROM drive, a CD-ROM image, or a file
138 The file system share point will be <filename>/export</filename>.
142 All files will be owned by a user called Jack Baumbach.
143 Jack's login name will be <emphasis>jackb</emphasis>. His password will be
144 <emphasis>m0r3pa1n</emphasis> &smbmdash; of course, that's just the example we are
145 using; do not use this in a production environment because
146 all readers of this document will know it.
151 <title>Installation Procedure: Read-Only Server</title>
153 Add user to system (with creation of the user's home directory):
155 &rootprompt;<userinput>useradd -c "Jack Baumbach" -m -g users -p m0r3pa1n jackb</userinput>
160 Create directory, and set permissions and ownership:
162 &rootprompt;<userinput>mkdir /export</userinput>
163 &rootprompt;<userinput>chmod u+rwx,g+rx,o+rx /export</userinput>
164 &rootprompt;<userinput>chown jackb.users /export</userinput>
169 Copy the files that should be shared to the <filename>/export</filename>
174 Install the Samba configuration file (<filename>/etc/samba/smb.conf</filename>)
175 as shown in <link linkend="anon-example">Anonymous Read-Only Server Configuration</link>.
178 <example id="anon-example">
179 <title>Anonymous Read-Only Server Configuration</title>
181 <smbconfcomment>Global parameters</smbconfcomment>
182 <smbconfsection name="[global]"/>
183 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
184 <smbconfoption name="netbios name">HOBBIT</smbconfoption>
185 <smbconfoption name="security">user</smbconfoption>
186 <smbconfoption name="map to guest">bad user</smbconfoption>
188 <smbconfsection name="[data]"/>
189 <smbconfoption name="comment">Data</smbconfoption>
190 <smbconfoption name="path">/export</smbconfoption>
191 <smbconfoption name="read only">Yes</smbconfoption>
192 <smbconfoption name="guest ok">Yes</smbconfoption>
197 Test the configuration file by executing the following command:
199 &rootprompt;<userinput>testparm</userinput>
201 Alternatively, where you are operating from a master configuration file called
202 <filename>smb.conf.master</filename>, the following sequence of commands might prove
205 &rootprompt; cd /etc/samba
206 &rootprompt; testparm -s smb.conf.master > smb.conf
207 &rootprompt; testparm
209 Note any error messages that might be produced. Proceed only if error-free output has been
210 obtained. An example of typical output that should be generated from the above configuration
213 Load smb config files from /etc/samba/smb.conf
214 Processing section "[data]"
215 Loaded services file OK.
216 Server role: ROLE_STANDALONE
217 Press enter to see a dump of your service definitions
218 <userinput>[Press enter]</userinput>
223 netbios name = HOBBIT
225 map to guest = bad user
236 Start Samba using the method applicable to your operating system platform. The method that
237 should be used is platform dependent. Refer to <link linkend="startingSamba">Starting Samba</link>
238 for further information regarding the starting of Samba.
242 Configure your MS Windows client for workgroup <emphasis>MIDEARTH</emphasis>,
243 set the machine name to ROBBINS, reboot, wait a few (2 - 5) minutes,
244 then open Windows Explorer and visit the Network Neighborhood.
245 The machine HOBBIT should be visible. When you click this machine
246 icon, it should open up to reveal the <emphasis>data</emphasis> share. After
247 you click the share, it should open up to reveal the files previously
248 placed in the <filename>/export</filename> directory.
253 The information above (following # Global parameters) provides the complete
254 contents of the <filename>/etc/samba/smb.conf</filename> file.
260 <title>Anonymous Read-Write Document Server</title>
263 <indexterm><primary>anonymous</primary><secondary>read-write server</secondary></indexterm>
264 We should view this configuration as a progression from the previous example.
265 The difference is that shared access is now forced to the user identity of jackb
266 and to the primary group jackb belongs to. One other refinement we can make is to
267 add the user <emphasis>jackb</emphasis> to the <filename>smbpasswd</filename> file.
270 &rootprompt;<userinput>smbpasswd -a jackb</userinput>
271 New SMB password: <userinput>m0r3pa1n</userinput>
272 Retype new SMB password: <userinput>m0r3pa1n</userinput>
275 Addition of this user to the <filename>smbpasswd</filename> file allows all files
276 to be displayed in the Explorer Properties boxes as belonging to <emphasis>jackb</emphasis>
277 instead of to <emphasis>User Unknown</emphasis>.
281 The complete, modified &smb.conf; file is as shown in <link linkend="anon-rw"/>.
284 <example id="anon-rw">
285 <title>Modified Anonymous Read-Write smb.conf</title>
287 <smbconfcomment>Global parameters</smbconfcomment>
288 <smbconfsection name="[global]"/>
289 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
290 <smbconfoption name="netbios name">HOBBIT</smbconfoption>
291 <smbconfoption name="security">USER</smbconfoption>
292 <smbconfoption name="map to guest">bad user</smbconfoption>
294 <smbconfsection name="[data]"/>
295 <smbconfoption name="comment">Data</smbconfoption>
296 <smbconfoption name="path">/export</smbconfoption>
297 <smbconfoption name="force user">jackb</smbconfoption>
298 <smbconfoption name="force group">users</smbconfoption>
299 <smbconfoption name="read only">No</smbconfoption>
300 <smbconfoption name="guest ok">Yes</smbconfoption>
307 <title>Anonymous Print Server</title>
310 <indexterm><primary>anonymous</primary><secondary>print server</secondary></indexterm>
311 An anonymous print server serves two purposes:
316 It allows printing to all printers from a single location.
320 It reduces network traffic congestion due to many users trying
321 to access a limited number of printers.
326 In the simplest of anonymous print servers, it is common to require the installation
327 of the correct printer drivers on the Windows workstation. In this case the print
328 server will be designed to just pass print jobs through to the spooler, and the spooler
329 should be configured to do raw pass-through to the printer. In other words, the print
330 spooler should not filter or process the data stream being passed to the printer.
334 In this configuration, it is undesirable to present the Add Printer Wizard, and we do
335 not want to have automatic driver download, so we disable it in the following
336 configuration. <link linkend="anon-print"></link> is the resulting &smb.conf; file.
339 <example id="anon-print">
340 <title>Anonymous Print Server smb.conf</title>
342 <smbconfcomment>Global parameters</smbconfcomment>
343 <smbconfsection name="[global]"/>
344 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
345 <smbconfoption name="netbios name">LUTHIEN</smbconfoption>
346 <smbconfoption name="security">user</smbconfoption>
347 <smbconfoption name="printing">cups</smbconfoption>
349 <smbconfsection name="[printers]"/>
350 <smbconfoption name="comment">All Printers</smbconfoption>
351 <smbconfoption name="path">/var/spool/samba</smbconfoption>
352 <smbconfoption name="guest ok">Yes</smbconfoption>
353 <smbconfoption name="printable">Yes</smbconfoption>
354 <smbconfoption name="use client driver">Yes</smbconfoption>
355 <smbconfoption name="browseable">No</smbconfoption>
360 The above configuration is not ideal. It uses no smart features, and it deliberately
361 presents a less than elegant solution. But it is basic, and it does print. Samba makes
362 use of the direct printing application program interface that is provided by CUPS.
363 When Samba has been compiled and linked with the CUPS libraries, the default printing
364 system will be CUPS. By specifying that the printcap name is CUPS, Samba will use
365 the CUPS library API to communicate directly with CUPS for all printer functions.
366 It is possible to force the use of external printing commands by setting the value
367 of the <parameter>printing</parameter> to either SYSV or BSD, and thus the value of
368 the parameter <parameter>printcap name</parameter> must be set to something other than
369 CUPS. In such case, it could be set to the name of any file that contains a list
370 of printers that should be made available to Windows clients.
374 Windows users will need to install a local printer and then change the print
375 to device after installation of the drivers. The print to device can then be set to
376 the network printer on this machine.
380 Make sure that the directory <filename>/var/spool/samba</filename> is capable of being used
381 as intended. The following steps must be taken to achieve this:
386 The directory must be owned by the superuser (root) user and group:
388 &rootprompt;<userinput>chown root.root /var/spool/samba</userinput>
393 Directory permissions should be set for public read-write with the
394 sticky bit set as shown:
396 &rootprompt;<userinput>chmod a+twrx /var/spool/samba</userinput>
398 The purpose of setting the sticky bit is to prevent who does not own the temporary print file
399 from being able to take control of it with the potential for devious misuse.
405 <indexterm><primary>MIME</primary><secondary>raw</secondary></indexterm>
406 <indexterm><primary>raw printing</primary></indexterm>
407 On CUPS-enabled systems there is a facility to pass raw data directly to the printer without
408 intermediate processing via CUPS print filters. Where use of this mode of operation is desired,
409 it is necessary to configure a raw printing device. It is also necessary to enable the raw mime
410 handler in the <filename>/etc/mime.conv</filename> and <filename>/etc/mime.types</filename>
411 files. Refer to <link linkend="cups-raw"></link>.
418 <title>Secure Read-Write File and Print Server</title>
421 We progress now from simple systems to a server that is slightly more complex.
425 Our new server will require a public data storage area in which only authenticated
426 users (i.e., those with a local account) can store files, as well as a home directory.
427 There will be one printer that should be available for everyone to use.
431 In this hypothetical environment (no espionage was conducted to obtain this data),
432 the site is demanding a simple environment that is <emphasis>secure enough</emphasis>
433 but not too difficult to use.
437 Site users will be Jack Baumbach, Mary Orville, and Amed Sehkah. Each will have
438 a password (not shown in further examples). Mary will be the printer administrator and will
439 own all files in the public share.
443 This configuration will be based on <emphasis>user-level security</emphasis> that
444 is the default, and for which the default is to store Microsoft Windows-compatible
445 encrypted passwords in a file called <filename>/etc/samba/smbpasswd</filename>.
446 The default &smb.conf; entry that makes this happen is
447 <smbconfoption name="passdb backend">smbpasswd</smbconfoption>. Since this is the default,
448 it is not necessary to enter it into the configuration file.
453 <title>Installing the Secure Office Server</title>
455 <indexterm><primary>office server</primary></indexterm>
456 Add all users to the operating system:
458 &rootprompt;<userinput>useradd -c "Jack Baumbach" -m -g users -p m0r3pa1n jackb</userinput>
459 &rootprompt;<userinput>useradd -c "Mary Orville" -m -g users -p secret maryo</userinput>
460 &rootprompt;<userinput>useradd -c "Amed Sehkah" -m -g users -p secret ameds</userinput>
465 Configure the Samba &smb.conf; file as shown in <link linkend="OfficeServer"/>.
468 <example id="OfficeServer">
469 <title>Secure Office Server smb.conf</title>
471 <smbconfcomment>Global parameters</smbconfcomment>
472 <smbconfsection name="[global]"/>
473 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
474 <smbconfoption name="netbios name">OLORIN</smbconfoption>
475 <smbconfoption name="show add printer wizard">No</smbconfoption>
476 <smbconfoption name="printing">cups</smbconfoption>
478 <smbconfsection name="[homes]"/>
479 <smbconfoption name="comment">Home Directories</smbconfoption>
480 <smbconfoption name="valid users">%S</smbconfoption>
481 <smbconfoption name="read only">No</smbconfoption>
482 <smbconfoption name="browseable">No</smbconfoption>
484 <smbconfsection name="[public]"/>
485 <smbconfoption name="comment">Data</smbconfoption>
486 <smbconfoption name="path">/export</smbconfoption>
487 <smbconfoption name="force user">maryo</smbconfoption>
488 <smbconfoption name="force group">users</smbconfoption>
489 <smbconfoption name="read only">No</smbconfoption>
491 <smbconfsection name="[printers]"/>
492 <smbconfoption name="comment">All Printers</smbconfoption>
493 <smbconfoption name="path">/var/spool/samba</smbconfoption>
494 <smbconfoption name="create mask">0600</smbconfoption>
495 <smbconfoption name="guest ok">Yes</smbconfoption>
496 <smbconfoption name="printable">Yes</smbconfoption>
497 <smbconfoption name="use client driver">Yes</smbconfoption>
498 <smbconfoption name="browseable">No</smbconfoption>
503 Initialize the Microsoft Windows password database with the new users:
505 &rootprompt;<userinput>smbpasswd -a root</userinput>
506 New SMB password: <userinput>bigsecret</userinput>
507 Reenter smb password: <userinput>bigsecret</userinput>
510 &rootprompt;<userinput>smbpasswd -a jackb</userinput>
511 New SMB password: <userinput>m0r3pa1n</userinput>
512 Retype new SMB password: <userinput>m0r3pa1n</userinput>
515 &rootprompt;<userinput>smbpasswd -a maryo</userinput>
516 New SMB password: <userinput>secret</userinput>
517 Reenter smb password: <userinput>secret</userinput>
520 &rootprompt;<userinput>smbpasswd -a ameds</userinput>
521 New SMB password: <userinput>mysecret</userinput>
522 Reenter smb password: <userinput>mysecret</userinput>
528 Install printer using the CUPS Web interface. Make certain that all
529 printers that will be shared with Microsoft Windows clients are installed
530 as raw printing devices.
534 Start Samba using the operating system administrative interface.
535 Alternately, this can be done manually by executing:
536 <indexterm><primary>smbd</primary></indexterm>
537 <indexterm><primary>nmbd</primary></indexterm>
538 <indexterm><primary>starting samba</primary><secondary>smbd</secondary></indexterm>
539 <indexterm><primary>starting samba</primary><secondary>nmbd</secondary></indexterm>
541 &rootprompt;<userinput> nmbd; smbd;</userinput>
543 Both applications automatically execute as daemons. Those who are paranoid about
544 maintaining control can add the <constant>-D</constant> flag to coerce them to start
549 Configure the <filename>/export</filename> directory:
551 &rootprompt;<userinput>mkdir /export</userinput>
552 &rootprompt;<userinput>chown maryo.users /export</userinput>
553 &rootprompt;<userinput>chmod u=rwx,g=rwx,o-rwx /export</userinput>
558 Check that Samba is running correctly:
560 &rootprompt;<userinput>smbclient -L localhost -U%</userinput>
561 Domain=[MIDEARTH] OS=[UNIX] Server=[Samba-3.0.20]
563 Sharename Type Comment
564 --------- ---- -------
566 IPC$ IPC IPC Service (Samba-3.0.20)
567 ADMIN$ IPC IPC Service (Samba-3.0.20)
578 The following error message indicates that Samba was not running:
580 &rootprompt; smbclient -L olorin -U%
581 Error connecting to 192.168.1.40 (Connection refused)
582 Connection to olorin failed
587 Connect to OLORIN as maryo:
589 &rootprompt;<userinput>smbclient //olorin/maryo -Umaryo%secret</userinput>
590 OS=[UNIX] Server=[Samba-3.0.20]
591 smb: \> <userinput>dir</userinput>
592 . D 0 Sat Jun 21 10:58:16 2003
593 .. D 0 Sat Jun 21 10:54:32 2003
594 Documents D 0 Fri Apr 25 13:23:58 2003
595 DOCWORK D 0 Sat Jun 14 15:40:34 2003
596 OpenOffice.org D 0 Fri Apr 25 13:55:16 2003
597 .bashrc H 1286 Fri Apr 25 13:23:58 2003
598 .netscape6 DH 0 Fri Apr 25 13:55:13 2003
599 .mozilla DH 0 Wed Mar 5 11:50:50 2003
600 .kermrc H 164 Fri Apr 25 13:23:58 2003
601 .acrobat DH 0 Fri Apr 25 15:41:02 2003
603 55817 blocks of size 524288. 34725 blocks available
604 smb: \> <userinput>q</userinput>
610 By now you should be getting the hang of configuration basics. Clearly, it is time to
611 explore slightly more complex examples. For the remainder of this chapter we abbreviate
612 instructions, since there are previous examples.
620 <title>Domain Member Server</title>
623 <indexterm><primary>Server Type</primary><secondary>Domain Member</secondary></indexterm>
624 In this instance we consider the simplest server configuration we can get away with
625 to make an accounting department happy. Let's be warned, the users are accountants and they
626 do have some nasty demands. There is a budget for only one server for this department.
630 The network is managed by an internal Information Services Group (ISG), to which we belong.
631 Internal politics are typical of a medium-sized organization; Human Resources is of the
632 opinion that they run the ISG because they are always adding and disabling users. Also,
633 departmental managers have to fight tooth and nail to gain basic network resources access for
634 their staff. Accounting is different, though, they get exactly what they want. So this should
639 We use the users from the last example. The accounting department
640 has a general printer that all departmental users may use. There is also a check printer
641 that may be used only by the person who has authority to print checks. The chief financial
642 officer (CFO) wants that printer to be completely restricted and for it to be located in the
643 private storage area in her office. It therefore must be a network printer.
647 The accounting department uses an accounting application called <emphasis>SpytFull</emphasis>
648 that must be run from a central application server. The software is licensed to run only off
649 one server, there are no workstation components, and it is run off a mapped share. The data
650 store is in a UNIX-based SQL backend. The UNIX gurus look after that, so this is not our
655 The accounting department manager (maryo) wants a general filing system as well as a separate
656 file storage area for form letters (nastygrams). The form letter area should be read-only to
657 all accounting staff except the manager. The general filing system has to have a structured
658 layout with a general area for all staff to store general documents as well as a separate
659 file area for each member of her team that is private to that person, but she wants full
660 access to all areas. Users must have a private home share for personal work-related files
661 and for materials not related to departmental operations.
665 <title>Example Configuration</title>
668 The server <emphasis>valinor</emphasis> will be a member server of the company domain.
669 Accounting will have only a local server. User accounts will be on the domain controllers,
670 as will desktop profiles and all network policy files.
675 Do not add users to the UNIX/Linux server; all of this will run off the
680 Configure &smb.conf; according to <link linkend="fast-member-server">Member server smb.conf
681 (globals)</link> and <link linkend="fast-memberserver-shares">Member server smb.conf (shares
682 and services)</link>.
685 <example id="fast-member-server">
686 <title>Member Server smb.conf (Globals)</title>
688 <smbconfcomment>Global parameters</smbconfcomment>
689 <smbconfsection name="[global]"/>
690 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
691 <smbconfoption name="netbios name">VALINOR</smbconfoption>
692 <smbconfoption name="security">DOMAIN</smbconfoption>
693 <smbconfoption name="printcap name">cups</smbconfoption>
694 <smbconfoption name="disable spoolss">Yes</smbconfoption>
695 <smbconfoption name="show add printer wizard">No</smbconfoption>
696 <smbconfoption name="idmap uid">15000-20000</smbconfoption>
697 <smbconfoption name="idmap gid">15000-20000</smbconfoption>
698 <smbconfoption name="winbind use default domain">Yes</smbconfoption>
699 <smbconfoption name="printing">cups</smbconfoption>
703 <example id="fast-memberserver-shares">
704 <title>Member Server smb.conf (Shares and Services)</title>
706 <smbconfsection name="[homes]"/>
707 <smbconfoption name="comment">Home Directories</smbconfoption>
708 <smbconfoption name="valid users">%S</smbconfoption>
709 <smbconfoption name="read only">No</smbconfoption>
710 <smbconfoption name="browseable">No</smbconfoption>
712 <smbconfsection name="[spytfull]"/>
713 <smbconfoption name="comment">Accounting Application Only</smbconfoption>
714 <smbconfoption name="path">/export/spytfull</smbconfoption>
715 <smbconfoption name="valid users">@Accounts</smbconfoption>
716 <smbconfoption name="admin users">maryo</smbconfoption>
717 <smbconfoption name="read only">Yes</smbconfoption>
719 <smbconfsection name="[public]"/>
720 <smbconfoption name="comment">Data</smbconfoption>
721 <smbconfoption name="path">/export/public</smbconfoption>
722 <smbconfoption name="read only">No</smbconfoption>
724 <smbconfsection name="[printers]"/>
725 <smbconfoption name="comment">All Printers</smbconfoption>
726 <smbconfoption name="path">/var/spool/samba</smbconfoption>
727 <smbconfoption name="create mask">0600</smbconfoption>
728 <smbconfoption name="guest ok">Yes</smbconfoption>
729 <smbconfoption name="printable">Yes</smbconfoption>
730 <smbconfoption name="use client driver">Yes</smbconfoption>
731 <smbconfoption name="browseable">No</smbconfoption>
736 <indexterm><primary>net</primary><secondary>rpc</secondary></indexterm>
737 Join the domain. Note: Do not start Samba until this step has been completed!
739 &rootprompt;<userinput>net rpc join -Uroot%'bigsecret'</userinput>
740 Joined domain MIDEARTH.
745 Make absolutely certain that you disable (shut down) the <command>nscd</command>
746 daemon on any system on which <command>winbind</command> is configured to run.
750 Start Samba following the normal method for your operating system platform.
751 If you wish to do this manually, execute as root:
752 <indexterm><primary>smbd</primary></indexterm>
753 <indexterm><primary>nmbd</primary></indexterm>
754 <indexterm><primary>winbindd</primary></indexterm>
755 <indexterm><primary>starting samba</primary><secondary>smbd</secondary></indexterm>
756 <indexterm><primary>starting samba</primary><secondary>nmbd</secondary></indexterm>
757 <indexterm><primary>starting samba</primary><secondary>winbindd</secondary></indexterm>
759 &rootprompt;<userinput>nmbd; smbd; winbindd;</userinput>
764 Configure the name service switch (NSS) control file on your system to resolve user and group names
765 via winbind. Edit the following lines in <filename>/etc/nsswitch.conf</filename>:
767 passwd: files winbind
769 hosts: files dns winbind
774 Set the password for <command>wbinfo</command> to use:
776 &rootprompt;<userinput>wbinfo --set-auth-user=root%'bigsecret'</userinput>
781 Validate that domain user and group credentials can be correctly resolved by executing:
783 &rootprompt;<userinput>wbinfo -u</userinput>
790 &rootprompt;<userinput>wbinfo -g</userinput>
791 MIDEARTH\Domain Users
792 MIDEARTH\Domain Admins
793 MIDEARTH\Domain Guests
800 Check that <command>winbind</command> is working. The following demonstrates correct
801 username resolution via the <command>getent</command> system utility:
803 &rootprompt;<userinput>getent passwd maryo</userinput>
804 maryo:x:15000:15003:Mary Orville:/home/MIDEARTH/maryo:/bin/false
809 A final test that we have this under control might be reassuring:
811 &rootprompt;<userinput>touch /export/a_file</userinput>
812 &rootprompt;<userinput>chown maryo /export/a_file</userinput>
813 &rootprompt;<userinput>ls -al /export/a_file</userinput>
815 -rw-r--r-- 1 maryo users 11234 Jun 21 15:32 a_file
818 &rootprompt;<userinput>rm /export/a_file</userinput>
823 Configuration is now mostly complete, so this is an opportune time
824 to configure the directory structure for this site:
826 &rootprompt;<userinput>mkdir -p /export/{spytfull,public}</userinput>
827 &rootprompt;<userinput>chmod ug=rwxS,o=x /export/{spytfull,public}</userinput>
828 &rootprompt;<userinput>chown maryo.Accounts /export/{spytfull,public}</userinput>
838 <title>Domain Controller</title>
842 <indexterm><primary>Server Type</primary><secondary>Domain Controller</secondary></indexterm>
843 For the remainder of this chapter the focus is on the configuration of domain control.
844 The examples that follow are for two implementation strategies. Remember, our objective is
845 to create a simple but working solution. The remainder of this book should help to highlight
846 opportunity for greater functionality and the complexity that goes with it.
850 A domain controller configuration can be achieved with a simple configuration using the new
851 tdbsam password backend. This type of configuration is good for small
852 offices, but has limited scalability (cannot be replicated), and performance can be expected
853 to fall as the size and complexity of the domain increases.
857 The use of tdbsam is best limited to sites that do not need
858 more than a Primary Domain Controller (PDC). As the size of a domain grows the need
859 for additional domain controllers becomes apparent. Do not attempt to under-resource
860 a Microsoft Windows network environment; domain controllers provide essential
861 authentication services. The following are symptoms of an under-resourced domain control
867 Domain logons intermittently fail.
871 File access on a domain member server intermittently fails, giving a permission denied
877 A more scalable domain control authentication backend option might use
878 Microsoft Active Directory or an LDAP-based backend. Samba-3 provides
879 for both options as a domain member server. As a PDC, Samba-3 is not able to provide
880 an exact alternative to the functionality that is available with Active Directory.
881 Samba-3 can provide a scalable LDAP-based PDC/BDC solution.
885 The tdbsam authentication backend provides no facility to replicate
886 the contents of the database, except by external means (i.e., there is no self-contained protocol
887 in Samba-3 for Security Account Manager database [SAM] replication).
891 If you need more than one domain controller, do not use a tdbsam authentication backend.
895 <title>Example: Engineering Office</title>
898 The engineering office network server we present here is designed to demonstrate use
899 of the new tdbsam password backend. The tdbsam
900 facility is new to Samba-3. It is designed to provide many user and machine account controls
901 that are possible with Microsoft Windows NT4. It is safe to use this in smaller networks.
906 A working PDC configuration using the tdbsam
907 password backend can be found in <link linkend="fast-engoffice-global">Engineering Office smb.conf
908 (globals)</link> together with <link linkend="fast-engoffice-shares">Engineering Office smb.conf
909 (shares and services)</link>:
910 <indexterm><primary>pdbedit</primary></indexterm>
913 <example id="fast-engoffice-global">
914 <title>Engineering Office smb.conf (globals)</title>
916 <smbconfsection name="[global]"/>
917 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
918 <smbconfoption name="netbios name">FRODO</smbconfoption>
919 <smbconfoption name="passdb backend">tdbsam</smbconfoption>
920 <smbconfoption name="printcap name">cups</smbconfoption>
921 <smbconfoption name="add user script">/usr/sbin/useradd -m %u</smbconfoption>
922 <smbconfoption name="delete user script">/usr/sbin/userdel -r %u</smbconfoption>
923 <smbconfoption name="add group script">/usr/sbin/groupadd %g</smbconfoption>
924 <smbconfoption name="delete group script">/usr/sbin/groupdel %g</smbconfoption>
925 <smbconfoption name="add user to group script">/usr/sbin/groupmod -A %u %g</smbconfoption>
926 <smbconfoption name="delete user from group script">/usr/sbin/groupmod -R %u %g</smbconfoption>
927 <smbconfoption name="add machine script">/usr/sbin/useradd -s /bin/false -d /var/lib/nobody %u</smbconfoption>
928 <smbconfcomment>Note: The following specifies the default logon script.</smbconfcomment>
929 <smbconfcomment>Per user logon scripts can be specified in the user account using pdbedit </smbconfcomment>
930 <smbconfoption name="logon script">scripts\logon.bat</smbconfoption>
931 <smbconfcomment>This sets the default profile path. Set per user paths with pdbedit</smbconfcomment>
932 <smbconfoption name="logon path">\\%L\Profiles\%U</smbconfoption>
933 <smbconfoption name="logon drive">H:</smbconfoption>
934 <smbconfoption name="logon home">\\%L\%U</smbconfoption>
935 <smbconfoption name="domain logons">Yes</smbconfoption>
936 <smbconfoption name="os level">35</smbconfoption>
937 <smbconfoption name="preferred master">Yes</smbconfoption>
938 <smbconfoption name="domain master">Yes</smbconfoption>
939 <smbconfoption name="idmap uid">15000-20000</smbconfoption>
940 <smbconfoption name="idmap gid">15000-20000</smbconfoption>
941 <smbconfoption name="printing">cups</smbconfoption>
945 <example id="fast-engoffice-shares">
946 <title>Engineering Office smb.conf (shares and services)</title>
948 <smbconfsection name="[homes]"/>
949 <smbconfoption name="comment">Home Directories</smbconfoption>
950 <smbconfoption name="valid users">%S</smbconfoption>
951 <smbconfoption name="read only">No</smbconfoption>
952 <smbconfoption name="browseable">No</smbconfoption>
954 <smbconfcomment>Printing auto-share (makes printers available thru CUPS)</smbconfcomment>
955 <smbconfsection name="[printers]"/>
956 <smbconfoption name="comment">All Printers</smbconfoption>
957 <smbconfoption name="path">/var/spool/samba</smbconfoption>
958 <smbconfoption name="create mask">0600</smbconfoption>
959 <smbconfoption name="guest ok">Yes</smbconfoption>
960 <smbconfoption name="printable">Yes</smbconfoption>
961 <smbconfoption name="browseable">No</smbconfoption>
963 <smbconfsection name="[print$]"/>
964 <smbconfoption name="comment">Printer Drivers Share</smbconfoption>
965 <smbconfoption name="path">/var/lib/samba/drivers</smbconfoption>
966 <smbconfoption name="write list">maryo, root</smbconfoption>
968 <smbconfcomment>Needed to support domain logons</smbconfcomment>
969 <smbconfsection name="[netlogon]"/>
970 <smbconfoption name="comment">Network Logon Service</smbconfoption>
971 <smbconfoption name="path">/var/lib/samba/netlogon</smbconfoption>
972 <smbconfoption name="admin users">root, maryo</smbconfoption>
973 <smbconfoption name="guest ok">Yes</smbconfoption>
974 <smbconfoption name="browseable">No</smbconfoption>
976 <smbconfcomment>For profiles to work, create a user directory under the path</smbconfcomment>
977 <smbconfcomment> shown. i.e., mkdir -p /var/lib/samba/profiles/maryo</smbconfcomment>
978 <smbconfsection name="[Profiles]"/>
979 <smbconfoption name="comment">Roaming Profile Share</smbconfoption>
980 <smbconfoption name="path">/var/lib/samba/profiles</smbconfoption>
981 <smbconfoption name="read only">No</smbconfoption>
982 <smbconfoption name="profile acls">Yes</smbconfoption>
984 <smbconfcomment>Other resource (share/printer) definitions would follow below.</smbconfcomment>
989 Create UNIX group accounts as needed using a suitable operating system tool:
991 &rootprompt;<userinput>groupadd ntadmins</userinput>
992 &rootprompt;<userinput>groupadd designers</userinput>
993 &rootprompt;<userinput>groupadd engineers</userinput>
994 &rootprompt;<userinput>groupadd qateam</userinput>
999 Create user accounts on the system using the appropriate tool
1000 provided with the operating system. Make sure all user home directories
1001 are created also. Add users to groups as required for access control
1002 on files, directories, printers, and as required for use in the Samba
1008 <indexterm><primary>net</primary><secondary>groupmap</secondary></indexterm>
1009 <indexterm><primary>initGroups.sh</primary></indexterm>
1010 Assign each of the UNIX groups to NT groups by executing this shell script
1011 (You could name the script <filename>initGroups.sh</filename>):
1014 #### Keep this as a shell script for future re-use
1016 # First assign well known groups
1017 net groupmap add ntgroup="Domain Admins" unixgroup=ntadmins rid=512 type=d
1018 net groupmap add ntgroup="Domain Users" unixgroup=users rid=513 type=
1019 net groupmap add ntgroup="Domain Guests" unixgroup=nobody rid=514 type=d
1021 # Now for our added Domain Groups
1022 net groupmap add ntgroup="Designers" unixgroup=designers type=d
1023 net groupmap add ntgroup="Engineers" unixgroup=engineers type=d
1024 net groupmap add ntgroup="QA Team" unixgroup=qateam type=d
1029 Create the <filename>scripts</filename> directory for use in the
1030 <smbconfsection name="[NETLOGON]"/> share:
1032 &rootprompt;<userinput>mkdir -p /var/lib/samba/netlogon/scripts</userinput>
1034 Place the logon scripts that will be used (batch or cmd scripts)
1040 The above configuration provides a functional PDC
1041 system to which must be added file shares and printers as required.
1047 <title>A Big Organization</title>
1050 In this section we finally get to review in brief a Samba-3 configuration that
1051 uses a Lightweight Directory Access (LDAP)-based authentication backend. The
1052 main reasons for this choice are to provide the ability to host primary
1053 and Backup Domain Control (BDC), as well as to enable a higher degree of
1054 scalability to meet the needs of a very distributed environment.
1058 <title>The Primary Domain Controller</title>
1061 This is an example of a minimal configuration to run a Samba-3 PDC
1062 using an LDAP authentication backend. It is assumed that the operating system
1063 has been correctly configured.
1067 The Idealx scripts (or equivalent) are needed to manage LDAP-based POSIX and/or
1068 SambaSamAccounts. The Idealx scripts may be downloaded from the <ulink url="http://www.idealx.org">
1069 Idealx</ulink> Web site. They may also be obtained from the Samba tarball. Linux
1070 distributions tend to install the Idealx scripts in the
1071 <filename>/usr/share/doc/packages/sambaXXXXXX/examples/LDAP/smbldap-tools</filename> directory.
1072 Idealx scripts version <constant>smbldap-tools-0.9.1</constant> are known to work well.
1077 Obtain from the Samba sources <filename>~/examples/LDAP/samba.schema</filename>
1078 and copy it to the <filename>/etc/openldap/schema/</filename> directory.
1082 Set up the LDAP server. This example is suitable for OpenLDAP 2.1.x.
1083 The <filename>/etc/openldap/slapd.conf</filename> file.
1084 <indexterm><primary>/etc/openldap/slapd.conf</primary></indexterm>
1085 <title>Example slapd.conf File</title>
1087 # Note commented out lines have been removed
1088 include /etc/openldap/schema/core.schema
1089 include /etc/openldap/schema/cosine.schema
1090 include /etc/openldap/schema/inetorgperson.schema
1091 include /etc/openldap/schema/nis.schema
1092 include /etc/openldap/schema/samba.schema
1094 pidfile /var/run/slapd/slapd.pid
1095 argsfile /var/run/slapd/slapd.args
1098 suffix "dc=quenya,dc=org"
1099 rootdn "cn=Manager,dc=quenya,dc=org"
1100 rootpw {SSHA}06qDkonA8hk6W6SSnRzWj0/pBcU3m0/P
1101 # The password for the above is 'nastyon3'
1103 directory /var/lib/ldap
1105 index objectClass eq
1106 index cn pres,sub,eq
1107 index sn pres,sub,eq
1108 index uid pres,sub,eq
1109 index displayName pres,sub,eq
1114 index sambaPrimaryGroupSID eq
1115 index sambaDomainName eq
1121 Create the following file <filename>initdb.ldif</filename>:
1122 <indexterm><primary>initdb.ldif</primary></indexterm>
1124 # Organization for SambaXP Demo
1125 dn: dc=quenya,dc=org
1126 objectclass: dcObject
1127 objectclass: organization
1130 description: The SambaXP Demo LDAP Tree
1132 # Organizational Role for Directory Management
1133 dn: cn=Manager,dc=quenya,dc=org
1134 objectclass: organizationalRole
1136 description: Directory Manager
1138 # Setting up the container for users
1139 dn: ou=People, dc=quenya, dc=org
1141 objectclass: organizationalUnit
1144 # Set up an admin handle for People OU
1145 dn: cn=admin, ou=People, dc=quenya, dc=org
1148 objectclass: organizationalRole
1149 objectclass: simpleSecurityObject
1150 userPassword: {SSHA}0jBHgQ1vp4EDX2rEMMfIudvRMJoGwjVb
1151 # The password for above is 'mordonL8'
1156 Load the initial data above into the LDAP database:
1158 &rootprompt;<userinput>slapadd -v -l initdb.ldif</userinput>
1163 Start the LDAP server using the appropriate tool or method for
1164 the operating system platform on which it is installed.
1168 Install the Idealx script files in the <filename>/usr/local/sbin</filename> directory,
1169 then configure the smbldap_conf.pm file to match your system configuration.
1173 The &smb.conf; file that drives this backend can be found in example <link
1174 linkend="fast-ldap">LDAP backend smb.conf for PDC</link>. Add additional stanzas
1178 <example id="fast-ldap">
1179 <title>LDAP backend smb.conf for PDC</title>
1181 <smbconfcomment>Global parameters</smbconfcomment>
1182 <smbconfsection name="[global]"/>
1183 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
1184 <smbconfoption name="netbios name">FRODO</smbconfoption>
1185 <smbconfoption name="passdb backend">ldapsam:ldap://localhost</smbconfoption>
1186 <smbconfoption name="username map">/etc/samba/smbusers</smbconfoption>
1187 <smbconfoption name="printcap name">cups</smbconfoption>
1188 <smbconfoption name="add user script">/usr/local/sbin/smbldap-useradd -m '%u'</smbconfoption>
1189 <smbconfoption name="delete user script">/usr/local/sbin/smbldap-userdel %u</smbconfoption>
1190 <smbconfoption name="add group script">/usr/local/sbin/smbldap-groupadd -p '%g'</smbconfoption>
1191 <smbconfoption name="delete group script">/usr/local/sbin/smbldap-groupdel '%g'</smbconfoption>
1192 <smbconfoption name="add user to group script">/usr/local/sbin/smbldap-groupmod -m '%u' '%g'</smbconfoption>
1193 <smbconfoption name="delete user from group script">/usr/local/sbin/smbldap-groupmod -x '%u' '%g'</smbconfoption>
1194 <smbconfoption name="set primary group script">/usr/local/sbin/smbldap-usermod -g '%g' '%u'</smbconfoption>
1195 <smbconfoption name="add machine script">/usr/local/sbin/smbldap-useradd -w '%u'</smbconfoption>
1196 <smbconfoption name="logon script">scripts\logon.bat</smbconfoption>
1197 <smbconfoption name="logon path">\\%L\Profiles\%U</smbconfoption>
1198 <smbconfoption name="logon drive">H:</smbconfoption>
1199 <smbconfoption name="logon home">\\%L\%U</smbconfoption>
1200 <smbconfoption name="domain logons">Yes</smbconfoption>
1201 <smbconfoption name="os level">35</smbconfoption>
1202 <smbconfoption name="preferred master">Yes</smbconfoption>
1203 <smbconfoption name="domain master">Yes</smbconfoption>
1204 <smbconfoption name="ldap suffix">dc=quenya,dc=org</smbconfoption>
1205 <smbconfoption name="ldap machine suffix">ou=People</smbconfoption>
1206 <smbconfoption name="ldap user suffix">ou=People</smbconfoption>
1207 <smbconfoption name="ldap group suffix">ou=People</smbconfoption>
1208 <smbconfoption name="ldap idmap suffix">ou=People</smbconfoption>
1209 <smbconfoption name="ldap admin dn">cn=Manager,dc=quenya,dc=org</smbconfoption>
1210 <smbconfoption name="ldap ssl">no</smbconfoption>
1211 <smbconfoption name="ldap passwd sync">Yes</smbconfoption>
1212 <smbconfoption name="idmap uid">15000-20000</smbconfoption>
1213 <smbconfoption name="idmap gid">15000-20000</smbconfoption>
1214 <smbconfoption name="printing">cups</smbconfoption>
1219 Add the LDAP password to the <filename>secrets.tdb</filename> file so Samba can update
1222 &rootprompt;<userinput>smbpasswd -w mordonL8</userinput>
1227 Add users and groups as required. Users and groups added using Samba tools
1228 will automatically be added to both the LDAP backend and the operating
1237 <title>Backup Domain Controller</title>
1240 <link linkend="fast-bdc"/> shows the example configuration for the BDC. Note that
1241 the &smb.conf; file does not specify the smbldap-tools scripts &smbmdash; they are
1242 not needed on a BDC. Add additional stanzas for shares and printers as required.
1247 Decide if the BDC should have its own LDAP server or not. If the BDC is to be
1248 the LDAP server, change the following &smb.conf; as indicated. The default
1249 configuration in <link linkend="fast-bdc">Remote LDAP BDC smb.conf</link>
1250 uses a central LDAP server.
1253 <example id="fast-bdc">
1254 <title>Remote LDAP BDC smb.conf</title>
1256 <smbconfcomment>Global parameters</smbconfcomment>
1257 <smbconfsection name="[global]"/>
1258 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
1259 <smbconfoption name="netbios name">GANDALF</smbconfoption>
1260 <smbconfoption name="passdb backend">ldapsam:ldap://frodo.quenya.org</smbconfoption>
1261 <smbconfoption name="username map">/etc/samba/smbusers</smbconfoption>
1262 <smbconfoption name="printcap name">cups</smbconfoption>
1263 <smbconfoption name="logon script">scripts\logon.bat</smbconfoption>
1264 <smbconfoption name="logon path">\\%L\Profiles\%U</smbconfoption>
1265 <smbconfoption name="logon drive">H:</smbconfoption>
1266 <smbconfoption name="logon home">\\%L\%U</smbconfoption>
1267 <smbconfoption name="domain logons">Yes</smbconfoption>
1268 <smbconfoption name="os level">33</smbconfoption>
1269 <smbconfoption name="preferred master">Yes</smbconfoption>
1270 <smbconfoption name="domain master">No</smbconfoption>
1271 <smbconfoption name="ldap suffix">dc=quenya,dc=org</smbconfoption>
1272 <smbconfoption name="ldap machine suffix">ou=People</smbconfoption>
1273 <smbconfoption name="ldap user suffix">ou=People</smbconfoption>
1274 <smbconfoption name="ldap group suffix">ou=People</smbconfoption>
1275 <smbconfoption name="ldap idmap suffix">ou=People</smbconfoption>
1276 <smbconfoption name="ldap admin dn">cn=Manager,dc=quenya,dc=org</smbconfoption>
1277 <smbconfoption name="ldap ssl">no</smbconfoption>
1278 <smbconfoption name="ldap passwd sync">Yes</smbconfoption>
1279 <smbconfoption name="idmap uid">15000-20000</smbconfoption>
1280 <smbconfoption name="idmap gid">15000-20000</smbconfoption>
1281 <smbconfoption name="printing">cups</smbconfoption>
1286 Configure the NETLOGON and PROFILES directory as for the PDC in <link linkend="fast-bdc"/>.