Relocate name lookup info to correct section.
[Samba.git] / docs / Samba-HOWTO-Collection / Printing.xml
blob9266712727cc7486e1d50ce5d10f267e79776798
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3                 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4   <!ENTITY % global_entities SYSTEM '../entities/global.entities'>
5   %global_entities;
6 ]>
8 <chapter id="printing">
10 <chapterinfo>
11         <author>
12                 <firstname>Kurt</firstname><surname>Pfeifle</surname>
13                 <affiliation>
14                         <orgname> Danka Deutschland GmbH </orgname>
15                         <address><email>kpfeifle@danka.de</email></address>
16                 </affiliation>
17         </author>
18         &author.jerry;
19         &author.jht;
20         <pubdate>May 31, 2003</pubdate>
21 </chapterinfo>
23 <title>Classical Printing Support</title>
25 <sect1>
26 <title>Features and Benefits</title>
28 <para>
29 Printing is often a mission-critical service for the users. Samba can
30 provide this service reliably and seamlessly for a client network
31 consisting of Windows workstations.
32 </para>
34 <para>
35 A Samba print service may be run on a Stand-alone or Domain Member server,
36 side by side with file serving functions, or on a dedicated print server.
37 It can be made as tight or as loosely secured as needs dictate. Configurations
38 may be simple or complex. Available authentication schemes are essentially
39 the same as described for file services in previous chapters. Overall,
40 Samba's printing support is now able to replace an NT or Windows 2000
41 print server full-square, with additional benefits in many cases. Clients
42 may download and install drivers and printers through their familiar
43 <quote>Point'n'Print</quote> mechanism. Printer installations executed by
44 <quote>Logon Scripts</quote> are no problem. Administrators can upload and
45 manage drivers to be used by clients through the familiar <quote>Add Printer
46 Wizard</quote>. As an additional benefit, driver and printer management may
47 be run from the command line or through scripts, making it more efficient
48 in case of large numbers of printers. If a central accounting of print jobs
49 (tracking every single page and supplying the raw data for all sorts of
50 statistical reports) is required, this function is best supported by
51 the newer Common UNIX Printing System (CUPS)
52 as the print subsystem underneath the Samba hood.
53 </para>
55 <para>
56 This chapter deals with the foundations of Samba printing as they
57 are implemented by the more traditional UNIX (BSD- and System V-style)
58 printing systems. Many things covered in this chapter apply also to CUPS.
59 If you use CUPS, you may be tempted
60 to jump to the next chapter but you will certainly miss a few things if
61 you do. It is recommended that you read this chapter as well as <link
62 linkend="CUPS-printing">CUPS Printing Support</link>.
63 </para>
65 <note>
66 <para>
67 Most of the following examples have been verified on Windows XP
68 Professional clients. Where this document describes the responses to
69 commands given, bear in mind that Windows 200x/XP clients are quite
70 similar, but may differ in minor details. Windows NT is somewhat different
71 again.
72 </para>
73 </note>
75 </sect1>
77 <sect1>
78 <title>Technical Introduction</title>
80 <para>
81 Samba's printing support always relies on the installed print subsystem
82 of the UNIX OS it runs on. Samba is a <quote>middleman.</quote> It takes
83 print files from Windows (or other SMB) clients and passes them to the real
84 printing system for further processing, therefore, it needs to communicate with
85 both sides: the Windows print clients and the UNIX printing system. Hence, we
86 must differentiate between the various client OS types, each of which behave
87 differently, as well as the various UNIX print subsystems, which themselves
88 have different features and are accessed differently.
89 </para>
91 <para>
92 This deals with the traditional way of UNIX printing. The next chapter
93 covers in great detail the more modern <emphasis>Common UNIX Printing
94 System</emphasis> (CUPS).
95 </para>
97 <important><para>CUPS users, be warned: do not just jump on to the next
98 chapter. You might miss important information only found here!
99 </para></important>
101 <para>
102 It is apparent from postings on the Samba mailing list that print configuration
103 is one of the most problematic aspects of Samba administration today. Many
104 new Samba administrators have the impression that Samba performs some sort
105 of print processing. Rest assured, Samba does not perform any type of print
106 processing. It does not do any form of print filtering.
107 </para>
109 <para>
110 Samba obtains from its clients a data stream (print job) that it spools to a
111 local spool area. When the entire print job has been received, Samba invokes
112 a local UNIX/Linux print command and passes the spooled file to it. It is
113 up to the local system printing subsystems to correctly process the print
114 job and to submit it to the printer.
115 </para>
117 <sect2>
118 <title>Client to Samba Print Job Processing</title>
120 <para>
121 Successful printing from a Windows client via a Samba print server to a UNIX
122 printer involves six (potentially seven) stages:
123 </para>
125 <orderedlist>
126 <listitem><para>Windows opens a connection to the printer share.</para></listitem>
128 <listitem><para>Samba must authenticate the user.</para></listitem>
130 <listitem><para>Windows sends a copy of the print file over the network
131 into Samba's spooling area.</para></listitem>
133 <listitem><para>Windows closes the connection.</para></listitem>
135 <listitem><para>Samba invokes the print command to hand the file over
136 to the UNIX print subsystem's spooling area.</para></listitem>
138 <listitem><para>The UNIX print subsystem processes the print job.</para></listitem>
140 <listitem><para>The print file may need to be explicitly deleted
141 from the Samba spooling area. This item depends on your print spooler
142 configuration settings.</para></listitem>
144 </orderedlist>
145 </sect2>
147 <sect2>
148 <title>Printing Related Configuration Parameters</title>
150 <para>
151 There are a number of configuration parameters to control Samba's
152 printing behavior. Please refer to the man page for &smb.conf; for an
153 overview of these. As with other parameters, there are Global Level
154 (tagged with a <emphasis>G</emphasis> in the listings) and Service Level
155 (<emphasis>S</emphasis>) parameters.
156 </para>
158 <variablelist>
159         <varlistentry><term>Global Parameters</term>
160                 <listitem><para> These <emphasis>may not</emphasis> go into
161                 individual share definitions. If they go in by error,
162                 the <command>testparm</command> utility can discover this
163                 (if you run it) and tell you so.
164                 </para></listitem>
165         </varlistentry>
167         <varlistentry><term>Service Level Parameters</term>
168                 <listitem><para> These may be specified in the
169                 <smbconfsection>[global]</smbconfsection> section of &smb.conf;.
170                 In this case they define the default behavior of all individual
171                 or service level shares (provided they do not have a different
172                 setting defined for the same parameter, thus overriding the
173                 global default).
174                 </para></listitem>
175         </varlistentry>
176 </variablelist>
177 </sect2>
179 </sect1>
181 <sect1>
182 <title>Simple Print Configuration</title>
184 <para>
185 <link linkend="simpleprc">Following example</link> shows a simple printing configuration.
186 If you compare this with your own, you may find 
187 additional parameters that have been pre-configured by your OS
188 vendor. Below is a discussion and explanation of the
189 parameters. This example does not use many parameters.
190 However, in many environments these are enough to provide a valid
191 &smb.conf; file that enables all clients to print.
192 </para>
194 <para>
195 <smbconfexample id="simpleprc">
196 <title>Simple configuration with BSD printing</title>
197 <smbconfsection>[global]</smbconfsection>
198 <smbconfoption><name>printing</name><value>bsd</value></smbconfoption>
199 <smbconfoption><name>load printers</name><value>yes</value></smbconfoption>
201 <smbconfsection>[printers]</smbconfsection>
202 <smbconfoption><name>path</name><value>/var/spool/samba</value></smbconfoption>
203 <smbconfoption><name>printable</name><value>yes</value></smbconfoption>
204 <smbconfoption><name>public</name><value>yes</value></smbconfoption>
205 <smbconfoption><name>writable</name><value>no</value></smbconfoption>
206 </smbconfexample></para>
208 <para>
209 This is only an example configuration. Samba assigns default values to
210 all configuration parameters. The defaults are conservative
211 and sensible. When a parameter is specified in the &smb.conf; file, this
212 overwrites the default value. The <command>testparm</command> utility when
213 run as root is capable of reporting all setting, both default as well as
214 &smb.conf; file settings. <command>Testparm</command> gives warnings for all
215 mis-configured settings. The complete output is easily 340 lines and more,
216 so you may want to pipe it through a pager program.
217 </para>
219 <para>
220 The syntax for the configuration file is easy to grasp. You should
221 know that  is not very picky about its syntax. As has been explained
222 elsewhere in this document, Samba tolerates some spelling errors (such
223 as <smbconfoption><name>browseable</name></smbconfoption> instead of
224 <smbconfoption><name>browseable</name></smbconfoption>), and spelling is
225 case-insensitive. It is permissible to use <parameter>Yes/No</parameter>
226 or <parameter>True/False</parameter> for Boolean settings. Lists of names
227 may be separated by commas, spaces or tabs.
228 </para>
230 <sect2>
231 <title>Verifying Configuration with <command>testparm</command></title>
233 <para>
234 To see all (or at least most) printing-related settings in Samba, including
235 the implicitly used ones, try the command outlined below. This command greps
236 for all occurrences of <constant>lp, print, spool, driver, ports</constant>
237 and <constant>[</constant> in testparms output. This provides a convenient
238 overview of the running <command>smbd</command> print configuration. This
239 command does not show individually created printer shares or the spooling
240 paths they may use. Here is the output of my Samba setup, with settings
241 shown in <link linkend="simpleprc">the example above</link>:
242 </para>
244 <para><screen>
245 &rootprompt;<userinput>testparm -s -v | egrep "(lp|print|spool|driver|ports|\[)"</userinput>
246  Load smb config files from /etc/samba/smb.conf
247  Processing section "[homes]"
248  Processing section "[printers]"
250  [global]
251         smb ports = 445 139
252         lpq cache time = 10
253         load printers = Yes
254         printcap name = /etc/printcap
255         disable spoolss = No
256         enumports command =
257         addprinter command = 
258         deleteprinter command = 
259         show add printer wizard = Yes
260         os2 driver map =
261         printer admin =
262         min print space = 0
263         max print jobs = 1000
264         printable = No
265         printing = bsd
266         print command = lpr -r -P'%p' %s
267         lpq command = lpq -P'%p'
268         lprm command = lprm -P'%p' %j
269         lppause command =
270         lpresume command =
271         printer name =
272         use client driver = No
274  [homes]
276  [printers]
277         path = /var/spool/samba
278         printable = Yes
279 </screen>
280 </para>
282 <para>
283 You can easily verify which settings were implicitly added by Samba's
284 default behavior. <emphasis>Remember: it may
285 be important in your future dealings with Samba.</emphasis>
286 </para>
288 <note><para> testparm in Samba-3 behaves differently from that in 2.2.x: used
289 without the <quote>-v</quote> switch it only shows you the settings actually
290 written into! To see the complete
291 configuration used, add the <quote>-v</quote> parameter to testparm.</para></note>
293 </sect2>
295 <sect2>
296 <title>Rapid Configuration Validation</title>
298 <para>
299 Should you need to troubleshoot at any stage, please always come back
300 to this point first and verify if <command>testparm</command> shows the parameters you
301 expect. To give you a warning from personal experience,
302 try to just comment out the <smbconfoption><name>load printers</name></smbconfoption>
303 parameter. If your 2.2.x system behaves like mine, you'll see this:
304 </para>
306 <para><screen>
307 &rootprompt;grep "load printers" /etc/samba/smb.conf
308         #  load printers = Yes
309         # This setting is commented out!!
311 &rootprompt;testparm -v /etc/samba/smb.conf | egrep "(load printers)"
312         load printers = Yes
313 </screen></para>
315 <para>
316 I assumed that commenting out of this setting should prevent Samba from
317 publishing my printers, but it still did. It took some time to figure out
318 the reason. But I am no longer fooled ... at least not by this.
319 </para>
321 <para><screen>
322 &rootprompt;<userinput>grep -A1 "load printers" /etc/samba/smb.conf</userinput>
323         load printers = No
324         # The above setting is what I want!
325         #  load printers = Yes
326         # This setting is commented out!
328 &rootprompt;<userinput>testparm -s -v smb.conf.simpleprinting | egrep "(load printers)"</userinput>
329         load printers = No
331 </screen></para>
333 <para>
334 Only when the parameter is explicitly set to
335 <smbconfoption><name>load printers</name><value>No</value></smbconfoption>
336 would Samba conform with my intentions. So, my strong advice is:
337 </para>
339 <itemizedlist>
340 <listitem><para>Never rely on commented out parameters.</para></listitem>
342 <listitem><para>Always set parameters explicitly as you intend them to
343 behave.</para></listitem>
345 <listitem><para>Use <command>testparm</command> to uncover hidden
346 settings that might not reflect your intentions.</para></listitem>
348 </itemizedlist>
350 <para>
351 The following is the most minimal configuration file:
352 <screen>
353 &rootprompt;<userinput>cat /etc/samba/smb.conf-minimal</userinput>
354         [printers]
355 </screen></para>
357 <para>
358 This example should show that you can use testparm to test any Samba
359 configuration file. Actually, we encourage you <emphasis>not</emphasis>
360 to change your working system (unless you know exactly what you are
361 doing). Don't rely on the assumption that changes will only take effect after
362 you re-start smbd!  This is not the case. Samba re-reads it every 60 seconds
363 and on each new client connection. You might have to face changes for your
364 production clients that you didn't intend to apply. You will now
365 note a few more interesting things; <command>testparm</command> is useful to
366 identify what the Samba print configuration would be if you used this minimalistic
367 configuration. Here is what you can expect to find:
368 </para>
370 <para><screen>
371 &rootprompt;<userinput>testparm -v smb.conf-minimal | egrep "(print|lpq|spool|driver|ports|[)"</userinput>
372  Processing section "[printers]"
373  WARNING: [printers] service MUST be printable!
374  No path in service printers - using /tmp
376         lpq cache time = 10
377         load printers = Yes
378         printcap name = /etc/printcap
379         disable spoolss = No
380         enumports command =
381         addprinter command =
382         deleteprinter command =
383         show add printer wizard = Yes
384         os2 driver map =
385         printer admin =
386         min print space = 0
387         max print jobs = 1000
388         printable = No
389         printing = bsd
390         print command = lpr -r -P%p %s
391         lpq command = lpq -P%p
392         printer name =
393         use client driver = No
395  [printers]
396         printable = Yes
398 </screen></para>
400 <para>
401 testparm issued two warnings:
402 </para>
404 <itemizedlist>
405         <listitem><para>We did not specify the <smbconfsection>[printers]</smbconfsection> section as printable.</para></listitem>
406         <listitem><para>We did not tell Samba which spool directory to use.</para></listitem>
407 </itemizedlist>
409 <para>
410 However, this was not fatal and Samba will default to values that will
411 work. Please, do not rely on this and do not use this example. This was
412 included to encourage you to be careful to design and specify your setup to do
413 precisely what you require. The outcome on your system may vary for some
414 parameters given, since Samba may have been built with  different compile-time
415 options. <emphasis>Warning:</emphasis> do not put a comment sign
416 <emphasis>at the end</emphasis> of a valid line. It will cause the parameter
417 to be ignored (just as if you had put the comment sign at the front). At first
418 I regarded this as a bug in my Samba versions. But the man page clearly says:
419 <quote>Internal whitespace in a parameter value is retained verbatim.</quote>
420 This means that a line consisting of, for example:
421 </para>
423 <para><smbconfblock>
424 <smbconfcomment>This defines LPRng as the printing system</smbconfcomment>
425 <smbconfoption><name>printing</name><value> lprng</value></smbconfoption>
426 </smbconfblock></para>
428 <para>
429 will regard the whole of the string after the
430 <quote><constant>=</constant></quote> sign as the value you want to
431 define. This is an invalid value that will be ignored and a default
432 value will be
433 used in its place.
434 </para>
435 </sect2>
436 </sect1>
438 <sect1>
439 <title>Extended Printing Configuration</title>
441 <para>
442 <link linkend="extbsdpr">Next configuration</link> shows a more verbose example configuration
443 for print-related settings in a BSD-style printing environment. What follows
444 is a discussion and explanation of the various parameters. We chose to
445 use BSD-style printing here because it is still the most commonly used
446 system on legacy UNIX/Linux installations. New installations predominantly
447 use CUPS, which is discussed in a separate chapter. The example explicitly
448 names many parameters that do not need to be specified because they are set
449 by default. You could use a much leaner &smb.conf; file. Alternately, you can use
450 <command>testparm</command> or <command>SWAT</command> to optimize the &smb.conf;
451 file to remove all parameters that are set at default.
452 </para>
454 <para><smbconfexample id="extbsdpr">
455         <title>Extended BSD Printing Configuration</title>
456 <smbconfsection>[global]</smbconfsection>
457 <smbconfoption><name>printing</name><value>bsd</value></smbconfoption>
458 <smbconfoption><name>load printers</name><value>yes</value></smbconfoption>
459 <smbconfoption><name>show add printer wizard</name><value>yes</value></smbconfoption>
460 <smbconfoption><name>printcap name</name><value>/etc/printcap</value></smbconfoption>
461 <smbconfoption><name>printer admin</name><value>@ntadmin, root</value></smbconfoption>
462 <smbconfoption><name>max print jobs</name><value>100</value></smbconfoption>
463 <smbconfoption><name>lpq cache time</name><value>20</value></smbconfoption>
464 <smbconfoption><name>use client driver</name><value>no</value></smbconfoption>
466 <smbconfsection>[printers]</smbconfsection>
467 <smbconfoption><name>comment</name><value>All Printers</value></smbconfoption>
468 <smbconfoption><name>printable</name><value>yes</value></smbconfoption>
469 <smbconfoption><name>path</name><value>/var/spool/samba</value></smbconfoption>
470 <smbconfoption><name>browseable</name><value>no</value></smbconfoption>
471 <smbconfoption><name>guest ok</name><value>yes</value></smbconfoption>
472 <smbconfoption><name>public</name><value>yes</value></smbconfoption>
473 <smbconfoption><name>read only</name><value>yes</value></smbconfoption>
474 <smbconfoption><name>writable</name><value>no       </value></smbconfoption>
476 <smbconfsection>[my_printer_name]</smbconfsection>
477 <smbconfoption><name>comment</name><value>Printer with Restricted Access</value></smbconfoption>
478 <smbconfoption><name>path</name><value>/var/spool/samba_my_printer</value></smbconfoption>
479 <smbconfoption><name>printer admin</name><value>kurt</value></smbconfoption>
480 <smbconfoption><name>browseable</name><value>yes</value></smbconfoption>
481 <smbconfoption><name>printable</name><value>yes</value></smbconfoption>
482 <smbconfoption><name>writable</name><value>no</value></smbconfoption>
483 <smbconfoption><name>hosts allow</name><value>0.0.0.0</value></smbconfoption>
484 <smbconfoption><name>hosts deny</name><value>turbo_xp, 10.160.50.23, 10.160.51.60</value></smbconfoption>
485 <smbconfoption><name>guest ok</name><value>no</value></smbconfoption>
486 </smbconfexample></para>
488 <para>
489 This is an example configuration. You may not find all the settings that are in 
490 the configuration file that was provided by the OS vendor. Samba configuration
491 parameters, if not explicitly set default to a sensible value.
492 To see all settings, as <constant>root</constant> use the <command>testparm</command>
493 utility. <command>testparm</command> gives warnings for mis-configured settings.
494 </para>
496 <sect2>
497 <title>Detailed Explanation Settings</title>
499 <para>
500 The following is a discussion of the settings from above shown example.
501 </para>
503 <sect3>
504 <title>The [global] Section</title>
506 <para>
507 The <smbconfsection>[global]</smbconfsection> section is one of four special
508 sections (along with [<smbconfsection>[homes]</smbconfsection>,
509 <smbconfsection>[printers]</smbconfsection>
510 and <smbconfsection>[print$]</smbconfsection>...). The
511 <smbconfsection>[global]</smbconfsection> contains all parameters which apply
512 to the server as a whole. It is the place for parameters that have only a
513 global meaning. It may also contain service level parameters that then define
514 default settings for all other sections and shares. This way you can simplify
515 the configuration and avoid setting the same value repeatedly. (Within each
516 individual section or share you may, however, override these globally set
517 share settings and specify other values).
518 </para>
520 <variablelist>
521         <varlistentry><term><smbconfoption><name>printing</name><value>bsd </value></smbconfoption></term>
522                 <listitem><para>Causes Samba to use default print commands
523                 applicable for the BSD (also known as RFC 1179 style or LPR/LPD) printing
524                 system. In general, the <parameter>printing</parameter> parameter informs Samba about the
525                 print subsystem it should expect. Samba supports CUPS, LPD, LPRNG,
526                 SYSV, HPUX, AIX, QNX, and PLP. Each of these systems defaults to a
527                 different <smbconfoption><name>print command</name></smbconfoption> (and other queue control
528                 commands).</para>
530                 <caution><para>The <smbconfoption><name>printing</name></smbconfoption> parameter is
531                 normally a service level parameter. Since it is included here in the
532                 <smbconfsection>[global]</smbconfsection> section, it will take effect for all
533                 printer shares that are not defined differently. Samba-3 no longer
534                 supports the SOFTQ printing system.</para></caution>
535         </listitem></varlistentry>
537         <varlistentry><term><smbconfoption><name>load printers</name><value>yes </value></smbconfoption></term>
538                 <listitem><para>Tells Samba to create automatically all
539                 available printer shares. Available printer shares are discovered by
540                 scanning the printcap file. All created printer shares are also loaded
541                 for browsing. If you use this parameter, you do not need to specify
542                 separate shares for each printer. Each automatically created printer
543                 share will clone the configuration options found in the
544                 <smbconfsection>[printers]</smbconfsection> section. (The <parameter>load printers
545                 = no</parameter> setting will allow you to specify each UNIX printer
546                 you want to share separately, leaving out some you do not want to be
547                 publicly visible and available).</para>
548         </listitem></varlistentry>
550         <varlistentry><term><smbconfoption><name>show add printer wizard</name><value>yes </value></smbconfoption></term>
551                 <listitem><para>Setting is normally enabled by default (even if the parameter is not specified in &smb.conf;).
552                 It causes the <guiicon>Add Printer Wizard</guiicon> icon to appear
553                 in the <guiicon>Printers</guiicon> folder of the Samba host's
554                 share listing (as shown in <guiicon>Network Neighborhood</guiicon> or
555                 by the <command>net view</command> command). To disable it, you need to
556                 explicitly set it to <constant>no</constant> (commenting it out
557                 will not suffice). The <parameter>Add Printer Wizard</parameter> lets you upload printer
558                 drivers to the <smbconfsection>[print$]</smbconfsection> share and associate it
559                 with a printer (if the respective queue exists before the
560                 action), or exchange a printer's driver against any other previously
561                 uploaded driver.</para>
562         </listitem></varlistentry>
564         <varlistentry><term><smbconfoption><name>max print jobs</name><value>100 </value></smbconfoption></term>
565                 <listitem><para>Sets the upper limit to 100 print jobs
566                 being active on the Samba server at any one time. Should a client
567                 submit a job that exceeds this number, a <quote>no more space
568                 available on server</quote> type of error message will be returned by
569                 Samba to the client. A setting of zero (the default) means there is
570                 <emphasis>no</emphasis> limit at all.
571         </para></listitem></varlistentry>
573         <varlistentry><term><smbconfoption><name>printcap name</name><value>/etc/printcap </value></smbconfoption></term>
574                 <listitem><para>Tells Samba where to look for a list of
575                 available printer names. Where CUPS is used, make sure that a printcap
576                 file is written. This is controlled by the <constant>Printcap</constant> directive in the 
577                 <filename>cupsd.conf</filename> file.
578         </para></listitem></varlistentry>
580         <varlistentry><term><smbconfoption><name>printer admin</name><value>@ntadmin </value></smbconfoption></term>
581                 <listitem><para>Members of the ntadmin group should be able to add
582                 drivers and set printer properties (<constant>ntadmin</constant> is only an example name,
583                 it needs to be a valid UNIX group name); root is implicitly always a
584                 <smbconfoption><name>printer admin</name></smbconfoption>. The @ sign precedes group names in the
585                 <filename>/etc/group</filename>. A printer admin can do anything to
586                 printers via the remote administration interfaces offered by MS-RPC
587                 (see below). In larger installations, the <smbconfoption><name>printer admin</name></smbconfoption>
588                 parameter is normally a per-share parameter. This permits different groups to administer each printer share.
589         </para></listitem></varlistentry>
591         <varlistentry><term><smbconfoption><name>lpq cache time</name><value>20 </value></smbconfoption></term>
592                 <listitem><para>Controls the cache time for the results of the
593                 lpq command. It prevents the lpq command being called too often and
594                 reduces the load on a heavily used print server.
595         </para></listitem></varlistentry>
597         <varlistentry><term><smbconfoption><name>use client driver</name><value>no </value></smbconfoption></term>
598                 <listitem><para>If set to <constant>yes</constant>, only 
599                 takes effect for Windows NT/200x/XP clients (and not for Win 95/98/ME). Its
600                 default value is <constant>No</constant> (or <constant>False</constant>).
601                 It must <emphasis>not</emphasis> be enabled on print shares 
602                 (with a <constant>yes</constant> or <constant>true</constant> setting) that
603                 have valid drivers installed on the Samba server. For more detailed
604                 explanations see the &smb.conf; man page.
605         </para></listitem></varlistentry>
606 </variablelist>
608 </sect3>
610 <sect3 id="ptrsect">
611 <title>The [printers] Section</title>
613 <para>
614 This is the second special section. If a section with this name appears in
615 the &smb.conf;, users are able to connect to any printer specified in the
616 Samba host's printcap file, because Samba on startup then creates a printer
617 share for every printer name it finds in the printcap file. You could regard
618 this section as a general convenience shortcut to share all printers with
619 minimal configuration. It is also a container for settings that should
620 apply as default to all printers. (For more details see the &smb.conf;
621 man page.) Settings inside this container must be Share Level parameters.
622 </para>
624 <variablelist>
625         <varlistentry><term><smbconfoption><name>comment</name><value>All printers </value></smbconfoption></term>
626                 <listitem><para>
627                 The <smbconfoption><name>comment</name></smbconfoption> is shown next to the share if
628                 a client queries the server, either via <guiicon>Network Neighborhood</guiicon> or with
629                 the <command>net view</command> command to list available shares.
630                 </para></listitem>
631         </varlistentry>
633         <varlistentry><term><smbconfoption><name>printable</name><value>yes </value></smbconfoption></term>
634                 <listitem><para>
635                 The <smbconfsection>[printers]</smbconfsection> service <emphasis>must</emphasis>
636                 be declared as printable. If you specify otherwise, smbd will refuse to load  at
637                 startup. This parameter allows connected clients to open, write to and submit spool files
638                 into the directory specified with the <smbconfoption><name>path</name></smbconfoption>
639                 parameter for this service. It is used by Samba to differentiate printer shares from
640                 file shares. 
641                 </para></listitem>
642         </varlistentry>
644         <varlistentry><term><smbconfoption><name>path</name><value>/var/spool/samba </value></smbconfoption></term>
645                 <listitem><para>
646                 Must point to a directory used by Samba to spool incoming print files. <emphasis>It
647                 must not be the same as the spool directory specified in the configuration of your UNIX
648                 print subsystem!</emphasis> The path typically points to a directory that is world
649                 writable, with the <quote>sticky</quote> bit set to it.
650                 </para></listitem>
651         </varlistentry>
653         <varlistentry><term><smbconfoption><name>browseable</name><value>no </value></smbconfoption></term>
654                 <listitem><para>
655                 Is always set to <constant>no</constant> if
656                 <smbconfoption><name>printable</name><value>yes</value></smbconfoption>. It makes
657                 the <smbconfsection>[printer]</smbconfsection> share itself invisible in the list of
658                 available shares in a <command>net view</command> command or in the Explorer browse
659                 list. (You will of course see the individual printers).
660                 </para></listitem>
661         </varlistentry>
663         <varlistentry><term><smbconfoption><name>guest ok</name><value>yes </value></smbconfoption></term>
664                 <listitem><para>
665                 If this parameter is set to <constant>yes</constant>, no password is required to
666                 connect to the printer's service. Access will be granted with the privileges of the
667                 <smbconfoption><name>guest account</name></smbconfoption>. On many systems the guest
668                 account will map to a user named <quote>nobody</quote>. This user will usually be found
669                 in the UNIX passwd file with an empty password, but with no valid UNIX login. (On some
670                 systems the guest account might not have the privilege to be able to print. Test this
671                 by logging in as your guest user using <command>su - guest</command> and run a system
672                 print command like:
673                 </para>
674         
675                 <para>
676                 <userinput>lpr -P printername /etc/motd</userinput>
677                 </para></listitem>
678         </varlistentry>
680         <varlistentry><term><smbconfoption><name>public</name><value>yes </value></smbconfoption></term>
681                 <listitem><para>
682                 Is a synonym for <smbconfoption><name>guest ok</name><value>yes</value></smbconfoption>.
683                 Since we have <smbconfoption><name>guest ok</name><value>yes</value></smbconfoption>, it
684                 really does not need to be here. (This leads to the interesting question: <quote>What if I
685                 by accident have two contradictory settings for the same share?</quote> The answer is the
686                 last one encountered by Samba wins. Testparm does not complain about different settings
687                 of the same parameter for the same share. You can test this by setting up multiple
688                 lines for the <parameter>guest account</parameter> parameter with different usernames,
689                 and then run testparm to see which one is actually used by Samba.)
690                 </para></listitem>
691         </varlistentry>
693         <varlistentry><term><smbconfoption><name>read only</name><value>yes </value></smbconfoption></term>
694                 <listitem><para>
695                 Normally (for other types of shares) prevents users from creating or modifying files
696                 in the service's directory. However, in a <quote>printable</quote> service, it is
697                 <emphasis>always</emphasis> allowed to write to the directory (if user privileges allow the
698                 connection), but only via print spooling operations. Normal write operations are not permitted.
699                 </para></listitem>
700         </varlistentry>
702         <varlistentry><term><smbconfoption><name>writable</name><value>no </value></smbconfoption></term>
703                 <listitem><para>
704                 Is a synonym for <smbconfoption><name>read only</name><value>yes</value></smbconfoption>.
705                 </para></listitem>
706         </varlistentry>
707 </variablelist>
708 </sect3>
710 <sect3>
711 <title>Any [my_printer_name] Section</title>
713 <para>
714 If a section appears in the &smb.conf; file, which when given the parameter
715 <smbconfoption><name>printable</name><value>yes</value></smbconfoption> causes Samba to configure it
716 as a printer share. Windows 9x/Me clients may have problems with connecting or loading printer drivers
717 if the share name has more than eight characters. Do not name a printer share with a name that may conflict
718 with an existing user or file share name. On Client connection requests, Samba always tries to find file
719 shares with that name first. If it finds one, it will connect to this and will not connect
720 to a printer with the same name!
721 </para>
723 <variablelist>
724         <varlistentry><term><smbconfoption><name>comment</name><value>Printer with Restricted Access </value></smbconfoption></term>
725                 <listitem><para>
726                 The comment says it all.
727                 </para></listitem>
728         </varlistentry>
730         <varlistentry><term><smbconfoption><name>path</name><value>/var/spool/samba_my_printer </value></smbconfoption></term>
731                 <listitem><para>
732                 Sets the spooling area for this printer to a directory other than the default. It is not
733                 necessary to set it differently, but the option is available.
734                 </para></listitem>
735         </varlistentry>
737         <varlistentry><term><smbconfoption><name>printer admin</name><value>kurt </value></smbconfoption></term>
738                 <listitem><para>
739                 The printer admin definition is different for this explicitly defined printer share from the general
740                 <smbconfsection>[printers]</smbconfsection> share. It is not a requirement; we
741                 did it to show that it is possible.
742                 </para></listitem>
743         </varlistentry>
745         <varlistentry><term><smbconfoption><name>browseable</name><value>yes </value></smbconfoption></term>
746                 <listitem><para>
747                 This makes the printer browseable so the clients may conveniently find it when browsing the
748                 <guiicon>Network Neighborhood</guiicon>.
749                 </para></listitem>
750         </varlistentry>
752         <varlistentry><term><smbconfoption><name>printable</name><value>yes </value></smbconfoption></term>
753                 <listitem><para>
754                 See <link linkend="ptrsect">The [printers] Section</link>.
755                 </para></listitem>
756         </varlistentry>
758         <varlistentry><term><smbconfoption><name>writable</name><value>no </value></smbconfoption></term>
759                 <listitem><para>
760                 See <link linkend="ptrsect">The [printers] Section</link>.
761                 </para></listitem>
762         </varlistentry>
764         <varlistentry><term><smbconfoption><name>hosts allow</name><value>10.160.50.,10.160.51. </value></smbconfoption></term>
765                 <listitem><para>
766                 Here we exercise a certain degree of access control by using the <smbconfoption><name>hosts allow</name></smbconfoption> and <smbconfoption><name>hosts deny</name></smbconfoption>
767                 parameters. This is not by any means a safe bet. It is not a way to secure your
768                 printers. This line accepts all clients from a certain subnet in a first evaluation of
769                 access control.
770                 </para></listitem>
771         </varlistentry>
773         <varlistentry><term><smbconfoption><name>hosts deny</name><value>turbo_xp,10.160.50.23,10.160.51.60 </value></smbconfoption></term>
774                 <listitem><para>
775                 All listed hosts are not allowed here (even if they belong to the allowed subnets). As
776                 you can see, you could name IP addresses as well as NetBIOS hostnames here.
777                 </para></listitem>
778         </varlistentry>
780         <varlistentry><term><smbconfoption><name>guest ok</name><value>no </value></smbconfoption></term>
781                 <listitem><para>
782                 This printer is not open for the guest account.
783                 </para></listitem>
784         </varlistentry>
785 </variablelist>
786 </sect3>
788 <sect3>
789 <title>Print Commands</title>
791 <para>
792 In each section defining a printer (or in the <smbconfsection>[printers]</smbconfsection> section),
793 a <parameter>print command</parameter> parameter may be defined. It sets a command to process the files
794 that have been placed into the Samba print spool directory for that printer. (That spool directory was,
795 if you remember, set up with the <smbconfoption><name>path</name></smbconfoption> parameter). Typically,
796 this command will submit the spool file to the Samba host's print subsystem, using the suitable system
797 print command. But there is no requirement that this needs to be the case. For debugging or
798 some other reason, you may want to do something completely different than print the file. An example is a
799 command that just copies the print file to a temporary location for further investigation when you need
800 to debug printing. If you craft your own print commands (or even develop print command shell scripts),
801 make sure you pay attention to the need to remove the files from the Samba spool directory. Otherwise,
802 your hard disk may soon suffer from shortage of free space.
803 </para>
804 </sect3>
806 <sect3>
807 <title>Default UNIX System Printing Commands</title>
809 <para>
810 You learned earlier on that Samba, in most cases, uses its built-in settings for many parameters
811 if it cannot find an explicitly stated one in its configuration file. The same is true for the
812 <smbconfoption><name>print command</name></smbconfoption>. The default print command varies depending
813 on the <smbconfoption><name>printing</name></smbconfoption> parameter setting. In the commands listed
814 below, you will notice some parameters of the form <emphasis>%X</emphasis> where <emphasis>X</emphasis> is
815 <emphasis>p, s, J</emphasis>, and so on. These letters stand for printer name, spool-file and job ID, respectively.
816 They are explained in more detail further below. <link linkend="printOptions">Next table</link> presents an overview of key
817 printing options but excludes the special case of CUPS that is discussed in <link linkend="CUPS-printing">CUPS Printing Support</link>.
818 </para>
820 <table frame='all' id="printOptions">
821         <title>Default Printing Settings</title>
822         <tgroup cols='2' align='left' colsep='1' rowsep='1'>
823                 <colspec align="left"/>
824                 <colspec align="left"/>
825         <thead>
826                 <row>
827                 <entry>Setting</entry>
828                 <entry>Default Printing Commands</entry>
829                 </row>
830         </thead>
831         <tbody>
832                 <row>
833                 <entry><smbconfoption><name>printing</name><value>bsd|aix|lprng|plp</value></smbconfoption></entry>
834                 <entry>print command is <command>lpr -r -P%p %s</command></entry>
835                 </row>
836                 <row>
837                 <entry><smbconfoption><name>printing</name><value>sysv|hpux</value></smbconfoption></entry>
838                 <entry>print command is <command>lp -c -P%p %s; rm %s</command></entry>
839                 </row>
840                 <row>
841                 <entry> <smbconfoption><name>printing</name><value>qnx</value></smbconfoption></entry>
842                 <entry>print command is <command>lp -r -P%p -s %s</command></entry>
843                 </row>
844                 <row>
845                 <entry><smbconfoption><name>printing</name><value>bsd|aix|lprng|plp</value></smbconfoption></entry>
846                 <entry>lpq command is <command>lpq -P%p</command></entry>
847                 </row>
848                 <row>
849                 <entry><smbconfoption><name>printing</name><value>sysv|hpux</value></smbconfoption></entry>
850                 <entry>lpq command is <command>lpstat -o%p</command></entry>
851                 </row>
852                 <row>
853                 <entry><smbconfoption><name>printing</name><value>qnx</value></smbconfoption></entry>
854                 <entry>lpq command is <command>lpq -P%p</command></entry>
855                 </row>
856                 <row>
857                 <entry><smbconfoption><name>printing</name><value>bsd|aix|lprng|plp</value></smbconfoption></entry>
858                 <entry>lprm command is <command>lprm -P%p %j</command></entry>
859                 </row>
860                 <row>
861                 <entry><smbconfoption><name>printing</name><value>sysv|hpux</value></smbconfoption></entry>
862                 <entry>lprm command is <command>cancel %p-%j</command></entry>
863                 </row>
864                 <row>
865                 <entry><smbconfoption><name>printing</name><value>qnx</value></smbconfoption></entry>
866                 <entry>lprm command is <command>cancel %p-%j</command></entry>
867                 </row>
868                 <row>
869                 <entry><smbconfoption><name>printing</name><value>bsd|aix|lprng|plp</value></smbconfoption></entry>
870                 <entry>lppause command is <command>lp -i %p-%j -H hold</command></entry>
871                 </row>
872                 <row>
873                 <entry><smbconfoption><name>printing</name><value>sysv|hpux</value></smbconfoption></entry>
874                 <entry>lppause command   (...is empty)</entry>
875                 </row>
876                 <row>
877                 <entry><smbconfoption><name>printing</name><value>qnx</value></smbconfoption></entry>
878                 <entry>lppause command   (...is empty)</entry>
879                 </row>
880                 <row>
881                 <entry><smbconfoption><name>printing</name><value>bsd|aix|lprng|plp</value></smbconfoption></entry>
882                 <entry>lpresume command is <command>lp -i %p-%j -H resume</command></entry>
883                 </row>
884                 <row>
885                 <entry><smbconfoption><name>printing</name><value>sysv|hpux</value></smbconfoption></entry>
886                 <entry>lpresume command   (...is empty)</entry>
887                 </row>
888                 <row>
889                 <entry><smbconfoption><name>printing</name><value>qnx</value></smbconfoption></entry>
890                 <entry>lpresume command   (...is empty)</entry>
891                 </row>
892         </tbody>
893         </tgroup>
894 </table>
896 <para>
897 We excluded the special case of CUPS here, because it is discussed in the next chapter. For
898 <parameter>printing = CUPS</parameter>, if Samba is compiled against libcups, it uses the CUPS API to submit
899 jobs. (It is a good idea also to set <smbconfoption><name>printcap</name><value>cups</value></smbconfoption>
900 in case your <filename>cupsd.conf</filename> is set to write its auto-generated printcap file to an
901 unusual place). Otherwise, Samba maps to the System V printing commands with the -oraw option for printing,
902 i.e., it uses <command>lp -c -d%p -oraw; rm %s</command>. With <parameter>printing = cups</parameter>,
903 and if Samba is compiled against libcups, any manually set print command will be ignored!
904 </para>
906 </sect3>
908 <sect3>
909 <title>Custom Print Commands</title>
911 <para>
912 After a print job has finished spooling to a service, the <smbconfoption><name>print command</name></smbconfoption>
913  will be used by Samba via a <emphasis>system()</emphasis> call to process the
914 spool file. Usually the command specified will submit the spool file to the host's printing subsystem. But
915 there is no requirement at all that this must be the case. The print subsystem may not remove the spool
916 file on its own. So whatever command you specify, you should ensure that the spool file is deleted after
917 it has been processed.
918 </para>
920 <para>
921 There is no difficulty with using your own customized print commands with the traditional printing
922 systems. However, if you do not wish to roll your own, you should be well informed about the default
923 built-in commands that Samba uses for each printing subsystem (see
924 Table 17.1). In all the
925 commands listed in the last paragraphs, you see parameters of the form <emphasis>%X</emphasis>. These are
926 <emphasis>macros</emphasis>, or shortcuts, used as place-holders for the names of real objects. At the time
927 of running a command with such a placeholder, Samba will insert the appropriate value automatically. Print
928 commands can handle all Samba macro substitutions. In regard to printing, the following ones do have
929 special relevance:
930 </para>
932 <itemizedlist>
933         <listitem><para><parameter>%s, %f</parameter> &smbmdash; the path to the spool file name.</para></listitem>
934         <listitem><para><parameter>%p</parameter> &smbmdash; the appropriate printer name.</para></listitem>
935         <listitem><para><parameter>%J</parameter> &smbmdash; the job name as transmitted by the client.</para></listitem>
936         <listitem><para><parameter>%c</parameter> &smbmdash; the number of printed pages of the spooled job (if known).</para></listitem>
937         <listitem><para><parameter>%z</parameter> &smbmdash; the size of the spooled print job (in bytes).</para></listitem>
938 </itemizedlist>
940 <para>
941 The print command must contain at least one occurrence of <parameter>%s</parameter> or
942 the <parameter>%f</parameter>. The <parameter>%p</parameter> is optional. If no printer name is supplied,
943 the <parameter>%p</parameter> will be silently removed from the print command. In this case, the job is
944 sent to the default printer.
945 </para>
947 <para>
948 If specified in the <smbconfsection>[global]</smbconfsection> section, the print command given will be
949 used for any printable service that does not have its own print command specified. If there is neither a
950 specified print command for a printable service nor a global print command, spool files will be created
951 but not processed! Most importantly, print files will not be removed, so they will consume disk space.
952 </para>
954 <para>
955 Printing may fail on some UNIX systems when using the <quote>nobody</quote> account. If this happens, create an
956 alternative guest account and give it the privilege to print. Set up this guest account in the
957 <smbconfsection>[global]</smbconfsection> section with the <parameter>guest account</parameter> parameter.
958 </para>
960 <para>
961 You can form quite complex print commands. You need to realize that print commands are just
962 passed to a UNIX shell. The shell is able to expand the included environment variables as
963 usual. (The syntax to include a UNIX environment variable <parameter>$variable</parameter>
964 in the Samba print command is <parameter>%$variable</parameter>.) To give you a working
965 <smbconfoption><name>print command</name></smbconfoption> example, the following will log a print job
966 to <filename>/tmp/print.log</filename>, print the file, then remove it. The semicolon (<quote>;</quote>
967 is the usual separator for commands in shell scripts:
968 </para>
970 <para><smbconfblock>
971 <smbconfoption><name>print command</name><value>echo Printing %s &gt;&gt; \</value></smbconfoption>
972 <member><parameter>/tmp/print.log; lpr -P %p %s; rm %s</parameter></member>
973 </smbconfblock></para>
975 <para>
976 You may have to vary your own command considerably from this example depending on how you normally print
977 files on your system. The default for the <smbconfoption><name>print command</name></smbconfoption>
978 parameter varies depending on the setting of the <smbconfoption><name>printing</name></smbconfoption>
979 parameter. Another example is:
980 </para>
982 <para><smbconfblock>
983 <smbconfoption><name>print command</name><value>/usr/local/samba/bin/myprintscript %p %s</value></smbconfoption>
984 </smbconfblock></para>
985 </sect3>
986 </sect2>
987 </sect1>
989 <sect1>
990 <title>Printing Developments Since Samba-2.2</title>
992 <para>
993 Prior to Samba-2.2.x, print server support for Windows clients was limited to <emphasis>LanMan</emphasis>
994 printing calls. This is the same protocol level as Windows 9x/Me PCs offer when they share printers.
995 Beginning with the 2.2.0 release, Samba started to support the native Windows NT printing mechanisms. These
996 are implemented via <emphasis>MS-RPC</emphasis> (RPC = <emphasis>Remote Procedure Calls</emphasis>
997 ). MS-RPCs use the <emphasis>SPOOLSS</emphasis> named pipe for all printing.
998 </para>
1000 <para>
1001 The additional functionality provided by the new SPOOLSS support includes:
1002 </para>
1004 <itemizedlist>
1005         <listitem><para>
1006         Support for downloading printer driver files to Windows 95/98/NT/2000 clients upon
1007         demand (<emphasis>Point'n'Print</emphasis>).
1008         </para></listitem>
1010         <listitem><para>
1011         Uploading of printer drivers via the Windows NT <emphasis>Add Printer Wizard</emphasis> (APW)
1012         or the <ulink url="http://imprints.sourceforge.net/">Imprints</ulink> tool set.
1013         </para></listitem>
1015         <listitem><para>
1016         Support for the native MS-RPC printing calls such as
1017         StartDocPrinter, EnumJobs(), and so on. (See the
1018         <ulink url="http://msdn.microsoft.com/">MSDN documentation</ulink> for more information on the
1019         Win32 printing API).
1020         </para></listitem>
1022         <listitem><para>
1023         Support for NT <emphasis>Access Control Lists</emphasis> (ACL) on printer objects.
1024         </para></listitem>
1026         <listitem><para>
1027         Improved support for printer queue manipulation through the use of internal databases for spooled
1028         job information (implemented by various <filename>*.tdb</filename> files).
1029         </para></listitem>
1030 </itemizedlist>
1032 <para>
1033 A benefit of updating is that Samba-3 is able to publish its printers to Active Directory (or LDAP).
1034 </para>
1036 <para>
1037 A fundamental difference exists between MS Windows NT print servers and Samba operation. Windows NT
1038 permits the installation of local printers that are not shared. This is an artifact of the fact that
1039 any Windows NT machine (server or client) may be used by a user as a workstation. Samba will publish all
1040 printers that are made available, either by default or by specific declaration via printer-specific shares.
1041 </para>
1043 <para>
1044 Windows NT/200x/XP Professional clients do not have to use the standard SMB printer share; they can
1045 print directly to any printer on another Windows NT host using MS-RPC. This, of course, assumes that
1046 the client has the necessary privileges on the remote host that serves the printer resource. The
1047 default permissions assigned by Windows NT to a printer gives the Print permissions to the well-known
1048 <emphasis>Everyone</emphasis> group. (The older clients of type Windows 9x/Me can only print to shared
1049 printers).
1050 </para>
1052 <sect2>
1053 <title>Point'n'Print Client Drivers on Samba Servers</title>
1055 <para>
1056 There is much confusion about what all this means. The question is often asked, <quote>Is it or is
1057 it not necessary for printer drivers to be installed on a Samba host in order to support printing from
1058 Windows clients?</quote> The answer to this is no, it is not necessary.
1059 </para>
1061 <para>
1062 Windows NT/2000 clients can, of course, also run their APW to install drivers <emphasis>locally</emphasis>
1063 (which then connect to a Samba-served print queue). This is the same method used by Windows 9x/Me
1064 clients. (However, a <emphasis>bug</emphasis> existed in Samba 2.2.0 that made Windows NT/2000 clients
1065 require that the Samba server possess a valid driver for the printer. This was fixed in Samba 2.2.1).
1066 </para>
1068 <para>
1069 But it is a new capability to install the printer drivers into the <smbconfsection>[print$]</smbconfsection>
1070 share of the Samba server, and a big convenience, too. Then <emphasis>all</emphasis> clients
1071 (including 95/98/ME) get the driver installed when they first connect to this printer share. The
1072 <emphasis>uploading</emphasis> or <emphasis>depositing</emphasis> of the driver into this
1073 <smbconfsection>[print$]</smbconfsection> share and the following binding of this driver to an existing
1074 Samba printer share can be achieved by different means:
1075 </para>
1077 <itemizedlist>
1078         <listitem><para>
1079         Running the <emphasis>APW</emphasis> on an NT/200x/XP Professional client (this does not work from 95/98/ME clients).
1080         </para></listitem>
1082         <listitem><para>
1083         Using the <emphasis>Imprints</emphasis> tool-set.
1084         </para></listitem>
1086         <listitem><para>
1087         Using the <emphasis>smbclient</emphasis> and <emphasis>rpcclient</emphasis> command-line tools.
1088         </para></listitem>
1090         <listitem><para>
1091         Using <emphasis>cupsaddsmb</emphasis> (only works for the CUPS
1092         printing system, not for LPR/LPD, LPRng, and so on).
1093         </para></listitem>
1094 </itemizedlist>
1096 <para>
1097 Samba does not use these uploaded drivers in any way to process spooled files. These drivers are utilized
1098 entirely by the clients who download and install them via the <quote>Point'n'Print</quote> mechanism
1099 supported by Samba. The clients use these drivers to generate print files in the format the printer
1100 (or the UNIX print system) requires. Print files received by Samba are handed over to the UNIX printing
1101 system, which is responsible for all further processing, as needed.
1102 </para>
1103 </sect2>
1105 <sect2>
1106 <title>The Obsoleted [printer$] Section</title>
1108         <para>
1109         Versions of Samba prior to 2.2 made it possible to use a share named
1110         <parameter>[printer$]</parameter>. This name was taken from the same named service created by
1111         Windows 9x/Me clients when a printer was shared by them. Windows 9x/Me printer servers always
1112         have a <smbconfsection>[printer$]</smbconfsection> service that provides read-only access (with
1113         no password required) to support printer driver downloads. However, Samba's initial
1114         implementation allowed for a parameter named <parameter>printer driver location</parameter> to
1115         be used on a per share basis. This specified the location of the driver files associated with
1116         that printer. Another parameter named <parameter>printer driver</parameter> provided a means of
1117         defining the printer driver name to be sent to the client.
1118         </para>
1120         <para>
1121         These parameters, including the <parameter>printer driver file</parameter> parameter,
1122         are now removed and cannot be used in installations of Samba-3. The share name
1123         <smbconfsection>[print$]</smbconfsection> is now used for the location of download-able printer
1124         drivers. It is taken from the <smbconfsection>[print$]</smbconfsection> service created
1125         by Windows NT PCs when a printer is shared by them. Windows NT print servers always have a
1126         <smbconfsection>[print$]</smbconfsection> service that provides read-write access (in the context
1127         of its ACLs) to support printer driver downloads and uploads. This does not mean Windows
1128         9x/Me clients are now thrown aside. They can use Samba's <smbconfsection>[print$]</smbconfsection>
1129         share support just fine.
1130         </para>
1131 </sect2>
1133 <sect2>
1134 <title>Creating the [print$] Share</title>
1136 <para>
1137 In order to support the uploading and downloading of printer driver files, you must first configure a
1138 file share named <smbconfsection>[print$]</smbconfsection>. The public name of this share is hard coded
1139 in the MS Windows clients. It cannot be renamed since Windows clients are programmed to search for a
1140 service of exactly this name if they want to retrieve printer driver files.
1141 </para>
1143 <para>
1144 You should modify the server's file to add the global parameters and create the
1145 <smbconfsection>[print$]</smbconfsection> file share (of course, some of the parameter values, such
1146 as <smbconfoption><name>path</name></smbconfoption> are arbitrary and should be replaced with appropriate values for your
1147 site). See <link linkend="prtdollar">next example</link>.
1148 </para>
1150 <para>
1151 <smbconfexample id="prtdollar">
1152 <title>[print\$] example</title>
1153 <smbconfsection>[global]</smbconfsection>
1154 <smbconfcomment>members of the ntadmin group should be able to add drivers and set</smbconfcomment>
1155 <smbconfcomment>printer properties. root is implicitly always a 'printer admin'.</smbconfcomment>
1156 <smbconfoption><name>printer admin</name><value>@ntadmin</value></smbconfoption>
1157 <member>...</member>
1158 <smbconfsection>[printers]</smbconfsection>
1159 <member>...</member>
1160 <smbconfsection>[print$]</smbconfsection>
1161 <smbconfoption><name>comment</name><value>Printer Driver Download Area</value></smbconfoption>
1162 <smbconfoption><name>path</name><value>/etc/samba/drivers</value></smbconfoption>
1163 <smbconfoption><name>browseable</name><value>yes</value></smbconfoption>
1164 <smbconfoption><name>guest ok</name><value>yes</value></smbconfoption>
1165 <smbconfoption><name>read only</name><value>yes</value></smbconfoption>
1166 <smbconfoption><name>write list</name><value>@ntadmin, root</value></smbconfoption>
1167 </smbconfexample>
1168 </para>
1170 <para>
1171 Of course, you also need to ensure that the directory named by the
1172 <smbconfoption><name>path</name></smbconfoption> parameter exists on the UNIX file system.
1173 </para>
1175 </sect2>
1177 <sect2>
1178 <title>[print$] Section Parameters</title>
1180 <para>
1181 The <smbconfsection>[print$]</smbconfsection> is a special section in &smb.conf;. It contains settings relevant to
1182 potential printer driver download and is used by windows clients for local print driver installation.
1183 The following parameters are frequently needed in this share section:
1184 </para>
1186 <variablelist>
1187         <varlistentry><term><smbconfoption><name>comment</name><value>Printer Driver Download Area </value></smbconfoption></term>
1188                 <listitem><para>
1189                 The comment appears next to the share name if it is listed in a share list (usually Windows
1190                 clients will not see it, but it will also appear up in a <command>smbclient -L sambaserver
1191                 </command> output).
1192                 </para></listitem>
1193         </varlistentry>
1195         <varlistentry><term><smbconfoption><name>path</name><value>/etc/samba/printers </value></smbconfoption></term>
1196                 <listitem><para>
1197                 Is the path to the location of the Windows driver file deposit from the UNIX point of view.
1198                 </para></listitem>
1199         </varlistentry>
1201         <varlistentry><term><smbconfoption><name>browseable</name><value>no </value></smbconfoption></term>
1202                 <listitem><para>
1203                 Makes the <smbconfsection>[print$]</smbconfsection> share invisible to clients from the
1204                 <guimenu>Network Neighborhood</guimenu>. However, you can still mount it from any client
1205                 using the <command>net use g:\\sambaserver\print$</command> command in a DOS-box or the
1206                 <guimenu>Connect network drive menu></guimenu> from Windows Explorer.
1207                 </para></listitem>
1208         </varlistentry>
1210         <varlistentry><term><smbconfoption><name>guest ok</name><value>yes </value></smbconfoption></term>
1211                 <listitem><para>
1212                 Gives read-only access to this share for all guest users. Access may be granted to
1213                 download and install printer drivers on clients. The requirement for <parameter>guest ok
1214                 = yes</parameter> depends on how your site is configured. If users will be guaranteed
1215                 to have an account on the Samba host, then this is a non-issue.
1216                 </para>
1218                 <note><para> 
1219                 If all your Windows NT users are guaranteed to be authenticated by the Samba server
1220                 (for example, if Samba authenticates via an NT domain server and the user has already been
1221                 validated by the Domain Controller in order to logon to the Windows NT session), then guest
1222                 access is not necessary. Of course, in a workgroup environment where you just want
1223                 to print without worrying about silly accounts and security, then configure the share for
1224                 guest access. You should consider adding <smbconfoption><name>map to guest</name><value>Bad
1225                 User</value></smbconfoption> in the <smbconfsection>[global]</smbconfsection> section
1226                 as well. Make sure you understand what this parameter does before using it.
1227                 </para></note>
1228                 </listitem>
1229         </varlistentry>
1231         <varlistentry><term><smbconfoption><name>read only</name><value>yes </value></smbconfoption></term>
1232                 <listitem><para>
1233                 Because we do not want everybody to upload driver files (or even change driver settings),
1234                 we tagged this share as not writable.
1235                 </para></listitem>
1236         </varlistentry>
1238         <varlistentry><term><smbconfoption><name>write list</name><value>@ntadmin, root </value></smbconfoption></term>
1239                 <listitem><para>
1240                 The <smbconfsection>[print$]</smbconfsection> was made read-only by the previous
1241                 setting so we should create a <parameter>write list</parameter> entry also. UNIX
1242                 groups (denoted with a leading <quote>@</quote> character). Users listed here are allowed
1243                 write-access (as an exception to the general public's read-only access), which they need to
1244                 update files on the share. Normally, you will want to only name administrative-level user
1245                 account in this setting. Check the file system permissions to make sure these accounts
1246                 can copy files to the share. If this is a non-root account, then the account should also
1247                 be mentioned in the global <smbconfoption><name>printer admin</name></smbconfoption>
1248                 parameter. See the &smb.conf; man page for more information on configuring file shares.
1249                 </para></listitem>
1250         </varlistentry>
1251 </variablelist>
1253 </sect2>
1255 <sect2>
1256 <title>The [print$] Share Directory</title>
1258 <para>
1259 In order for a Windows NT print server to support the downloading of driver files by multiple client
1260 architectures, you must create several subdirectories within the <smbconfsection>[print$]</smbconfsection>
1261 service (i.e., the UNIX directory named by the <smbconfoption><name>path</name></smbconfoption>
1262 parameter). These correspond to each of the supported client architectures. Samba follows this model as
1263 well. Just like the name of the <smbconfsection>[print$]</smbconfsection> share itself, the subdirectories
1264 must be exactly the names listed below (you may leave out the subdirectories of architectures you do
1265 not need to support).
1266 </para>
1268 <para>
1269 Therefore, create a directory tree below the
1270 <smbconfsection>[print$]</smbconfsection> share for each architecture you wish
1271 to support like this:
1272 </para>
1274 <para><programlisting>
1275 [print$]--+
1276           |--W32X86           # serves drivers to Windows NT x86
1277           |--WIN40            # serves drivers to Windows 95/98
1278           |--W32ALPHA         # serves drivers to Windows NT Alpha_AXP
1279           |--W32MIPS          # serves drivers to Windows NT R4000
1280           |--W32PPC           # serves drivers to Windows NT PowerPC
1281 </programlisting>
1282 </para>
1284 <important><title>Required permissions</title>
1285         <para>
1286         In order to add a new driver to your Samba host, one of two conditions must hold true:
1287         </para>
1289         <itemizedlist>
1290                 <listitem><para>
1291                 The account used to connect to the Samba host must have a UID of 0 (i.e., a root account).
1292                 </para></listitem>
1294                 <listitem><para>
1295                 The account used to connect to the Samba host must be named in the <emphasis>printer admin</emphasis>list.
1296                 </para></listitem>
1297         </itemizedlist>
1299         <para>
1300         Of course, the connected account must still have write access to add files to the subdirectories beneath
1301         <smbconfsection>[print$]</smbconfsection>. Remember that all file shares are set to <quote>read-only</quote> by default.
1302         </para>
1303 </important>
1305 <para>
1306 Once you have created the required <smbconfsection>[print$]</smbconfsection> service and
1307 associated subdirectories, go to a Windows NT 4.0/200x/XP client workstation. Open <guiicon>Network
1308 Neighborhood</guiicon> or <guiicon>My Network Places</guiicon> and browse for the Samba host. Once you
1309 have located the server, navigate to its <guiicon>Printers and Faxes</guiicon> folder. You should see
1310 an initial listing of printers that matches the printer shares defined on your Samba host.
1311 </para>
1312 </sect2>
1313 </sect1>
1315 <sect1>
1316 <title>Installing Drivers into [print$]</title>
1318 <para>
1319 Have you successfully created the <smbconfsection>[print$]</smbconfsection> share in &smb.conf;, and have your forced Samba
1320 to re-read its &smb.conf; file? Good. But you are not yet ready to use the new facility. The client driver
1321 files need to be installed into this share. So far it is still an empty share. Unfortunately, it is
1322 not enough to just copy the driver files over. They need to be
1323 correctly installed so that appropriate
1324 records for each driver will exist in the Samba internal databases so it can provide the correct
1325 drivers as they are requested from MS Windows clients. And that is a bit tricky, to say the least. We
1326 now discuss two alternative ways to install the drivers into <smbconfsection>[print$]</smbconfsection>:
1327 </para>
1329 <itemizedlist>
1330         <listitem><para>
1331         Using the Samba command-line utility <command>rpcclient</command> with its various subcommands (here:
1332         <command>adddriver</command> and <command>setdriver</command>) from any UNIX workstation.
1333         </para></listitem>
1335         <listitem><para>
1336         Running a GUI (<guiicon>Printer Properties</guiicon> and <guiicon>Add Printer Wizard</guiicon>)
1337         from any Windows NT/200x/XP client workstation.
1338         </para></listitem>
1339 </itemizedlist>
1341 <para>
1342 The latter option is probably the easier one (even if the process may seem a little bit weird at first).
1343 </para>
1345 <sect2>
1346 <title>Add Printer Wizard Driver Installation</title>
1348 <para>
1349 The initial listing of printers in the Samba host's <guiicon>Printers</guiicon> folder accessed from a
1350 client's Explorer will have no real printer driver assigned to them. By default this driver name is set
1351 to a null string. This must be changed now. The local <guiicon>Add Printer Wizard</guiicon> (APW), run from
1352 NT/2000/XP clients, will help us in this task.
1353 </para>
1355 <para>
1356 Installation of a valid printer driver is not straightforward. You must attempt
1357 to view the printer properties for the printer to which you want the driver assigned. Open the Windows
1358 Explorer, open <guiicon>Network Neighborhood</guiicon>, browse to the Samba host, open Samba's <guiicon>Printers</guiicon>
1359 folder, right-click on the printer icon and select <guimenu>Properties...</guimenu>. You are now trying to
1360 view printer and driver properties for a queue that has this default <constant>NULL</constant> driver
1361 assigned. This will result in the following error message:
1362 </para>
1364         <para><errorname>
1365         Device settings cannot be displayed. The driver for the specified printer is not installed,
1366         only spooler properties will be displayed. Do you want to install the driver now?
1367         </errorname></para>
1369 <para>
1370 Do not click on <guibutton>Yes</guibutton>!  Instead, click on <guibutton>No</guibutton> in the error dialog.
1371 Only now you will be presented with the printer properties window. From here, the way to assign a driver
1372 to a printer is open to us. You now have the choice of:
1373 </para>
1375 <itemizedlist>
1376         <listitem><para>
1377         Select a driver from the pop-up list of installed drivers. Initially this list will be empty.
1378         </para></listitem>
1380         <listitem><para>
1381         Click on <guibutton>New Driver</guibutton> to install a new printer driver (which will
1382         start up the APW).
1383         </para></listitem>
1384 </itemizedlist>
1386 <para>
1387 Once the APW is started, the procedure is exactly the same as the one you are familiar with in Windows (we
1388 assume here that you are familiar with the printer driver installations procedure on Windows NT). Make sure
1389 your connection is, in fact, setup as a user with <smbconfoption><name>printer admin</name></smbconfoption>
1390 privileges (if in doubt, use <command>smbstatus</command> to check for this). If you wish to install
1391 printer drivers for client operating systems other than <application>Windows NT x86</application>,
1392 you will need to use the <guilabel>Sharing</guilabel> tab of the printer properties dialog.
1393 </para>
1395 <para>
1396 Assuming you have connected with an administrative (or root) account (as named by the
1397 <smbconfoption><name>printer admin</name></smbconfoption> parameter), you will also be able to modify
1398 other printer properties such as ACLs and default device settings using this dialog. For the default
1399 device settings, please consider the advice given further in <link linkend="inst-rpc">Installing Print Drivers Using <command>rpcclient</command></link>.
1400 </para>
1401 </sect2>
1403 <sect2 id="inst-rpc">
1404 <title>Installing Print Drivers Using <command>rpcclient</command></title>
1406 <para>
1407 The second way to install printer drivers into <smbconfsection>[print$]</smbconfsection> and set them
1408 up in a valid way is to do it from the UNIX command line. This involves four distinct steps:
1409 </para>
1411 <orderedlist>
1412         <listitem><para>
1413         Gather info about required driver files and collect the files.
1414         </para></listitem>
1416         <listitem><para>
1417         Deposit the driver files into the <smbconfsection>[print$]</smbconfsection> share's correct subdirectories
1418         (possibly by using <command>smbclient</command>).
1419         </para></listitem>
1421         <listitem><para>
1422         Run the <command>rpcclient</command> command line utility once with the <command>adddriver</command>
1423         subcommand.
1424         </para></listitem>
1426         <listitem><para>
1427         Run <command>rpcclient</command> a second time with the <command>setdriver</command> subcommand.
1428         </para></listitem>
1429 </orderedlist>
1431 <para>
1432 We provide detailed hints for each of these steps in the paragraphs that follow.
1433 </para>
1435 <sect3>
1436 <title>Identifying Driver Files</title>
1438 <para>
1439 To find out about the driver files, you have two options. You could check the contents of the driver
1440 CDROM that came with your printer. Study the <filename>*.inf</filename> files lcoated on the CDROM. This
1441 may not be possible, since the <filename>*.inf</filename> file might be missing. Unfortunately, vendors have now started
1442 to use their own installation programs. These installations packages are often in some Windows platform
1443 archive format. Additionally, the files may be re-named during the installation process. This makes it
1444 extremely difficult to identify the driver files required.
1445 </para>
1447 <para>
1448 Then you only have the second option. Install the driver locally on a Windows client and
1449 investigate which file names and paths it uses after they are installed. (You need to repeat
1450 this procedure for every client platform you want to support. We show it here for the
1451 <application>W32X86</application> platform only, a name used by Microsoft for all Windows NT/200x/XP
1452 clients.)
1453 </para>
1455 <para>
1456 A good method to recognize the driver files is to print the test page from the driver's
1457 <guilabel>Properties</guilabel> dialog (<guilabel>General</guilabel> tab). Then look at the list of
1458 driver files named on the printout. You'll need to recognize what Windows (and Samba) are calling the
1459 <guilabel>Driver File</guilabel>, <guilabel>Data File</guilabel>, <guilabel>Config File</guilabel>,
1460 <guilabel>Help File</guilabel> and (optionally) the <guilabel>Dependent Driver Files</guilabel>
1461 (this may vary slightly for Windows NT). You need to take a note of all file names for the next steps.
1462 </para>
1464 <para>
1465 Another method to quickly test the driver filenames and related paths is provided by the
1466 <command>rpcclient</command> utility. Run it with <command>enumdrivers</command> or with the
1467 <command>getdriver</command> subcommand, each at the <filename>3</filename> info level. In the following example,
1468 <emphasis>TURBO_XP</emphasis> is the name of the Windows PC (in this case it was a Windows XP Professional
1469 laptop). I installed the driver locally to TURBO_XP, from a Samba server called <constant>KDE-BITSHOP</constant>.
1470 We could run an interactive <command>rpcclient</command> session; then we would get an
1471 <command>rpcclient /></command> prompt and would type the subcommands at this prompt. This is left as
1472 a good exercise to the reader. For now, we use <command>rpcclient</command> with the <option>-c</option>
1473 parameter to execute a single subcommand line and exit again. This is the method you would use if you
1474 want to create scripts to automate the procedure for a large number of printers and drivers. Note the
1475 different quotes used to overcome the different spaces in between words:
1476 </para>
1478 <para><screen>
1479 &rootprompt;<userinput>rpcclient -U'Danka%xxxx' -c \
1480         'getdriver "Heidelberg Digimaster 9110 (PS)" 3' TURBO_XP</userinput>
1481 cmd = getdriver "Heidelberg Digimaster 9110 (PS)" 3
1483 [Windows NT x86]
1484 Printer Driver Info 3:
1485   Version: [2]
1486   Driver Name: [Heidelberg Digimaster 9110 (PS)]
1487   Architecture: [Windows NT x86]
1488   Driver Path: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01_de.DLL]
1489   Datafile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.ppd]
1490   Configfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01U_de.DLL]
1491   Helpfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01U_de.HLP]
1492   
1493   Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.DLL]
1494   Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.INI]
1495   Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.dat]
1496   Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.cat]
1497   Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.def]
1498   Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.hre]
1499   Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.vnd]
1500   Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.hlp]
1501   Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01Aux.dll]
1502   Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01_de.NTF]
1503   
1504   Monitorname: []
1505   Defaultdatatype: []
1506 </screen></para>
1508 <para>
1509 You may notice that this driver has quite a large number of <guilabel>Dependent files</guilabel>
1510 (there are worse cases, however). Also, strangely, the
1511 <guilabel>Driver File</guilabel> is tagged here
1512 <guilabel>Driver Path</guilabel>. We do not yet have support for the so-called
1513 <application>WIN40</application> architecture installed. This name is used by Microsoft for the Windows
1514 9x/Me platforms. If we want to support these, we need to install the Windows 9x/Me driver files in
1515 addition to those for <application>W32X86</application> (i.e., the Windows NT72000/XP clients) onto a
1516 Windows PC. This PC can also host the Windows 9x/Me drivers, even if it runs on Windows NT, 2000 or XP.
1517 </para>
1519 <para>
1520 Since the <smbconfsection>[print$]</smbconfsection> share is usually accessible through the <guiicon>Network
1521 Neighborhood</guiicon>, you can also use the UNC notation from Windows Explorer to poke at it. The Windows
1522 9x/Me driver files will end up in subdirectory <filename>0</filename> of the <filename>WIN40</filename>
1523 directory. The full path to access them will be <filename>\\WINDOWSHOST\print$\WIN40\0\</filename>.
1524 </para>
1526 <note><para>
1527 More recent drivers on Windows 2000 and Windows XP are installed into the <quote>3</quote> subdirectory
1528 instead of the <quote>2</quote>. The version 2 of drivers, as used in Windows NT, were running in Kernel
1529 Mode. Windows 2000 changed this. While it still can use the Kernel Mode drivers (if this is enabled by
1530 the Admin), its native mode for printer drivers is User Mode execution. This requires drivers designed
1531 for this. These types of drivers install into the <quote>3</quote> subdirectory.
1532 </para></note>
1533 </sect3>
1535 <sect3>
1536 <title>Obtaining Driver Files from Windows Client [print$] Shares</title>
1538 <para>
1539 Now we need to collect all the driver files we identified in our previous step. Where do we get them
1540 from? Well, why not retrieve them from the very PC and the same <smbconfsection>[print$]</smbconfsection>
1541 share that we investigated in our last step to identify the files? We can use <command>smbclient</command>
1542 to do this. We will use the paths and names that were leaked to us by <command>getdriver</command>. The
1543 listing is edited to include line breaks for readability:
1544 </para>
1546 <para><screen>
1547 &rootprompt;<userinput>smbclient //TURBO_XP/print\$ -U'Danka%xxxx' \ 
1548    -c 'cd W32X86/2;mget HD*_de.* hd*ppd Hd*_de.* Hddm*dll HDN*Aux.DLL'</userinput>
1550 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
1551 Got a positive name query response from 10.160.50.8 ( 10.160.50.8 )
1552 Domain=[DEVELOPMENT] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
1553 <prompt>Get file Hddm91c1_de.ABD? </prompt><userinput>n</userinput>
1554 <prompt>Get file Hddm91c1_de.def? </prompt><userinput>y</userinput>
1555 getting file \W32X86\2\Hddm91c1_de.def of size 428 as Hddm91c1_de.def
1556 <prompt>Get file Hddm91c1_de.DLL? </prompt><userinput>y</userinput>
1557 getting file \W32X86\2\Hddm91c1_de.DLL of size 876544 as Hddm91c1_de.DLL
1558 [...]
1559 </screen></para>
1561 <para>
1562 After this command is complete, the files are in our current local directory. You probably have noticed
1563 that this time we passed several commands to the <option>-c</option> parameter, separated by semi-colons.
1564 This effects that all commands are executed in sequence on the remote Windows server before smbclient
1565 exits again.
1566 </para>
1568 <para>
1569 Remember to repeat the procedure for the <application>WIN40</application> architecture should
1570 you need to support Windows 9x/Me/XP clients. Remember too, the files for these architectures are in the
1571 <filename>WIN40/0/</filename> subdirectory. Once this is complete, we can run <command>smbclient ...
1572 put</command> to store the collected files on the Samba server's <smbconfsection>[print$]</smbconfsection>
1573 share.
1574 </para>
1575 </sect3>
1577 <sect3>
1578 <title>Installing Driver Files into [print$]</title>
1580 <para>
1581 We are now going to locate the driver files into the <smbconfsection>[print$]</smbconfsection>
1582 share. Remember, the UNIX path to this share has been defined
1583 previously in your words missing here. You
1584 also have created subdirectories for the different Windows client types you want to
1585 support. Supposing your <smbconfsection>[print$]</smbconfsection> share maps to the UNIX path
1586 <filename>/etc/samba/drivers/</filename>, your driver files should now go here:
1587 </para>
1589 <itemizedlist>
1590         <listitem><para>
1591         For all Windows NT, 2000 and XP clients into <filename>/etc/samba/drivers/W32X86/</filename> but
1592         not (yet) into the <filename>2</filename> subdirectory.
1593         </para></listitem>
1595         <listitem><para>
1596         For all Windows 95, 98 and ME clients into <filename>/etc/samba/drivers/WIN40/</filename> but not
1597         (yet) into the <filename>0</filename> subdirectory.
1598         </para></listitem>
1599 </itemizedlist>
1601 <para>
1602 We again use smbclient to transfer the driver files across the network. We specify the same files
1603 and paths as were leaked to us by running <command>getdriver</command> against the original
1604 <emphasis>Windows</emphasis> install. However, now we are going to store the files into a
1605 <emphasis>Samba/UNIX</emphasis> print server's <smbconfsection>[print$]</smbconfsection> share.
1606 </para>
1608 <para><screen>
1609 &rootprompt;<userinput>smbclient //SAMBA-CUPS/print\$ -U'root%xxxx' -c \
1610   'cd W32X86; put HDNIS01_de.DLL; \
1611   put Hddm91c1_de.ppd; put HDNIS01U_de.DLL;        \
1612   put HDNIS01U_de.HLP; put Hddm91c1_de.DLL;        \
1613   put Hddm91c1_de.INI; put Hddm91c1KMMin.DLL;      \
1614   put Hddm91c1_de.dat; put Hddm91c1_de.dat;        \
1615   put Hddm91c1_de.def; put Hddm91c1_de.hre;        \
1616   put Hddm91c1_de.vnd; put Hddm91c1_de.hlp;        \
1617   put Hddm91c1_de_reg.HLP; put HDNIS01Aux.dll;     \
1618   put HDNIS01_de.NTF'</userinput>
1620 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
1621 Got a positive name query response from 10.160.51.162 ( 10.160.51.162 )
1622 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a]
1623 putting file HDNIS01_de.DLL as \W32X86\HDNIS01_de.DLL
1624 putting file Hddm91c1_de.ppd as \W32X86\Hddm91c1_de.ppd
1625 putting file HDNIS01U_de.DLL as \W32X86\HDNIS01U_de.DLL
1626 putting file HDNIS01U_de.HLP as \W32X86\HDNIS01U_de.HLP
1627 putting file Hddm91c1_de.DLL as \W32X86\Hddm91c1_de.DLL
1628 putting file Hddm91c1_de.INI as \W32X86\Hddm91c1_de.INI
1629 putting file Hddm91c1KMMin.DLL as \W32X86\Hddm91c1KMMin.DLL
1630 putting file Hddm91c1_de.dat as \W32X86\Hddm91c1_de.dat
1631 putting file Hddm91c1_de.dat as \W32X86\Hddm91c1_de.dat
1632 putting file Hddm91c1_de.def as \W32X86\Hddm91c1_de.def
1633 putting file Hddm91c1_de.hre as \W32X86\Hddm91c1_de.hre
1634 putting file Hddm91c1_de.vnd as \W32X86\Hddm91c1_de.vnd
1635 putting file Hddm91c1_de.hlp as \W32X86\Hddm91c1_de.hlp
1636 putting file Hddm91c1_de_reg.HLP as \W32X86\Hddm91c1_de_reg.HLP
1637 putting file HDNIS01Aux.dll as \W32X86\HDNIS01Aux.dll
1638 putting file HDNIS01_de.NTF as \W32X86\HDNIS01_de.NTF
1639 </screen>
1641 Whew &smbmdash; that was a lot of typing! Most drivers are a lot smaller &smbmdash; many only having three generic
1642 PostScript driver files plus one PPD. While we did retrieve the files from the <filename>2</filename>
1643 subdirectory of the <filename>W32X86</filename> directory from the Windows box, we do not put them
1644 (for now) in this same subdirectory of the Samba box. This relocation will automatically be done by the
1645 <command>adddriver</command> command, which we will run shortly (and do not forget to also put the files
1646 for the Windows 9x/Me architecture into the <filename>WIN40/</filename> subdirectory should you need them).
1647 </para>
1648 </sect3>
1650 <sect3>
1651 <title><command>smbclient</command> to Confirm Driver Installation</title>
1653 <para>
1654 For now we verify that our files are there. This can be done with <command>smbclient</command>, too
1655 (but, of course, you can log in via SSH also and do this through a standard UNIX shell access):
1656 </para>
1658 <para><screen>
1659 &rootprompt;<userinput>smbclient //SAMBA-CUPS/print\$ -U 'root%xxxx' \
1660         -c 'cd W32X86; pwd; dir; cd 2; pwd; dir'</userinput>
1661  added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
1662 Got a positive name query response from 10.160.51.162 ( 10.160.51.162 )
1663 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.8a]
1665 Current directory is \\SAMBA-CUPS\print$\W32X86\
1666 .                                  D        0  Sun May  4 03:56:35 2003
1667 ..                                 D        0  Thu Apr 10 23:47:40 2003
1668 2                                   D        0  Sun May  4 03:56:18 2003
1669 HDNIS01Aux.dll                      A    15356  Sun May  4 03:58:59 2003
1670 Hddm91c1KMMin.DLL                   A    46966  Sun May  4 03:58:59 2003
1671 HDNIS01_de.DLL                      A   434400  Sun May  4 03:58:59 2003
1672 HDNIS01_de.NTF                      A   790404  Sun May  4 03:56:35 2003
1673 Hddm91c1_de.DLL                     A   876544  Sun May  4 03:58:59 2003
1674 Hddm91c1_de.INI                     A      101  Sun May  4 03:58:59 2003
1675 Hddm91c1_de.dat                     A     5044  Sun May  4 03:58:59 2003
1676 Hddm91c1_de.def                     A      428  Sun May  4 03:58:59 2003
1677 Hddm91c1_de.hlp                     A    37699  Sun May  4 03:58:59 2003
1678 Hddm91c1_de.hre                     A   323584  Sun May  4 03:58:59 2003
1679 Hddm91c1_de.ppd                     A    26373  Sun May  4 03:58:59 2003
1680 Hddm91c1_de.vnd                     A    45056  Sun May  4 03:58:59 2003
1681 HDNIS01U_de.DLL                     A   165888  Sun May  4 03:58:59 2003
1682 HDNIS01U_de.HLP                     A    19770  Sun May  4 03:58:59 2003
1683 Hddm91c1_de_reg.HLP                 A   228417  Sun May  4 03:58:59 2003
1684               40976 blocks of size 262144. 709 blocks available
1686 Current directory is \\SAMBA-CUPS\print$\W32X86\2\
1687 .                                  D        0  Sun May  4 03:56:18 2003
1688 ..                                 D        0  Sun May  4 03:56:35 2003
1689 ADOBEPS5.DLL                        A   434400  Sat May  3 23:18:45 2003
1690 laserjet4.ppd                       A     9639  Thu Apr 24 01:05:32 2003
1691 ADOBEPSU.DLL                        A   109568  Sat May  3 23:18:45 2003
1692 ADOBEPSU.HLP                        A    18082  Sat May  3 23:18:45 2003
1693 PDFcreator2.PPD                     A    15746  Sun Apr 20 22:24:07 2003
1694               40976 blocks of size 262144. 709 blocks available
1695 </screen></para>
1697 <para>
1698 Notice that there are already driver files present in the <filename>2</filename> subdirectory (probably
1699 from a previous installation). Once the files for the new driver are there too, you are still a few
1700 steps away from being able to use them on the clients. The only thing you could do now is to retrieve
1701 them from a client just like you retrieve ordinary files from a file share, by opening print$ in Windows
1702 Explorer. But that wouldn't install them per Point'n'Print. The reason
1703 is: Samba does not yet know that
1704 these files are something special, namely <emphasis>printer driver files</emphasis> and it does not know
1705 to which print queue(s) these driver files belong.
1706 </para>
1707 </sect3>
1709 <sect3>
1710 <title>Running <command>rpcclient</command> with <command>adddriver</command></title>
1712 <para>
1713 Next, you must tell Samba about the special category of the files you just uploaded into the
1714 <smbconfsection>[print$]</smbconfsection> share. This is done by the <command>adddriver</command>
1715 command. It will prompt Samba to register the driver files into its internal TDB database files. The
1716 following command and its output has been edited, again, for readability:
1717 </para>
1719 <para><screen>
1720 &rootprompt;<userinput>rpcclient -Uroot%xxxx -c 'adddriver "Windows NT x86" \
1721   "dm9110:HDNIS01_de.DLL: \
1722   Hddm91c1_de.ppd:HDNIS01U_de.DLL:HDNIS01U_de.HLP:   \
1723   NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI,          \
1724   Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre,   \
1725   Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL, \
1726   HDNIS01Aux.dll,HDNIS01_de.NTF,                     \
1727   Hddm91c1_de_reg.HLP' SAMBA-CUPS</userinput>
1729 cmd = adddriver "Windows NT x86" \
1730   "dm9110:HDNIS01_de.DLL:Hddm91c1_de.ppd:HDNIS01U_de.DLL:   \
1731   HDNIS01U_de.HLP:NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI, \
1732   Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre,          \
1733   Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL,        \
1734   HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP"
1736 Printer Driver dm9110 successfully installed.
1737 </screen></para>
1739 <para>
1740 After this step, the driver should be recognized by Samba on the print server. You need to be very
1741 careful when typing the command. Don't exchange the order of the fields. Some changes would lead to
1742 an <computeroutput>NT_STATUS_UNSUCCESSFUL</computeroutput> error message. These become obvious. Other
1743 changes might install the driver files successfully, but render the driver unworkable. So take care!
1744 Hints about the syntax of the adddriver command are in the man page. The CUPS printing chapter 
1745 provides a more detailed description, should you need it.
1746 </para>
1747 </sect3>
1749 <sect3>
1750 <title>Checking <command>adddriver</command> Completion</title>
1752 <para>
1753 One indication for Samba's recognition of the files as driver files is the <computeroutput>successfully
1754 installed</computeroutput> message. Another one is the fact that our files have been moved by the
1755 <command>adddriver</command> command into the <filename>2</filename> subdirectory. You can check this
1756 again with <command>smbclient</command>:
1757 </para>
1759 <para><screen>
1760 &rootprompt;<userinput>smbclient //SAMBA-CUPS/print\$ -Uroot%xx \
1761         -c 'cd W32X86;dir;pwd;cd 2;dir;pwd'</userinput>
1762  added interface ip=10.160.51.162 bcast=10.160.51.255 nmask=255.255.252.0
1763  Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a]
1765   Current directory is \\SAMBA-CUPS\print$\W32X86\
1766   .                                  D        0  Sun May  4 04:32:48 2003
1767   ..                                 D        0  Thu Apr 10 23:47:40 2003
1768   2                                   D        0  Sun May  4 04:32:48 2003
1769                 40976 blocks of size 262144. 731 blocks available 
1771   Current directory is \\SAMBA-CUPS\print$\W32X86\2\
1772   .                                  D        0  Sun May  4 04:32:48 2003
1773   ..                                 D        0  Sun May  4 04:32:48 2003
1774   DigiMaster.PPD                      A   148336  Thu Apr 24 01:07:00 2003
1775   ADOBEPS5.DLL                        A   434400  Sat May  3 23:18:45 2003
1776   laserjet4.ppd                       A     9639  Thu Apr 24 01:05:32 2003
1777   ADOBEPSU.DLL                        A   109568  Sat May  3 23:18:45 2003
1778   ADOBEPSU.HLP                        A    18082  Sat May  3 23:18:45 2003
1779   PDFcreator2.PPD                     A    15746  Sun Apr 20 22:24:07 2003
1780   HDNIS01Aux.dll                      A    15356  Sun May  4 04:32:18 2003
1781   Hddm91c1KMMin.DLL                   A    46966  Sun May  4 04:32:18 2003
1782   HDNIS01_de.DLL                      A   434400  Sun May  4 04:32:18 2003
1783   HDNIS01_de.NTF                      A   790404  Sun May  4 04:32:18 2003
1784   Hddm91c1_de.DLL                     A   876544  Sun May  4 04:32:18 2003
1785   Hddm91c1_de.INI                     A      101  Sun May  4 04:32:18 2003
1786   Hddm91c1_de.dat                     A     5044  Sun May  4 04:32:18 2003
1787   Hddm91c1_de.def                     A      428  Sun May  4 04:32:18 2003
1788   Hddm91c1_de.hlp                     A    37699  Sun May  4 04:32:18 2003
1789   Hddm91c1_de.hre                     A   323584  Sun May  4 04:32:18 2003
1790   Hddm91c1_de.ppd                     A    26373  Sun May  4 04:32:18 2003
1791   Hddm91c1_de.vnd                     A    45056  Sun May  4 04:32:18 2003
1792   HDNIS01U_de.DLL                     A   165888  Sun May  4 04:32:18 2003
1793   HDNIS01U_de.HLP                     A    19770  Sun May  4 04:32:18 2003
1794   Hddm91c1_de_reg.HLP                 A   228417  Sun May  4 04:32:18 2003
1795                 40976 blocks of size 262144. 731 blocks available
1796 </screen></para>
1798 <para>
1799 Another verification is that the timestamp of the printing TDB files is now updated
1800 (and possibly their file size has increased).
1801 </para>
1802 </sect3>
1804 <sect3>
1805 <title>Check Samba for Driver Recognition</title>
1807 <para>
1808 Now the driver should be registered with Samba. We can easily verify this, and will do so in a
1809 moment. However, this driver is not yet associated with a particular printer. We may check the driver
1810 status of the files by at least three methods:
1811 </para>
1813 <itemizedlist>
1814         <listitem><para>
1815         From any Windows client browse Network Neighborhood, find the Samba host and open the Samba
1816         <guiicon>Printers and Faxes</guiicon> folder. Select any printer icon, right-click and select
1817         the printer <guimenuitem>Properties</guimenuitem>. Click the <guilabel>Advanced</guilabel>
1818         tab. Here is a field indicating the driver for that printer. A drop-down menu allows you to
1819         change that driver (be careful not to do this unwittingly). You can use this list to view
1820         all drivers known to Samba. Your new one should be among them. (Each type of client will only
1821         see his own architecture's list. If you do not have every driver installed for each platform,
1822         the list will differ if you look at it from Windows95/98/ME or Windows NT/2000/XP.)
1823         </para></listitem>
1825         <listitem><para>
1826         From a Windows 200x/XP client (not Windows NT) browse <guiicon>Network Neighborhood</guiicon>,
1827         search for the Samba server and open the server's <guiicon>Printers</guiicon> folder,
1828         right-click on the white background (with no printer highlighted). Select <guimenuitem>Server
1829         Properties</guimenuitem>. On the <guilabel>Drivers</guilabel> tab you will see the new driver
1830         listed. This view enables you to also inspect the list of files belonging to that driver
1831         (this does not work on Windows NT, but only on Windows 2000 and Windows XP; Windows NT does not
1832         provide the <guimenuitem>Drivers</guimenuitem> tab). An
1833         alternative and much quicker method for
1834         Windows 2000/XP to start this dialog is by typing into a DOS box (you must of course adapt the
1835         name to your Samba server instead of <replaceable>SAMBA-CUPS</replaceable>):
1836         </para>
1838         <para><userinput>rundll32 printui.dll,PrintUIEntry /s /t2 /n\\<replaceable>SAMBA-CUPS</replaceable></userinput></para>
1839         </listitem>
1841         <listitem><para>
1842         From a UNIX prompt, run this command (or a variant thereof) where
1843         <replaceable>SAMBA-CUPS</replaceable> is the name of the Samba host and xxxx represents the
1844         actual Samba password assigned to root:
1845         </para>
1847         <para><userinput>rpcclient -U'root%xxxx' -c 'enumdrivers' <replaceable>SAMBA-CUPS</replaceable></userinput></para>
1849         <para>
1850         You will see a listing of all drivers Samba knows about. Your new one should be among
1851         them. But it is only listed under the <parameter>[Windows NT x86]</parameter> heading, not under
1852         <smbconfsection>[Windows 4.0]</smbconfsection>, since you didn't install that part. Or did you?
1853         You will see a listing of all drivers Samba knows about. Your new one should be among them. In
1854         our example it is named <constant>dm9110</constant>. Note that the third column shows the other
1855         installed drivers twice, one time for each supported architecture. Our new driver only shows up
1856         for <application>Windows NT 4.0 or 2000</application>. To have it present for <application>Windows
1857         95, 98 and ME</application>, you'll have to repeat the whole procedure with the WIN40 architecture
1858         and subdirectory.
1859         </para></listitem>
1860 </itemizedlist>
1861 </sect3>
1863 <sect3>
1864 <title>Specific Driver Name Flexibility</title>
1866 <para>
1867 You can name the driver as you like. If you repeat the <command>adddriver</command> step with the same
1868 files as before but with a different driver name, it will work the same:
1869 </para>
1871 <para><screen>
1872 &rootprompt;<userinput>rpcclient -Uroot%xxxx         \
1873   -c 'adddriver "Windows NT x86"                     \
1874   "mydrivername:HDNIS01_de.DLL:              \
1875   Hddm91c1_de.ppd:HDNIS01U_de.DLL:HDNIS01U_de.HLP:   \
1876   NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI,          \
1877   Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre,   \
1878   Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL, \
1879   HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP' SAMBA-CUPS
1880   </userinput>
1882 cmd = adddriver "Windows NT x86" \
1883  "mydrivername:HDNIS01_de.DLL:Hddm91c1_de.ppd:HDNIS01U_de.DLL:\
1884   HDNIS01U_de.HLP:NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI,           \
1885   Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre,                    \
1886   Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL,                  \
1887   HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP"
1889 Printer Driver mydrivername successfully installed.
1890 </screen></para>
1892 <para>
1893 You will be able to bind that driver to any print queue (however, you are responsible that
1894 you associate drivers to queues that make sense with respect to target printers). You cannot run the
1895 <command>rpcclient</command> <command>adddriver</command> command repeatedly. Each run consumes the
1896 files you had put into the <smbconfsection>[print$]</smbconfsection> share by moving them into the
1897 respective subdirectories. So you must execute an <command>smbclient ... put</command> command before
1898 each <command>rpcclient ... adddriver</command> command.
1899 </para>
1900 </sect3>
1902 <sect3>
1903 <title>Running <command>rpcclient</command> with the <command>setdriver</command></title>
1905 <para>
1906 Samba needs to know which printer owns which driver. Create a mapping of the driver to a printer, and
1907 store this info in Samba's memory, the TDB files. The <command>rpcclient setdriver</command> command
1908 achieves exactly this:
1909 </para>
1911 <para><screen>
1912 &rootprompt;<userinput>rpcclient -U'root%xxxx' -c 'setdriver dm9110 mydrivername' <replaceable>SAMBA-CUPS</replaceable></userinput>
1913  cmd = setdriver dm9110 mydrivername
1915 Successfully set dm9110 to driver mydrivername.
1916 </screen></para>
1918 <para>
1919 Ah, no, I did not want to do that. Repeat, this time with the name I intended: 
1920 </para>
1922 <para><screen>
1923 &rootprompt;<userinput>rpcclient -U'root%xxxx' -c 'setdriver dm9110 dm9110' <replaceable>SAMBA-CUPS</replaceable></userinput>
1924  cmd = setdriver dm9110 dm9110
1925 Successfully set dm9110 to driver dm9110.
1926 </screen></para>
1928 <para>
1929 The syntax of the command is:
1930 <screen>
1931 <userinput>rpcclient -U'root%<replaceable>sambapassword</replaceable>' -c 'setdriver <replaceable>printername</replaceable> \
1932  <replaceable>drivername</replaceable>' <replaceable>SAMBA-Hostname</replaceable></userinput>. 
1933 </screen>
1934 Now we have done most of the work, but not all of it.
1935 </para>
1937 <note><para>
1938 The <command>setdriver</command> command will only succeed if the
1939 printer is already known to Samba. A
1940 bug in 2.2.x prevented Samba from recognizing freshly installed printers. You had to restart Samba,
1941 or at least send an HUP signal to all running smbd processes to work around this: <userinput>kill -HUP
1942 `pidof smbd`</userinput>.
1943 </para></note>
1944 </sect3>
1945 </sect2>
1946 </sect1>
1948 <sect1>
1949 <title>Client Driver Installation Procedure</title>
1951 <para>
1952 As Don Quixote said: <quote>The proof of the pudding is in the eating.</quote> The proof
1953 for our setup lies in the printing. So let's install the printer driver onto the client PCs. This is
1954 not as straightforward as it may seem. Read on.
1955 </para>
1957 <sect2>
1958 <title>First Client Driver Installation</title>
1960 <para>
1961 Especially important is the installation onto the first client PC (for each architectural platform
1962 separately). Once this is done correctly, all further clients are easy to setup and shouldn't need further
1963 attention. What follows is a description for the recommended first procedure. You work now from a client
1964 workstation. You should guarantee that your connection is not unwittingly mapped to <emphasis>bad
1965 user</emphasis> nobody. In a DOS box type:
1966 </para>
1968 <para><userinput>net use \\<replaceable>SAMBA-SERVER</replaceable>\print$ /user:root</userinput></para>
1970 <para>
1971 Replace root, if needed, by another valid <smbconfoption><name>printer admin</name></smbconfoption> user as given in
1972 the definition. Should you already be connected as a different user, you will get an error message. There
1973 is no easy way to get rid of that connection, because Windows does not seem to know a concept of logging
1974 off from a share connection (do not confuse this with logging off from the local workstation; that is
1975 a different matter).  On Windows NT/2K, you can force a logoff from all smb/cifs connections by restarting the 
1976 <quote>workstation</quote> service. You can try to close all Windows file explorer and Internet Explorer for 
1977 Windows. As a last resort, you may have to reboot. Make sure there is no automatic reconnection set up. It may be
1978 easier to go to a different workstation and try from there. After you have made sure you are connected
1979 as a printer admin user (you can check this with the <command>smbstatus</command> command on Samba),
1980 do this from the Windows workstation:
1981 </para>
1983 <procedure>
1984         <step><para>
1985         Open <guiicon>Network Neighborhood</guiicon>.
1986         </para></step>
1988         <step><para>
1989         Browse to Samba server.
1990         </para></step>
1992         <step><para>
1993         Open its <guiicon>Printers and Faxes</guiicon> folder.
1994         </para></step>
1996         <step><para>
1997         Highlight and right-click on the printer.
1998         </para></step>
2000         <step><para>
2001         Select <guimenuitem>Connect</guimenuitem> (for Windows NT4/200x
2002         it is possibly <guimenuitem>Install</guimenuitem>).
2003         </para></step>
2004 </procedure>
2006 <para>
2007 A new printer (named <replaceable>printername</replaceable> on Samba-server) should now have
2008 appeared in your <emphasis>local</emphasis> Printer folder (check <guimenu>Start</guimenu> --
2009 <guimenuitem>Settings</guimenuitem> -- <guimenuitem>Control Panel</guimenuitem> -- <guiicon>Printers
2010 and Faxes</guiicon>).
2011 </para>
2013 <para>
2014 Most likely you are now tempted to try to print a test page. After all, you now can open the printer
2015 properties, and on the <guimenu>General</guimenu> tab there is a button offering to do just that. But
2016 chances are that you get an error message saying <errorname>Unable to print Test Page</errorname>. The
2017 reason might be that there is not yet a valid Device Mode set for the driver, or that the <quote>Printer
2018 Driver Data</quote> set is still incomplete.
2019 </para>
2021 <para>
2022 You must make sure that a valid <parameter>Device Mode</parameter> is set for the
2023 driver. We now explain what that means.
2024 </para>
2025 </sect2>
2027 <sect2>
2028 <title>Setting Device Modes on New Printers</title>
2030 <para>
2031 For a printer to be truly usable by a Windows NT/200x/XP client, it must possess:
2032 </para>
2034 <itemizedlist>
2035         <listitem><para>
2036         A valid <emphasis>Device Mode</emphasis> generated by the driver for the printer (defining things
2037         like paper size, orientation and duplex settings).
2038         </para></listitem>
2040         <listitem><para>
2041         A complete set of <emphasis>Printer Driver Data</emphasis> generated by the driver.
2042         </para></listitem>
2043 </itemizedlist>
2045 <para>
2046 If either of these is incomplete, the clients can produce less than optimal output at best. In the
2047 worst cases, unreadable garbage or nothing at all comes from the printer or it produces a harvest of
2048 error messages when attempting to print. Samba stores the named values and all printing related information in
2049 its internal TDB database files <filename>(ntprinters.tdb</filename>, <filename>ntdrivers.tdb</filename>,
2050 <filename>printing.tdb</filename> and <filename>ntforms.tdb</filename>).
2051 </para>
2053 <para>
2054 What do these two words stand for? Basically, the Device Mode and the set of Printer Driver Data is a
2055 collection of settings for all print queue properties, initialized in a sensible way. Device Modes and
2056 Printer Driver Data should initially be set on the print server (the Samba host) to healthy
2057 values so the clients can start to use them immediately. How do we set these initial healthy values?
2058 This can be achieved by accessing the drivers remotely from an NT (or 200x/XP) client, as is discussed
2059 in the following paragraphs.
2060 </para>
2062 <para>
2063 Be aware that a valid Device Mode can only be initiated by a
2064 <smbconfoption><name>printer admin</name></smbconfoption>, or root
2065 (the reason should be obvious). Device Modes can only be correctly
2066 set by executing the printer driver program itself. Since Samba cannot execute this Win32 platform driver
2067 code, it sets this field initially to NULL (which is not a valid setting for clients to use). Fortunately,
2068 most drivers automatically generate the Printer Driver Data that is needed when they are uploaded to the
2069 <smbconfsection>[print$]</smbconfsection> share with the help of the APW or rpcclient.
2070 </para>
2072 <para>
2073 The generation and setting of a first valid Device Mode, however, requires some tickling from a client,
2074 to set it on the Samba server. The easiest means of doing so is to simply change the page orientation on
2075 the server's printer. This executes enough of the printer driver program on the client for the desired
2076 effect to happen, and feeds back the new Device Mode to our Samba server. You can use the native Windows
2077 NT/200x/XP printer properties page from a Window client for this:
2078 </para>
2080 <procedure>
2081         <step><para>
2082         Browse the <guiicon>Network Neighborhood.</guiicon>
2083         </para></step>
2085         <step><para>
2086         Find the Samba server.
2087         </para></step>
2089         <step><para>
2090         Open the Samba server's <guiicon>Printers and Faxes</guiicon> folder.
2091         </para></step>
2093         <step><para>
2094         Highlight the shared printer in question.
2095         </para></step>
2097         <step><para>
2098         Right-click on the printer (you may already be here, if you followed the last section's description).
2099         </para></step>
2101         <step><para>
2102         At the bottom of the context menu select <guimenu>Properties</guimenu> (if the menu still offers the 
2103         <guimenuitem>Connect</guimenuitem> entry further above, you
2104         need to click on that one first to achieve the driver
2105         installation as shown in the last section).
2106         </para></step>
2108         <step><para>
2109         Go to the <guilabel>Advanced</guilabel> tab; click on <guibutton>Printing Defaults</guibutton>.
2110         </para></step>
2112         <step><para>
2113         Change the <guimenuitem>Portrait</guimenuitem> page setting to <guimenuitem>Landscape</guimenuitem> (and back).
2114         </para></step>
2116         <step><para>
2117         Make sure to apply changes between swapping the page orientation to cause the change to actually take effect.
2118         </para></step>
2120         <step><para>
2121         While you are at it, you may also want to set the desired printing defaults here, which then apply to all future
2122         client driver installations on the remaining from now on.
2123         </para></step>
2124 </procedure>
2126 <para>
2127 This procedure has executed the printer driver program on the client platform and fed back the correct
2128 Device Mode to Samba, which now stored it in its TDB files. Once the driver is installed on the client,
2129 you can follow the analogous steps by accessing the <emphasis>local</emphasis> <guiicon>Printers</guiicon>
2130 folder, too, if you are a Samba printer admin user. From now on, printing should work as expected.
2131 </para>
2133 <para>
2134 Samba includes a service level parameter name <parameter>default devmode</parameter> for generating a default
2135 Device Mode for a printer. Some drivers will function well with Samba's default set of properties. Others
2136 may crash the client's spooler service. So use this parameter with caution. It is always better to have
2137 the client generate a valid device mode for the printer and store it on the server for you.
2138 </para>
2139 </sect2>
2141 <sect2>
2142 <title>Additional Client Driver Installation</title>
2144 <para>
2145 Every additional driver may be installed, along the lines described
2146 above. Browse network, open the
2147 <guiicon>Printers</guiicon> folder on Samba server, right-click on <guiicon>Printer</guiicon> and choose
2148 <guimenuitem>Connect...</guimenuitem>. Once this completes (should be not more than a few seconds,
2149 but could also take a minute, depending on network conditions), you should find the new printer in your
2150 client workstation local <guiicon>Printers and Faxes</guiicon> folder.
2151 </para>
2153 <para>
2154 You can also open your local <guiicon>Printers and Faxes</guiicon> folder by
2155 using this command on Windows 200x/XP Professional workstations:
2156 </para>
2158 <para><userinput>rundll32 shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder</userinput></para>
2160 <para>
2161 or this command on Windows NT 4.0 workstations:
2162 </para>
2164 <para><userinput>
2165 rundll32 shell32.dll,Control_RunDLL MAIN.CPL @2
2166 </userinput></para>
2168 <para>
2169 You can enter the commands either inside a <guilabel>DOS box</guilabel> window or in the <guimenuitem>Run
2170 command...</guimenuitem> field from the <guimenu>Start</guimenu> menu.
2171 </para>
2172 </sect2>
2174 <sect2>
2175 <title>Always Make First Client Connection as root or <quote>printer admin</quote></title>
2177 <para>
2178 After you installed the driver on the Samba server (in its <smbconfsection>[print$]</smbconfsection>
2179 share, you should always make sure that your first client installation completes correctly. Make it a
2180 habit for yourself to build the very first connection from a client as <smbconfoption><name>printer admin</name></smbconfoption>. This is to make sure that:
2181 </para>
2183 <itemizedlist>
2184         <listitem><para>
2185         A first valid <emphasis>Device Mode</emphasis> is really initialized (see above for more
2186         explanation details).
2187         </para></listitem>
2189         <listitem><para>        
2190         The default print settings of your printer for all further client installations are as you want them.
2191         </para></listitem>
2192 </itemizedlist>
2194 <para>
2195 Do this by changing the orientation to landscape, click on <guiicon>Apply</guiicon>, and then change it
2196 back again. Next, modify the other settings (for example, you do not want the default media size set to
2197 <guiicon>Letter</guiicon> when you are all using <guiicon>A4</guiicon>, right? You may want to set the
2198 printer for <guiicon>duplex</guiicon> as the default, and so on).
2199 </para>
2201 <para>
2202 To connect as root to a Samba printer, try this command from a Windows 200x/XP DOS box command prompt:
2203 </para>
2205 <para><screen>
2206 &dosprompt;<userinput>runas /netonly /user:root "rundll32 printui.dll,PrintUIEntry /p /t3 /n 
2207         \\<replaceable>SAMBA-SERVER</replaceable>\<replaceable>printername</replaceable>"</userinput>
2208 </screen>
2209 </para>
2211 <para>
2212 You will be prompted for root's Samba-password; type it, wait a few
2213 seconds, click on <guibutton>Printing
2214 Defaults</guibutton>, and proceed to set the job options that should be used as defaults by all
2215 clients. Alternately, instead of root you can name one other member of the <smbconfoption><name>printer admin</name></smbconfoption> from the setting.
2216 </para>
2218 <para>
2219         Now all the other users downloading and installing the driver the same way <?latex \linebreak ?>(called
2220 <quote>Point'n'Print</quote>) will have the same defaults set for them. If you miss this step
2221 you'll get a lot of Help Desk calls from your users, but maybe you like to talk to people.
2222 </para>
2223 </sect2>
2224 </sect1>
2226 <sect1>
2227 <title>Other Gotchas</title>
2229 <para>
2230 Your driver is installed. It is now ready for Point'n'Print
2231 installation by the clients. You may have tried to download and use it
2232 onto your first client machine, but
2233 wait. Let's make sure you are acquainted first with a few tips and tricks you may find useful. For example,
2234 suppose you did not set the defaults on the printer, as advised in the preceding
2235 paragraphs. Your users complain about various issues (such as, <quote>We need to set the paper size
2236 for each job from Letter to A4 and it will not store it.</quote>)
2237 </para>
2239 <sect2>
2240 <title>Setting Default Print Options for Client Drivers</title>
2242 <para>
2243 The last sentence might be viewed with mixed feelings by some users and
2244 Admins. They have struggled for hours and could not arrive at a point
2245 where their settings seemed to be saved. It is not their fault. The confusing
2246 thing is that in the multi-tabbed dialog that pops up when you right-click
2247 on the printer name and select <guimenuitem>Properties</guimenuitem>, you
2248 can arrive at two dialogs that appear identical, each claiming that they help
2249 you to set printer options in three different ways. Here is the definite
2250 answer to the Samba default driver setting FAQ:
2251 </para>
2253 <formalpara><title><quote>I can not set and save default print options
2254 for all users on Windows 200x/XP. Why not?</quote></title>
2256 <para>
2257 How are you doing it? I bet the wrong way. (It is not easy to find out, though). There are three different
2258 ways to bring you to a dialog that seems to set everything. All three
2259 dialogs look the same, but only one
2260 of them does what you intend. You need to be Administrator or Print Administrator to do this for all
2261 users. Here is how I reproduce it in an XP Professional:
2262 </para>
2263 The following list needs periods after the letters and numbers:::::::::
2264 <orderedlist numeration="upperalpha">
2265         <listitem><para>The first <quote>wrong</quote> way:
2266         <orderedlist numeration="arabic">
2267                 <listitem><para>Open the <guiicon>Printers</guiicon> folder.</para></listitem>
2269                 <listitem><para>Right-click on the printer (<emphasis>remoteprinter on cupshost</emphasis>) and
2270                 select in context menu <guimenu>Printing Preferences...</guimenu></para></listitem>.
2272                 <listitem><para>Look at this dialog closely and remember what it looks like.</para></listitem>
2273         </orderedlist></para></listitem>
2275         <listitem><para>The second <quote>wrong</quote> way:
2276                 <orderedlist numeration="arabic">
2277                         <listitem><para>Open the <guimenu>Printers</guimenu> folder.</para></listitem>
2279                         <listitem><para>Right-click on the printer (<emphasis>remoteprinter on
2280                         cupshost</emphasis>) and select in the context menu
2281                         <guimenuitem>Properties</guimenuitem></para></listitem>
2283                         <listitem><para>Click on the <guilabel>General</guilabel>
2284                         tab</para></listitem>.
2286                         <listitem><para>Click on the <guibutton>Printing
2287                         Preferences...</guibutton></para></listitem> button.
2289                         <listitem><para>A new dialog opens. Keep this dialog open and go back
2290                         to the parent dialog.</para></listitem>
2291                 </orderedlist>
2292         </para></listitem>
2294         <listitem><para>
2295         The third and correct way: (should you do this from the beginning, just carry out steps 1
2296         and 2 from the second method above).
2297         </para>
2299                 <orderedlist numeration="arabic">
2300                         <listitem><para>Click on the <guilabel>Advanced</guilabel>
2301                         tab. (If everything is <quote>grayed out,</quote> then you are not logged
2302                         in as a user with enough privileges).</para></listitem>
2304                         <listitem><para>Click on the <guibutton>Printing
2305                         Defaults</guibutton> button.</para></listitem>
2307                         <listitem><para>On any of the two new tabs,
2308                         click on the
2309                         <guilabel>Advanced</guilabel> button.</para></listitem>
2311                         <listitem><para>A new dialog opens. Compare
2312                         this one to the other. Are they
2313                         identical looking comparing one from
2314                         <quote>B.5</quote> and one from A.3".</para></listitem>
2315                 </orderedlist>
2316         </listitem>
2317 </orderedlist>
2319 <para>
2320 Do you see any difference in the two settings dialogs? I do not either. However, only the last one, which
2321 you arrived at with steps C.1 through 6 will permanently save any settings which will then become the defaults
2322 for new users. If you want all clients to have the same defaults, you need to conduct these steps as
2323 administrator (<smbconfoption><name>printer admin</name></smbconfoption> in ) before
2324 a client downloads the driver (the clients can later set their own per-user defaults
2325 by following procedures A or B above). Windows 200x/XP allow per-user default settings and the ones the
2326 administrator gives them, before they set up their own. The parents of the identically-looking dialogs have a slight difference in their window names; one is called <computeroutput>Default Print
2327 Values for Printer Foo on Server Bar"</computeroutput> (which is the one you need) and the other is called
2328 <quote><computeroutput>Print Settings for Printer Foo on Server Bar</computeroutput></quote>. The last one is the one you
2329 arrive at when you right-click on the printer and select <guimenuitem>Print Settings...</guimenuitem>. This
2330 is the one that you were taught to use back in the days of Windows NT, so it is only natural to try the
2331 same way with Windows 200x/XP. You would not dream that there is now a different path to arrive at an
2332 identically looking, but functionally different, dialog to set defaults for all users.
2333 </para></formalpara>
2335 <tip><para>Try (on Windows 200x/XP) to run this command (as a user with the right privileges):
2336 </para>
2338 <para><userinput>
2339 rundll32 printui.dll,PrintUIEntry /p /t3 /n\\<replaceable>SAMBA-SERVER</replaceable>\<replaceable>printersharename</replaceable>
2340 </userinput></para>
2342 <para>
2343 To see the tab with the <guilabel>Printing Defaults</guilabel> button (the one you need),also run this command:
2344 </para>
2346 <para><userinput>
2347 rundll32 printui.dll,PrintUIEntry /p /t0 /n\\<replaceable>SAMBA-SERVER</replaceable>\<replaceable>printersharename</replaceable>
2348 </userinput></para>
2350 <para>
2351 To see the tab with the <guilabel>Printing Preferences</guilabel>
2352 button (the one which does not set system-wide defaults), you can
2353 start the commands from inside a DOS box" or from <guimenu>Start</guimenu> -> <guimenuitem>Run</guimenuitem>.
2354 </para>
2355 </tip>
2357 </sect2>
2359 <sect2>
2360 <title>Supporting Large Numbers of Printers</title>
2362 <para>
2363 One issue that has arisen during the recent development phase of Samba is the need to support driver
2364 downloads for hundreds of printers. Using Windows NT APW here is somewhat awkward (to say the least). If
2365 you do not want to acquire RSS pains from the printer installation clicking orgy alone, you need
2366 to think about a non-interactive script.
2367 </para>
2369 <para>
2370 If more than one printer is using the same driver, the <command>rpcclient setdriver</command>
2371 command can be used to set the driver associated with an installed queue. If the driver is uploaded to
2372 <smbconfsection>[print$]</smbconfsection> once and registered with the printing TDBs, it can be used by
2373 multiple print queues. In this case, you just need to repeat the <command>setprinter</command> subcommand of
2374 <command>rpcclient</command> for every queue (without the need to conduct the <command>adddriver</command>
2375 repeatedly). The following is an example of how this could be accomplished:
2376 </para>
2378 <para><screen>
2379 &rootprompt;<userinput>rpcclient <replaceable>SAMBA-CUPS</replaceable> -U root%<replaceable>secret</replaceable> -c 'enumdrivers'</userinput>
2380  cmd = enumdrivers
2382  [Windows NT x86]
2383  Printer Driver Info 1:
2384    Driver Name: [infotec  IS 2075 PCL 6]
2386  Printer Driver Info 1:
2387    Driver Name: [DANKA InfoStream]
2389  Printer Driver Info 1:
2390    Driver Name: [Heidelberg Digimaster 9110 (PS)]
2392  Printer Driver Info 1:
2393    Driver Name: [dm9110]
2395  Printer Driver Info 1:
2396    Driver Name: [mydrivername]
2398  [....]
2399 </screen>
2401 <screen>
2402 &rootprompt;<userinput>rpcclient <replaceable>SAMBA-CUPS</replaceable> -U root%<replaceable>secret</replaceable> -c 'enumprinters'</userinput>
2403  cmd = enumprinters
2404    flags:[0x800000]
2405    name:[\\SAMBA-CUPS\dm9110]
2406    description:[\\SAMBA-CUPS\dm9110,,110ppm HiVolume DANKA Stuttgart]
2407    comment:[110 ppm HiVolume DANKA Stuttgart]
2408  [....]
2409 </screen>
2411 <screen>
2412 &rootprompt;<userinput>rpcclient <replaceable>SAMBA-CUPS</replaceable> -U root%<replaceable>secret</replaceable> -c \
2413   'setdriver <replaceable>dm9110</replaceable> "<replaceable>Heidelberg Digimaster 9110 (PS)</replaceable>"'</userinput>
2414  cmd = setdriver dm9110 Heidelberg Digimaster 9110 (PPD)
2415  Successfully set dm9110 to driver Heidelberg Digimaster 9110 (PS).
2416 </screen>
2418 <screen>
2419 &rootprompt;<userinput>rpcclient <replaceable>SAMBA-CUPS</replaceable> -U root%<replaceable>secret</replaceable> -c 'enumprinters'</userinput>
2420  cmd = enumprinters
2421    flags:[0x800000]
2422    name:[\\SAMBA-CUPS\dm9110]
2423    description:[\\SAMBA-CUPS\dm9110,Heidelberg Digimaster 9110 (PS),\
2424      110ppm HiVolume DANKA Stuttgart]
2425    comment:[110ppm HiVolume DANKA Stuttgart]
2426  [....]
2427 </screen>
2429 <screen>
2430 &rootprompt;<userinput>rpcclient <replaceable>SAMBA-CUPS</replaceable> -U root%<replaceable>secret</replaceable> -c 'setdriver <replaceable>dm9110</replaceable> <replaceable>mydrivername</replaceable>'</userinput>
2431  cmd = setdriver dm9110 mydrivername
2432  Successfully set dm9110 to mydrivername.
2433 </screen>
2435 <screen>
2436 &rootprompt;<userinput>rpcclient <replaceable>SAMBA-CUPS</replaceable> -U root%<replaceable>secret</replaceable> -c 'enumprinters'</userinput>
2437  cmd = enumprinters
2438    flags:[0x800000]
2439    name:[\\SAMBA-CUPS\dm9110]
2440    description:[\\SAMBA-CUPS\dm9110,mydrivername,\
2441      110ppm HiVolume DANKA Stuttgart]
2442    comment:[110ppm HiVolume DANKA Stuttgart]
2443  [....]
2444 </screen></para>
2446 <para>
2447 It may not be easy to recognize that the first call to <command>enumprinters</command> showed the
2448 <quote>dm9110</quote> printer with an empty string where the driver should have been listed (between
2449 the 2 commas in the description field). After the <command>setdriver</command> command
2450 succeeded, all is well.
2451 </para>
2452 </sect2>
2454 <sect2>
2455 <title>Adding New Printers with the Windows NT APW</title>
2457 <para>
2458 By default, Samba exhibits all printer shares defined in &smb.conf; in the <guiicon>Printers</guiicon>
2459 folder. Also located in this folder is the Windows NT Add Printer Wizard icon. The APW will be shown only if:
2460 </para>
2462 <itemizedlist>
2463         <listitem><para>
2464         The connected user is able to successfully execute an <command>OpenPrinterEx(\\server)</command> with
2465         administrative privileges (i.e., root or <smbconfoption><name>printer admin</name></smbconfoption>).
2466         </para>
2468         <tip><para> Try this from a Windows 200x/XP DOS box command prompt:
2469         </para>
2471         <para><userinput>
2472         runas /netonly /user:root rundll32 printui.dll,PrintUIEntry /p /t0 /n \\<replaceable>SAMBA-SERVER</replaceable>\<replaceable>printersharename</replaceable>
2473         </userinput></para>
2475         <para>
2476         Click on <guibutton>Printing Preferences</guibutton>.
2477         </para></tip></listitem>
2479         <listitem><para>... contains the setting
2480         <smbconfoption><name>show add printer wizard</name><value>yes</value></smbconfoption> (the
2481         default).</para></listitem>
2482 </itemizedlist>
2484 <para>
2485 The APW can do various things:
2486 </para>
2488 <itemizedlist>
2489         <listitem><para>
2490         Upload a new driver to the Samba <smbconfsection>[print$]</smbconfsection> share.
2491         </para></listitem>
2493         <listitem><para>
2494         Associate an uploaded driver with an existing (but still driverless) print queue.
2495         </para></listitem>
2497         <listitem><para>
2498         Exchange the currently used driver for an existing print queue with one that has been uploaded before.
2499         </para></listitem>
2501         <listitem><para>
2502         Add an entirely new printer to the Samba host (only in conjunction with a working
2503         <smbconfoption><name>add printer command</name></smbconfoption>. A corresponding
2504         <smbconfoption><name>delete printer command</name></smbconfoption> for removing entries from the
2505         <guiicon>Printers</guiicon> folder may also be provided).
2506         </para></listitem>
2507 </itemizedlist>
2509 <para>
2510 The last one (add a new printer) requires more effort than the previous ones. To use
2511 the APW to successfully add a printer to a Samba server, the <smbconfoption><name>add printer command</name></smbconfoption> must have a defined value. The program hook must successfully
2512 add the printer to the UNIX print system (i.e., to <filename>/etc/printcap</filename>,
2513 <filename>/etc/cups/printers.conf</filename> or other appropriate files) and to &smb.conf; if necessary.
2514 </para>
2516 <para>
2517 When using the APW from a client, if the named printer share does not exist, smbd will execute the
2518 <smbconfoption><name>add printer command</name></smbconfoption> and re-parse to the to attempt to locate the new printer
2519 share. If the share is still not defined, an error of <errorname>Access Denied</errorname> is returned to
2520 the client. The <smbconfoption><name>add printer command</name></smbconfoption> is executed
2521 under the context of the connected user, not necessarily a root account. A <smbconfoption><name>map to guest</name><value>bad user</value></smbconfoption> may have connected you unwittingly under the wrong
2522 privilege. You should check it by using the <command>smbstatus</command> command.
2523 </para>
2525 </sect2>
2527 <sect2>
2528 <title>Error Message: <quote><errorname>Cannot connect under a different Name</errorname></quote></title>
2530 <para>
2531 Once you are connected with the wrong credentials, there is no means to reverse the situation other than
2532 to close all Explorer Windows, and perhaps reboot.
2533 </para>
2535 <itemizedlist>
2536         <listitem><para>
2537         The <command>net use \\SAMBA-SERVER\sharename /user:root</command> gives you an error message:
2538         <quote>Multiple connections to a server or a shared resource by the same user utilizing
2539         the several user names are not allowed. Disconnect all previous connections to the server,
2540         esp. the shared resource, and try again.</quote>
2541         </para></listitem>
2543         <listitem><para>
2544         Every attempt to <quote>connect a network drive</quote> to <filename>\\SAMBASERVER\\print$</filename>
2545         to <constant>z:</constant> is countered by the pertinacious message: <quote>This
2546         network folder is currently connected under different credentials (username and password).
2547         Disconnect first any existing connection to this network share in order to connect again under
2548         a different username and password</quote>.
2549         </para></listitem>
2550 </itemizedlist>
2552 <para>
2553 So you close all connections. You try again. You get the same message. You check from the Samba side,
2554 using <command>smbstatus</command>. Yes, there are more connections. You kill them all. The client
2555 still gives you the same error message. You watch the smbd.log file on a high debug level and try
2556 reconnect. Same error message, but not a single line in the log. You start to wonder if there was a
2557 connection attempt at all. You run ethereal and tcpdump while you try to connect. Result: not a single
2558 byte goes on the wire. Windows still gives the error message. You close all Explorer windows and start it
2559 again. You try to connect &smbmdash; and this times it works!  Windows seems to cache connection information somewhere and
2560 does not keep it up-to-date (if you are unlucky you might need to reboot to get rid of the error message).
2561 </para>
2563 <para>
2564 The easiest way to forcefully terminate all connections from your client to a server is by executing:
2565 <screen>
2566 &dosprompt; net use * /delete
2567 </screen>
2568 This will disconnect all mapped drives also and will allow you create fresh connection as required.
2569 </para>
2570 </sect2>
2572 <sect2>
2573 <title>Take Care When Assembling Driver Files</title>
2575 <para>
2576 You need to be extremely careful when you take notes about the files and belonging to a particular
2577 driver. Don't confuse the files for driver version <quote>0</quote> (for Windows 9x/Me, going into
2578 <filename>[print$]/WIN/0/</filename>), driver version <filename>2</filename> (Kernel Mode driver for Windows NT,
2579 going into <filename>[print$]/W32X86/2/</filename> may be used on Windows 200x/XP also), and
2580 driver version <quote>3</quote> (non-Kernel Mode driver going into <filename>[print$]/W32X86/3/</filename>
2581 cannot be used on Windows NT). Quite often these different driver versions contain
2582 files that have the same name but actually are very different. If you look at them from
2583 the Windows Explorer (they reside in <filename>%WINDOWS%\system32\spool\drivers\W32X86\</filename>),
2584 you will probably see names in capital letters, while an <command>enumdrivers</command> command from Samba
2585 would show mixed or lower case letters. So it is easy to confuse them. If you install them manually using
2586 <command>rpcclient</command> and subcommands, you may even succeed without an error message. Only later,
2587 when you try install on a client, you will encounter error messages like <computeroutput>This server
2588 has no appropriate driver for the printer</computeroutput>.
2589 </para>
2591 <para>
2592 Here is an example. You are invited to look closely at the various files, compare their names and
2593 their spelling, and discover the differences in the composition of the version 2 and 3 sets. Note: the
2594 version 0 set contained 40 <parameter>Dependentfiles</parameter>, so I left it out for space reasons:
2595 </para>
2597 <para><screen>
2598 &rootprompt;<userinput>rpcclient -U 'Administrator%<replaceable>secret</replaceable>' -c 'enumdrivers 3' 10.160.50.8 </userinput>
2600  Printer Driver Info 3:
2601          Version: [3]
2602          Driver Name: [Canon iR8500 PS3]
2603          Architecture: [Windows NT x86]
2604          Driver Path: [\\10.160.50.8\print$\W32X86\3\cns3g.dll]
2605          Datafile: [\\10.160.50.8\print$\W32X86\3\iR8500sg.xpd]
2606          Configfile: [\\10.160.50.8\print$\W32X86\3\cns3gui.dll]
2607          Helpfile: [\\10.160.50.8\print$\W32X86\3\cns3g.hlp]
2609          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\aucplmNT.dll]
2610          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\ucs32p.dll]
2611          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\tnl32.dll]
2612          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\aussdrv.dll]
2613          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cnspdc.dll]
2614          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\aussapi.dat]
2615          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cns3407.dll]
2616          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\CnS3G.cnt]
2617          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\NBAPI.DLL]
2618          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\NBIPC.DLL]
2619          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcview.exe]
2620          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcdspl.exe]
2621          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcedit.dll]
2622          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcqm.exe]
2623          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcspl.dll]
2624          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cfine32.dll]
2625          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcr407.dll]
2626          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\Cpcqm407.hlp]
2627          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcqm407.cnt]
2628          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cns3ggr.dll]
2630          Monitorname: []
2631          Defaultdatatype: []
2633  Printer Driver Info 3:
2634          Version: [2]
2635          Driver Name: [Canon iR5000-6000 PS3]
2636          Architecture: [Windows NT x86]
2637          Driver Path: [\\10.160.50.8\print$\W32X86\2\cns3g.dll]
2638          Datafile: [\\10.160.50.8\print$\W32X86\2\IR5000sg.xpd]
2639          Configfile: [\\10.160.50.8\print$\W32X86\2\cns3gui.dll]
2640          Helpfile: [\\10.160.50.8\print$\W32X86\2\cns3g.hlp]
2642          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\AUCPLMNT.DLL]
2643          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\aussdrv.dll]
2644          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\cnspdc.dll]
2645          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\aussapi.dat]
2646          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\cns3407.dll]
2647          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\CnS3G.cnt]
2648          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\NBAPI.DLL]
2649          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\NBIPC.DLL]
2650          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\cns3gum.dll]
2652          Monitorname: [CPCA Language Monitor2]
2653          Defaultdatatype: []
2655 </screen></para>
2657 <para>
2658 If we write the <quote>version 2</quote> files and the <quote>version 3</quote> files
2659 into different text files and compare the result, we see this
2660 picture:
2661 </para>
2663 <para><screen>
2664 &rootprompt;<userinput>sdiff 2-files 3-files</userinput>
2666 <![CDATA[
2667  cns3g.dll                     cns3g.dll
2668  iR8500sg.xpd                  iR8500sg.xpd
2669  cns3gui.dll                   cns3gui.dll
2670  cns3g.hlp                     cns3g.hlp
2671  AUCPLMNT.DLL                | aucplmNT.dll
2672                              > ucs32p.dll
2673                              > tnl32.dll
2674  aussdrv.dll                   aussdrv.dll
2675  cnspdc.dll                    cnspdc.dll
2676  aussapi.dat                   aussapi.dat
2677  cns3407.dll                   cns3407.dll
2678  CnS3G.cnt                     CnS3G.cnt
2679  NBAPI.DLL                     NBAPI.DLL
2680  NBIPC.DLL                     NBIPC.DLL
2681  cns3gum.dll                 | cpcview.exe
2682                              > cpcdspl.exe 
2683                              > cpcqm.exe
2684                              > cpcspl.dll
2685                              > cfine32.dll
2686                              > cpcr407.dll
2687                              > Cpcqm407.hlp
2688                              > cpcqm407.cnt
2689                              > cns3ggr.dll
2691 </screen>
2693 Do not be fooled! Driver files for each version with identical
2694 names may be different in their content, as you can see from this size
2695 comparison:
2696 </para>
2698 <para><screen>
2699 &rootprompt;<userinput>for i in cns3g.hlp cns3gui.dll cns3g.dll; do                  \
2700            smbclient //10.160.50.8/print\$ -U 'Administrator%xxxx' \
2701            -c "cd W32X86/3; dir $i; cd .. ; cd 2; dir $i";      \
2702                    done</userinput>
2704   CNS3G.HLP               A   122981  Thu May 30 02:31:00 2002
2705   CNS3G.HLP               A    99948  Thu May 30 02:31:00 2002
2707   CNS3GUI.DLL             A  1805824  Thu May 30 02:31:00 2002
2708   CNS3GUI.DLL             A  1785344  Thu May 30 02:31:00 2002
2710   CNS3G.DLL               A  1145088  Thu May 30 02:31:00 2002
2711   CNS3G.DLL               A    15872  Thu May 30 02:31:00 2002
2712 </screen></para>
2714 <para>
2715 In my example were even more differences than shown here. Conclusion: you must be careful to select
2716 the correct driver files for each driver version. Don't rely on the
2717 names alone and don't interchange files
2718 belonging to different driver versions.
2719 </para>
2720 </sect2>
2722 <sect2>
2723 <title>Samba and Printer Ports</title>
2725 <para>
2726 Windows NT/2000 print servers associate a port with each printer. These normally take the form of
2727 <filename>LPT1:</filename>, <filename>COM1:</filename>,
2728 <filename>FILE:</filename>, and so on. Samba must also
2729 support the concept of ports associated with a printer. By default, only one printer port, named <quote>Samba
2730 Printer Port</quote>, exists on a system. Samba does not really need such a <quote>port</quote> in order
2731 to print; rather it is a requirement of Windows clients. They insist on being told about an available
2732 port when they request this information, otherwise they throw an error message at you. So Samba fakes the port
2733 information to keep the Windows clients happy.
2734 </para>
2736 <para>
2737 Samba does not support the concept of <constant>Printer Pooling</constant> internally either. Printer
2738 Pooling assigns a logical printer to multiple ports as a form of load balancing or fail over.
2739 </para>
2741 <para>
2742 If you require multiple ports be defined for some reason or another (my users and my boss should not know
2743 that they are working with Samba), configure <smbconfoption><name>enumports command</name></smbconfoption>
2744 which can be used to define an external program that generates a listing of ports on a system.
2745 </para>
2746 </sect2>
2748 <sect2>
2749 <title>Avoiding Common Client Driver Mis-configuration</title>
2751 <para>
2752 So now the printing works, but there are still problems. Most jobs print well, some do not print at
2753 all. Some jobs have problems with fonts, which do not look good. Some jobs print fast and some
2754 are dead-slow. We cannot cover it all, but we want to encourage you to read the brief paragraph about
2755 <quote>Avoiding the Wrong PostScript Driver Settings</quote> in the CUPS Printing part of this document.
2756 </para>
2757 </sect2>
2758 </sect1>
2760 <sect1>
2761 <title>The Imprints Tool-set</title>
2763 <para>
2764 The Imprints tool set provides a UNIX equivalent of the Windows NT Add Printer
2765 Wizard. For complete information, please refer to the 
2766 <ulink url="http://imprints.sourceforge.net/">Imprints</ulink> Web site as well as the documentation
2767 included with the imprints source distribution. This section only provides a brief introduction to
2768 the features of Imprints.
2769 </para>
2771 <para>
2772 Unfortunately, the Imprints tool-set is no longer maintained. As of December 2000, the project is in
2773 need of a new maintainer. The most important skill to have is Perl coding and an interest in MS-RPC-based
2774 printing used in Samba. If you wish to volunteer, please coordinate
2775 your efforts on the Samba technical
2776 mailing list. The tool-set is still in usable form, but only for a series of older printer models where
2777 there are prepared packages to use. Packages for more up-to-date print devices are needed if Imprints
2778 should have a future.
2779 </para>
2781 <sect2>
2782 <title>What is Imprints?</title>
2784 <para>
2785 Imprints is a collection of tools for supporting these goals:
2786 </para>
2788 <itemizedlist>
2789         <listitem><para>
2790         Providing a central repository of information regarding Windows NT and 95/98 printer driver packages.
2791         </para></listitem>
2793         <listitem><para>
2794         Providing the tools necessary for creating the Imprints printer driver packages.
2795         </para></listitem>
2797         <listitem><para>
2798         Providing an installation client that will obtain printer drivers from a central Internet (or intranet) Imprints Server
2799         repository and install them on remote Samba and Windows NT4 print servers.
2800         </para></listitem>
2801 </itemizedlist>
2802 </sect2>
2804 <sect2>
2805 <title>Creating Printer Driver Packages</title>
2807 <para>
2808 The process of creating printer driver packages is beyond the scope of this document (refer to Imprints.txt
2809 also included with the Samba distribution for more information). In short, an Imprints driver package
2810 is a gzipped tarball containing the driver files, related INF files, and a control file needed by the
2811 installation client.
2812 </para>
2813 </sect2>
2815 <sect2>
2816 <title>The Imprints Server</title>
2818 <para>
2819 The Imprints server is really a database server that may be queried via standard HTTP mechanisms. Each
2820 printer entry in the database has an associated URL for the actual downloading of the package. Each
2821 package is digitally signed via GnuPG which can be used to verify that
2822 the package downloaded is actually
2823 the one referred in the Imprints database. It is strongly recommended that this security check
2824 not be disabled.
2825 </para>
2826 </sect2>
2828 <sect2>
2829 <title>The Installation Client</title>
2831 <para>
2832 More information regarding the Imprints installation client is available from the the documentation file
2833 <filename>Imprints-Client-HOWTO.ps</filename> that is included with the Imprints source package. The Imprints
2834 installation client comes in two forms:
2835 </para>
2837 <itemizedlist>
2838         <listitem><para>A set of command line Perl scripts.</para></listitem>
2839         <listitem><para>A GTK+ based graphical interface to the command line Perl scripts.</para></listitem>
2840 </itemizedlist>
2842 <para>
2843 The installation client (in both forms) provides a means of querying the Imprints database server for
2844 a matching list of known printer model names as well as a means to download and install the drivers on
2845 remote Samba and Windows NT print servers.
2846 </para>
2848 <para>
2849 The basic installation process is in four steps and Perl code is wrapped around smbclient and rpcclient.
2850 </para>
2852 <itemizedlist>
2853         <listitem><para>
2854         For each supported architecture for a given driver:
2855         <orderedlist>
2856                 <listitem><para>rpcclient: Get the appropriate upload directory on the remote server.</para></listitem>
2857                 <listitem><para>smbclient: Upload the driver files.</para></listitem>
2858                 <listitem><para>rpcclient: Issues an AddPrinterDriver() MS-RPC.</para></listitem>
2859         </orderedlist>
2860         </para></listitem>
2862         <listitem><para>rpcclient: Issue an AddPrinterEx() MS-RPC to actually create the printer.</para></listitem>
2863 </itemizedlist>
2865 <para>
2866 One of the problems encountered when implementing the Imprints tool set was the name space issues between
2867 various supported client architectures. For example, Windows NT includes a driver named <quote>Apple LaserWriter
2868 II NTX v51.8</quote> and Windows 95 calls its version of this driver <quote>Apple LaserWriter II NTX</quote>.
2869 </para>
2871 <para>
2872 The problem is how to know what client drivers have been uploaded for a printer. An astute reader will
2873 remember that the Windows NT Printer Properties dialog only includes space for one printer driver name. A
2874 quick look in the Windows NT 4.0 system registry at:
2875 </para>
2877 <para><filename>
2878  HKLM\System\CurrentControlSet\Control\Print\Environment
2879 </filename></para>
2881 <para>
2882 will reveal that Windows NT always uses the NT driver name. This is okay as Windows NT always requires
2883 that at least the Windows NT version of the printer driver is present. Samba does not have the
2884 requirement internally, therefore, <quote>How can you use the NT driver name if it has not already been installed?</quote>
2885 </para>
2887 <para>
2888 The way of sidestepping this limitation is to require that all Imprints printer driver packages include both the Intel Windows NT and
2889 95/98 printer drivers and that the NT driver is installed first.
2890 </para>
2891 </sect2>
2892 </sect1>
2894 <sect1>
2895 <title>Adding Network Printers without User Interaction</title>
2897 <para>
2898 The following MS Knowledge Base article may be of some help if you need to handle Windows 2000
2899 clients: <emphasis>How to Add Printers with No User Interaction in Windows 2000,</emphasis> (<ulink
2900 url="http://support.microsoft.com/default.aspx?scid=kb;en-us;189105">http://support.microsoft.com/default.aspx?scid=kb;en-us;189105</ulink>).
2901 It also applies to Windows XP Professional clients.
2902 The ideas sketched out in this section are inspired by this article, which describes a command-line method that can be
2903 applied to install network and local printers and their drivers. This is most useful if integrated in Logon
2904 Scripts. You can see what options are available by typing in the command prompt (<command>DOS box</command>):
2905 </para>
2907 <para><userinput>rundll32 printui.dll,PrintUIEntry /?</userinput></para>
2909 <para>
2910 A window pops up that shows you all of the command-line switches available. An extensive list of examples
2911 is also provided. This is only for Win 200x/XP, it does not work on
2912 Windows NT. Windows NT probably has
2913 some other tools in the respective Resource Kit. Here is a suggestion about what a client logon script
2914 might contain, with a short explanation of what the lines actually do (it works if 200x/XP Windows
2915 clients access printers via Samba, and works for Windows-based print servers too):
2916 </para>
2918 <para><screen>
2919 <userinput>rundll32 printui.dll,PrintUIEntry /dn /n "\\cupsserver\infotec2105-IPDS" /q</userinput>
2920 <userinput>rundll32 printui.dll,PrintUIEntry /in /n "\\cupsserver\infotec2105-PS"</userinput>
2921 <userinput>rundll32 printui.dll,PrintUIEntry /y /n "\\cupsserver\infotec2105-PS"</userinput>
2922 </screen></para>
2924 <para>
2925 Here is a list of the used command-line parameters: 
2926 </para>
2928 <variablelist>
2929         <varlistentry><term>/dn</term>
2930                 <listitem><para>deletes a network printer</para></listitem>
2931         </varlistentry>
2932         <varlistentry><term>/q</term>
2933                 <listitem><para>quiet modus</para></listitem>
2934         </varlistentry>
2935         <varlistentry><term>/n</term>
2936                 <listitem><para>names a printer</para></listitem>
2937         </varlistentry>
2938         <varlistentry><term>/in</term>
2939                 <listitem><para>adds a network printer connection</para></listitem>
2940         </varlistentry>
2941         <varlistentry><term>/y</term>
2942                 <listitem><para>sets printer as default printer</para></listitem>
2943         </varlistentry>
2944 </variablelist>
2946 <itemizedlist>
2947         <listitem><para>
2948         Line 1 deletes a possibly existing previous network printer <emphasis>infotec2105-IPDS</emphasis>
2949         (which had used native Windows drivers with LPRng that were removed from the server that was
2950         converted to CUPS). The <command>/q</command> at the end eliminates Confirm
2951         or error dialog boxes from popping up. They should not be presented to the user logging on.
2952         </para></listitem>
2954         <listitem><para>        
2955         Line 2 adds the new printer
2956         <emphasis>infotec2105-PS</emphasis> (which actually is the same
2957         physical device but is now run by the new CUPS printing system and associated with the
2958         CUPS/Adobe PS drivers). The printer and its driver must have been added to Samba prior to
2959         the user logging in (e.g., by a procedure as discussed earlier in this chapter, or by running
2960         <command>cupsaddsmb</command>). The driver is now auto-downloaded to the client PC where the
2961         user is about to log in.
2962         </para></listitem>
2964         <listitem><para>
2965         Line 3 sets the default printer to this new network printer (there might be several other
2966         printers installed with this same method and some may be local as well, so we decide for a
2967         default printer). The default printer selection may, of course, be different for different users.
2968         </para></listitem>
2969 </itemizedlist>
2971 <para>
2972 The second line only works if the printer <emphasis>infotec2105-PS</emphasis> has an already working
2973 print queue on the <constant>cupsserver</constant>, and if the
2974 printer drivers have been successfully uploaded
2975 (via the <command>APW</command>, <command>smbclient/rpcclient</command>, or <command>cupsaddsmb</command>)
2976 into the <smbconfsection>[print$]</smbconfsection> driver repository of Samba. Some Samba versions
2977 prior to version 3.0 required a re-start of smbd after the printer install and the driver upload,
2978 otherwise the script (or any other client driver download) would fail.
2979 </para>
2981 <para>
2982 Since there no easy way to test for the existence of an installed network printer from the logon script,
2983 do not bother checking, just allow the de-installation/re-installation to occur every time a user logs in;
2984 it's really quick anyway (1 to 2 seconds).
2985 </para>
2987 <para>
2988 The additional benefits for this are:
2989 </para>
2991 <itemizedlist>
2992         <listitem><para>
2993         It puts in place any printer default setup changes automatically at every user logon.
2994         </para></listitem>
2996         <listitem><para>
2997         It allows for <quote>roaming</quote> users' login into the domain from different workstations.
2998         </para></listitem>
2999 </itemizedlist>
3001 <para>
3002 Since network printers are installed per user, this much simplifies the process of keeping the installation
3003 up-to-date. The few extra seconds at logon time will not really be noticeable. Printers can be centrally
3004 added, changed and deleted at will on the server with no user intervention required from the clients
3005 (you just need to keep the logon scripts up-to-date).
3006 </para>
3007 </sect1>
3009 <sect1>
3010 <title>The <command>addprinter</command> Command</title>
3012 <para>
3013 The <command>addprinter</command> command can be configured to be a shell script or program executed by
3014 Samba. It is triggered by running the APW from a client against the Samba print server. The APW asks
3015 the user to fill in several fields (such as printer name, driver to be used, comment, port monitor,
3016 and so on). These parameters are passed on to Samba by the APW. If the addprinter command is designed in a
3017 way that it can create a new printer (through writing correct printcap entries on legacy systems, or
3018 execute the <command>lpadmin</command> command on more modern systems) and create the associated share
3019 in, then the APW will in effect really create a new printer on Samba and the UNIX print subsystem!
3020 </para>
3021 </sect1>
3023 <sect1>
3024 <title>Migration of Classical Printing to Samba</title>
3026 <para>
3027 The basic NT-style printer driver management has not changed considerably in 3.0 over the 2.2.x releases
3028 (apart from many small improvements). Here migration should be quite easy, especially if you followed
3029 previous advice to stop using deprecated parameters in your setup. For migrations from an existing 2.0.x
3030 setup, or if you continued Windows 9x/Me-style printing in your Samba 2.2 installations, it is more of
3031 an effort. Please read the appropriate release notes and the HOWTO Collection for Samba-2.2.x. You can
3032 follow several paths. Here are possible scenarios for migration:
3033 </para>
3035 <itemizedlist>
3036         <listitem><para>
3037         You need to study and apply the new Windows NT printer and driver support. Previously used
3038         parameters <parameter>printer driver file</parameter>, <parameter>printer driver</parameter>
3039         and <parameter>printer driver location</parameter> are no longer supported.
3040         </para></listitem>
3042         <listitem><para>
3043         If you want to take advantage of Windows NT printer driver support, you also need to migrate the
3044         Windows 9x/Me drivers to the new setup.
3045         </para></listitem>
3047         <listitem><para>
3048         An existing <filename>printers.def</filename> file (the one specified in the now removed parameter
3049         <parameter>printer driver file</parameter>) will no longer work with Samba-3. In 3.0, smbd attempts
3050         to locate a Windows 9x/Me driver files for the printer in <smbconfsection>[print$]</smbconfsection>
3051         and additional settings in the TDB and only there; if it fails, it will <emphasis>not</emphasis>
3052         (as 2.2.x used to do) drop down to using a <filename>printers.def</filename> (and all associated
3053         parameters). The make_printerdef tool is removed and there is no backward compatibility for this.
3054         </para></listitem>
3056         <listitem><para>You need to install a Windows 9x/Me driver into the
3057         <smbconfsection>[print$]</smbconfsection> share for a printer on your Samba
3058         host. The driver files will be stored in the <quote>WIN40/0</quote> subdirectory of
3059         <smbconfsection>[print$]</smbconfsection>, and some other settings and information go
3060         into the printing-related TDBs.</para></listitem>
3062         <listitem><para>If you want to migrate an existing
3063         <filename>printers.def</filename> file into the new setup, the
3064         only current
3065         solution is to use the Windows NT APW to install the NT drivers
3066         and the 9x/Me drivers. This can be scripted using smbclient and
3067         rpcclient. See the Imprints installation client at:
3068         </para>
3070         <para>
3071                 <ulink noescape="1" url="http://imprints.sourceforge.net/">http://imprints.sourceforge.net/</ulink>
3072         </para>
3074         <para>
3075         for an example. See also the discussion of rpcclient usage in the
3076         <quote>CUPS Printing</quote> section.</para></listitem>
3077 </itemizedlist>
3078 </sect1>
3080 <sect1>
3081 <title>Publishing Printer Information in Active Directory or LDAP</title>
3083 <para>
3084 This will be addressed in a later update of this document. If you wish to volunteer your services to help
3085 document this, please contact <ulink url="mail://jht@samba.org">John H Terpstra.</ulink>
3086 </para>
3087 </sect1>
3089 <sect1>
3090 <title>Common Errors</title>
3092 <sect2>
3093 <title>I Give My Root Password but I Do Not Get Access</title>
3095 <para>
3096 Do not confuse the root password which is valid for the UNIX system (and in most cases stored in the
3097 form of a one-way hash in a file named <filename>/etc/shadow</filename>), with the password used to
3098 authenticate against Samba. Samba does not know the UNIX password. Root access to Samba resources
3099 requires that a Samba account for root must first be created. This is done with the <command>smbpasswd</command>
3100 command as follows:
3101 </para>
3103 <para><screen>
3104 &rootprompt; smbpasswd -a root
3105 New SMB password: secret
3106 Retype new SMB password: secret
3107 </screen></para>
3109 </sect2>
3111 <sect2>
3112 <title>My Print Jobs Get Spooled into the Spooling Directory, but Then Get Lost</title>
3114 <para>
3115 Do not use the existing UNIX print system spool directory for the Samba spool directory. It may seem
3116 convenient and a savings of space, but it only leads to problems. The two must be separate.
3117 </para>
3119 </sect2>
3120 </sect1>
3122 </chapter>