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