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">
4 <title>No Frills Samba Servers</title>
7 Congratulations, you managed to get past the opening chapter. To some, this is where the interesting
8 exercises begin. This is the start of the real journey toward the Samba deployment of a lifetime.
12 <title>Introduction</title>
15 This chapter lays the groundwork for understanding the basics of Samba operation.
16 Instead of a bland technical discussion, each principle is demonstrated by way of a
17 real-world scenario for which a working solution<footnote><para>The examples given mirror those documented
18 in TOSHARG Chapter 2, Section 2.3.1. You may gain additional insight from the Stand-alone server
19 configurations covered in TOSHARG sections 2.3.1.2 through 2.3.1.4.
20 </para></footnote> is fully described.
24 The practical exercises take you on a journey through a drafting office, a charity administration
25 office, and an accounting office. You may choose to apply any or all of these to your own environment.
29 Every assignment case can be implemented far more creatively, but remember that the solutions you
30 create are designed to demonstrate a particular solution possibility. With experience, you should
31 find much improved solutions compared with those presented here. By the time you complete this book,
32 you should aim to be a Samba expert, so do attempt to find better solutions and try them as you work your
33 way through the examples.
38 <title>Assignment Tasks</title>
41 Each case presented highlights different aspects of Windows networking for which a simple
42 Samba-based solution can be provided. Each has subtly different requirements taken from real-world cases.
43 Each is briefly reviewed to cover points of highlight. In each example, instructions are based
44 on the assumption that the official Samba Team RPM package has been installed.
48 This chapter has three assignments built around ficticious companies:
53 <listitem><para>A drafting office</para></listitem>
54 <listitem><para>A charity administration office</para></listitem>
55 <listitem><para>An accounting office</para></listitem>
64 <title>Drafting Office</title>
67 Our fictitious company is called <emphasis>Abmas Design Inc.</emphasis> This is a three-person
68 computer-aided design (CAD) business that often has more work than can be handled. The
69 business owner hires contract draftspeople from wherever he can. They bring their own
70 notebook computers into the office. There are four permanent drafting machines. Abmas has a
71 collection of over 10 years of plans that must be available for all draftsmen to reference.
72 Abmas hires the services of an experienced network engineer to update the
73 plans that are stored on a central server one day per month. She knows how to upload
74 plans from each machine. The files available from the server must remain read-only.
75 Anyone should be able to access the plans at any time and without barriers or difficulty.
78 <para><indexterm><primary>Red Hat</primary></indexterm>
79 <indexterm><primary>Fedora</primary></indexterm>
80 Mr. Bob Jordan has asked you to install the new server as economically as possible. The central
81 server has a Pentium-IV 1.6GHz CPU, 768MB RAM, a 20GB IDE boot drive, a 160GB IDE second disk
82 to store plans, and a 100-base-T Ethernet card. You have already installed Red Hat Fedora Core2 and
83 have upgraded Samba to version 3.0.12 using the RPM package that is provided from the Samba
84 <ulink url="http://www.samba.org">FTP</ulink> sites.
88 <primary>consultant</primary>
90 The four permanent drafting machines (Microsoft Windows workstations) have attached printers
91 and plotters that are shared on a peer-to-peer basis by any/all network users. The intent
92 is to continue to share printers in this manner. The three permanent staff work together with
93 all contractors to store all new work on one PC. A daily copy is made of the work storage
94 area to another PC for safekeeping. When the network consultant arrives, the weekly work
95 area is copied to the central server and the files are removed from the main weekly storage
96 machine. The office works best with this arrangement and does not want to change anything.
97 Old habits are too ingrained.
101 <title>Dissection and Discussion</title>
104 <primary>file server</primary>
105 <secondary>read-only</secondary>
107 The requirements for this server installation demand simplicity. An anonymous read-only
108 file server adequately meets all needs. The network consultant determines how
109 to upload all files from the weekly storage area to the server. This installation should
110 focus only on critical aspects of the installation.
114 It is not necessary to have specific users on the server. The site has a method for storing
115 all design files (plans). Each plan is stored in a directory that is named YYYYWW<footnote><para>
116 This information is given purely as an example of how data may be stored in such a way that it
117 will be easy to locate records at a later date. The example is not meant to imply any instructions
118 that may be construed as essential to the design of the solution, this is something you will almost
119 certainly want to determine for yourself.</para></footnote>, where
120 YYYY is the year, and WW is the week of the year. This arrangement allows work to be stored
121 by week of year to preserve the filing technique the site is familiar with.
122 There is another customer directory that is alphabetically listed. At the top level are 26
123 directories (A-Z), in each is a second level of directory for the first plus second letter of the name
124 (A-Z); inside each is a directory by the customers' name. Inside each directory is a symbolic
125 link to each design drawing/plan. This way of storing customer data files permits all
126 plans to be located both by customer name, as well as by the date the work was performed, without
127 demanding the disk space that would be needed if a duplicate file copy were to be stored.
128 The share containing the plans is called <emphasis>Plans</emphasis>.
134 <title>Implementation</title>
137 It is assumed that the server is fully installed and ready for installation and
138 configuration of Samba 3.0.12 and any support files needed. All TCP/IP addresses
139 have been hard coded. In our case the IP address of the Samba server is
140 <constant>192.168.1.1</constant> and the netmask is <constant>255.255.255.0</constant>.
141 The host name of the server used was <constant>server</constant>.
145 <title>Samba Server Configuration</title>
148 Download the Samba-3 RPM packages for Red Hat Fedora Core2 from the Samba
149 <ulink url="http://www.samba.org">FTP servers.</ulink>
152 <step><para><indexterm>
153 <primary>RPM</primary>
154 <secondary>install</secondary>
155 </indexterm><indexterm>
156 <primary>package</primary>
158 Install the RPM package as using either the Red Hat Linux preferred GUI
159 tool or using the <command>rpm</command>, as follows:
161 &rootprompt; rpm -Uvh samba-3.0.12-1.i386.rpm
166 Create a mount point for the file system that will be used to store all data files.
167 You can create a directory called <filename>/plans</filename> as follows:
169 &rootprompt; mkdir /plans
170 &rootprompt; chmod 755 /plans
172 The 755 permissions on this directory (mount point) permit the owner to read, write
173 and execute, and the group and everyone else to read and execute only.
177 <primary>file system</primary>
178 <secondary>Ext3</secondary>
180 Use Red Hat Linux system tools (refer to Red Hat instructions for instructions)
181 to format the 160GB hard drive with a suitable file system. An Ext3 file system
182 is suitable. Configure this drive to automatically mount using the <filename>/plans</filename>
183 directory as the mount point.
187 Install the &smb.conf; file shown in <link linkend="draft-smbconf"/> in the
188 <filename>/etc/samba</filename> directory.
190 <smbconfexample id="draft-smbconf">
191 <title>Drafting Office &smb.conf; File</title>
192 <smbconfcomment>Global Parameters</smbconfcomment>
193 <smbconfsection name="[global]"/>
194 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
195 <smbconfoption name="security">SHARE</smbconfoption>
197 <smbconfsection name="[Plans]"/>
198 <smbconfoption name="path">/plans</smbconfoption>
199 <smbconfoption name="read only">Yes</smbconfoption>
200 <smbconfoption name="guest ok">Yes</smbconfoption>
204 <step><para><indexterm>
205 <primary>/etc/hosts</primary>
207 Verify that the <filename>/etc/hosts</filename> file contains the following entry:
213 <step><para><indexterm>
214 <primary>samba</primary>
215 <secondary>starting samba</secondary>
216 </indexterm><indexterm>
217 <primary>chkconfig</primary>
219 <indexterm><primary>starting samba</primary></indexterm>
220 Use the standard system tool to start Samba and to configure it to restart
221 automatically at every system reboot. For example:
223 &rootprompt; chkconfig smb on
224 &rootprompt; /etc/rc.d/init.d/smb restart
231 <title>Windows Client Configuration</title>
234 Make certain that all clients are set to the same network address range as
235 has been used for the Samba server. For example, one client might have an IP
236 address 192.168.1.10.
239 <step><para><indexterm>
240 <primary>netmask</primary>
242 Ensure that the netmask used on the Windows clients matches that used
243 for the Samba server. All clients must have the same netmask. For example,
247 <step><para><indexterm>
248 <primary>workgroup</primary>
250 Set the workgroup name on all clients to <constant>MIDEARTH</constant>.
254 Verify on each client that the machine called <constant>SERVER</constant>
255 is visible in the <guimenu>Network Neighborhood</guimenu>, that it is
256 possible to connect to it and see the share <guimenuitem>Plans</guimenuitem>,
257 and that it is possible to open that share to reveal its contents.
264 <sect3 id="validate1">
265 <title>Validation</title>
268 <primary>validation</primary>
270 The first priority in validating the new Samba configuration should be to check
271 that Samba answers on the loop-back interface. Then it is time to check that Samba
272 answers its own name correctly. Last, check that a client can connect to the Samba
277 <step><para><indexterm>
278 <primary>smbd</primary>
279 </indexterm><indexterm>
280 <primary>daemon</primary>
281 </indexterm><indexterm>
282 <primary>smbclient</primary>
284 To check the ability to access the <command>smbd</command> daemon
285 services, execute the following:
287 &rootprompt; smbclient -L localhost -U%
288 Sharename Type Comment
289 --------- ---- -------
291 IPC$ IPC IPC Service (Samba 3.0.12)
292 ADMIN$ IPC IPC Service (Samba 3.0.12)
303 <primary>loopback</primary>
304 </indexterm><indexterm>
305 <primary>NULL connection</primary>
307 This indicates that Samba is able to respond on the loopback interface to
308 a NULL connection. The <parameter>-U%</parameter> means send an empty
309 username and an empty password. This command should be repeated after
310 Samba has been running for 15 minutes.
314 Now verify that Samba correctly handles being passed a username
315 and password, and that it answers its own name. Execute the following:
317 &rootprompt; smbclient -L server -Uroot%password
319 The output should be identical to the previous response. Samba has been
320 configured to ignore all usernames given; instead it uses the
321 <parameter>guest account</parameter> for all connections.
324 <step><para><indexterm>
325 <primary>Windows Explorer</primary>
326 </indexterm><indexterm>
327 <primary>Network Neighborhood</primary>
329 From the Windows 9x/Me client, launch Windows Explorer,
331 <guiicon>[Desktop: right-click] Network Neighborhood</guiicon>
332 <guimenu>Explore</guimenu>
333 <guimenuitem>[Left Panel] [+] Entire Network</guimenuitem>
334 <guimenuitem>[Left Panel] [+] Server</guimenuitem>
335 <guimenuitem>[Left Panel] [+] Plans</guimenuitem>
336 </menuchoice>. In the right panel you should see the files and directories
337 (folders) that are in the <guiicon>Plans</guiicon> share.
346 <title>Charity Administration Office</title>
349 The fictitious charity organization is called <emphasis>Abmas Vision NL</emphasis>. This is an
350 office that has five networked computers. Staff are all volunteers with frequent staff changes.
351 Ms. Amy May, the director of operations, wants a no-hassle network. Anyone should be able to
352 use any PC. Only two Windows applications are used: a custom funds tracking and management package
353 that stores all files on the central server and Microsoft Word. The office prepares mail-out
354 letters, letters of invitation, and thank-you notes. All files must be stored in perpetuity.
355 The custom funds tracking and management (FTM) software has been configured to use a server named
356 <constant>SERVER</constant>, a share named <constant>FTMFILES</constant>, and a printer queue
357 named <constant>PRINTQ</constant> that uses preprinted stationery, thus demanding a
358 dedicated printer. This printer does not need to be mapped to a local printer on the workstations.
362 The FTM software has been in use since the days of Windows 3.11. The software was configured
363 by the vendor who has since gone out of business. The name of the identities of the file
364 server and the printer are hard coded in a configuration file that was created using a
365 setup tool that the vendor did not provide to Abmas Vision NL or to its predecessors. The
366 company that produced the software is no longer in business. In order to avoid risk of
367 any incompatibilities the share name and the name of the target print queue is being set
368 precisely as the application expects. In actual fact, share names and print queue names
369 should be treated as case insensitive (i.e.: Case does not matter) but Abmas Vision claim
370 that if the share name is not in lower case the application claims it can not find the
375 <primary>print queue</primary>
376 </indexterm><indexterm>
377 <primary>print spooler</primary>
379 Printer handling in Samba results in a significant level of confusion. Samba presents to the
380 MS Windows client only a print queue. The Samba <command>smbd</command> process passes a
381 print job sent to it from the Windows client to the native UNIX printing system. The native
382 UNIX printing system (spooler) places the job in a print queue from which it is
383 delivered to the printer. In this book, network diagrams refer to a printer by the name
384 of the print queue that services that printer. It does not matter what the fully qualified
385 name (or the host name) of a network attached printer is. The UNIX print spooler is configured
386 to correctly deliver all jobs to the printer.
390 This organization has a policy forbidding use of privately owned computers on site as a measure
391 to prevent leakage of confidential information. Only the five PCs owned by Abmas Vision NL are
392 used on this network.
396 <primary>SUSE Enterprise Linux Server</primary>
398 The central server was donated by a local computer store. It is a dual processor Pentium-III
399 server, has 1GB RAM, a 3-Ware IDE RAID Controller that has 4 x 200GB IDE hard drives, and a
400 100-base-T network card. The office has 100-base-T permanent network connections that go to
401 a central hub and all equipment is new. The five network computers all are equipped with Microsoft
402 Windows Me. Funding is limited, so the server has no operating system on it. You have approval
403 to install Samba on Linux, but just make sure it works without problems. There are two HP LaserJet
404 5 PS printers that are network connected. The second printer is to be used for general
405 office and letter printing. Your recommendation to allow only the Linux server to print directly
406 to the printers was accepted. You have supplied SUSE Enterprise Linux Server 9 and
407 have upgraded Samba to version 3.0.12.
411 <title>Dissection and Discussion</title>
414 <indexterm><primary>force user</primary></indexterm><indexterm>
415 <primary>nt acl support</primary>
416 </indexterm><indexterm>
417 <primary>UID</primary>
418 </indexterm><indexterm>
419 <primary>Posix</primary>
421 This installation demands simplicity. Frequent turn-over of volunteer staff would indicate that
422 a network environment that requires users to logon might be problematic. It is suggested that the
423 best solution for this office would be one where the user can log onto any PC with any username
424 and password. Samba can accommodate an office like this by using the <parameter>force user</parameter>
425 parameter in share and printer definitions. The use of the <parameter>force user</parameter>
426 ensures that all files are owned by same user identifier (UID) and thus ensures that there
427 will never be a problem with file access due to file access permissions. Additionally, you elect
428 to use the <parameter>nt acl support = No</parameter> option to ensure that no attempts can be
429 made to write access control lists (Posix type) to any file or directory. This prevents
430 an inadvertent ACL from overriding actual file permissions.
434 <indexterm><primary>SUID</primary></indexterm>
435 <indexterm><primary>SGID</primary></indexterm>
436 <indexterm><primary>security</primary><secondary>share mode</secondary></indexterm>
437 This organization is a prime candidate for Share Mode security. The <parameter>force user</parameter>
438 allows all files to be owned by the same user and group. In addition to this, it would not hurt to
439 set SUID and set SGID shared directories. This means that all new files that are created, no matter
440 who creates it, are owned by the owner or group of the directory in which they are created.
441 For further information regarding the significance of the SUID/SGID settings, see
442 <link linkend="ch12-SUIDSGID"/>.
446 <indexterm><primary>CUPS</primary></indexterm>
447 <indexterm><primary>printing</primary><secondary>raw</secondary></indexterm><indexterm>
448 <primary>Red Hat Linux</primary>
449 </indexterm><indexterm>
450 <primary>SUSE Linux</primary>
452 All client workstations print to a print queue on the server. This ensures that print jobs
453 continue to print in the event that a user may shut down the workstation immediately after
454 sending a job to the printer. Today, both Red Hat Linux and SUSE Linux use CUPS-based printing.
455 Older Linux systems offered a choice to use either the LPRng printing system, or CUPS. It appears, however,
456 that CUPS has now become the leading UNIX printing technology.
460 <indexterm><primary>print queue</primary></indexterm>
461 The print queues are set up as <constant>Raw</constant> devices, which means that CUPS will
462 not do intelligent print processing, and vendor supplied drivers be installed locally on the
467 The hypothetical software (Funds Tracking and Management) referred to is representative of
468 custom-built software that directly uses a NetBIOS interface. Most such software originated in
469 the days of MS/PC DOS. NetBIOS names are upper-case (and functionally are case insensitive),
470 thus some old software applications would permit only upper-case names to be entered.
471 Some such applications were later ported to MS Windows but retain the upper-case network
472 resource naming conventions because customers are familiar with that. We made the decision
473 to name shares and print queues for this application in upper-case also for the same reason.
474 Nothing would break if you were to use lower-case names, but that decision might create a need
475 to re-educate staff &smbmdash; something well avoided at this time.
479 NetBIOS networking does not print directly to a printer. Instead, all printing is done to a
480 print queue. The print spooling system is responsible for communicating with the physical
481 printer. In this example, therefore, the resource that is referred to as <constant>PRINTQ</constant>
482 really is just a print queue. The name of the print queue is held to be representative of
483 the device to which the print spooler delivers print jobs.
489 <title>Implementation</title>
492 It is assumed that the server is fully installed and ready for configuration of
493 Samba 3.0.12 and for necessary support files. All TCP/IP addresses should be hard coded.
494 In our case, the IP address of the Samba server is 192.168.1.1 and the netmask is
495 255.255.255.0. The host name of the server used was <constant>server</constant>.
496 The office network is built as shown in <link linkend="charitynet"/>.
499 <image id="charitynet">
500 <imagedescription>Charity Administration Office Network</imagedescription>
501 <imagefile scale="66">Charity-Network</imagefile>
505 <title>Samba Server Configuration</title>
507 <step><para><indexterm>
508 <primary>groupadd</primary>
510 Create a group account for office file storage as follows:
512 &rootprompt; groupadd office
516 <step><para><indexterm>
517 <primary>useradd</primary>
518 </indexterm><indexterm>
519 <primary>passwd</primary>
521 Create a user account for office file storage as follows:
523 &rootprompt; useradd -m abmas
524 &rootprompt; passwd abmas
525 Changing password for abmas.
526 New password: XXXXXXXX
527 Re-enter new password: XXXXXXXX
530 where XXXXXXXX is a secret password.
534 Use the 3-Ware IDE RAID Controller firmware utilities to configure the four 200GB
535 drives as a single RAID level 5 drive, with one drive set aside as the hot spare.
536 (Refer to the 3-Ware RAID Controller Manual for the manufacturers' preferred procedure.)
537 The resulting drive has a capacity of approximately 500GB of usable space.
540 <step><para><indexterm>
541 <primary>permissions</primary>
543 Create a mount point for the file system that can be used to store all data files.
544 Create a directory called <filename>/data</filename> as follows:
546 &rootprompt; mkdir /data
547 &rootprompt; chmod 755 /data
549 The 755 permissions on this directory (mount point) permit the owner to read, write and execute,
550 and the group and everyone else to read and execute only.
554 Use SUSE Linux system tools (refer to the SUSE Administrators Guide for correct
555 procedures) to format the partition with a suitable file system. The reiserfs file system
556 is suitable. Configure this drive to automount using the <filename>/data</filename>
557 directory as the mount point. It must be mounted before proceeding.
561 Under the directory called <filename>/data</filename> create two directories
562 named <filename>ftmfiles</filename> and <filename>officefiles</filename>, and set
563 ownership and permissions as follows:
565 &rootprompt; mkdir -p /data/{ftmfiles,officefiles/{letters,invitations,misc}}
566 &rootprompt; chown -R abmas.office /data
567 &rootprompt; chmod -R ug+rwxs,o-w,o+rx /data
569 These demonstrate compound operations. The <command>mkdir</command> command
570 creates in one step these directories:
574 /data/officefiles/letters
575 /data/officefiles/invitations
576 /data/officefiles/misc
578 The <command>chown</command> operation sets the owner to the user <constant>abmas</constant>
579 and the group to <constant>office</constant> on all directories just created. And
580 the <command>chmod</command> operation recursively sets the permissions so that
581 the owner and group have SUID/SGID with read/write/execute permission, and everyone else has
582 read and execute permission. This means that all files and directories are created
583 with the same owner and group as the directory in which they are created. Any new
584 directories created still have the same owner, group, and permissions as the
585 directory they are in. This should eliminate all permissions-based file access problems.
586 For more information on this subject, refer to <emphasis>TOSHARG</emphasis>, Chapter 13, <emphasis>File, Directory
587 and Share Access Controls</emphasis>, or refer to the UNIX man page for the
588 <command>chmod</command> and the <command>chown</command> commands.
593 Install the &smb.conf; file shown in <link linkend="charity-smbconf"/> in the
594 <filename>/etc/samba</filename> directory.
598 <indexterm><primary>smbd</primary></indexterm>
599 We must ensure that the <command>smbd</command> can resolve the name of the Samba
600 server to its IP address. Verify that the <filename>/etc/hosts</filename> file
601 contains the following entry:
608 Configure the printers with the IP address as shown in <link linkend="charitynet"/>.
609 Follow the instructions in the manufacturers' manual to permit printing to port 9100,
610 so that the CUPS spooler can print using raw mode protocols.
613 <step><para><indexterm>
614 <primary>lpadmin</primary>
616 Configure the CUPS Print Queues as follows:
618 &rootprompt; lpadmin -p PRINTQ -v socket://192.168.1.20:9100 -E
619 &rootprompt; lpadmin -p hplj5 -v socket://192.168.1.30:9100 -E
621 This creates the necessary print queues with no assigned print filter.
625 <indexterm><primary>mime type</primary></indexterm><indexterm>
626 <primary>/etc/cups/mime.convs</primary>
627 </indexterm><indexterm>
628 <primary>application/octet-stream</primary>
630 Edit the file <filename>/etc/cups/mime.convs</filename> to uncomment the line:
632 application/octet-stream application/vnd.cups-raw 0 -
636 <step><para><indexterm>
637 <primary>/etc/cups/mime.types</primary>
639 Edit the file <filename>/etc/cups/mime.types</filename> to uncomment the line:
641 application/octet-stream
646 <indexterm><primary>starting samba</primary></indexterm>
647 Use the standard system tool to start Samba and CUPS to configure them to restart
648 automatically at every system reboot. For example:
652 <indexterm><primary>starting samba</primary></indexterm>
653 <indexterm><primary>starting
654 CUPS</primary></indexterm><indexterm>
655 <primary>chkconfig</primary>
658 &rootprompt; chkconfig smb on
659 &rootprompt; chkconfig cups on
660 &rootprompt; /etc/rc.d/init.d/smb restart
661 &rootprompt; /etc/rc.d/init.d/cups restart
667 <smbconfexample id="charity-smbconf">
668 <title>Charity Administration Office &smb.conf; File</title>
669 <smbconfcomment>Global Parameters</smbconfcomment>
670 <smbconfsection name="[global]"/>
671 <smbconfoption name="workgroup">MIDEARTH</smbconfoption>
672 <smbconfoption name="security">SHARE</smbconfoption>
673 <smbconfoption name="printing">CUPS</smbconfoption>
674 <smbconfoption name="printcap name">CUPS</smbconfoption>
675 <smbconfoption name="disable spoolss">Yes</smbconfoption>
676 <smbconfoption name="show add printer wizard">No</smbconfoption>
677 <smbconfoption name="wins support">yes</smbconfoption>
679 <smbconfsection name="[FTMFILES]"/>
680 <smbconfoption name="comment">Funds Tracking & Management Files</smbconfoption>
681 <smbconfoption name="path">/data/ftmfiles</smbconfoption>
682 <smbconfoption name="read only">No</smbconfoption>
683 <smbconfoption name="force user">abmas</smbconfoption>
684 <smbconfoption name="force group">office</smbconfoption>
685 <smbconfoption name="guest ok">Yes</smbconfoption>
686 <smbconfoption name="nt acl support">No</smbconfoption>
688 <smbconfsection name="[office]"/>
689 <smbconfoption name="comment">General Office Files</smbconfoption>
690 <smbconfoption name="path">/data/officefiles</smbconfoption>
691 <smbconfoption name="read only">No</smbconfoption>
692 <smbconfoption name="force user">abmas</smbconfoption>
693 <smbconfoption name="force group">office</smbconfoption>
694 <smbconfoption name="guest ok">Yes</smbconfoption>
695 <smbconfoption name="nt acl support">No</smbconfoption>
697 <smbconfsection name="[printers]"/>
698 <smbconfoption name="comment">Print Temporary Spool Configuration</smbconfoption>
699 <smbconfoption name="path">/var/spool/samba</smbconfoption>
700 <smbconfoption name="printable">Yes</smbconfoption>
701 <smbconfoption name="guest ok">Yes</smbconfoption>
702 <smbconfoption name="use client driver">Yes</smbconfoption>
703 <smbconfoption name="browseable">No</smbconfoption>
707 <title>Windows Client Configuration</title>
710 Configure clients to the network settings shown in <link linkend="charitynet"/>.
714 Ensure that the netmask used on the Windows clients matches that used
715 for the Samba server. All clients must have the same netmask. For example,
716 <constant>255.255.255.0</constant>.
720 <indexterm><primary>WINS</primary></indexterm>
721 On all Windows clients, set the WINS Server address to <constant>192.168.1.1</constant>,
722 the IP address of the server.
726 Set the workgroup name on all clients to <constant>MIDEARTH</constant>.
729 <step><para><indexterm>
730 <secondary>logon</secondary>
732 Install the <quote>Client for Microsoft Networks.</quote> Ensure that the only option
733 enabled in its properties is the option <quote>Logon and restore network connections.</quote>
737 Click <guibutton>OK</guibutton> when you are prompted to reboot the system. Reboot the
738 system, then logon using any user name and password you choose.
741 <step><para><indexterm>
742 <primary>My Network Places</primary>
744 Verify on each client that the machine called <constant>SERVER</constant>
745 is visible in <guimenu>My Network Places</guimenu>, that it is
746 possible to connect to it and see the share <guimenuitem>office</guimenuitem>,
747 and that it is possible to open that share to reveal its contents.
750 <step><para><indexterm>
751 <primary>password caching</primary>
752 </indexterm><indexterm>
753 <primary>regedit</primary>
755 Disable password caching on all Windows 9x/Me machines using the registry change file
756 shown in <link linkend="MEreg"/>. Be sure to remove all files that have the
757 <filename>PWL</filename> extension that are in the <filename>C:\WINDOWS</filename>
760 <title>Windows Me &smbmdash; Registry Edit File: Disable Password Caching</title>
764 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
765 Windows\CurrrentVersion\Policies\Network]
766 "DisablePwdCaching"=dword:00000001
769 The best way to apply this is to save the patch in a file called
770 <filename>ME-dpwc.reg</filename> and then execute:
772 C:\WINDOWS: regedit ME-dpwc.reg
777 Instruct all users to log onto the workstation using a name of their own
778 choosing, with a password of their own choosing. The Samba server has been
779 configured to ignore the username and password given.
783 On each Windows Me workstation, configure a network drive mapping to drive <filename>G:</filename>
784 that redirects to the uniform naming convention (UNC) resource
785 <filename>\\server\office</filename>. Make this a permanent drive connection as follows:
790 <guimenu>(Right-click) My Network</guimenu>
791 <guimenuitem>Map Network Drive...</guimenuitem>
796 In the box labeled <quote>Drive:</quote>, type G.
800 In the box labeled <quote>Path:</quote>, enter
801 <filename>\\server\officefiles</filename>.
805 Click <guimenuitem>Reconnect at logon</guimenuitem>.
806 Click <guibutton>OK</guibutton>.
813 On each workstation, install the Funds Tracking and Management software following the
814 manufacturer's instructions.
818 During installation, you are prompted for the name of the Windows 98
819 server. Enter the name <constant>SERVER</constant>.
822 You are prompted for the name of the data share.
823 The prompt defaults to <constant>FTMFILES</constant>. Press enter to accept the default value.
826 You are now prompted for the print queue name. The default prompt is the name of
827 the server you entered (<constant>SERVER</constant> as follows:
828 <constant>\\SERVER\PRINTQ</constant>). Simply accept the default and press enter to
829 continue. The software now completes the installation.
835 Install an office automation software package of the customer's choice. Either Microsoft
836 Office 2003 Standard or OpenOffice 1.1.0 suffices for any functions the office may
837 need to perform. Repeat this on each workstation.
841 Install a printer on each using the following steps:
847 <guimenu>Start</guimenu>
848 <guimenuitem>Settings</guimenuitem>
849 <guimenuitem>Printers</guimenuitem>
850 <guiicon>Add Printer</guiicon>
851 <guibutton>Next</guibutton>
852 </menuchoice>. Do not click <guimenuitem>Network printer</guimenuitem>.
853 Ensure that <guimenuitem>Local printer</guimenuitem> is selected.
857 Click <guibutton>Next</guibutton>. In the panel labeled
858 <guimenuitem>Manufacturer:</guimenuitem>, select <constant>HP</constant>.
859 In the <guimenuitem>Printers:</guimenuitem> panel, select the printer called
860 <constant>HP LaserJet 5/5M Postscript</constant>. Click <guibutton>Next</guibutton>.
864 In the panel labeled <guimenuitem>Available ports:</guimenuitem>, select
865 <constant>FILE:</constant>. Accept the default printer name by clicking
866 <guibutton>Next</guibutton>. When asked, <quote>Would you like to print a
867 test page?</quote>, click <guimenuitem>No</guimenuitem>. Click
868 <guibutton>Finish</guibutton>.
872 You may be prompted for the name of a file to print to. If so, close the
873 dialog panel. Right-click <menuchoice>
874 <guiicon>HP LaserJet 5/5M Postscript</guiicon>
875 <guimenuitem>Properties</guimenuitem>
876 <guisubmenu>Details (Tab)</guisubmenu>
877 <guimenuitem>Add Port</guimenuitem>
882 In the panel labeled <guimenuitem>Network</guimenuitem>, enter the name of
883 the print queue on the Samba server as follows: <constant>\\SERVER\hplj5</constant>.
885 <guibutton>OK</guibutton>
886 <guibutton>OK</guibutton>
887 </menuchoice> to complete the installation.
891 It is a good idea to test the functionality of the complete installation before
892 handing the newly configured network over to the Charity Administration Office
905 <title>Validation</title>
908 Use the same validation process as was followed in <link linkend="validate1"/>.
915 <sect2 id="AccountingOffice">
916 <title>Accounting Office</title>
919 The office of Abmas Accounting Inc. is a 40-year-old family-run business. There are nine permanent
920 computer users. The network clients were upgraded two years ago. All computers run Windows 2000
921 Professional. This year the server will be upgraded from an old Windows NT4 server (actually
922 running Windows NT4 Workstation, which worked fine as there were fewer than 10 users) that has
923 run in workgroup (Stand-Alone) mode, to a new Linux server running Samba.
927 The office does not want a Domain Server. Mr. Alan Meany wants to keep the Windows 2000 Professional
928 clients running as workgroup machines so that any staff member can take a machine home and keep
929 working. It has worked well so far and your task is to replace the old server. All users have
930 their own workstation logon (you configured it that way when the machines were installed).
931 Mr. Meany wants the new system to operate the same way as the old Windows NT4 server &smbmdash; users
932 cannot access each others' files, but he can access everyone's files. Each person's work files are
933 in a separate share on the server. Users logon to their Windows workstation with their username
934 and enter an assigned password; they do not need to enter a password when accessing their files
939 <primary>Red Hat Linux</primary>
941 The new server will run Red Hat Fedora Core2. You should install Samba-3.0.12 and
942 copy all files off the old system to the new one. The existing Windows NT4 server has a parallel
943 port HP LaserJet 4 printer that is shared by all. The printer driver is installed on each
944 workstation. You must not change anything on the workstations. Mr. Meany gave instructions to
945 replace the server <quote>but leave everything else alone to avoid staff unrest.</quote>
949 You have tried to educate Mr. Meany and found that he has no interest to understand networking.
950 He believes that Windows for Workgroups 3.11 was <quote>the best server Microsoft ever sold
951 </quote> and that Windows NT and 2000 are <quote>too fang-dangled complex!</quote>
955 <title>Dissection and Discussion</title>
958 <indexterm><primary>security</primary><secondary>user mode</secondary></indexterm>
959 The requirements of this network installation are not unusual. The staff are not interested in the
960 details of networking. Passwords are never changed. In this example solution, we demonstrate the use
961 of User Mode security in a simple context. Directories should be set SGID to ensure that members
962 of a common group can access the contents. Each user has his or her own share to which only they
963 can connect. Mr. Meany's share will be a top level directory above the share point for each employee.
964 Mr. Meany is a member of the same group as his staff and is able to access their work files.
965 The well used HP LaserJet 4 is available as a service called <constant>hplj</constant>.
969 You have finished configuring the new hardware and have just completed installation of Red Hat
970 Fedora Core2. Roll up your sleeves and let's get to work.
975 <sect3 id="AcctgNet">
976 <title>Implementation</title>
979 The workstations have fixed IP addresses. The old server runs Windows NT4 Workstation, so it
980 cannot be running as a WINS server. It is best that the new configuration preserves the same
981 configuration. The office does not use Internet access, so security really is not an issue.
985 The core information regarding the users, their passwords, the directory share point, and the
986 share name is given in <link linkend="acctingnet"/>. The overall network topology is shown in
987 <link linkend="acctingnet2"/>. All machines have been configured as indicated prior to the
988 start of Samba configuration. The following prescriptive steps may now commence.
991 <image id="acctingnet2">
992 <imagedescription>Accounting Office Network Topology</imagedescription>
993 <imagefile scale="66">AccountingNetwork</imagefile>
996 <table id="acctingnet">
997 <title>Accounting Office Network Information</title>
999 <colspec align="left"/>
1000 <colspec align="left"/>
1001 <colspec align="left"/>
1002 <colspec align="left"/>
1003 <colspec align="left"/>
1004 <colspec align="left"/>
1008 <entry>Login-ID</entry>
1009 <entry>Password</entry>
1010 <entry>Share Name</entry>
1011 <entry>Directory</entry>
1017 <entry>Alan Meany</entry>
1019 <entry>alm1961</entry>
1021 <entry>/data</entry>
1025 <entry>James Meany</entry>
1026 <entry>james</entry>
1027 <entry>jimm1962</entry>
1028 <entry>james</entry>
1029 <entry>/data/james</entry>
1033 <entry>Jeannie Meany</entry>
1034 <entry>jeannie</entry>
1035 <entry>jema1965</entry>
1036 <entry>jeannie</entry>
1037 <entry>/data/jeannie</entry>
1041 <entry>Suzy Millicent</entry>
1043 <entry>suzy1967</entry>
1045 <entry>/data/suzy</entry>
1049 <entry>Ursula Jenning</entry>
1051 <entry>ujen1974</entry>
1052 <entry>ursula</entry>
1053 <entry>/data/ursula</entry>
1057 <entry>Peter Pan</entry>
1058 <entry>peter</entry>
1059 <entry>pete1984</entry>
1060 <entry>peter</entry>
1061 <entry>/data/peter</entry>
1065 <entry>Dale Roland</entry>
1067 <entry>dale1986</entry>
1069 <entry>/data/dale</entry>
1073 <entry>Bertrand E Paoletti</entry>
1075 <entry>eric1993</entry>
1077 <entry>/data/eric</entry>
1081 <entry>Russell Lewis</entry>
1083 <entry>russ2001</entry>
1084 <entry>russell</entry>
1085 <entry>/data/russell</entry>
1095 <title>Migration from Windows NT4 Workstation System to Samba-3</title>
1097 <step><para><indexterm>
1098 <primary>migration</primary>
1100 Rename the old server from <constant>CASHPOOL</constant> to <constant>STABLE</constant>
1101 by logging onto the console as the <constant>Administrator</constant>. Restart the machine
1102 following system prompts.
1106 Name the new server <constant>CASHPOOL</constant> using the standard configuration method.
1107 Restart the machine following system prompts.
1111 Install the latest Samba-3 binary Red Hat Linux RPM that is available from the
1115 <step><para><indexterm>
1116 <primary>group account</primary>
1117 </indexterm><indexterm>
1118 <primary>groupadd</primary>
1120 Add a group account for the office to use. Execute the following:
1122 &rootprompt; groupadd accts
1127 Install the &smb.conf; file shown<footnote><para>This example makes use of the
1128 <parameter>smbpasswd</parameter> file. It does so in an obtuse way since the use of
1129 the <parameter>passdb backend</parameter> has not been specified in the &smb.conf;
1130 file. This means that you are depending on correct default behavior.</para></footnote>
1131 in <link linkend="acctconf"/>.
1134 <step><para><indexterm>
1135 <primary>useradd</primary>
1136 </indexterm><indexterm>
1137 <primary>passwd</primary>
1138 </indexterm><indexterm>
1139 <primary>smbpasswd</primary>
1141 For each user who uses this system (see <link linkend="acctingnet"/>),
1142 execute the following:
1144 &rootprompt; useradd -m -G accts -c "Name of User" "LoginID"
1145 &rootprompt; passwd "LoginID"
1146 Changing password for user "LoginID"
1147 New Password: XXXXXXXXX <-- the password from the table
1148 Retype new password: XXXXXXXXX
1149 &rootprompt; smbpasswd -a "LoginID"
1150 New SMB password: XXXXXXXXX <-- the password from the table
1151 Retype new SMB password: XXXXXXXXX
1152 Added user "LoginID"
1156 <step><para><indexterm>
1157 <primary>data storage</primary>
1159 Create the directory structure for the file shares by executing the following:
1161 &rootprompt; mkdir -p /data
1162 &rootprompt; chown alan /data
1163 &rootprompt; for i in james suzy ursula peter dale eric jeannie russell
1168 &rootprompt; chgrp -R accts /data
1169 &rootprompt; chmod -R ug+rwxs,o-r+x /data
1171 The data storage structure is now prepared for use.
1174 <step><para><indexterm>
1175 <primary>lpadmin</primary>
1177 Configure the CUPS Print Queues as follows:
1179 &rootprompt; lpadmin -p hplj -v parallel:/dev/lp0 -E
1181 This creates the necessary print queues with no assigned print filter.
1185 <indexterm><primary>mime types</primary></indexterm><indexterm>
1186 <primary>/etc/cups/mime.convs</primary>
1188 Edit the file <filename>/etc/cups/mime.convs</filename> to uncomment the line:
1190 application/octet-stream application/vnd.cups-raw 0 -
1194 <step><para><indexterm>
1195 <primary>/etc/cups/mime.types</primary>
1196 </indexterm><indexterm>
1197 <primary>application/octet-stream</primary>
1199 Edit the file <filename>/etc/cups/mime.types</filename> to uncomment the line:
1201 application/octet-stream
1206 <indexterm><primary>starting samba</primary></indexterm>
1207 Use the standard system tool to start Samba and CUPS to configure them to restart
1208 automatically at every system reboot. For example:
1212 <indexterm><primary>starting samba</primary></indexterm>
1213 <indexterm><primary>starting
1214 CUPS</primary></indexterm><indexterm>
1215 <primary>chkconfig</primary>
1218 &rootprompt; chkconfig smb on
1219 &rootprompt; chkconfig cups on
1220 &rootprompt; /etc/rc.d/init.d/smb restart
1221 &rootprompt; /etc/rc.d/init.d/cups restart
1226 On Alan's workstation, use Windows explorer to migrate the files from the old server
1227 to the new server. The new server should appear in the <guimenu>Network Neighborhood</guimenu>
1228 with the name of the old server (<constant>CASHPOOL</constant>).
1234 Logon to Alan's workstation as the user <constant>alan</constant>.
1238 Launch a second instance of Windows explorer and navigate to the share called
1239 <guiicon>files</guiicon> on the server called <guimenu>STABLE</guimenu>.
1243 Click in the right panel, and press <guimenu>Ctrl-A</guimenu> to select all files and
1244 directories. Press <guimenu>Ctrl-C</guimenu> to instruct Windows that you wish to
1245 copy all selected items.
1249 Launch the Windows explorer, and navigate to the share called <guiicon>files</guiicon>
1250 on the server called <guimenu>CASHPOOL</guimenu>. Click in the right panel, and then press
1251 <guimenu>Ctrl-V</guimenu> to commence the copying process.
1258 Verify that the files are being copied correctly from the Windows NT4 machine to the Samba-3 server.
1259 This is best done on the Samba-3 server. Check the contents of the directory tree under
1260 <filename>/data</filename>. This can be done by executing the following command:
1262 &rootprompt; ls -aR /data
1264 Make certain to check the ownership and permissions on all files. If in doubt, execute the following:
1266 &rootprompt; chown alan /data
1267 &rootprompt; for i in james suzy ursula peter dale eric jeannie russell
1271 &rootprompt; chgrp -R accts /data
1272 &rootprompt; chmod -R ug+rwxs,o-r+x /data
1277 The migration of all data should now be complete. It is time to validate the installation.
1278 For this, you should make sure all applications, including printing, work before asking the
1279 customer to test drive the new network.
1284 <smbconfexample id="acctconf">
1285 <title>Accounting Office Network &smb.conf; File</title>
1286 <smbconfcomment>Global parameters</smbconfcomment>
1287 <smbconfsection name="[global]"/>
1288 <smbconfoption name="workgroup">BILLMORE</smbconfoption>
1289 <smbconfoption name="printing">CUPS</smbconfoption>
1290 <smbconfoption name="printcap name">CUPS</smbconfoption>
1291 <smbconfoption name="disable spoolss">Yes</smbconfoption>
1292 <smbconfoption name="show add printer wizard">No</smbconfoption>
1294 <smbconfsection name="[files]"/>
1295 <smbconfoption name="comment">Work area files</smbconfoption>
1296 <smbconfoption name="path">/data/%U</smbconfoption>
1297 <smbconfoption name="valid users">%S</smbconfoption>
1298 <smbconfoption name="read only">No</smbconfoption>
1300 <smbconfsection name="[master]"/>
1301 <smbconfoption name="comment">Master work area files</smbconfoption>
1302 <smbconfoption name="path">/data</smbconfoption>
1303 <smbconfoption name="valid users">alan</smbconfoption>
1304 <smbconfoption name="read only">No</smbconfoption>
1306 <smbconfsection name="[printers]"/>
1307 <smbconfoption name="comment">Print Temporary Spool Configuration</smbconfoption>
1308 <smbconfoption name="path">/var/spool/samba</smbconfoption>
1309 <smbconfoption name="printable">Yes</smbconfoption>
1310 <smbconfoption name="guest ok">Yes</smbconfoption>
1311 <smbconfoption name="use client driver">Yes</smbconfoption>
1312 <smbconfoption name="browseable">No</smbconfoption>
1320 <title>Questions and Answers</title>
1323 The following questions and answers draw from the examples in this chapter.
1324 Many design decisions are impacted by the configurations chosen. The intent
1325 is to expose some of the hidden implications.
1328 <qandaset defaultlabel="chap02qa">
1333 What makes an anonymous Samba server more simple than an non-anonymous Samba server?
1340 In the anonymous server, the only account used is the <constant>guest</constant> account.
1341 In a non-anonymous configuration, it is necessary to add real user accounts to both the
1342 UNIX system and to the Samba configuration. Non-anonymous servers require additional
1353 How is the operation of the parameter <parameter>force user</parameter> different from
1354 setting the root directory of the share SUID?
1361 The parameter <parameter>force user</parameter> causes all operations on the share to assume the UID
1362 of the forced user. The new default GID that applies is the primary GID of the forced user.
1363 This gives all users of this resource the actual privilege of the forced user.
1367 When a directory is set SUID, the operating system forces files that are written within it
1368 to be owned by the owner of the directory. While this happens, the user who is using the share
1369 has only the level of privilege he or she is assigned within the operating system context.
1373 The parameter <parameter>force user</parameter> has potential security implications that go
1374 beyond the actual share root directory. Be careful and wary of using this parameter.
1384 When would you use both the per share parameter <parameter>force user</parameter> as well
1385 as setting the share root directory SUID?
1392 You would use both parameters when it is necessary to guarantee that all share handling operations
1393 are conducted as the forced user, while all file and directory creation are done as the SUID
1404 What is better about CUPS printing than LPRng printing?
1411 CUPS is a print spooling system that has integrated remote management facilities, provides completely
1412 automated print processing/preprocessing, and has the potential to be configured to automatically
1413 apply print preprocessing filters to ensure that a print job submitted is correctly rendered for the
1414 target printer. CUPS includes an image file RIP that supports printing of image files to
1415 non-PostScript printers. CUPS has lots of bells and whistles and is more like a super-charged MS Windows
1416 NT/200x print monitor and processor. Its complexity can be eliminated or turbo-charged to suit
1421 The LPRng software is an enhanced, extended, and portable implementation of the Berkeley LPR print
1422 spooler functionality. It provides the same interface and meets RFC1179 requirements. LPRng is capable
1423 of being configured to act like CUPS, but it is in principle a replacement for the old Berkeley lpr/lpd
1424 spooler. LPRng is generally preferred by those who are familiar with Berkeley lpr/lpd.
1428 Which is better is a matter of personal taste. It depends on what you want to do and how you want to
1429 do it and manage it. Most modern Linux systems ship with CUPS as the default print management system.
1439 When should Windows client IP addresses be hard coded?
1446 When there are few MS Windows clients, little client change, no mobile users, and users are not
1447 inclined to tamper with network settings, it is a safe and convenient matter to hard-code Windows
1448 client TCP/IP settings. Given that it is possible to lock down the Windows desktop and remove
1449 user ability to access network configuration controls, fixed configuration eliminates the need
1450 for a DHCP server. This reduces maintenance overheads and eliminates a possible point of network
1461 Under what circumstances would it be best to use a DHCP server?
1468 In network configurations where there are mobile users, or where Windows client PCs move around
1469 (particularly between offices or between subnets), it makes complete sense to control all Windows
1470 client configurations using a DHCP server. Additionally, when users do tamper with the network
1471 settings, the use of DHCP can be used to normalize all client settings.
1475 One of the least appreciated benefits of using a DHCP server to assign all network client
1476 device TCP/IP settings is that it makes it a pain-free process to change network TCP/IP
1477 settings, change network addressing, or enhance the ability of client devices to
1478 benefit from new network services.
1482 Another benefit of modern DHCP servers is the ability of the DHCP server to register dynamically
1483 assigned IP addresses with the DNS server. The benefits of Dynamic DNS (DDNS) are considerable in
1484 a large Windows network environment.
1494 What is the purpose of setting the parameter <parameter>guest ok</parameter> on a share?
1501 If this parameter is yes for a service, then no password is required to connect to the service.
1502 Privileges are those of the guest account.
1512 When would you set the global parameter <parameter>disable spoolss</parameter>?
1519 Setting this parameter to <constant>Yes</constant> disables Samba's support for the SPOOLSS set of
1520 MS-RPC's and yields behavior identical to Samba 2.0.x. Windows NT/2000 clients can downgrade to
1521 using LanMan style printing commands. Windows 9x/ME are unaffected by the parameter. However, this
1522 disables the ability to upload printer drivers to a Samba server via the Windows NT/200x Add Printer
1523 Wizard or by using the NT printer properties dialog window. It also disables the capability of
1524 Windows NT/200x clients to download print drivers from the Samba host on demand. Be extremely careful about
1525 setting this parameter.
1529 The alternate parameter <parameter>use client driver</parameter> applies only to Windows NT/200x clients. It has no
1530 effect on Windows 95/98/ME clients. When serving a printer to Windows NT/200x clients without first installing a valid
1531 printer driver on the Samba host, the client is required to install a local printer driver. From this point on,
1532 the client treats the printer as a local printer and not a network printer connection. This is much the same behavior
1533 that occurs when <parameter>disable spoolss = yes</parameter>.
1537 Under normal circumstances, the NT/200x client attempts to open the network printer using MS-RPC. Because the client
1538 considers the printer to be local, it attempts to issue the OpenPrinterEx() call requesting access rights associated
1539 with the logged on user. If the user possesses local administrator rights but not root privilege on the Samba host (often
1540 the case), the OpenPrinterEx() call fails. The result is that the client now displays an "Access Denied; Unable
1541 to connect" message in the printer queue window (even though jobs may be printed successfully). This parameter MUST
1542 not be enabled on a print share that has valid print driver installed on the Samba server.
1552 Why would you disable password caching on Windows 9x/Me clients?
1559 Windows 9x/Me workstations that are set at default (password caching enabled) store the username and
1560 password in files located in the Windows master directory. Such files can be scavenged (read off a client
1561 machine) and decrypted, thus revealing the user's access credentials for all systems the user may have accessed.
1562 It is most insecure to allow any Windows 9x/Me client to operate with password caching enabled.
1572 The example of Abmas Accounting Inc. uses User Mode security. How does this provide anonymous access?
1579 The example used does not provide anonymous access. Since the clients are all Windows 2000 Professional,
1580 and given that users are logging onto their machines, by default the client attempts to connect to
1581 a remote server using currently logged in user credentials. By ensuring that the user's login ID and
1582 password is the same as those set on the Samba server, access is transparent and does not require
1583 separate user authentication.