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 <quote>Samba-3 by Example</quote>.
40 <title>Features and Benefits</title>
43 Samba needs very little configuration to create a basic working system.
44 In this chapter we progress from the simple to the complex, for each providing
45 all steps and configuration file changes needed to make each work. Please note
46 that a comprehensively configured system will likely employ additional smart
47 features. These additional features are covered in the remainder of this document.
51 The examples used here have been obtained from a number of people who made
52 requests for example configurations. All identities have been obscured to protect
53 the guilty, and any resemblance to unreal nonexistent sites is deliberate.
59 <title>Description of Example Sites</title>
62 In the first set of configuration examples we consider the case of exceptionally simple
63 system requirements. There is a real temptation to make something that should require
64 little effort much too complex.
68 <link linkend="anon-ro"></link> documents the type of server that might be sufficient to serve CD-ROM
69 images, or reference document files for network client use. This configuration is also discussed in
70 <link linkend="StandAloneServer"></link>, <link linkend="RefDocServer"></link>.
71 The purpose for this configuration 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
76 to as long as they have the correct printer drivers installed on their computer. This is a
77 mirror of the system described in <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
82 to users who have an account on the system. This server is meant to closely resemble a
83 workgroup file and print server, but has to be more secure than an anonymous access machine.
84 This type of system will typically suit the needs of a small office. The server provides no
85 network logon facilities, offers no domain control; instead it is just a network-attached storage (NAS) device and a print server.
89 Finally, we start looking at more complex systems that will either integrate into existing
90 MS Windows networks or replace them entirely. The examples provided cover domain
91 member servers as well as Samba domain control (PDC/BDC) and finally describes in detail
92 a large distributed network with branch offices in remote locations.
98 <title>Worked Examples</title>
101 The configuration examples are designed to cover everything necessary to get Samba
102 running. They do not cover basic operating system platform configuration, which is
103 clearly beyond the scope of this text.
107 It is also assumed that Samba has been correctly installed, either by way of installation
108 of the packages that are provided by the operating system vendor or through other means.
112 <title>Standalone Server</title>
115 <indexterm><primary>Server Type</primary><secondary>Stand-alone</secondary></indexterm>
116 A standalone server implies no more than the fact that it is not a domain controller
117 and it does not participate in domain control. It can be a simple, workgroup-like
118 server, or it can be a complex server that is a member of a domain security context.
122 <title>Anonymous Read-Only Document Server</title>
125 <indexterm><primary>read only</primary><secondary>server</secondary></indexterm>
126 The purpose of this type of server is to make available to any user
127 any documents or files that are placed on the shared resource. The
128 shared resource could be a CD-ROM drive, a CD-ROM image, or a file
133 As the examples are developed, every attempt is made to progress the
134 system toward greater capability, just as one might expect would happen
135 in a real business office as that office grows in size and its needs
140 The configuration file is presented in <link linkend="anon-example">Anonymous Read-Only Server
141 Configuration</link>.
144 <example id="anon-example">
145 <title>Anonymous Read-Only Server Configuration</title>
147 <smbconfcomment>Global parameters</smbconfcomment>
148 <smbconfsection name="[global]"/>
149 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
150 <smbconfoption name="netbios name">HOBBIT</smbconfoption>
151 <smbconfoption name="security">share</smbconfoption>
153 <smbconfsection name="[data]"/>
154 <smbconfoption name="comment">Data</smbconfoption>
155 <smbconfoption name="path">/export</smbconfoption>
156 <smbconfoption name="read only">Yes</smbconfoption>
157 <smbconfoption name="guest ok">Yes</smbconfoption>
163 The file system share point will be <filename>/export</filename>.
167 All files will be owned by a user called Jack Baumbach.
168 Jack's login name will be <emphasis>jackb</emphasis>. His password will be
169 <emphasis>m0r3pa1n</emphasis> &smbmdash; of course, that's just the example we are
170 using; do not use this in a production environment because
171 all readers of this document will know it.
176 <title>Installation Procedure: Read-Only Server</title>
178 Add user to system (with creation of the user's home directory):
180 &rootprompt;<userinput>useradd -c "Jack Baumbach" -m -g users -p m0r3pa1n jackb</userinput>
185 Create directory, and set permissions and ownership:
187 &rootprompt;<userinput>mkdir /export</userinput>
188 &rootprompt;<userinput>chmod u+rwx,g+rx,o+rx /export</userinput>
189 &rootprompt;<userinput>chown jackb.users /export</userinput>
194 Copy the files that should be shared to the <filename>/export</filename>
199 Install the Samba configuration file (<filename>/etc/samba/smb.conf</filename>)
204 Test the configuration file:
206 &rootprompt;<userinput>testparm</userinput>
208 Note any error messages that might be produced. Proceed only if error-free output has been
209 obtained. An example of the output with the following file will list the file.
211 Load smb config files from /etc/samba/smb.conf
212 Processing section "[data]"
213 Loaded services file OK.
214 Server role: ROLE_STANDALONE
215 Press enter to see a dump of your service definitions
216 <userinput>[Press enter]</userinput>
221 netbios name = HOBBIT
233 Start Samba using the method applicable to your operating system
238 Configure your MS Windows client for workgroup <emphasis>MIDEARTH</emphasis>,
239 set the machine name to ROBBINS, reboot, wait a few (2 - 5) minutes,
240 then open Windows Explorer and visit the Network Neighborhood.
241 The machine HOBBIT should be visible. When you click this machine
242 icon, it should open up to reveal the <emphasis>data</emphasis> share. After
243 you click the share, it should open up to reveal the files previously
244 placed in the <filename>/export</filename> directory.
249 The information above (following # Global parameters) provides the complete
250 contents of the <filename>/etc/samba/smb.conf</filename> file.
256 <title>Anonymous Read-Write Document Server</title>
259 <indexterm><primary>anonymous</primary><secondary>read-write server</secondary></indexterm>
260 We should view this configuration as a progression from the previous example.
261 The difference is that shared access is now forced to the user identity of jackb
262 and to the primary group jackb belongs to. One other refinement we can make is to
263 add the user <emphasis>jackb</emphasis> to the <filename>smbpasswd</filename> file.
266 &rootprompt;<userinput>smbpasswd -a jackb</userinput>
267 New SMB password: <userinput>m0r3pa1n</userinput>
268 Retype new SMB password: <userinput>m0r3pa1n</userinput>
271 Addition of this user to the <filename>smbpasswd</filename> file allows all files
272 to be displayed in the Explorer Properties boxes as belonging to <emphasis>jackb</emphasis>
273 instead of to <emphasis>User Unknown</emphasis>.
277 The complete, modified &smb.conf; file is as shown in <link linkend="anon-rw"/>.
280 <example id="anon-rw">
281 <title>Modified Anonymous Read-Write smb.conf</title>
283 <smbconfcomment>Global parameters</smbconfcomment>
284 <smbconfsection name="[global]"/>
285 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
286 <smbconfoption name="netbios name">HOBBIT</smbconfoption>
287 <smbconfoption name="security">SHARE</smbconfoption>
289 <smbconfsection name="[data]"/>
290 <smbconfoption name="comment">Data</smbconfoption>
291 <smbconfoption name="path">/export</smbconfoption>
292 <smbconfoption name="force user">jackb</smbconfoption>
293 <smbconfoption name="force group">users</smbconfoption>
294 <smbconfoption name="read only">No</smbconfoption>
295 <smbconfoption name="guest ok">Yes</smbconfoption>
302 <title>Anonymous Print Server</title>
305 <indexterm><primary>anonymous</primary><secondary>print server</secondary></indexterm>
306 An anonymous print server serves two purposes:
311 It allows printing to all printers from a single location.
315 It reduces network traffic congestion due to many users trying
316 to access a limited number of printers.
321 In the simplest of anonymous print servers, it is common to require the installation
322 of the correct printer drivers on the Windows workstation. In this case the print
323 server will be designed to just pass print jobs through to the spooler, and the spooler
324 should be configured to do raw pass-through to the printer. In other words, the print
325 spooler should not filter or process the data stream being passed to the printer.
329 In this configuration, it is undesirable to present the Add Printer Wizard, and we do
330 not want to have automatic driver download, so we disable it in the following
331 configuration. <link linkend="anon-print"></link> is the resulting &smb.conf; file.
334 <example id="anon-print">
335 <title>Anonymous Print Server smb.conf</title>
337 <smbconfcomment>Global parameters</smbconfcomment>
338 <smbconfsection name="[global]"/>
339 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
340 <smbconfoption name="netbios name">LUTHIEN</smbconfoption>
341 <smbconfoption name="security">share</smbconfoption>
342 <smbconfoption name="printcap name">cups</smbconfoption>
343 <smbconfoption name="disable spoolss">Yes</smbconfoption>
344 <smbconfoption name="show add printer wizard">No</smbconfoption>
345 <smbconfoption name="printing">cups</smbconfoption>
347 <smbconfsection name="[printers]"/>
348 <smbconfoption name="comment">All Printers</smbconfoption>
349 <smbconfoption name="path">/var/spool/samba</smbconfoption>
350 <smbconfoption name="guest ok">Yes</smbconfoption>
351 <smbconfoption name="printable">Yes</smbconfoption>
352 <smbconfoption name="use client driver">Yes</smbconfoption>
353 <smbconfoption name="browseable">No</smbconfoption>
358 The above configuration is not ideal. It uses no smart features, and it deliberately
359 presents a less than elegant solution. But it is basic, and it does print.
363 Windows users will need to install a local printer and then change the print
364 to device after installation of the drivers. The print to device can then be set to
365 the network printer on this machine.
369 Make sure that the directory <filename>/var/spool/samba</filename> is capable of being used
370 as intended. The following steps must be taken to achieve this:
375 The directory must be owned by the superuser (root) user and group:
377 &rootprompt;<userinput>chown root.root /var/spool/samba</userinput>
382 Directory permissions should be set for public read-write with the
383 sticky bit set as shown:
385 &rootprompt;<userinput>chmod a+trw TX /var/spool/samba</userinput>
387 The purpose of setting the sticky bit is to prevent who does not own the temporary print file
388 from being able to take control of it with the potential for devious misuse.
394 <indexterm><primary>MIME</primary><secondary>raw</secondary></indexterm>
395 <indexterm><primary>raw printing</primary></indexterm>
396 On CUPS-enabled systems there is a facility to pass raw data directly to the printer without
397 intermediate processing via CUPS print filters. Where use of this mode of operation is desired,
398 it is necessary to configure a raw printing device. It is also necessary to enable the raw mime
399 handler in the <filename>/etc/mime.conv</filename> and <filename>/etc/mime.types</filename>
400 files. Refer to <link linkend="cups-raw"></link>.
407 <title>Secure Read-Write File and Print Server</title>
410 We progress now from simple systems to a server that is slightly more complex.
414 Our new server will require a public data storage area in which only authenticated
415 users (i.e., those with a local account) can store files, as well as a home directory.
416 There will be one printer that should be available for everyone to use.
420 In this hypothetical environment (no espionage was conducted to obtain this data),
421 the site is demanding a simple environment that is <emphasis>secure enough</emphasis>
422 but not too difficult to use.
426 Site users will be Jack Baumbach, Mary Orville, and Amed Sehkah. Each will have
427 a password (not shown in further examples). Mary will be the printer administrator and will
428 own all files in the public share.
432 This configuration will be based on <emphasis>user-level security</emphasis> that
433 is the default, and for which the default is to store Microsoft Windows-compatible
434 encrypted passwords in a file called <filename>/etc/samba/smbpasswd</filename>.
435 The default &smb.conf; entry that makes this happen is
436 <smbconfoption name="passdb backend">smbpasswd, guest</smbconfoption>. Since this is the default,
437 it is not necessary to enter it into the configuration file. Note that guest backend is
438 added to the list of active passdb backends no matter whether it specified directly in Samba configuration
444 <title>Installing the Secure Office Server</title>
446 <indexterm><primary>office server</primary></indexterm>
447 Add all users to the operating system:
449 &rootprompt;<userinput>useradd -c "Jack Baumbach" -m -g users -p m0r3pa1n jackb</userinput>
450 &rootprompt;<userinput>useradd -c "Mary Orville" -m -g users -p secret maryo</userinput>
451 &rootprompt;<userinput>useradd -c "Amed Sehkah" -m -g users -p secret ameds</userinput>
456 Configure the Samba &smb.conf; file as shown in <link linkend="OfficeServer"/>.
459 <example id="OfficeServer">
460 <title>Secure Office Server smb.conf</title>
462 <smbconfcomment>Global parameters</smbconfcomment>
463 <smbconfsection name="[global]"/>
464 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
465 <smbconfoption name="netbios name">OLORIN</smbconfoption>
466 <smbconfoption name="printcap name">cups</smbconfoption>
467 <smbconfoption name="disable spoolss">Yes</smbconfoption>
468 <smbconfoption name="show add printer wizard">No</smbconfoption>
469 <smbconfoption name="printing">cups</smbconfoption>
471 <smbconfsection name="[homes]"/>
472 <smbconfoption name="comment">Home Directories</smbconfoption>
473 <smbconfoption name="valid users">%S</smbconfoption>
474 <smbconfoption name="read only">No</smbconfoption>
475 <smbconfoption name="browseable">No</smbconfoption>
477 <smbconfsection name="[public]"/>
478 <smbconfoption name="comment">Data</smbconfoption>
479 <smbconfoption name="path">/export</smbconfoption>
480 <smbconfoption name="force user">maryo</smbconfoption>
481 <smbconfoption name="force group">users</smbconfoption>
482 <smbconfoption name="guest ok">Yes</smbconfoption>
483 <smbconfoption name="read only">No</smbconfoption>
485 <smbconfsection name="[printers]"/>
486 <smbconfoption name="comment">All Printers</smbconfoption>
487 <smbconfoption name="path">/var/spool/samba</smbconfoption>
488 <smbconfoption name="printer admin">root, maryo</smbconfoption>
489 <smbconfoption name="create mask">0600</smbconfoption>
490 <smbconfoption name="guest ok">Yes</smbconfoption>
491 <smbconfoption name="printable">Yes</smbconfoption>
492 <smbconfoption name="use client driver">Yes</smbconfoption>
493 <smbconfoption name="browseable">No</smbconfoption>
498 Initialize the Microsoft Windows password database with the new users:
500 &rootprompt;<userinput>smbpasswd -a root</userinput>
501 New SMB password: <userinput>bigsecret</userinput>
502 Reenter smb password: <userinput>bigsecret</userinput>
505 &rootprompt;<userinput>smbpasswd -a jackb</userinput>
506 New SMB password: <userinput>m0r3pa1n</userinput>
507 Retype new SMB password: <userinput>m0r3pa1n</userinput>
510 &rootprompt;<userinput>smbpasswd -a maryo</userinput>
511 New SMB password: <userinput>secret</userinput>
512 Reenter smb password: <userinput>secret</userinput>
515 &rootprompt;<userinput>smbpasswd -a ameds</userinput>
516 New SMB password: <userinput>mysecret</userinput>
517 Reenter smb password: <userinput>mysecret</userinput>
523 Install printer using the CUPS Web interface. Make certain that all
524 printers that will be shared with Microsoft Windows clients are installed
525 as raw printing devices.
529 Start Samba using the operating system administrative interface.
530 Alternately, this can be done manually by executing:
531 <indexterm><primary>smbd</primary></indexterm>
532 <indexterm><primary>nmbd</primary></indexterm>
533 <indexterm><primary>starting samba</primary><secondary>smbd</secondary></indexterm>
534 <indexterm><primary>starting samba</primary><secondary>nmbd</secondary></indexterm>
536 &rootprompt;<userinput> nmbd; smbd;</userinput>
538 Both applications automatically execute as daemons. Those who are paranoid about
539 maintaining control can add the <constant>-D</constant> flag to coerce them to start
544 Configure the <filename>/export</filename> directory:
546 &rootprompt;<userinput>mkdir /export</userinput>
547 &rootprompt;<userinput>chown maryo.users /export</userinput>
548 &rootprompt;<userinput>chmod u=rwx,g=rwx,o-rwx /export</userinput>
553 Check that Samba is running correctly:
555 &rootprompt;<userinput>smbclient -L localhost -U%</userinput>
556 Domain=[MIDEARTH] OS=[UNIX] Server=[Samba-3.0.20]
558 Sharename Type Comment
559 --------- ---- -------
561 IPC$ IPC IPC Service (Samba-3.0.20)
562 ADMIN$ IPC IPC Service (Samba-3.0.20)
576 Connect to OLORIN as maryo:
578 &rootprompt;<userinput>smbclient //olorin/maryo -Umaryo%secret</userinput>
579 OS=[UNIX] Server=[Samba-3.0.20]
580 smb: \> <userinput>dir</userinput>
581 . D 0 Sat Jun 21 10:58:16 2003
582 .. D 0 Sat Jun 21 10:54:32 2003
583 Documents D 0 Fri Apr 25 13:23:58 2003
584 DOCWORK D 0 Sat Jun 14 15:40:34 2003
585 OpenOffice.org D 0 Fri Apr 25 13:55:16 2003
586 .bashrc H 1286 Fri Apr 25 13:23:58 2003
587 .netscape6 DH 0 Fri Apr 25 13:55:13 2003
588 .mozilla DH 0 Wed Mar 5 11:50:50 2003
589 .kermrc H 164 Fri Apr 25 13:23:58 2003
590 .acrobat DH 0 Fri Apr 25 15:41:02 2003
592 55817 blocks of size 524288. 34725 blocks available
593 smb: \> <userinput>q</userinput>
599 By now you should be getting the hang of configuration basics. Clearly, it is time to
600 explore slightly more complex examples. For the remainder of this chapter we abbreviate
601 instructions, since there are previous examples.
609 <title>Domain Member Server</title>
612 <indexterm><primary>Server Type</primary><secondary>Domain Member</secondary></indexterm>
613 In this instance we consider the simplest server configuration we can get away with
614 to make an accounting department happy. Let's be warned, the users are accountants and they
615 do have some nasty demands. There is a budget for only one server for this department.
619 The network is managed by an internal Information Services Group (ISG), to which we belong.
620 Internal politics are typical of a medium-sized organization; Human Resources is of the
621 opinion that they run the ISG because they are always adding and disabling users. Also,
622 departmental managers have to fight tooth and nail to gain basic network resources access for
623 their staff. Accounting is different, though, they get exactly what they want. So this should
628 We use the users from the last example. The accounting department
629 has a general printer that all departmental users may use. There is also a check printer
630 that may be used only by the person who has authority to print checks. The chief financial
631 officer (CFO) wants that printer to be completely restricted and for it to be located in the
632 private storage area in her office. It therefore must be a network printer.
636 The accounting department uses an accounting application called <emphasis>SpytFull</emphasis>
637 that must be run from a central application server. The software is licensed to run only off
638 one server, there are no workstation components, and it is run off a mapped share. The data
639 store is in a UNIX-based SQL backend. The UNIX gurus look after that, so it is not our
644 The accounting department manager (maryo) wants a general filing system as well as a separate
645 file storage area for form letters (nastygrams). The form letter area should be read-only to
646 all accounting staff except the manager. The general filing system has to have a structured
647 layout with a general area for all staff to store general documents as well as a separate
648 file area for each member of her team that is private to that person, but she wants full
649 access to all areas. Users must have a private home share for personal work-related files
650 and for materials not related to departmental operations.
654 <title>Example Configuration</title>
657 The server <emphasis>valinor</emphasis> will be a member server of the company domain.
658 Accounting will have only a local server. User accounts will be on the domain controllers,
659 as will desktop profiles and all network policy files.
664 Do not add users to the UNIX/Linux server; all of this will run off the
669 Configure &smb.conf; according to <link linkend="fast-member-server">Member server smb.conf
670 (globals)</link> and <link linkend="fast-memberserver-shares">Member server smb.conf (shares
671 and services)</link>.
674 <example id="fast-member-server">
675 <title>Member server smb.conf (globals)</title>
677 <smbconfcomment>Global parameters</smbconfcomment>
678 <smbconfsection name="[global]"/>
679 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
680 <smbconfoption name="netbios name">VALINOR</smbconfoption>
681 <smbconfoption name="security">DOMAIN</smbconfoption>
682 <smbconfoption name="printcap name">cups</smbconfoption>
683 <smbconfoption name="disable spoolss">Yes</smbconfoption>
684 <smbconfoption name="show add printer wizard">No</smbconfoption>
685 <smbconfoption name="idmap uid">15000-20000</smbconfoption>
686 <smbconfoption name="idmap gid">15000-20000</smbconfoption>
687 <smbconfoption name="winbind use default domain">Yes</smbconfoption>
688 <smbconfoption name="printing">cups</smbconfoption>
692 <example id="fast-memberserver-shares">
693 <title>Member server smb.conf (shares and services)</title>
695 <smbconfsection name="[homes]"/>
696 <smbconfoption name="comment">Home Directories</smbconfoption>
697 <smbconfoption name="valid users">%S</smbconfoption>
698 <smbconfoption name="read only">No</smbconfoption>
699 <smbconfoption name="browseable">No</smbconfoption>
701 <smbconfsection name="[spytfull]"/>
702 <smbconfoption name="comment">Accounting Application Only</smbconfoption>
703 <smbconfoption name="path">/export/spytfull</smbconfoption>
704 <smbconfoption name="valid users">@Accounts</smbconfoption>
705 <smbconfoption name="admin users">maryo</smbconfoption>
706 <smbconfoption name="read only">Yes</smbconfoption>
708 <smbconfsection name="[public]"/>
709 <smbconfoption name="comment">Data</smbconfoption>
710 <smbconfoption name="path">/export/public</smbconfoption>
711 <smbconfoption name="read only">No</smbconfoption>
713 <smbconfsection name="[printers]"/>
714 <smbconfoption name="comment">All Printers</smbconfoption>
715 <smbconfoption name="path">/var/spool/samba</smbconfoption>
716 <smbconfoption name="printer admin">root, maryo</smbconfoption>
717 <smbconfoption name="create mask">0600</smbconfoption>
718 <smbconfoption name="guest ok">Yes</smbconfoption>
719 <smbconfoption name="printable">Yes</smbconfoption>
720 <smbconfoption name="use client driver">Yes</smbconfoption>
721 <smbconfoption name="browseable">No</smbconfoption>
726 <indexterm><primary>net</primary><secondary>rpc</secondary></indexterm>
727 Join the domain. Note: Do not start Samba until this step has been completed!
729 &rootprompt;<userinput>net rpc join -Uroot%'bigsecret'</userinput>
730 Joined domain MIDEARTH.
735 Make absolutely certain that you disable (shut down) the <command>nscd</command>
736 daemon on any system on which <command>winbind</command> is configured to run.
740 Start Samba following the normal method for your operating system platform.
741 If you wish to do this manually, execute as root:
742 <indexterm><primary>smbd</primary></indexterm>
743 <indexterm><primary>nmbd</primary></indexterm>
744 <indexterm><primary>winbindd</primary></indexterm>
745 <indexterm><primary>starting samba</primary><secondary>smbd</secondary></indexterm>
746 <indexterm><primary>starting samba</primary><secondary>nmbd</secondary></indexterm>
747 <indexterm><primary>starting samba</primary><secondary>winbindd</secondary></indexterm>
749 &rootprompt;<userinput>nmbd; smbd; winbindd;</userinput>
754 Configure the name service switch (NSS) control file on your system to resolve user and group names
755 via winbind. Edit the following lines in <filename>/etc/nsswitch.conf</filename>:
757 passwd: files winbind
759 hosts: files dns winbind
764 Set the password for <command>wbinfo</command> to use:
766 &rootprompt;<userinput>wbinfo --set-auth-user=root%'bigsecret'</userinput>
771 Validate that domain user and group credentials can be correctly resolved by executing:
773 &rootprompt;<userinput>wbinfo -u</userinput>
780 &rootprompt;<userinput>wbinfo -g</userinput>
781 MIDEARTH\Domain Users
782 MIDEARTH\Domain Admins
783 MIDEARTH\Domain Guests
790 Check that <command>winbind</command> is working. The following demonstrates correct
791 username resolution via the <command>getent</command> system utility:
793 &rootprompt;<userinput>getent passwd maryo</userinput>
794 maryo:x:15000:15003:Mary Orville:/home/MIDEARTH/maryo:/bin/false
799 A final test that we have this under control might be reassuring:
801 &rootprompt;<userinput>touch /export/a_file</userinput>
802 &rootprompt;<userinput>chown maryo /export/a_file</userinput>
803 &rootprompt;<userinput>ls -al /export/a_file</userinput>
805 -rw-r--r-- 1 maryo users 11234 Jun 21 15:32 a_file
808 &rootprompt;<userinput>rm /export/a_file</userinput>
813 Configuration is now mostly complete, so this is an opportune time
814 to configure the directory structure for this site:
816 &rootprompt;<userinput>mkdir -p /export/{spytfull,public}</userinput>
817 &rootprompt;<userinput>chmod ug=rwxS,o=x /export/{spytfull,public}</userinput>
818 &rootprompt;<userinput>chown maryo.Accounts /export/{spytfull,public}</userinput>
828 <title>Domain Controller</title>
832 <indexterm><primary>Server Type</primary><secondary>Domain Controller</secondary></indexterm>
833 For the remainder of this chapter the focus is on the configuration of domain control.
834 The examples that follow are for two implementation strategies. Remember, our objective is
835 to create a simple but working solution. The remainder of this book should help to highlight
836 opportunity for greater functionality and the complexity that goes with it.
840 A domain controller configuration can be achieved with a simple configuration using the new
841 tdbsam password backend. This type of configuration is good for small
842 offices, but has limited scalability (cannot be replicated), and performance can be expected
843 to fall as the size and complexity of the domain increases.
847 The use of tdbsam is best limited to sites that do not need
848 more than a Primary Domain Controller (PDC). As the size of a domain grows the need
849 for additional domain controllers becomes apparent. Do not attempt to under-resource
850 a Microsoft Windows network environment; domain controllers provide essential
851 authentication services. The following are symptoms of an under-resourced domain control
857 Domain logons intermittently fail.
861 File access on a domain member server intermittently fails, giving a permission denied
867 A more scalable domain control authentication backend option might use
868 Microsoft Active Directory or an LDAP-based backend. Samba-3 provides
869 for both options as a domain member server. As a PDC, Samba-3 is not able to provide
870 an exact alternative to the functionality that is available with Active Directory.
871 Samba-3 can provide a scalable LDAP-based PDC/BDC solution.
875 The tdbsam authentication backend provides no facility to replicate
876 the contents of the database, except by external means (i.e., there is no self-contained protocol
877 in Samba-3 for Security Account Manager database [SAM] replication).
881 If you need more than one domain controller, do not use a tdbsam authentication backend.
885 <title>Example: Engineering Office</title>
888 The engineering office network server we present here is designed to demonstrate use
889 of the new tdbsam password backend. The tdbsam
890 facility is new to Samba-3. It is designed to provide many user and machine account controls
891 that are possible with Microsoft Windows NT4. It is safe to use this in smaller networks.
896 A working PDC configuration using the tdbsam
897 password backend can be found in <link linkend="fast-engoffice-global">Engineering Office smb.conf
898 (globals)</link> together with <link linkend="fast-engoffice-shares">Engineering Office smb.conf
899 (shares and services)</link>:
900 <indexterm><primary>pdbedit</primary></indexterm>
903 <example id="fast-engoffice-global">
904 <title>Engineering Office smb.conf (globals)</title>
906 <smbconfsection name="[global]"/>
907 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
908 <smbconfoption name="netbios name">FRODO</smbconfoption>
909 <smbconfoption name="passdb backend">tdbsam</smbconfoption>
910 <smbconfoption name="printcap name">cups</smbconfoption>
911 <smbconfoption name="add user script">/usr/sbin/useradd -m %u</smbconfoption>
912 <smbconfoption name="delete user script">/usr/sbin/userdel -r %u</smbconfoption>
913 <smbconfoption name="add group script">/usr/sbin/groupadd %g</smbconfoption>
914 <smbconfoption name="delete group script">/usr/sbin/groupdel %g</smbconfoption>
915 <smbconfoption name="add user to group script">/usr/sbin/groupmod -A %u %g</smbconfoption>
916 <smbconfoption name="delete user from group script">/usr/sbin/groupmod -R %u %g</smbconfoption>
917 <smbconfoption name="add machine script">/usr/sbin/useradd -s /bin/false -d /var/lib/nobody %u</smbconfoption>
918 <smbconfcomment>Note: The following specifies the default logon script.</smbconfcomment>
919 <smbconfcomment>Per user logon scripts can be specified in the user account using pdbedit </smbconfcomment>
920 <smbconfoption name="logon script">scripts\logon.bat</smbconfoption>
921 <smbconfcomment>This sets the default profile path. Set per user paths with pdbedit</smbconfcomment>
922 <smbconfoption name="logon path">\\%L\Profiles\%U</smbconfoption>
923 <smbconfoption name="logon drive">H:</smbconfoption>
924 <smbconfoption name="logon home">\\%L\%U</smbconfoption>
925 <smbconfoption name="domain logons">Yes</smbconfoption>
926 <smbconfoption name="os level">35</smbconfoption>
927 <smbconfoption name="preferred master">Yes</smbconfoption>
928 <smbconfoption name="domain master">Yes</smbconfoption>
929 <smbconfoption name="idmap uid">15000-20000</smbconfoption>
930 <smbconfoption name="idmap gid">15000-20000</smbconfoption>
931 <smbconfoption name="printing">cups</smbconfoption>
935 <example id="fast-engoffice-shares">
936 <title>Engineering Office smb.conf (shares and services)</title>
938 <smbconfsection name="[homes]"/>
939 <smbconfoption name="comment">Home Directories</smbconfoption>
940 <smbconfoption name="valid users">%S</smbconfoption>
941 <smbconfoption name="read only">No</smbconfoption>
942 <smbconfoption name="browseable">No</smbconfoption>
944 <smbconfcomment>Printing auto-share (makes printers available thru CUPS)</smbconfcomment>
945 <smbconfsection name="[printers]"/>
946 <smbconfoption name="comment">All Printers</smbconfoption>
947 <smbconfoption name="path">/var/spool/samba</smbconfoption>
948 <smbconfoption name="printer admin">root, maryo</smbconfoption>
949 <smbconfoption name="create mask">0600</smbconfoption>
950 <smbconfoption name="guest ok">Yes</smbconfoption>
951 <smbconfoption name="printable">Yes</smbconfoption>
952 <smbconfoption name="browseable">No</smbconfoption>
954 <smbconfsection name="[print$]"/>
955 <smbconfoption name="comment">Printer Drivers Share</smbconfoption>
956 <smbconfoption name="path">/var/lib/samba/drivers</smbconfoption>
957 <smbconfoption name="write list">maryo, root</smbconfoption>
958 <smbconfoption name="printer admin">maryo, root</smbconfoption>
960 <smbconfcomment>Needed to support domain logons</smbconfcomment>
961 <smbconfsection name="[netlogon]"/>
962 <smbconfoption name="comment">Network Logon Service</smbconfoption>
963 <smbconfoption name="path">/var/lib/samba/netlogon</smbconfoption>
964 <smbconfoption name="admin users">root, maryo</smbconfoption>
965 <smbconfoption name="guest ok">Yes</smbconfoption>
966 <smbconfoption name="browseable">No</smbconfoption>
968 <smbconfcomment>For profiles to work, create a user directory under the path</smbconfcomment>
969 <smbconfcomment> shown. i.e., mkdir -p /var/lib/samba/profiles/maryo</smbconfcomment>
970 <smbconfsection name="[Profiles]"/>
971 <smbconfoption name="comment">Roaming Profile Share</smbconfoption>
972 <smbconfoption name="path">/var/lib/samba/profiles</smbconfoption>
973 <smbconfoption name="read only">No</smbconfoption>
974 <smbconfoption name="profile acls">Yes</smbconfoption>
976 <smbconfcomment>Other resource (share/printer) definitions would follow below.</smbconfcomment>
981 Create UNIX group accounts as needed using a suitable operating system tool:
983 &rootprompt;<userinput>groupadd ntadmins</userinput>
984 &rootprompt;<userinput>groupadd designers</userinput>
985 &rootprompt;<userinput>groupadd engineers</userinput>
986 &rootprompt;<userinput>groupadd qateam</userinput>
991 Create user accounts on the system using the appropriate tool
992 provided with the operating system. Make sure all user home directories
993 are created also. Add users to groups as required for access control
994 on files, directories, printers, and as required for use in the Samba
1000 <indexterm><primary>net</primary><secondary>groupmap</secondary></indexterm>
1001 <indexterm><primary>initGroups.sh</primary></indexterm>
1002 Assign each of the UNIX groups to NT groups by executing this shell script
1003 (You could name the script <filename>initGroups.sh</filename>):
1006 #### Keep this as a shell script for future re-use
1008 # First assign well known groups
1009 net groupmap modify ntgroup="Domain Admins" unixgroup=ntadmins
1010 net groupmap modify ntgroup="Domain Users" unixgroup=users
1011 net groupmap modify ntgroup="Domain Guests" unixgroup=nobody
1013 # Now for our added Domain Groups
1014 net groupmap add ntgroup="Designers" unixgroup=designers type=d
1015 net groupmap add ntgroup="Engineers" unixgroup=engineers type=d
1016 net groupmap add ntgroup="QA Team" unixgroup=qateam type=d
1021 Create the <filename>scripts</filename> directory for use in the
1022 <smbconfsection name="[NETLOGON]"/> share:
1024 &rootprompt;<userinput>mkdir -p /var/lib/samba/netlogon/scripts</userinput>
1026 Place the logon scripts that will be used (batch or cmd scripts)
1032 The above configuration provides a functional PDC
1033 system to which must be added file shares and printers as required.
1039 <title>A Big Organization</title>
1042 In this section we finally get to review in brief a Samba-3 configuration that
1043 uses a Lightweight Directory Access (LDAP)-based authentication backend. The
1044 main reasons for this choice are to provide the ability to host primary
1045 and Backup Domain Control (BDC), as well as to enable a higher degree of
1046 scalability to meet the needs of a very distributed environment.
1050 <title>The Primary Domain Controller</title>
1053 This is an example of a minimal configuration to run a Samba-3 PDC
1054 using an LDAP authentication backend. It is assumed that the operating system
1055 has been correctly configured.
1059 The Idealx scripts (or equivalent) are needed to manage LDAP-based POSIX and/or
1060 SambaSamAccounts. The Idealx scripts may be downloaded from the <ulink url="http://www.idealx.org">
1061 Idealx</ulink> Web site. They may also be obtained from the Samba tarball. Linux
1062 distributions tend to install the Idealx scripts in the
1063 <filename>/usr/share/doc/packages/sambaXXXXXX/examples/LDAP/smbldap-tools</filename> directory.
1064 Idealx scripts version <constant>smbldap-tools-0.8.7</constant> are known to work well.
1069 Obtain from the Samba sources <filename>~/examples/LDAP/samba.schema</filename>
1070 and copy it to the <filename>/etc/openldap/schema/</filename> directory.
1074 Set up the LDAP server. This example is suitable for OpenLDAP 2.1.x.
1075 The <filename>/etc/openldap/slapd.conf</filename> file.
1076 <indexterm><primary>/etc/openldap/slapd.conf</primary></indexterm>
1077 <title>Example slapd.conf file</title>
1079 # Note commented out lines have been removed
1080 include /etc/openldap/schema/core.schema
1081 include /etc/openldap/schema/cosine.schema
1082 include /etc/openldap/schema/inetorgperson.schema
1083 include /etc/openldap/schema/nis.schema
1084 include /etc/openldap/schema/samba.schema
1086 pidfile /var/run/slapd/slapd.pid
1087 argsfile /var/run/slapd/slapd.args
1090 suffix "dc=quenya,dc=org"
1091 rootdn "cn=Manager,dc=quenya,dc=org"
1092 rootpw {SSHA}06qDkonA8hk6W6SSnRzWj0/pBcU3m0/P
1093 # The password for the above is 'nastyon3'
1095 directory /var/lib/ldap
1097 index objectClass eq
1098 index cn pres,sub,eq
1099 index sn pres,sub,eq
1100 index uid pres,sub,eq
1101 index displayName pres,sub,eq
1106 index sambaPrimaryGroupSID eq
1107 index sambaDomainName eq
1113 Create the following file <filename>samba-ldap-init.ldif</filename>:
1114 <indexterm><primary>samba-ldap-init.ldif</primary></indexterm>
1116 # Organization for SambaXP Demo
1117 dn: dc=quenya,dc=org
1118 objectclass: dcObject
1119 objectclass: organization
1122 description: The SambaXP Demo LDAP Tree
1124 # Organizational Role for Directory Management
1125 dn: cn=Manager,dc=quenya,dc=org
1126 objectclass: organizationalRole
1128 description: Directory Manager
1130 # Setting up the container for users
1131 dn: ou=People, dc=quenya, dc=org
1133 objectclass: organizationalUnit
1136 # Set up an admin handle for People OU
1137 dn: cn=admin, ou=People, dc=quenya, dc=org
1140 objectclass: organizationalRole
1141 objectclass: simpleSecurityObject
1142 userPassword: {SSHA}0jBHgQ1vp4EDX2rEMMfIudvRMJoGwjVb
1143 # The password for above is 'mordonL8'
1148 Load the initial data above into the LDAP database:
1150 &rootprompt;<userinput>slapadd -v -l initdb.ldif</userinput>
1155 Start the LDAP server using the appropriate tool or method for
1156 the operating system platform on which it is installed.
1160 Install the Idealx script files in the <filename>/usr/local/sbin</filename> directory,
1161 then configure the smbldap_conf.pm file to match your system configuration.
1165 The &smb.conf; file that drives this backend can be found in example <link
1166 linkend="fast-ldap">LDAP backend smb.conf for PDC</link>.
1169 <example id="fast-ldap">
1170 <title>LDAP backend smb.conf for PDC</title>
1172 <smbconfcomment>Global parameters</smbconfcomment>
1173 <smbconfsection name="[global]"/>
1174 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
1175 <smbconfoption name="netbios name">FRODO</smbconfoption>
1176 <smbconfoption name="passdb backend">ldapsam:ldap://localhost</smbconfoption>
1177 <smbconfoption name="username map">/etc/samba/smbusers</smbconfoption>
1178 <smbconfoption name="printcap name">cups</smbconfoption>
1179 <smbconfoption name="add user script">/usr/local/sbin/smbldap-useradd -m '%u'</smbconfoption>
1180 <smbconfoption name="delete user script">/usr/local/sbin/smbldap-userdel %u</smbconfoption>
1181 <smbconfoption name="add group script">/usr/local/sbin/smbldap-groupadd -p '%g'</smbconfoption>
1182 <smbconfoption name="delete group script">/usr/local/sbin/smbldap-groupdel '%g'</smbconfoption>
1183 <smbconfoption name="add user to group script">/usr/local/sbin/smbldap-groupmod -m '%u' '%g'</smbconfoption>
1184 <smbconfoption name="delete user from group script">/usr/local/sbin/smbldap-groupmod -x '%u' '%g'</smbconfoption>
1185 <smbconfoption name="set primary group script">/usr/local/sbin/smbldap-usermod -g '%g' '%u'</smbconfoption>
1186 <smbconfoption name="add machine script">/usr/local/sbin/smbldap-useradd -w '%u'</smbconfoption>
1187 <smbconfoption name="logon script">scripts\logon.bat</smbconfoption>
1188 <smbconfoption name="logon path">\\%L\Profiles\%U</smbconfoption>
1189 <smbconfoption name="logon drive">H:</smbconfoption>
1190 <smbconfoption name="logon home">\\%L\%U</smbconfoption>
1191 <smbconfoption name="domain logons">Yes</smbconfoption>
1192 <smbconfoption name="os level">35</smbconfoption>
1193 <smbconfoption name="preferred master">Yes</smbconfoption>
1194 <smbconfoption name="domain master">Yes</smbconfoption>
1195 <smbconfoption name="ldap suffix">dc=quenya,dc=org</smbconfoption>
1196 <smbconfoption name="ldap machine suffix">ou=People</smbconfoption>
1197 <smbconfoption name="ldap user suffix">ou=People</smbconfoption>
1198 <smbconfoption name="ldap group suffix">ou=People</smbconfoption>
1199 <smbconfoption name="ldap idmap suffix">ou=People</smbconfoption>
1200 <smbconfoption name="ldap admin dn">cn=Manager</smbconfoption>
1201 <smbconfoption name="ldap ssl">no</smbconfoption>
1202 <smbconfoption name="ldap passwd sync">Yes</smbconfoption>
1203 <smbconfoption name="idmap uid">15000-20000</smbconfoption>
1204 <smbconfoption name="idmap gid">15000-20000</smbconfoption>
1205 <smbconfoption name="printing">cups</smbconfoption>
1210 Add the LDAP password to the <filename>secrets.tdb</filename> file so Samba can update
1213 &rootprompt;<userinput>smbpasswd -w mordonL8</userinput>
1218 Add users and groups as required. Users and groups added using Samba tools
1219 will automatically be added to both the LDAP backend and the operating
1228 <title>Backup Domain Controller</title>
1231 <link linkend="fast-bdc"/> shows the example configuration for the BDC.
1236 Decide if the BDC should have its own LDAP server or not. If the BDC is to be
1237 the LDAP server, change the following &smb.conf; as indicated. The default
1238 configuration in <link linkend="fast-bdc">Remote LDAP BDC smb.conf</link>
1239 uses a central LDAP server.
1242 <example id="fast-bdc">
1243 <title>Remote LDAP BDC smb.conf</title>
1245 <smbconfcomment>Global parameters</smbconfcomment>
1246 <smbconfsection name="[global]"/>
1247 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
1248 <smbconfoption name="netbios name">GANDALF</smbconfoption>
1249 <smbconfoption name="passdb backend">ldapsam:ldap://frodo.quenya.org</smbconfoption>
1250 <smbconfoption name="username map">/etc/samba/smbusers</smbconfoption>
1251 <smbconfoption name="printcap name">cups</smbconfoption>
1252 <smbconfoption name="logon script">scripts\logon.bat</smbconfoption>
1253 <smbconfoption name="logon path">\\%L\Profiles\%U</smbconfoption>
1254 <smbconfoption name="logon drive">H:</smbconfoption>
1255 <smbconfoption name="logon home">\\%L\%U</smbconfoption>
1256 <smbconfoption name="domain logons">Yes</smbconfoption>
1257 <smbconfoption name="os level">33</smbconfoption>
1258 <smbconfoption name="preferred master">Yes</smbconfoption>
1259 <smbconfoption name="domain master">No</smbconfoption>
1260 <smbconfoption name="ldap suffix">dc=quenya,dc=org</smbconfoption>
1261 <smbconfoption name="ldap machine suffix">ou=People</smbconfoption>
1262 <smbconfoption name="ldap user suffix">ou=People</smbconfoption>
1263 <smbconfoption name="ldap group suffix">ou=People</smbconfoption>
1264 <smbconfoption name="ldap idmap suffix">ou=People</smbconfoption>
1265 <smbconfoption name="ldap admin dn">cn=Manager</smbconfoption>
1266 <smbconfoption name="ldap ssl">no</smbconfoption>
1267 <smbconfoption name="ldap passwd sync">Yes</smbconfoption>
1268 <smbconfoption name="idmap uid">15000-20000</smbconfoption>
1269 <smbconfoption name="idmap gid">15000-20000</smbconfoption>
1270 <smbconfoption name="printing">cups</smbconfoption>
1275 Configure the NETLOGON and PROFILES directory as for the PDC in <link linkend="fast-bdc"/>.