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