1 <chapter id="printing">
5 <firstname>Kurt</firstname><surname>Pfeifle</surname>
7 <orgname> Danka Deutschland GmbH </orgname>
8 <address><email>kpfeifle@danka.de</email></address>
11 <pubdate>May 32, 2003</pubdate>
14 <title>Classical Printing Support</title>
17 <title>Features and Benefits</title>
20 Printing is often a mission-critical service for the users. Samba can
21 provide this service reliably and seamlessly for a client network
22 consisting of Windows workstations.
26 A Samba-3.0 print service may be run on a Standalone or a Domain
27 member server, side by side with file serving functions, or on a
28 dedicated print server. It can be made as tight or as loosely secured
29 as needs dictate. Configurations may be simple or complex. Available
30 authentication schemes are essentially the same as described for file
31 services in previous chapters. Overall, Samba's printing support is
32 now able to replace an NT or Windows 2000 print server full-square,
33 with additional benefits in many cases. Clients may download and
34 install drivers and printers through their familiar "Point'n'Print"
35 mechanism. Printer installations executed by "Logon Scripts" are no
36 problem. Administrators can upload and manage drivers to be used by
37 clients through the familiar "Add Printer Wizard". As an additional
38 benefit, driver and printer management may be run from the commandline
39 or through scripts, making it more efficient in case of large numbers
40 of printers. If a central accounting of print jobs (tracking every
41 single page and supplying the raw data for all sorts of statistical
42 reports) is required, this is best supported by CUPS as the print
43 subsystem underneath the Samba hood.
47 This chapter deals with the foundations of Samba printing, as they
48 implemented by the more traditional UNIX (BSD- and System V-style)
49 printing systems. Many things apply to CUPS, the newer Common UNIX
50 Printing System, too; so if you use CUPS, you might be tempted to jump
51 to the next chapter -- but you will certainly miss a few things if you
52 do so. Better read this chapter too.
57 Most of the given examples have been verified on Windows XP
58 Professional clients. Where this document describes the responses to
59 commands given, bear in mind that Windows 2000 clients are very
60 similar, but may differ in details. Windows NT is somewhat different
68 <title>Technical Introduction</title>
71 Samba's printing support always relies on the installed print
72 subsystem of the Unix OS it runs on. Samba is a "middleman". It takes
73 printfiles from Windows (or other SMB) clients and passes them to the
74 real printing system for further processing. Therefore it needs to
75 "talk" to two sides: to the Windows print clients and to the Unix
76 printing system. Hence we must differentiate between the various
77 client OS types each of which behave differently, as well as the
78 various UNIX print subsystems, which themselves have different
79 features and are accessed differently. This part of the Samba HOWTO
80 Collection deals with the "traditional" way of Unix printing first;
81 the next chapter covers in great detail the more modern
82 <emphasis>Common UNIX Printing System</emphasis>
85 <important><para>CUPS users, be warned: don't just jump on to the next
86 chapter. You might miss important information contained only
87 here!</para></important>
91 <title>What happens if you send a Job from a Client</title>
94 To successfully print a job from a Windows client via a Samba
95 print server to a UNIX printer, there are 6 (potentially 7)
100 <listitem><para>Windows opens a connection to the printershare</para></listitem>
102 <listitem><para>Samba must authenticate the user</para></listitem>
104 <listitem><para>Windows sends a copy of the printfile over the network
105 into Samba's spooling area</para></listitem>
107 <listitem><para>Windows closes the connection again</para></listitem>
109 <listitem><para>Samba invokes the print command to hand the file over
110 to the UNIX print subsystem's spooling area</para></listitem>
112 <listitem><para>The Unix print subsystem processes the print
113 job</para></listitem>
115 <listitem><para>The printfile may need to be explicitely deleted
116 from the Samba spooling area.</para></listitem>
122 <title>Printing Related Configuration Parameters</title>
125 There are a number of configuration parameters in
126 <filename>smb.conf</filename> controlling Samba's printing
127 behaviour. Please also refer to the man page for smb.conf to
128 acquire an overview about these. As with other parameters, there are
129 Global Level (tagged with a "<emphasis>G</emphasis>" in the listings) and
130 Service Level ("<emphasis>S</emphasis>") parameters.
134 <varlistentry><term>Service Level Parameters</term>
135 <listitem><para>These <emphasis>may</emphasis> go into the
136 <parameter>[global]</parameter> section of
137 <filename>smb.conf</filename>. In this case they define the default
138 behaviour of all individual or service level shares (provided those
139 don't have a different setting defined for the same parameter, thus
140 overriding the global default).</para></listitem>
143 <varlistentry><term>Global Parameters</term>
144 <listitem><para>These <emphasis>may not</emphasis> go into individual
145 shares. If they go in by error, the "testparm" utility can discover
146 this (if you run it) and tell you so.</para></listitem>
152 <title>Parameters Recommended for Use</title>
154 <para>The following <filename>smb.conf</filename> parameters directly
155 related to printing are used in Samba-3. See also the
156 <filename>smb.conf</filename> man page for detailed explanations:
160 <title>LIST OF PRINTING RELATED PARAMETERS IN Samba-3</title>
162 <itemizedlist><title>Global level parameters:</title>
163 <listitem><para><parameter>addprinter command (G)</parameter></para></listitem>
164 <listitem><para><parameter>deleteprinter command (G)</parameter></para></listitem>
165 <listitem><para><parameter>disable spoolss (G)</parameter></para></listitem>
166 <listitem><para><parameter>enumports command (G)</parameter></para></listitem>
167 <listitem><para><parameter>load printers (G)</parameter></para></listitem>
168 <listitem><para><parameter>lpq cache time (G)</parameter></para></listitem>
169 <listitem><para><parameter>os2 driver map (G)</parameter></para></listitem>
170 <listitem><para><parameter>printcap name (G), printcap (G)</parameter></para></listitem>
171 <listitem><para><parameter>show add printer wizard (G)</parameter></para></listitem>
172 <listitem><para><parameter>total print jobs (G)</parameter></para></listitem>
173 <listitem><para><parameter>use client driver (G)</parameter></para></listitem>
176 <itemizedlist><title>Service level parameters:</title>
177 <listitem><para><parameter>hosts allow (S)</parameter></para></listitem>
178 <listitem><para><parameter>hosts deny (S)</parameter></para></listitem>
179 <listitem><para><parameter>lppause command (S)</parameter></para></listitem>
180 <listitem><para><parameter>lpq command (S)</parameter></para></listitem>
181 <listitem><para><parameter>lpresume command (S)</parameter></para></listitem>
182 <listitem><para><parameter>lprm command (S)</parameter></para></listitem>
183 <listitem><para><parameter>max print jobs (S)</parameter></para></listitem>
184 <listitem><para><parameter>min print space (S)</parameter></para></listitem>
185 <listitem><para><parameter>print command (S)</parameter></para></listitem>
186 <listitem><para><parameter>printable (S), print ok (S)</parameter></para></listitem>
187 <listitem><para><parameter>printer name (S), printer (S)</parameter></para></listitem>
188 <listitem><para><parameter>printer admin (S)</parameter></para></listitem>
189 <listitem><para><parameter>printing = [cups|bsd|lprng...] (S)</parameter></para></listitem>
190 <listitem><para><parameter>queuepause command (S)</parameter></para></listitem>
191 <listitem><para><parameter>queueresume command (S)</parameter></para></listitem>
192 <listitem><para><parameter>total print jobs (S)</parameter></para></listitem>
198 Samba's printing support implements the Microsoft Remote Procedure
199 Calls (MS-RPC) methods for printing. These are used by Windows NT (and
200 later) print servers. The old "LanMan" protocol is still supported as
201 a fallback resort, and for older clients to use. More details will
202 follow further beneath.
207 <title>Parameters for Backwards Compatibility</title>
210 Two new parameters that were added in Samba 2.2.2, are still present
211 in Samba-3.0. Both of these options are described in the
212 <filename>smb.conf</filename>(5) man page and are disabled by
213 default. <emphasis>Use them with caution!</emphasis>
217 <varlistentry><term><parameter>disable spoolss(G)</parameter></term>
218 <listitem><para> This is
219 provided for better support of Samba 2.0.x backwards capability. It
220 will disable Samba's support for MS-RPC printing and yield identical
221 printing behaviour to Samba 2.0.x.</para></listitem>
224 <varlistentry><term><parameter>use client driver (G)</parameter></term>
225 <listitem><para> was provided
226 for using local printer drivers on Windows NT/2000 clients. It does
227 not apply to Windows 95/98/ME clients.</para></listitem>
232 <title>PARAMETERS "FOR BACKWARD COMPATIBILITY ONLY", USE WITH CAUTION</title>
236 <listitem><para><parameter>disable spoolss (G)</parameter></para></listitem>
238 <listitem><para><parameter>use client driver (S)</parameter></para></listitem>
246 <title>Parameters no longer in Use</title>
249 Samba users upgrading from 2.2.x to 3.0 need to be aware that some
250 previously available settings are no longer supported (as was
251 announced some time ago). Here is a list of them:
255 <title>"OLD" PARAMETERS, REMOVED IN Samba-3</title>
258 The following <filename>smb.conf</filename> parameters have been
259 deprecated already in Samba 2.2 and are now completely removed from
260 Samba-3. You cannot use them in new 3.0 installations:
263 <listitem><para><parameter>printer driver file (G)</parameter></para></listitem>
264 <listitem><para><parameter>total print jobs (G)</parameter></para></listitem>
265 <listitem><para><parameter>postscript (S)</parameter></para></listitem>
266 <listitem><para><parameter>printer driver (S)</parameter></para></listitem>
267 <listitem><para><parameter>printer driver location (S)</parameter></para></listitem>
277 <title>A simple Configuration to Print with Samba-3</title>
280 Here is a very simple example configuration for print related settings
281 in the <filename>smb.conf</filename> file. If you compare it with your
282 own system's <filename>smb.conf</filename>, you probably find some
283 additional parameters included there (as pre-configured by your OS
284 vendor). Further below is a discussion and explanation of the
285 parameters. Note, that this example doesn't use many parameters.
286 However, in many environments these are enough to provide a valid
287 <filename>smb.conf</filename> which enables all clients to print.
296 path = /var/spool/samba
303 This is only an example configuration. Many settings, if not
304 explicitly set to a specific value, are used and set by Samba
305 implicitly to its own default, because these have been compiled in.
306 To see all settings, let root use the <command>testparm</command>
307 utility. <command>testparm</command> also gives warnings if you have
308 mis-configured certain things. Its complete output is easily 340 lines
309 and more. You may want to pipe it through a pager program.
313 The syntax for the configuration file is easy to grasp. You should
314 know that <filename>smb.conf</filename> is not very picky about its
315 syntax. It has been explained elsewhere in this document. A short
316 reminder: It even tolerates some spelling errors (like "browsable"
317 instead of "browseable"). Most spelling is case-insensitive. Also, you
318 can use "Yes|No" or "True|False" for boolean settings. Lists of names
319 may be separated by commas, spaces or tabs.
323 <title>Verification of "Settings in Use" with <command>testparm</command></title>
326 To see all (or at least most) printing related settings in Samba,
327 including the implicitly used ones, try the command outlined below
328 (hit "ENTER" twice!). It greps for all occurrences of "lp", "print",
329 "spool", "driver", "ports" and "[" in testparm's output and gives you
330 a nice overview about the running smbd's print configuration. (Note
331 that this command does not show individually created printer shares,
332 or the spooling paths in each case). Here is the output of my Samba
333 setup, with exactly the same settings in <filename>smb.conf</filename>
339 transmeta: # testparm -v | egrep "(lp|print|spool|driver|ports|\[)"
341 Load smb config files from /etc/samba/smb.conf.simpleprinting
342 Processing section "[homes]"
343 Processing section "[printers]"
350 printcap name = /etc/printcap
354 deleteprinter command =
355 show add printer wizard = Yes
359 max print jobs = 1000
362 print command = lpr -r -P'%p' %s
363 lpq command = lpq -P'%p'
364 lprm command = lprm -P'%p' %j
368 use client driver = No
373 path = /var/spool/samba
379 You can easily verify which settings were implicitly added by Samba's
380 default behaviour. <emphasis>Don't forget about this point: it may
381 be important in your future dealings with Samba.</emphasis>
384 <note><para> testparm in Samba-3.0 behaves differently from 2.2.x: used
385 without the "-v" switch it only shows you the settings actually
386 written into <filename>smb.conf</filename>! To see the complete
387 configuration used, add the "-v" parameter to testparm.</para></note>
392 <title>A little Experiment to warn you</title>
395 Should you need to troubleshoot at any stage, please always come back
396 to this point first and verify if "testparm" shows the parameters you
397 expect! To give you an example from personal experience as a warning,
398 try to just "comment out" the <parameter>load printers</parameter>"
399 parameter. If your 2.2.x system behaves like mine, you'll see this:
404 kde-bitshop:/etc/samba # grep "load printers" smb.conf
405 # load printers = Yes
406 # This setting is commented ooouuuuut!!
408 kde-bitshop:/etc/samba # testparm -v smb.conf | egrep "(load printers)"
414 Despite my imagination that the commenting out of this setting should
415 prevent Samba from publishing my printers, it still did! Oh Boy -- it
416 cost me quite some time to find out the reason. But I am not fooled
417 any more... at least not by this ;-)
422 kde-bitshop:/etc/samba # grep -A1 "load printers" smb.conf
424 # This setting is what I mean!!
425 # load printers = Yes
426 # This setting is commented ooouuuuut!!
428 kde-bitshop:/etc/samba # testparm -v smb.conf.simpleprinting | egrep "(load printers)"
434 Only when setting the parameter explicitly to
435 "<parameter>load printers = No</parameter>"
436 would Samba recognize my intentions. So my strong advice is:
440 <listitem><para>Never rely on "commented out" parameters!</para></listitem>
442 <listitem><para>Always set it up explicitly as you intend it to
443 behave.</para></listitem>
445 <listitem><para>Use <command>testparm</command> to uncover hidden
446 settings which might not reflect your intentions.</para></listitem>
451 You can have a working Samba print configuration with this
452 minimal <filename>smb.conf</filename>:
457 kde-bitshop:/etc/samba # cat /etc/samba/smb.conf-minimal
463 This example should show you that you can use testparm to test any
464 filename for fitness as a Samba configuration. Actually, we want to
465 encourage you <emphasis>not</emphasis> to change your
466 <filename>smb.conf</filename> on a working system (unless you know
467 exactly what you are doing)! Don't rely on an assumption that changes
468 will only take effect after you re-start smbd! This is not the
469 case. Samba re-reads its <filename>smb.conf</filename> every 60
470 seconds and on each new client connection. You might have to face
471 changes for your production clients that you didn't intend to apply at
472 this time! You will now note a few more interesting things. Let's now
473 ask <command>testparm</command> what the Samba print configuration
474 would be, if you used this minimalistic file as your real
475 <filename>smb.conf</filename>:
480 kde-bitshop:~ # testparm -v /etc/samba/smb.conf-minimal | egrep "(print|lpq|spool|driver|ports|[)"
481 Processing section "[printers]"
482 WARNING: [printers] service MUST be printable!
483 No path in service printers - using /tmp
488 printcap name = /etc/printcap
492 deleteprinter command =
493 show add printer wizard = Yes
497 max print jobs = 1000
500 print command = lpr -r -P%p %s
501 lpq command = lpq -P%p
503 use client driver = No
510 testparm issued 2 warnings:
514 <listitem><para>because we didn't specify the
515 <parameter>[printers]</parameter> section as printable,
516 and</para></listitem>
518 <listitem><para>because we didn't tell it which spool directory to
519 use.</para></listitem>
524 However, this was not fatal, and Samba-3.0 will default to values that
525 will work here. But, please!, don't rely on this and don't use this
526 example! This was only meant to make you careful to design and specify
527 your setup to be what you really want it to be. The outcome on your
528 system may vary for some parameters, since you may have a Samba built
529 with a different compile-time configuration.
530 <emphasis>Warning:</emphasis> don't put a comment sign <emphasis>at
531 the end</emphasis> of a valid <filename>smb.conf</filename> line. It
532 will cause the parameter to be ignored (just as if you had put the
533 comment sign at the front). At first I regarded this as a bug in my
534 Samba version(s). But the man page states: <quote>Internal whitespace
535 in a parameter value is retained verbatim.</quote> This means that a
536 line consisting of, for example,
540 printing =lprng #This defines LPRng as the printing system"
544 will regard the whole of the string after the "="
545 sign as the value you want to define. And this is an invalid value
546 that will be ignored, and a default value used instead.]
552 <title>Extended Sample Configuration to Print with Samba-3</title>
555 Here we show a more verbose example configuration for print related
556 settings in an <filename>smb.conf</filename>. Below is a discussion
557 and explanation of the various parameters. We chose to use BSD-style
558 printing here, because we guess it is still the most commonly used
559 system on legacy Linux installations (new installs now predominantly
560 have CUPS, which is discussed entirely in the next chapter of this
561 document). Note, that this example explicitly names many parameters
562 which don't need to be stated because they are set by default. You
563 might be able to do with a leaner <filename>smb.conf</filename>.</para>
566 if you read access it with the Samba Web Administration Tool (SWAT),
567 and then write it to disk again, it will be optimized in a way such
568 that it doesn't contain any superfluous parameters and comments. SWAT
569 organizes the file for best performance. Remember that each smbd
570 re-reads the Samba configuration once a minute, and that each
571 connection spawns an smbd process of its own, so it is not a bad idea
572 to optimize the <filename>smb.conf</filename> in environments with
573 hundreds or thousands of clients.</para></tip>
579 show add printer wizard = yes
580 printcap name = /etc/printcap
581 printer admin = @ntadmin, root
582 total print jobs = 100
584 use client driver = no
587 comment = All Printers
589 path = /var/spool/samba
597 comment = Printer with Restricted Access
598 path = /var/spool/samba_my_printer
603 hosts allow = 0.0.0.0
604 hosts deny = turbo_xp, 10.160.50.23, 10.160.51.60
609 This <emphasis>also</emphasis> is only an example configuration. You
610 may not find all the settings in your own
611 <filename>smb.conf</filename> (as pre-configured by your OS
612 vendor). Many configuration parameters, if not explicitly set to a
613 specific value, are used and set by Samba implicitly to its own
614 default, because these have been compiled in. To see all settings, let
615 root use the <command>testparm</command>
616 utility. <command>testparm</command> also gives warnings if you have
617 mis-configured certain things..
622 <title>Detailed Explanation of the Example's Settings</title>
625 Following is a discussion of the settings from above shown example.
629 <title>The [global] Section</title>
632 The <parameter>[global]</parameter> section is one of 4 special
633 sections (along with [<parameter>[homes]</parameter>,
634 <parameter>[printers]</parameter> and
635 <parameter>[print$]</parameter>...) It contains all parameters which
636 apply to the server as a whole. It is the place for parameters which
637 have only a "global" meaning (G). It may also contain service level
638 parameters (S) which then define default settings for all other
639 sections and shares. This way you can simplify the configuration and
640 avoid setting the same value repeatedly. (Within each individual
641 section or share you may however override these globally set "share
642 level" settings and specify other values).
646 <varlistentry><term><parameter>printing = bsd</parameter></term>
647 <listitem><para> this causes Samba to use default print commands
648 applicable for the BSD (a.k.a. RFC 1179 style or LPR/LPD) printing
649 system. In general, the "printing" parameter informs Samba about the
650 print subsystem it should expect. Samba supports CUPS, LPD, LPRNG,
651 SYSV, HPUX, AIX, QNX and PLP. Each of these systems defaults to a
652 different "print command" (and other queue control
653 commands). <emphasis>Caution:</emphasis> The "printing" parameter is
654 normally a service level parameter. Since it is included here in the
655 <parameter>[global]</parameter> section, it will take effect for all
656 printer shares that are not defined differently. Samba-3.0 no longer
657 supports the SOFTQ printing system.</para></listitem></varlistentry>
659 <varlistentry><term><parameter>load printers = yes</parameter></term>
660 <listitem><para> this tells Samba to create automatically all
661 available printer shares. "Available" printer shares are discovered by
662 scanning the printcap file. All created printer shares are also loaded
663 for browsing. If you use this parameter, you do not need to specify
664 separate shares for each printer. Each automatically created printer
665 share will clone the configuration options found in the
666 <parameter>[printers]</parameter> section. (A <parameter>load printers
667 = no</parameter> setting will allow you to specify each UNIX printer
668 you want to share separately, leaving out some you don't want to be
669 publicly visible and available). </para></listitem></varlistentry>
671 <varlistentry><term><parameter>show add printer wizard =
672 yes</parameter></term> <listitem><para> this setting is normally
673 enabled by default (even if the parameter is not written into the
674 <filename>smb.conf</filename>). It makes the "Add Printer Wizard" icon
675 show up in the "Printers" folder of the Samba host's share listing (as
676 shown in "Network Neighbourhood" or by the "net view" command). To
677 disable it, you need to explicitly set it to "no" (commenting it out
678 will not suffice!). The Add Printer Wizard lets you upload printer
679 drivers to the <parameter>[print$]</parameter> share and associate it
680 with a printer (if the respective queue exists there before the
681 action), or exchange a printer's driver against any other previously
682 uploaded driver. </para></listitem></varlistentry>
684 <varlistentry><term><parameter>total print jobs = 100</parameter></term>
685 <listitem><para> this setting sets the upper limit to 100 print jobs
686 being active on the Samba server at any one time. Should a client
687 submit a job which exceeds this number, a <quote>no more space
688 available on server</quote> type of error message will be returned by
689 Samba to the client. A setting of "0" (the default) means there is
690 <emphasis>no</emphasis> limit at all!
691 </para></listitem></varlistentry>
693 <varlistentry><term><parameter>printcap name = /etc/printcap</parameter></term>
695 <listitem><para> this tells Samba where to look for a list of
696 available printer names. (If you use CUPS, make sure that a printcap
697 file is written: this is controlled by the "Printcap" directive of
698 <filename>cupsd.conf</filename>).
699 </para></listitem></varlistentry>
701 <varlistentry><term><parameter>printer admin = @ntadmin</parameter></term>
702 <listitem><para> members of the ntadmin group should be able to add
703 drivers and set printer properties ("ntadmin" is only an example name,
704 it needs to be a valid UNIX group name); root is implicitly always a
705 'printer admin'. The "@" sign precedes group names in
706 <filename>smb.conf</filename>. A printer admin can do anything to
707 printers via the remote administration interfaces offered by MS-RPC
708 (see below). Note that the <parameter>printer admin</parameter>
709 parameter is normally a share level parameter, so you may associate
710 different groups to different printer shares in larger installations,
711 if you use the <parameter>printer admin</parameter> parameter on the
713 </para></listitem></varlistentry>
715 <varlistentry><term><parameter>lpq cache time = 20</parameter></term>
716 <listitem><para> this controls the cache time for the results of the
717 lpq command. It prevents the lpq command being called too often and
718 reduces load on a heavily used print server.
719 </para></listitem></varlistentry>
721 <varlistentry><term><parameter>use client driver = no</parameter></term>
722 <listitem><para> if set to "yes", this setting only takes effect for
723 Win NT/2k/XP clients (and not for Win 95/98/ME). Its default value is
724 "No" (or "False"). It must <emphasis>not</emphasis> be enabled on
725 print shares (with a "yes" or "true" setting) which have valid drivers
726 installed on the Samba server! For more detailed explanations see the
727 man page of <filename>smb.conf</filename>.
728 </para></listitem></varlistentry>
734 <title>The [printers] Section</title>
737 This is the second special section. If a section with this name
738 appears in the <filename>smb.conf</filename>, users are able to
739 connect to any printer specified in the Samba host's printcap file,
740 because Samba on startup then creates a printer share for every
741 printername it finds in the printcap file. You could regard this
742 section as a general convenience shortcut to share all printers with
743 minimal configuration. It is also a container for settings which
744 should apply as default to all printers. (For more details see the
745 <filename>smb.conf</filename> man page.) Settings inside this
746 container must be share level parameters (S).
750 <varlistentry><term><parameter>comment = All printers</parameter></term>
751 <listitem><para> the <parameter>comment</parameter> is shown next to
752 the share if a client queries the server, either via "Network
753 Neighbourhood" or with the <command>net view</command> command to list
755 </para></listitem></varlistentry>
757 <varlistentry><term><parameter>printable = yes</parameter></term>
758 <listitem><para> please note well, that the
759 <parameter>[printers]</parameter> service <emphasis>must</emphasis> be
760 declared as printable. If you specify otherwise, smbd will refuse to
761 load <filename>smb.conf</filename> at startup. This parameter allows
762 connected clients to open, write to and submit spool files into the
763 directory specified with the <parameter>path</parameter> parameter for
764 this service. It is used by Samba to differentiate printer shares from
765 file shares. </para></listitem></varlistentry>
767 <varlistentry><term><parameter>path = /var/spool/samba</parameter></term>
768 <listitem><para>this must point to a directory used by Samba to spool
769 incoming print files. <emphasis>It must not be the same as the spool
770 directory specified in the configuration of your UNIX print
771 subsystem!</emphasis> The path would typically point to a directory
772 which is world writeable, with the "sticky" bit set to it.
773 </para></listitem></varlistentry>
775 <varlistentry><term><parameter>browseable = no</parameter></term>
776 <listitem><para> this is always set to "no" if <parameter>printable =
777 yes</parameter>. It makes the [printer] 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>
783 <varlistentry><term><parameter>guest ok = yes</parameter></term>
786 if set to "yes", then no password is required to
787 connect to the printers service. Access will be granted with the
788 privileges of the "guest account". On many systems the guest
789 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 "su - guest" and run a system print command like
797 lpr -P printername /etc/motd
800 </listitem></varlistentry>
802 <varlistentry><term><parameter>public = yes</parameter></term>
803 <listitem><para> this is a synonym for <parameter>guest ok =
804 yes</parameter>. Since we have <parameter>guest ok = yes</parameter>,
805 it really doesn't need to be here! (This leads to the interesting
806 question: <quote>What, if I by accident have to contradictory settings
807 for the same share?</quote> The answer is: the last one encountered by
808 Sambe wins. The "winner" is shown by testparm. Testparm doesn't
809 complain about different settings of the same parameter for the same
810 share! You can test this by setting up multiple lines for the "guest
811 account" parameter with different usernames, and then run testparm to
812 see which one is actually used by Samba.)
813 </para></listitem></varlistentry>
815 <varlistentry><term><parameter>read only = yes</parameter></term>
816 <listitem><para>this normally (for other types of shares) prevents
817 users creating or modifying files in the service's directory. However,
818 in a "printable" service, it is <emphasis>always</emphasis> allowed to
819 write to the directory (if user privileges allow the connection), but
820 only via print spooling operations. "Normal" write operations are not
821 allowed. </para></listitem></varlistentry>
823 <varlistentry><term><parameter>writeable = no</parameter></term>
825 synonym for <parameter>read only = yes</parameter>
826 </para></listitem></varlistentry>
831 <title>Any [my_printer_name] Section</title>
834 If a section appears in the <filename>smb.conf</filename>, which is
835 tagged as <parameter>printable = yes</parameter>, Samba presents it as
836 a printer share to its clients. Note, that Win95/98/ME clients may
837 have problems with connecting or loading printer drivers if the share
838 name has more than 8 characters! Also be very careful if you give a
839 printer the same name as an existing user or file share name: upon a
840 client's connection request to a certain sharename, Samba always tries
841 to find file shares with that name first; if it finds one, it will
842 connect to this and will never ultimately connect to a printer with
847 <varlistentry><term><parameter>comment = Printer with Restricted Access</parameter></term>
848 <listitem><para> the comment says it all.
849 </para></listitem></varlistentry>
851 <varlistentry><term><parameter>path = /var/spool/samba_my_printer</parameter></term>
852 <listitem><para> here we set the spooling area for this printer to
853 another directory than the default. It is not a requirement to set it
854 differently, but the option is available.
855 </para></listitem></varlistentry>
857 <varlistentry><term><parameter>printer admin = kurt</parameter></term>
858 <listitem><para> the printer admin definition is different for this
859 explicitly defined printer share from the general
860 <parameter>[printers]</parameter> share. It is not a requirement; we
861 did it to show that it is possible if you want it.
862 </para></listitem></varlistentry>
864 <varlistentry><term><parameter>browseable = yes</parameter></term>
865 <listitem><para> we also made this printer browseable (so that the
866 clients may conveniently find it when browsing the Network
868 </para></listitem></varlistentry>
870 <varlistentry><term><parameter>printable = yes</parameter></term>
871 <listitem><para>see explanation in last subsection.
872 </para></listitem></varlistentry>
874 <varlistentry><term><parameter>writeable = no</parameter></term>
875 <listitem><para>see explanation in last subsection.
876 </para></listitem></varlistentry>
878 <varlistentry><term><parameter>hosts allow = 10.160.50.,10.160.51.</parameter></term>
879 <listitem><para>here we exercise a certain degree of access control
880 by using the "hosts allow" and "hosts deny" parameters. Note, that
881 this is not by any means a safe bet. It is not a way to secure your
882 printers. This line accepts all clients from a certain subnet in a
883 first evaluation of access control
884 </para></listitem></varlistentry>
886 <varlistentry><term><parameter>hosts deny = turbo_xp,10.160.50.23,10.160.51.60
888 <listitem><para>all listed hosts are not allowed here (even if they
889 belong to the "allowed subnets"). As you can see, you could name IP
890 addresses as well as NetBIOS hostnames
892 </para></listitem></varlistentry>
894 <varlistentry><term><parameter>guest ok = no</parameter></term>
895 <listitem><para>this printer is not open for the guest account!
896 </para></listitem></varlistentry>
902 <title>Print Commands</title>
905 In each section defining a printer (or in the
906 <parameter>[printers]</parameter> section), a <parameter>print
907 command</parameter> parameter may be defined. It sets a command to
908 process the files which have been placed into the Samba print spool
909 directory for that printer. (That spool directory was, if you
910 remember, set up with the <parameter>path</parameter>
911 parameter). Typically, this command will submit the spool file to the
912 Samba host's print subsystem, using the suitable system print
913 command. But there is no requirement that this needs to be the
914 case. For debugging purposes or some other reason you may want to do
915 something completely different than "print" the file. An example is a
916 command that just copies the print file to a temporary location for
917 further investigation when you need to debug printing. If you craft
918 your own print commands (or even develop print command shell scripts),
919 make sure you pay attention to the need to remove the files from the
920 Samba spool directory. Otherwise your hard disk may soon suffer from
921 shortage of free space.
926 <title>Default Print Commands for various Unix Print Subsystems</title>
929 You learned earlier on, that Samba in most cases uses its built-in
930 settings for many parameters if it can not find an explicitly stated
931 one in its configuration file. The same is true for the
932 <parameter>print command</parameter>. The default print command varies
933 depending on the <parameter>printing =...</parameter> parameter
934 setting. In the commands listed below, you will notice some parameters
935 of the form <emphasis>%X</emphasis> where <emphasis>X</emphasis> is
936 <emphasis>p, s, J</emphasis> etc. These letters stand for
937 "printername", "spoolfile" and "job ID" respectively. They are
938 explained in more detail further below. Here is an overview (excluding
939 the special case of CUPS, which is discussed in the next chapter):
942 <informaltable frame='all'>
943 <tgroup cols='2' align='left' colsep='1' rowsep='1'>
946 <entry>If this setting is active...</entry>
947 <entry>...this is used in lieu of an explicit command:</entry>
952 <entry><parameter>printing = bsd|aix|lprng|plp</parameter></entry>
953 <entry>print command is <command>lpr -r -P%p %s</command></entry>
956 <entry><parameter>printing = sysv|hpux</parameter></entry>
957 <entry>print command is <command>lp -c -P%p %s; rm %s</command></entry>
960 <entry> <parameter>printing = qnx</parameter></entry>
961 <entry>print command is <command>lp -r -P%p -s %s</command></entry>
964 <entry><parameter>printing = bsd|aix|lprng|plp</parameter></entry>
965 <entry>lpq command is <command>lpq -P%p</command></entry>
968 <entry><parameter>printing = sysv|hpux</parameter></entry>
969 <entry>lpq command is <command>lpstat -o%p</command></entry>
972 <entry><parameter>printing = qnx</parameter></entry>
973 <entry>lpq command is <command>lpq -P%p</command></entry>
976 <entry><parameter>printing = bsd|aix|lprng|plp</parameter></entry>
977 <entry>lprm command is <command>lprm -P%p %j</command></entry>
980 <entry><parameter>printing = sysv|hpux</parameter></entry>
981 <entry>lprm command is <command>cancel %p-%j</command></entry>
984 <entry><parameter>printing = qnx</parameter></entry>
985 <entry>lprm command is <command>cancel %p-%j</command></entry>
988 <entry><parameter>printing = bsd|aix|lprng|plp</parameter></entry>
989 <entry>lppause command is <command>lp -i %p-%j -H hold</command></entry>
992 <entry><parameter>printing = sysv|hpux</parameter></entry>
993 <entry>lppause command (...is empty)</entry>
996 <entry><parameter>printing = qnx</parameter></entry>
997 <entry>lppause command (...is empty)</entry>
1000 <entry><parameter>printing = bsd|aix|lprng|plp</parameter></entry>
1001 <entry>lpresume command is <command>lp -i %p-%j -H resume</command></entry>
1004 <entry><parameter>printing = sysv|hpux</parameter></entry>
1005 <entry>lpresume command (...is empty)</entry>
1008 <entry><parameter>printing = qnx</parameter></entry>
1009 <entry>lpresume command (...is empty)</entry>
1016 We excluded the special CUPS case here, because it is discussed in the
1017 next chapter. Just a short summary. For <parameter>printing =
1018 CUPS</parameter>: If SAMBA is compiled against libcups, it uses the
1019 CUPS API to submit jobs, etc. (It is a good idea also to set
1020 "<parameter>printcap = cups</parameter>" in case your
1021 <filename>cupsd.conf</filename> is set to write its autogenerated
1022 printcap file to an unusual place). Otherwise Samba maps to the System
1023 V printing commands with the -oraw option for printing, i.e. it uses
1024 <command>lp -c -d%p -oraw; rm %s</command> With <parameter>printing =
1025 cups</parameter> , and if SAMBA is compiled against libcups, any
1026 manually set print command will be ignored!
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.
1049 <title>Setting up your own Print Commands</title>
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
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
1079 <listitem><para><parameter>%s, %f</parameter> - the path to the spool
1080 file name</para></listitem>
1082 <listitem><para><parameter>%p</parameter> - the appropriate printer
1083 name</para></listitem>
1085 <listitem><para><parameter>%J</parameter> - the job name as
1086 transmitted by the client.</para></listitem>
1088 <listitem><para><parameter>%c</parameter> - the number of printed
1089 pages of the spooled job (if known).</para></listitem>
1091 <listitem><para><parameter>%z</parameter> - the size of the spooled
1092 print job (in bytes)</para></listitem>
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.
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
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.
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 <filename>smb.conf</filename> 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
1137 print command = echo Printing %s >> /tmp/print.log; lpr -P %p %s; rm %s
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:
1149 print command = /usr/local/samba/bin/myprintscript %p %s
1155 <title>Innovations in Samba Printing since 2.2</title>
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.
1169 The additional functionality provided by the new SPOOLSS support includes:
1173 <listitem><para>Support for downloading printer driver files to Windows
1174 95/98/NT/2000 clients upon demand (<emphasis>Point'n'Print</emphasis>);
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>);
1183 <listitem><para>Support for the native MS-RPC printing calls such as
1184 StartDocPrinter, EnumJobs(), etc... (See the MSDN documentation
1186 url="http://msdn.microsoft.com/">http://msdn.microsoft.com/</ulink>
1187 for more information on the Win32 printing API);</para></listitem>
1189 <listitem><para>Support for NT <emphasis>Access Control
1190 Lists</emphasis> (ACL) on printer objects;</para></listitem>
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>
1200 One other benefit of an update is this: Samba-3 is able to publish
1201 all its printers in Active Directory (or LDAP)!
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 <filename>smb.conf</filename>. 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"
1222 <title>Client Drivers on Samba Server for <emphasis>Point'n'Print</emphasis></title>
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
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
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>
1256 <listitem><para>using the <emphasis>Imprints</emphasis>
1257 toolset;</para></listitem>
1259 <listitem><para>using the <emphasis>smbclient</emphasis> and
1260 <emphasis>rpcclient</emphasis> commandline tools;</para></listitem>
1262 <listitem><para>using <emphasis>cupsaddsmb</emphasis>(only works for
1263 the CUPS printing system, not for LPR/LPD, LPRng
1264 etc.).</para></listitem>
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.
1281 <title>The [printer$] Section is removed from Samba-3</title>
1284 <parameter>[print$]</parameter> vs. <parameter>[printer$]</parameter>
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>
1315 <title>Creating the [print$] Share</title>
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.
1328 You should modify the server's <filename>smb.conf</filename> 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):
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
1346 comment = Printer Driver Download Area
1347 path = /etc/samba/drivers
1351 write list = @ntadmin, root
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.
1362 <title>Parameters in the <parameter>[print$]</parameter> Section</title>
1365 <parameter>[print$]</parameter> is a special section in
1366 <filename>smb.conf</filename>. It contains settings relevant to
1367 potential printer driver download and local installation by clients.
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>
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>
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>
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
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
1411 </para></note> </listitem></varlistentry>
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>
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 <filename>smb.conf</filename> man page for more information on
1430 configuring file shares. </para></listitem></varlistentry>
1437 <title>Subdirectory Structure in <parameter>[print$]</parameter></title>
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).
1452 Therefore, create a directory tree below the
1453 <parameter>[print$]</parameter> share for each architecture you wish
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"
1468 <important><title>REQUIRED PERMISSIONS</title>
1471 In order to add a new driver to your Samba host, one of two conditions
1476 <listitem><para>The account used to connect to the Samba host must
1477 have a UID of 0 (i.e. a root account)</para></listitem>
1479 <listitem><para>The account used to connect to the Samba host must be
1480 named in the <emphasis>printer admin</emphasis>list.</para></listitem>
1485 Of course, the connected account must still possess access to add
1486 files to the subdirectories beneath
1487 <parameter>[print$]</parameter>. Remember that all file shares are set
1488 to 'read only' by default.
1493 Once you have created the required <parameter>[print$]</parameter>
1494 service and associated subdirectories, go to a Windows NT 4.0/2k/XP
1495 client workstation. Open "Network Neighbourhood" or "My Network
1496 Places" and browse for the Samba host. Once you have located the
1497 server, navigate to its "Printers and Faxes" folder. You should see
1498 an initial listing of printers that matches the printer shares defined
1505 <title>Installing Drivers into [print$]</title>
1508 You have successfully created the <parameter>[print$]</parameter>
1509 share in <filename>smb.conf</filename>? And Samba has re-read its
1510 configuration? Good. But you are not yet ready to take off. The
1511 <emphasis>driver files</emphasis> need to be present in this share,
1512 too! So far it is still an empty share. Unfortunatly, it is not enough
1513 to just copy the driver files over. They need to be <emphasis>set
1514 up</emphasis> too. And that is a bit tricky, to say the least. We
1515 will now discuss two alternative ways to install the drivers into
1516 <parameter>[print$]</parameter>:
1521 <listitem><para>using the Samba commandline utility
1522 <command>rpcclient</command> with its various subcommands (here:
1523 <command>adddriver</command> and <command>setdriver</command>) from
1524 any UNIX workstation;</para></listitem>
1526 <listitem><para>running a GUI (<emphasis>Printer
1527 Properties</emphasis> and <emphasis>Add Printer Wizard</emphasis>)
1528 from any Windows NT/2k/XP client workstation.</para></listitem>
1533 The latter option is probably the easier one (even if the only
1534 entrance to this realm seems a little bit weird at first).
1538 <title>Setting Drivers for existing Printers with a Client GUI</title>
1541 The initial listing of printers in the Samba host's
1542 <emphasis>Printers</emphasis> folder accessed from a client's Explorer
1543 will have no real printer driver assigned to them. By default, in
1544 Samba-3 (as in 2.2.1 and later) this driver name is set to a NULL
1545 string. This must be changed now. The local <emphasis>Add Printer
1546 Wizard</emphasis>, run from NT/2000/XP clients, will help us in this
1551 However, the job to set a valid driver for the printer is not a
1552 straightforward one: You must attempt to view the printer properties
1553 for the printer to which you want the driver assigned. Open the
1554 Windows Explorer, open Network Neighbourhood, browse to the Samba
1555 host, open Samba's <guiicon>Printers</guiicon> folder, right-click the printer icon and
1556 select <guimenu>Properties...</guimenu>. You are now trying to view printer and driver
1557 properties for a queue which has this default <constant>NULL</constant> driver
1558 assigned. This will result in an error message (this is normal here):
1561 <para><computeroutput> Device settings cannot be displayed. The driver
1562 for the specified printer is not installed, only spooler properties
1563 will be displayed. Do you want to install the driver
1564 now?</computeroutput></para>
1567 <emphasis>Important:</emphasis>Don't click "Yes"! Instead,
1568 <emphasis>click "No"</emphasis> in the error dialog. Only now you will
1569 be presented with the printer properties window. From here, the way to
1570 assign a driver to a printer is open to us. You have now the choice
1575 <listitem><para>select a driver from the popup list of installed
1576 drivers. <emphasis>Initially this list will be empty.</emphasis>
1577 Or</para></listitem>
1579 <listitem><para>use the <emphasis>"New Driver..."</emphasis> button to
1580 install a new printer driver (which will in fact start up the
1581 APW).</para></listitem>
1585 Once the APW is started, the procedure is exactly the same as the one
1586 you are familiar with in Wiindows (we assume here that you are
1587 familiar with the printer driver installations procedure on Windows
1588 NT). Make sure your connection is in fact setup as a user with
1589 <emphasis>printer admin</emphasis> privileges (if in doubt, use
1590 <command>smbstatus</command> to check for this). If you wish to
1591 install printer drivers for client operating systems other than
1592 "Windows NT x86", you will need to use the
1593 <emphasis>Sharing</emphasis> tab of the printer properties dialog.
1597 Assuming you have connected with an administrative (or root) account
1598 (as named by the <parameter>printer admin</parameter> parameter),
1599 you will also be able to modify other printer properties such as ACLs
1600 and default device settings using this dialog. For the default device
1601 settings, please consider the advice given further below.
1606 <title>Setting Drivers for existing Printers with
1607 <command>rpcclient</command></title>
1610 The second way to install printer drivers into
1611 <parameter>[print$]</parameter> and set them up in a valid way can be
1612 done from the UNIX command line. This involves four distinct steps:
1616 <listitem><para> gathering the info about the required driver files
1617 and collecting the files together;</para></listitem>
1619 <listitem><para> deposit the driver files into the
1620 <parameter>[print$]</parameter> share's correct subdirectories
1621 (possibly by using <command>smbclient</command>);</para></listitem>
1623 <listitem><para>2. -- running the <command>rpcclient</command>
1624 commandline utility once with the <command>addriver</command>
1625 subcommand,</para></listitem>
1627 <listitem><para>3. -- running <command>rpcclient</command> a second
1628 time with the <command>setdriver</command>
1629 subcommand.</para></listitem>
1633 We will provide detailed hints for each of these steps in the next few
1638 <title>Identifying the Driver Files</title>
1641 To find out about the driver files, you have two options: you could
1642 investigate the driver CD which comes with your printer. Study the
1643 <filename>*.inf</filename> file on the CD, if it is contained. This
1644 may not be the possible, since the *.inf file might be
1645 missing. Unfortunately, many vendors have now started to use their own
1646 installation programs. These installations packages are often some
1647 sort of Windows platform archive format, plus, the files may get
1648 re-named during the installation process. This makes it extremely
1649 difficult to identify the driver files you need.
1653 Then you only have the second option: install the driver first on a
1654 Windows client *locally* and investigate which file names and paths it
1655 uses after they are installed. (Note, that you need to repeat this
1656 procedure for every client platform you want to support. We are going
1657 to show it here for the "<emphasis>W32X86</emphasis>" platform only, a
1658 name used by Microsoft for all WinNT/2k/XP clients...)
1662 A good method to recognize the driver files this is to print the test
1663 page from the driver's <emphasis>Properties</emphasis> Dialog
1664 (<emphasis>General</emphasis> tab). Then look at the list of driver
1665 files named on the printout. You'll need to recognize what Windows
1666 (and Samba) are calling the <parameter>Driver File</parameter> , the
1667 <parameter>Data File</parameter>, the <parameter>Config File</parameter>,
1668 the <parameter>Help File</parameter> and (optionally) the
1669 <parameter>Dependent Driver Files</parameter> (this may vary slightly
1670 for Windows NT). You need to remember all names (or better take a
1671 note) for the next steps.
1675 Another method to quickly test the driver filenames and related paths
1676 is provided by the <command>rpcclient</command> utility. Run it with
1677 <command>enumdrivers</command> or with the
1678 <command>getdriver</command> subcommand, each in the
1679 <emphasis>3</emphasis> level. In the following example,
1680 <emphasis>TURBO_XP</emphasis> is the name of the Windows PC (in this
1681 case it was a Windows XP Professional laptop, BTW). I had installed
1682 the driver locally to TURBO_XP while <emphasis>kde-bitshop</emphasis> is
1683 the name of the Linux host from which I am working. We could run an
1684 <emphasis>interactive</emphasis> <command>rpcclient</command> session;
1685 then we'd get an <emphasis>rpcclient /></emphasis> prompt and would
1686 type the subcommands at this prompt. This is left as a good exercise
1687 to the reader. For now we use <command>rpcclient</command> with the
1688 <parameter>-c</parameter> parameter to execute a single subcommand
1689 line and exit again. This is the method you would use if you want to
1690 create scripts to automate the procedure for a large number of
1691 printers and drivers. Note the different quotes used to overcome the
1692 different spaces in between words:
1697 kde-bitshop:~# rpcclient -U'Danka%xxxx' -c 'getdriver "Heidelberg Digimaster 9110 (PS)" 3' TURBO_XP
1698 cmd = getdriver "Heidelberg Digimaster 9110 (PS)" 3
1701 Printer Driver Info 3:
1703 Driver Name: [Heidelberg Digimaster 9110 (PS)]
1704 Architecture: [Windows NT x86]
1705 Driver Path: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01_de.DLL]
1706 Datafile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.ppd]
1707 Configfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01U_de.DLL]
1708 Helpfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01U_de.HLP]
1710 Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.DLL]
1711 Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.INI]
1712 Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1KMMin.DLL]
1713 Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.dat]
1714 Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.cat]
1715 Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.def]
1716 Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.hre]
1717 Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.vnd]
1718 Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.hlp]
1719 Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de_reg.HLP]
1720 Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01Aux.dll]
1721 Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01_de.NTF]
1729 You may notice, that this driver has quite a big number of
1730 "Dependentfiles" (I know worse cases however). Also, strangely, the
1731 "<filename>Driver File</filename>" is here tagged as "<filename>Driver
1732 Path</filename>".... oh, well. Here we don't have yet support for the
1733 so-called "WIN40" architecture installed. This name is used by
1734 Microsoft for the Win95/98/ME platforms. If we want to support these,
1735 we need to install the Win95/98/ME driver files in addition to those
1736 for W32X86 (i.e. the WinNT72000/XP clients) onto a Windows PC. This PC
1737 can also host the Win9x drivers, even if itself runs on Windows NT,
1742 Since the <parameter>print$</parameter> share is usually accessible
1743 through the Network Neighbourhood, you can also use the UNC notation
1744 from Windows Explorer to poke at it. The Win9x driver files will end
1745 up in subdirectory "0" of the "WIN40" directory. The full path to
1747 <filename>\\WINDOWSHOST\print$\WIN40\0\</filename>.
1750 <note><para> more recent drivers on Windows 2000 and Wndows XP are
1751 installed into the "3" subdirectory instead of the "2". The version 2
1752 of drivers, as used in Windows NT, were running in Kernel Mode.
1753 Windows 2000 changed this. While it still can use the Kernel Mode
1754 drivers (if this is enabled by the Admin), its native mode for printer
1755 drivers is User Mode execution. This requires drivers designed for
1756 this. These type of drivers install into the "3" subdirectory.
1761 <title>Collecting the Driver Files from a Windows Host's
1762 <parameter>[print$]</parameter> Share</title>
1765 Now we need to collect all the driver files we identified. in our
1766 previous step. Where do we get them from? Well, why not retrieve them
1767 from the very PC and the same <parameter>[print$]</parameter> share
1768 which we investigated in our last step to identify the files? We can
1769 use <command>smbclient</command> to do this. We will use the paths and
1770 names which were leaked to us by <command>getdriver</command>. The
1771 listing is edited to include linebreaks for readability:
1776 kde-bitshop:~# smbclient //TURBO_XP/print\$ -U'Danka%xxxx' \
1777 -c 'cd W32X86/2;mget HD*_de.* \
1778 hd*ppd Hd*_de.* Hddm*dll HDN*Aux.DLL'
1779 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
1780 Got a positive name query response from 10.160.50.8 ( 10.160.50.8 )
1781 Domain=[DEVELOPMENT] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
1782 Get file Hddm91c1_de.ABD? n
1783 Get file Hddm91c1_de.def? y
1784 getting file \W32X86\2\Hddm91c1_de.def of size 428 as Hddm91c1_de.def (22.0 kb/s) \
1786 Get file Hddm91c1_de.DLL? y
1787 getting file \W32X86\2\Hddm91c1_de.DLL of size 876544 as Hddm91c1_de.DLL (737.3 kb/s) \
1788 (average 737.3 kb/s)
1794 After this command is complete, the files are in our current local
1795 directory. You probably have noticed that this time we passed several
1796 commands to the "-c" parameter, separated by semi-colons. This
1797 effects that all commands are executed in sequence on the remote
1798 Windows server before smbclient exits again.
1802 Don't forget to repeat the procedure for the "WIN40" architecture
1803 should you need to support Win95/98/XP clients. Remember, the files
1804 for these architectures are in the WIN40/0/ subdir. Once we are
1805 complete, we can run <command>smbclient ... put</command> to store
1806 the collected files on the Samba server's
1807 <parameter>[print$]</parameter> share.
1812 <title>Depositing the Driver Files into <parameter>[print$]</parameter></title>
1815 So, now we are going to put the driver files into the
1816 <parameter>[print$]</parameter> share. Remember, the UNIX path to this
1817 share has been defined previously in your
1818 <filename>smb.conf</filename>. You also have created subdirectories
1819 for the different Windows client types you want to support. Supposing
1820 your <parameter>[print$]</parameter> share maps to the UNIX path
1821 <filename>/etc/samba/drivers/</filename>, your driver files should now
1826 <listitem><para>for all Windows NT, 2000 and XP clients into
1827 <filename>/etc/samba/drivers/W32X86/</filename> <emphasis>but
1828 *not*(yet) into the "2" subdir</emphasis>!</para></listitem>
1830 <listitem><para>for all Windows 95, 98 and ME clients into
1831 <filename>/etc/samba/drivers/WIN40/</filename> -- <emphasis>but *not*
1832 (yet) into the "0" subdir</emphasis>!</para></listitem>
1836 We again use smbclient to transfer the driver files across the
1837 network. We specify the same files and paths as were leaked to us by
1838 running "<command>getdriver</command>" against the original
1839 <emphasis>Windows</emphasis> install. However, now we are going to
1840 store the files into a <emphasis>Samba/UNIX</emphasis> print server's
1841 <parameter>[print$]</parameter> share...
1846 kde-bitshop:~# smbclient //SAMBA-CUPS/print\$ -U'root%xxxx' -c 'cd W32X86; put HDNIS01_de.DLL; \
1847 put Hddm91c1_de.ppd; put HDNIS01U_de.DLL; \
1848 put HDNIS01U_de.HLP; put Hddm91c1_de.DLL; \
1849 put Hddm91c1_de.INI; put Hddm91c1KMMin.DLL; \
1850 put Hddm91c1_de.dat; put Hddm91c1_de.dat; \
1851 put Hddm91c1_de.def; put Hddm91c1_de.hre; \
1852 put Hddm91c1_de.vnd; put Hddm91c1_de.hlp; \
1853 put Hddm91c1_de_reg.HLP; put HDNIS01Aux.dll; \
1855 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
1856 Got a positive name query response from 10.160.51.162 ( 10.160.51.162 )
1857 Domain=[CUPS-PRINT] OS=[Unix] Server=[Samba 2.2.7a]
1858 putting file HDNIS01_de.DLL as \W32X86\HDNIS01_de.DLL (4465.5 kb/s) (average 4465.5 kb/s)
1859 putting file Hddm91c1_de.ppd as \W32X86\Hddm91c1_de.ppd (12876.8 kb/s) (average 4638.9 kb/s)
1860 putting file HDNIS01U_de.DLL as \W32X86\HDNIS01U_de.DLL (20249.8 kb/s) (average 5828.3 kb/s)
1861 putting file HDNIS01U_de.HLP as \W32X86\HDNIS01U_de.HLP (9652.8 kb/s) (average 5899.8 kb/s)
1862 putting file Hddm91c1_de.DLL as \W32X86\Hddm91c1_de.DLL (23777.7 kb/s) (average 10400.6 kb/s)
1863 putting file Hddm91c1_de.INI as \W32X86\Hddm91c1_de.INI (98.6 kb/s) (average 10329.0 kb/s)
1864 putting file Hddm91c1KMMin.DLL as \W32X86\Hddm91c1KMMin.DLL (22931.5 kb/s) (average 10501.7 kb/s)
1865 putting file Hddm91c1_de.dat as \W32X86\Hddm91c1_de.dat (2462.8 kb/s) (average 10393.0 kb/s)
1866 putting file Hddm91c1_de.dat as \W32X86\Hddm91c1_de.dat (4925.3 kb/s) (average 10356.3 kb/s)
1867 putting file Hddm91c1_de.def as \W32X86\Hddm91c1_de.def (417.9 kb/s) (average 10290.1 kb/s)
1868 putting file Hddm91c1_de.hre as \W32X86\Hddm91c1_de.hre (22571.3 kb/s) (average 11338.5 kb/s)
1869 putting file Hddm91c1_de.vnd as \W32X86\Hddm91c1_de.vnd (3384.6 kb/s) (average 10754.3 kb/s)
1870 putting file Hddm91c1_de.hlp as \W32X86\Hddm91c1_de.hlp (18406.8 kb/s) (average 10839.8 kb/s)
1871 putting file Hddm91c1_de_reg.HLP as \W32X86\Hddm91c1_de_reg.HLP (20278.3 kb/s) (average 11386.3 kb/s)
1872 putting file HDNIS01Aux.dll as \W32X86\HDNIS01Aux.dll (14994.6 kb/s) (average 11405.2 kb/s)
1873 putting file HDNIS01_de.NTF as \W32X86\HDNIS01_de.NTF (23390.2 kb/s) (average 13170.8 kb/s)
1878 Phewww -- that was a lot of typing! Most drivers are a lot smaller --
1879 many only having 3 generic PostScript driver files plus 1 PPD. Note,
1880 that while we did retrieve the files from the "2" subdirectory of the
1881 "W32X86" directory from the Windows box, we <emphasis>don't</emphasis>
1882 put them (for now) in this same subdirectory of the Samba box! This
1883 re-location will automatically be done by the
1884 <command>adddriver</command> command which we will run shortly (and
1885 don't forget to also put the files for the Win95/98/ME architecture
1886 into the <emphasis>WIN40/</emphasis> subdirectory should you need
1892 <title>Check if the Driver Files are there (with smbclient)</title>
1895 For now we verify that our files are there. This can be done with
1896 <command>smbclient</command> too (but of course you can log in via SSH
1897 also and do this through a standard UNIX shell access too):
1902 kde-bitshop:~# smbclient //SAMBA-CUPS/print\$ -U 'root%xxxx' -c 'cd W32X86; pwd; dir; cd 2; pwd; dir'
1903 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
1904 Got a positive name query response from 10.160.51.162 ( 10.160.51.162 )
1905 Domain=[CUPS-PRINT] OS=[Unix] Server=[Samba 2.2.7a]
1907 Current directory is \\SAMBA-CUPS\print$\W32X86\
1908 . D 0 Sun May 4 03:56:35 2003
1909 .. D 0 Thu Apr 10 23:47:40 2003
1910 2 D 0 Sun May 4 03:56:18 2003
1911 HDNIS01Aux.dll A 15356 Sun May 4 03:58:59 2003
1912 Hddm91c1KMMin.DLL A 46966 Sun May 4 03:58:59 2003
1913 HDNIS01_de.DLL A 434400 Sun May 4 03:58:59 2003
1914 HDNIS01_de.NTF A 790404 Sun May 4 03:56:35 2003
1915 Hddm91c1_de.DLL A 876544 Sun May 4 03:58:59 2003
1916 Hddm91c1_de.INI A 101 Sun May 4 03:58:59 2003
1917 Hddm91c1_de.dat A 5044 Sun May 4 03:58:59 2003
1918 Hddm91c1_de.def A 428 Sun May 4 03:58:59 2003
1919 Hddm91c1_de.hlp A 37699 Sun May 4 03:58:59 2003
1920 Hddm91c1_de.hre A 323584 Sun May 4 03:58:59 2003
1921 Hddm91c1_de.ppd A 26373 Sun May 4 03:58:59 2003
1922 Hddm91c1_de.vnd A 45056 Sun May 4 03:58:59 2003
1923 HDNIS01U_de.DLL A 165888 Sun May 4 03:58:59 2003
1924 HDNIS01U_de.HLP A 19770 Sun May 4 03:58:59 2003
1925 Hddm91c1_de_reg.HLP A 228417 Sun May 4 03:58:59 2003
1926 40976 blocks of size 262144. 709 blocks available
1928 Current directory is \\SAMBA-CUPS\print$\W32X86\2\
1929 . D 0 Sun May 4 03:56:18 2003
1930 .. D 0 Sun May 4 03:56:35 2003
1931 ADOBEPS5.DLL A 434400 Sat May 3 23:18:45 2003
1932 laserjet4.ppd A 9639 Thu Apr 24 01:05:32 2003
1933 ADOBEPSU.DLL A 109568 Sat May 3 23:18:45 2003
1934 ADOBEPSU.HLP A 18082 Sat May 3 23:18:45 2003
1935 PDFcreator2.PPD A 15746 Sun Apr 20 22:24:07 2003
1936 40976 blocks of size 262144. 709 blocks available
1941 Notice that there are already driver files present in the
1942 <filename>2</filename> subdir (probably from a previous
1943 installation). Once the files for the new driver are there too, you
1944 are still a few steps away from being able to use them on the
1945 clients. The only thing you could do *now* is to retrieve them from a
1946 client just like you retrieve ordinary files from a file share, by
1947 opening print$ in Windows Explorer. But that wouldn't install them per
1948 Point'n'Print. The reason is: Samba doesn't know yet that these files
1949 are something special, namely <emphasis>printer driver
1950 files</emphasis> and it doesn't know yet to which print queue(s) these
1951 driver files belong.
1956 <title>Running <command>rpcclient</command> with
1957 <command>adddriver</command></title>
1960 So, next you must tell Samba about the special category of the files
1961 you just uploaded into the <parameter>[print$]</parameter> share. This
1962 is done by the "<command>adddriver</command>" command. It will
1963 prompt Samba to register the driver files into its internal TDB
1964 database files. The following command and its output has been edited,
1965 again, for readability:
1970 kde-bitshop:~# rpcclient -Uroot%xxxx -c 'adddriver "Windows NT x86" "dm9110:HDNIS01_de.DLL: \
1971 Hddm91c1_de.ppd:HDNIS01U_de.DLL:HDNIS01U_de.HLP: \
1972 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, \
1976 Hddm91c1_de_reg.HLP' SAMBA-CUPS
1978 cmd = adddriver "Windows NT x86" "dm9110:HDNIS01_de.DLL:Hddm91c1_de.ppd:HDNIS01U_de.DLL: \
1979 HDNIS01U_de.HLP:NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI, \
1980 Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre, \
1981 Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL, \
1982 HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP"
1984 Printer Driver dm9110 successfully installed.
1989 After this step the driver should be recognized by Samba on the print
1990 server. You need to be very carefull when typing the command. Don't
1991 exchange the order of the fields. Some changes would lead to a
1992 <computeroutput>NT_STATUS_UNSUCCESSFUL</computeroutput> error
1993 message. These become obvious. Other changes might install the driver
1994 files successfully, but render the driver unworkable. So take care!
1995 Hints about the syntax of the adddriver command are in the man
1996 page. The CUPS printing chapter of this HOWTO collection provides a
1997 more detailed description, if you should need it.
2002 <title>Check how Driver Files have been moved after
2003 <command>adddriver</command> finished</title>
2006 One indication for Samba's recognition of the files as driver files is
2007 the <computeroutput>successfully installed</computeroutput> message.
2008 Another one is the fact, that our files have been moved by the
2009 <command>adddriver</command> command into the "<filename>2</filename>"
2010 subdirectory. You can check this again with
2011 <command>smbclient</command>:
2016 kde-bitshop:~# smbclient //SAMBA-CUPS/print\$ -Uroot%xxxx -c 'cd W32X86;dir;pwd;cd 2;dir;pwd'
2017 added interface ip=10.160.51.162 bcast=10.160.51.255 nmask=255.255.252.0
2018 Domain=[CUPS-PRINT] OS=[Unix] Server=[Samba 2.2.7a]
2020 Current directory is \\SAMBA-CUPS\print$\W32X86\
2021 . D 0 Sun May 4 04:32:48 2003
2022 .. D 0 Thu Apr 10 23:47:40 2003
2023 2 D 0 Sun May 4 04:32:48 2003
2024 40976 blocks of size 262144. 731 blocks available
2026 Current directory is \\SAMBA-CUPS\print$\W32X86\2\
2027 . D 0 Sun May 4 04:32:48 2003
2028 .. D 0 Sun May 4 04:32:48 2003
2029 DigiMaster.PPD A 148336 Thu Apr 24 01:07:00 2003
2030 ADOBEPS5.DLL A 434400 Sat May 3 23:18:45 2003
2031 laserjet4.ppd A 9639 Thu Apr 24 01:05:32 2003
2032 ADOBEPSU.DLL A 109568 Sat May 3 23:18:45 2003
2033 ADOBEPSU.HLP A 18082 Sat May 3 23:18:45 2003
2034 PDFcreator2.PPD A 15746 Sun Apr 20 22:24:07 2003
2035 HDNIS01Aux.dll A 15356 Sun May 4 04:32:18 2003
2036 Hddm91c1KMMin.DLL A 46966 Sun May 4 04:32:18 2003
2037 HDNIS01_de.DLL A 434400 Sun May 4 04:32:18 2003
2038 HDNIS01_de.NTF A 790404 Sun May 4 04:32:18 2003
2039 Hddm91c1_de.DLL A 876544 Sun May 4 04:32:18 2003
2040 Hddm91c1_de.INI A 101 Sun May 4 04:32:18 2003
2041 Hddm91c1_de.dat A 5044 Sun May 4 04:32:18 2003
2042 Hddm91c1_de.def A 428 Sun May 4 04:32:18 2003
2043 Hddm91c1_de.hlp A 37699 Sun May 4 04:32:18 2003
2044 Hddm91c1_de.hre A 323584 Sun May 4 04:32:18 2003
2045 Hddm91c1_de.ppd A 26373 Sun May 4 04:32:18 2003
2046 Hddm91c1_de.vnd A 45056 Sun May 4 04:32:18 2003
2047 HDNIS01U_de.DLL A 165888 Sun May 4 04:32:18 2003
2048 HDNIS01U_de.HLP A 19770 Sun May 4 04:32:18 2003
2049 Hddm91c1_de_reg.HLP A 228417 Sun May 4 04:32:18 2003
2050 40976 blocks of size 262144. 731 blocks available
2055 Another verification is that the timestamp of the printing TDB files
2056 is now updated (and possibly their filesize has increased).
2061 <title>Check if the Driver is recognized by Samba</title>
2064 Now the driver should be registered with Samba. We can easily verify
2065 this, and will do so in a moment. However, this driver is
2066 <emphasis>not yet</emphasis> associated with a particular
2067 <emphasis>printer</emphasis>. We may check the driver status of the
2068 files by at least three methods:
2072 <listitem><para>from any Windows client browse Network Neighbourhood,
2073 finde the Samba host and open the Samba "<emphasis>Printers and
2074 Faxes</emphasis>" folder. Select any printer icon, right-click and
2075 select the printer " <emphasis>Properties</emphasis>". Click on the
2076 "<emphasis>Advanced</emphasis>" tab. Here is a field indicating the
2077 driver for that printer. A drop down menu allows you to change that
2078 driver (be carefull to not do this unwittingly.). You can use this
2079 list to view all drivers know to Samba. Your new one should be amongst
2080 them. (Each type of client will only see his own architecture's
2081 list. If you don't have every driver installed for each platform, the
2082 list will differ if you look at it from Windows95/98/ME or
2083 WindowsNT/2000/XP.)</para></listitem>
2085 <listitem><para>from a Windows 2000 or XP client (not WinNT) browse
2086 <emphasis>Network Neighbourhood</emphasis>, search for the Samba
2087 server and open the server's <emphasis>Printers</emphasis> folder,
2088 right-click the white background (with no printer highlighted). Select
2089 "<emphasis>Server Properties</emphasis>". On the
2090 "<emphasis>Drivers</emphasis> " tab you will see the new driver listed
2091 now. This view enables you to also inspect the list of files belonging
2092 to that driver<emphasis> (this doesn't work on Windows NT, but only on
2093 Windows 2000 and Windows XP. WinNT doesn't provide the "Drivers"
2094 tab).</emphasis>. An alternative, much quicker method for Windows
2095 2000/XP to start this dialog is by typing into a DOS box (you must of
2096 course adapt the name to your Samba server instead of SAMBA-CUPS):
2100 rundll32 printui.dll,PrintUIEntry /s /t2 /n\\SAMBA-CUPS
2104 <listitem><para>from a UNIX prompt run this command (or a variant
2105 thereof), where "SAMBA-CUPS" is the name of the Samba host and "xxxx"
2106 represents the actual Samba password assigned to root:
2110 rpcclient -U'root%xxxx' -c 'enumdrivers' SAMBA-CUPS
2114 You will see a listing of all drivers Samba knows about. Your new one
2115 should be amongst them. But it is only listed under the [Windows NT
2116 x86] heading, not under [Windows 4.0], since we didn't install that
2117 part. Or did *you*? -- You will see a listing of all drivers Samba
2118 knows about. Your new one should be amongst them. In our example it is
2119 named <emphasis>dm9110</emphasis>. Note that the 3rd column shows the
2120 other installed drivers twice, for each supported architecture one
2121 time. Our new driver only shows up for "Windows NT 4.0 or 2000". To
2122 have it present for "Windows 95, 98 and ME" you'll have to repeat the
2123 whole procedure with the WIN40 architecture and subdirectory.
2129 <title>A sidenote: you are not bound to specific driver names</title>
2132 You can name the driver as you like. If you repeat the
2133 <command>adddriver</command> step, with the same files as before, but
2134 with a different driver name, it will work the same:
2139 kde-bitshop:~# rpcclient -Uroot%xxxx \
2140 -c 'adddriver "Windows NT x86" \
2141 "myphantasydrivername:HDNIS01_de.DLL: \
2142 Hddm91c1_de.ppd:HDNIS01U_de.DLL:HDNIS01U_de.HLP: \
2143 NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI, \
2144 Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre, \
2145 Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL, \
2146 HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP' SAMBA-CUPS
2148 cmd = adddriver "Windows NT x86"
2149 "myphantasydrivername:HDNIS01_de.DLL:Hddm91c1_de.ppd:HDNIS01U_de.DLL:\
2150 HDNIS01U_de.HLP:NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI, \
2151 Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre, \
2152 Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL, \
2153 HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP"
2155 Printer Driver myphantasydrivername successfully installed.
2160 You will also be able to bind that driver to any print queue (however,
2161 you are responsible yourself that you associate drivers to queues
2162 which make sense to the target printer). Note, that you can't run the
2163 <command>rpcclient</command> <command>adddriver</command> command
2164 repeatedly. Each run "consumes" the files you had put into the
2165 <parameter>[print$]</parameter> share by moving them into the
2166 respective subdirectories. So you <emphasis>must</emphasis> precede an
2167 "<command>smbclient ... put"</command> command before each
2168 "<command>rpcclient ... addriver</command>" command.
2173 <title>La Grande Finale: Running <command>rpcclient</command> with
2174 <command>setdriver</command></title>
2177 Samba still needs to know <emphasis>which</emphasis> printer's driver
2178 this is. It needs to create a mapping of the driver to a printer, and
2179 store this info in its "memory", the TDB files. The <command>rpcclient
2180 setdriver</command> command achieves exactly this:
2184 kde-bitshop:~# rpcclient -U'root%xxxx' -c 'setdriver dm9110 myphantasydrivername' SAMBA-CUPS
2185 cmd = setdriver dm9110 myphantasydrivername
2186 Successfully set dm9110 to driver myphantasydrivername.
2190 Ahhhhh -- no, I didn't want to do that. Repeat, this time with the
2195 kde-bitshop:~# rpcclient -U'root%xxxx' -c 'setdriver dm9110 dm9110' SAMBA-CUPS
2196 cmd = setdriver dm9110 dm9110
2197 Succesfully set dm9110 to driver dm9110.
2201 The syntax of the command is <command>rpcclient -U'root%sambapassword'
2202 -c 'setdriver "printername" "drivername' SAMBA-Hostname</command> . --
2203 Now we have done *most* of the work. But not yet all....
2207 the "setdriver" command will only succeed if the printer is known to
2208 Samba already. A bug in 2.2.x prevented Samba from recognizing freshly
2209 installed printers. You had to restart Samba, or at least send a HUP
2210 signal to all running smbd processes to work around this:
2211 <command>kill -HUP `pidof smbd`</command>. </para></note>
2217 <title>"The Proof of the Pudding lies in the Eating" (Client Driver Insta
2221 A famous philosopher said once: <quote>The Proof of the Pudding lies
2222 in the Eating</quote>. The proof for our setup lies in the printing.
2223 So let's install the printer driver onto the client PCs. This is not
2224 as straightforward as it may seem. Read on.
2228 <title>The first Client Driver Installation</title>
2231 Especially important is the installation onto the first client PC (for
2232 each architectural platform separately). Once this is done correctly,
2233 all further clients are easy to setup and shouldn't need further
2234 attention. What follows is a description for the recommended first
2235 procedure. You work now from a client workstation. First you should
2236 guarantee that your connection is not unwittingly mapped to
2237 <parameter>bad user</parameter> "nobody". In a DOS box type:
2241 net use \\SAMBA-SERVER\print$ /user:root
2245 Replace root, if needed, by another valid 'printer admin' user as
2246 given in the <filename>smb.conf</filename> definition. Should you
2247 already be connected as a different user, you'll get an error
2248 message. There is no easy way to get rid of that connection, because
2249 Windows doesn't seem to know a concept of "logging off" from a share
2250 connection (don't confuse this with logging off from the local
2251 workstation; that is a different matter). You can try to close
2252 <emphasis>all</emphasis> Windows file explorer and Internet Explorer
2253 windows. As a last resort, you may have to reboot. Make sure there is
2254 no automatic re-connection set up. It may be easier to go to a
2255 different workstation and try from there. After you have made sure you
2256 are connected as a printer admin user (you can check this with the
2257 <command>smbstatus</command> command on Samba) do this from the
2258 Windows workstation:
2262 <listitem><para>Open <emphasis>Network
2263 Neighbourhood</emphasis></para></listitem>
2265 <listitem><para>Browse to Samba server</para></listitem>
2267 <listitem><para>Open its <emphasis>Printers and
2268 Faxes</emphasis> folder</para></listitem>
2270 <listitem><para>Highlight and right-click the printer</para></listitem>
2272 <listitem><para>Select <emphasis>Connect...</emphasis> (for WinNT4/2K
2273 it is possibly <emphasis>Install...</emphasis>)</para></listitem>
2277 A new printer (named <replaceable>printername</replaceable> on
2278 samba-server) should now have appeared in your
2279 <emphasis>local</emphasis> Printer folder (check <emphasis>Start --
2280 Settings -- Control Panel -- Printers and Faxes</emphasis>).
2284 Most likely you are now tempted to try and print a test page. After
2285 all, you now can open the printer properties and on the "General" tab,
2286 there is a button offering to do just that. But chances are that you
2287 get an error message saying <computeroutput>Unable to print Test
2288 Page</computeroutput>. The reason might be that there is not yet a
2289 valid Device Mode set for the driver, or that the "Printer Driver
2290 Data" set is still incomplete.
2294 You must now make sure that a valid "Device Mode" is set for the
2295 driver. Don't fear -- we will explain now what that means.
2300 <title>IMPORTANT! Setting Device Modes on new Printers</title>
2303 In order for a printer to be truly usable by a Windows NT/2K/XP
2304 client, it must possess:
2308 <listitem><para>a valid <emphasis>Device Mode</emphasis> generated by
2309 the driver for the printer (defining things like paper size,
2310 orientation and duplex settings), and</para></listitem>
2312 <listitem><para>a complete set of
2313 <emphasis>Printer Driver Data</emphasis> generated by the
2314 driver.</para></listitem>
2318 If either one of these is incomplete, the clients can produce less
2319 than optimal output at best. In the worst cases, unreadable garbage or
2320 nothing at all comes from the printer or they produce a harvest of
2321 error messages when attempting to print. Samba stores the named values
2322 and all printing related info in its internal TDB database files
2323 <filename>(ntprinters.tdb</filename>,
2324 <filename>ntdrivers.tdb</filename>, <filename>printing.tdb</filename>
2325 and <filename>ntforms.tdb</filename>).
2329 What do these two words stand for? Basically, the Device Mode and the
2330 set of Printer Driver Data is a collection of settings for all print
2331 queue properties, initialized in a sensible way. Device Modes and
2332 Printer Driver Data should initially be set on the print server (that is
2333 here: the Samba host) to healthy values so that the clients can start
2334 to use them immediately. How do we set these initial healthy values?
2335 This can be achieved by accessing the drivers remotely from an NT (or
2336 2k/XP) client, as is discussed in the next paragraphs.
2340 Be aware, that a valid Device Mode can only be initiated by a
2341 "<emphasis>printer admin</emphasis>", or root (the reason should be
2342 obvious). Device Modes can only correctly be set by executing the
2343 printer driver program itself. Since Samba can not execute this Win32
2344 platform driver code, it sets this field initially to NULL (which is
2345 not a valid setting for clients to use). Fortunately, most drivers
2346 generate themselves the Printer Driver Data that is needed, when they
2347 are uploaded to the <parameter>[print$]</parameter> share with the
2348 help of the APW or rpcclient.
2352 The generation and setting of a first valid Device Mode however
2353 requires some "tickling" from a client, to set it on the Samba
2354 server. The easiest means of doing so is to simply change the page
2355 orientation on the server's printer. This "executes" enough of the
2356 printer driver program on the client for the desired effect to happen,
2357 and feeds back the new Device Mode to our Samba server. You can use the
2358 native Windows NT/2K/XP printer properties page from a Window client
2363 <listitem><para>Browse the "Network Neighbourhood"</para></listitem>
2365 <listitem><para>Find the Samba server</para></listitem>
2367 <listitem><para>Open the Samba server's <emphasis>Printers and
2368 Faxes</emphasis> folder</para></listitem>
2370 <listitem><para>Highlight the shared printer in question</para></listitem>
2372 <listitem><para>Right-click the printer (you may already be here, if you
2373 followed the last section's description)</para></listitem>
2375 <listitem><para>At the bottom of the context menu select
2376 "Properties...." (if the menu still offers the "Connect..." entry
2377 further above, you need to click that one first to achieve the driver
2378 installation as shown in the last section)</para></listitem>
2380 <listitem><para>Go to the "Advanced" tab; click on "Printing
2381 Defaults..."</para></listitem>
2383 <listitem><para>Change the "Portrait" page setting to "Landscape" (and
2384 back)</para></listitem>
2386 <listitem><para>(Oh, and make sure to <emphasis>apply</emphasis>
2387 changes between swapping the page orientation to cause the change to
2388 actually take effect...).</para></listitem>
2390 <listitem><para>While you're at it, you may optionally also want to
2391 set the desired printing defaults here, which then apply to all future
2392 client driver installations on the remaining from now
2393 on.</para></listitem>
2397 This procedure has executed the printer driver program on the client
2398 platform and fed back the correct Device Mode to Samba, which now
2399 stored it in its TDB files. Once the driver is installed on the
2400 client, you can follow the analogous steps by accessing the
2401 <emphasis>local</emphasis> "Printers" folder too if you are a Samba
2402 printer admin user. From now on printing should work as expected.
2406 Samba also includes a service level parameter name <parameter>default
2407 devmode</parameter> for generating a default Device Mode for a
2408 printer. Some drivers will function well with Samba's default set of
2409 properties. Others may crash the client's spooler service. So use this
2410 parameter with caution. It is always better to have the client
2411 generate a valid device mode for the printer and store it on the
2417 <title>Further Client Driver Install Procedures</title>
2420 Every further driver may be done by any user, along the lines
2421 described above: Browse network, open printers folder on Samba server,
2422 right-click printer and choose "Connect...". Once this completes
2423 (should be not more than a few seconds, but could also take a minute,
2424 depending on network conditions), you should find the new printer in
2425 your client workstation local <emphasis>Printers and
2426 Faxes</emphasis> folder.
2430 You can also open your local "Printers and Faxes" folder by using this
2431 command on Windows 2000 and Windows XP Professional workstations:
2435 rundll32 shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder
2439 or this command on Windows NT 4.0 workstations:
2443 rundll32 shell32.dll,Control_RunDLL MAIN.CPL @2
2447 You can enter the commands either inside a "DOS box" window or in the
2448 "Run command..." field from the "Start" menu.
2453 <title>Always make first Client Connection as root or "printer admin"</title>
2456 After you installed the driver on the Samba server (in its
2457 <parameter>[print$]</parameter> share, you should always make sure
2458 that your first client installation completes correctly. Make it a habit for
2459 yourself to build that the very first connection from a client as
2460 "printer admin". This is to make sure that:
2465 <listitem><para> a first valid <emphasis>Device Mode</emphasis> is
2466 really initialized (see above for more explanation details), and
2467 that</para></listitem>
2469 <listitem><para> the default print settings of your printer for all
2470 further client installations are as you want them</para></listitem>
2474 Do this by changing the orientation to landscape, click
2475 <emphasis>Apply</emphasis>, and then change it back again. Then modify
2476 the other settings (for example, you don't want the default media size
2477 set to <emphasis>Letter</emphasis>, when you are all using
2478 <emphasis>A4</emphasis>, right? You may want to set the printer for
2479 <emphasis>duplex</emphasis> as the default; etc.).
2483 To connect as root to a Samba printer, try this command from a Windows
2484 2K/XP DOS box command prompt:
2488 runas /netonly /user:root "rundll32 printui.dll,PrintUIEntry /p /t3 /n \\SAMBA-SERVER\printername"
2492 You will be prompted for root's Samba-password; type it, wait a few
2493 seconds, click on "<emphasis>Printing Defaults...</emphasis>" and
2494 proceed to set the job options as should be used as defaults by all
2495 clients. Alternatively, instead of root you can name one other member
2496 of the<emphasis>printer admins</emphasis> from the
2497 <filename>smb.conf</filename> setting.
2501 Now all the other users downloading and installing the driver
2502 the same way (called <emphasis>Point'n'Print</emphasis>) will
2503 have the same defaults set for them. If you miss this step you'll
2504 get a lot of helpdesk calls from your users. But maybe you like to
2505 talk to people.... ;-)
2511 <title>Other Gotchas</title>
2514 Your driver is installed. It is ready for
2515 <emphasis>Point'n'Print</emphasis> installation by the clients
2516 now. You <emphasis>may</emphasis> have tried to download and use it
2517 onto your first client machine now. But wait... let's make you
2518 acquainted first with a few tips and tricks you may find useful. For
2519 example, suppose you didn't manage to "set the defaults" on the
2520 printer, as advised in the preceeding paragraphs? And your users
2521 complain about various issues (such as <quote>We need to set the paper
2522 size for each job from Letter to A4 and it won't store it!</quote>)
2526 <title>Setting Default Print Options for the Client Drivers</title>
2529 The last sentence might be viewed with mixed feelings by some users and
2530 admins. They have struggled for hours and hours and couldn't arrive at
2531 a point were their settings seemed to be saved. It is not their
2532 fault. The confusing thing is this: in the multi-tabbed dialog that pops
2533 up when you right-click the printer name and select
2534 <emphasis>Properties...</emphasis>, you can arrive at two identically
2535 looking dialogs, each claiming that they help you to set printer options,
2536 in three different ways. Here is the definite answer to the "Samba
2537 Default Driver Setting FAQ":
2540 <formalpara><title><quote>I can't set and save default print options
2541 for all users on Win2K/XP! Why not?</quote></title>
2544 How are you doing it? I bet the wrong way.... (it is not very
2545 easy to find out, though). There are 3 different ways to bring you to
2546 a dialog that <emphasis>seems</emphasis> to set everything. All three
2547 dialogs <emphasis>look</emphasis> the same. Only one of them
2548 <emphasis>does</emphasis> what you intend.
2549 <emphasis>Important:</emphasis> you need to be Administrator or Print
2550 Administrator to do this for all users. Here is how I reproduce it in
2553 <orderedlist numeration="upperalpha">
2555 <listitem><para>The first "wrong" way:
2557 <orderedlist numeration="arabic">
2558 <listitem><para>Open the <emphasis>Printers</emphasis>
2559 folder.</para></listitem>
2561 <listitem><para>Right-click on the printer
2562 (<emphasis>remoteprinter on cupshost</emphasis>) and
2563 select in context menu <emphasis>Printing
2564 Preferences...</emphasis></para></listitem>
2566 <listitem><para>Look at this dialog closely and remember what it looks
2567 like.</para></listitem>
2572 <listitem><para>The second "wrong" way:
2574 <orderedlist numeration="arabic">
2575 <listitem><para>Open the "<emphasis>Printers</emphasis>"
2576 folder.</para></listitem>
2578 <listitem><para>Right-click on the printer (<emphasis>remoteprinter on
2579 cupshost</emphasis>) and select in the context menu
2580 <emphasis>Properties</emphasis></para></listitem>
2582 <listitem><para>Click on the <emphasis>General</emphasis>
2583 tab</para></listitem>
2585 <listitem><para>Click on the button <emphasis>Printing
2586 Preferences...</emphasis></para></listitem>
2588 <listitem><para>A new dialog opens. Keep this dialog open and go back
2589 to the parent dialog.</para></listitem>
2594 <listitem><para>The third, the "correct" way: (should you do
2595 this from the beginning, just carry out steps 1. and 2. from second
2598 <orderedlist numeration="arabic">
2599 <listitem><para>Click on the <emphasis>Advanced</emphasis>
2600 tab. (Hmmm... if everything is "Grayed Out", then you are not logged
2601 in as a user with enough privileges).</para></listitem>
2603 <listitem><para>Click on the "<emphasis>Printing
2604 Defaults...</emphasis>" button.</para></listitem>
2606 <listitem><para>On any of the two new tabs, click on the
2607 <emphasis>Advanced...</emphasis>
2608 button.</para></listitem>
2610 <listitem><para>A new dialog opens. Compare this one to the other,
2611 identical looking one from "B.5" or A.3".</para></listitem>
2617 Do you see any difference in the two settings dialogs? I don't
2618 either. However, only the last one, which you arrived at with steps
2619 C.1.-6. will permanently save any settings which will then become the
2620 defaults for new users. If you want all clients to have the same
2621 defaults, you need to conduct these steps as administrator
2622 (<emphasis>printer admin</emphasis> in <filename>smb.conf</filename>)
2623 <emphasis>before</emphasis> a client downloads the driver (the clients
2624 can later set their own <emphasis>per-user defaults</emphasis> by
2625 following the procedures<emphasis>A.</emphasis>
2626 or<emphasis>B.</emphasis> above...). (This is new: Windows 2000 and
2627 Windows XP allow <emphasis>per-user</emphasis> default settings and
2628 the ones the administrator gives them, before they set up their own).
2629 The "parents" of the identically looking dialogs have a slight
2630 difference in their window names: one is called
2631 <computeroutput>Default Print Values for Printer Foo on Server
2632 Bar"</computeroutput> (which is the one you need) and the other is
2633 called "<computeroutput>Print Settings for Printer Foo on Server
2634 Bar</computeroutput>". The last one is the one you arrive at when you
2635 right-click on the printer and select <emphasis>Print
2636 Settings...</emphasis>. This is the one what you were
2637 taught to use back in the days of Windows NT! So it is only natural to
2638 try the same way with Win2k or WinXP. You wouldn't dream
2639 that there is now a different "clicking path" to arrive at an
2640 identically looking, but functionally different dialog to set defaults
2642 </para></formalpara>
2644 <tip><para>Try (on Win2000 and WinXP) to run this command (as a user
2645 with the right privileges):
2649 rundll32 printui.dll,PrintUIEntry /p /t3 /n\\SAMBA-SERVER\printersharename
2653 to see the tab with the <emphasis>Printing Defaults...</emphasis>
2654 button (the one you need). Also run this command:
2658 rundll32 printui.dll,PrintUIEntry /p /t0 /n\\SAMBA-SERVER\printersharename
2662 to see the tab with the <emphasis>Printing Preferences...</emphasis>
2663 button (the one which doesn't set system-wide defaults). You can
2664 start the commands from inside a DOS box" or from the <emphasis>Start
2665 -- Run...</emphasis> menu.
2672 <title>Supporting large Numbers of Printers</title>
2675 One issue that has arisen during the recent development phase of Samba
2676 is the need to support driver downloads for 100's of printers. Using
2677 Windows NT APW here is somewhat awkward (to say the least). If you
2678 don't want to acquire RSS pains from such the printer installation
2679 clicking orgy alone, you need to think about a non-interactive script.
2683 If more than one printer is using the same driver, the
2684 <command>rpcclient setdriver</command> command can be used to set the
2685 driver associated with an installed queue. If the driver is uploaded
2686 to <parameter>[print$]</parameter> once and registered with the
2687 printing TDBs, it can be used by multiple print queues. In this case
2688 you just need to repeat the <command>setprinter</command> subcommand
2689 of <command>rpcclient</command> for every queue (without the need to
2690 conduct the <command>adddriver</command> again and again). The
2691 following is an example of how this could be accomplished:
2696 ----------------------------------------------------------------------------------
2697 $ rpcclient SAMBA-CUPS -U root%secret -c 'enumdrivers'
2701 Printer Driver Info 1:
2702 Driver Name: [infotec IS 2075 PCL 6]
2704 Printer Driver Info 1:
2705 Driver Name: [DANKA InfoStream]
2707 Printer Driver Info 1:
2708 Driver Name: [Heidelberg Digimaster 9110 (PS)]
2710 Printer Driver Info 1:
2711 Driver Name: [dm9110]
2713 Printer Driver Info 1:
2714 Driver Name: [myphantasydrivername]
2717 ----------------------------------------------------------------------------------
2719 ----------------------------------------------------------------------------------
2720 $ rpcclient SAMBA-CUPS -U root%secret -c 'enumprinters'
2723 name:[\\SAMBA-CUPS\dm9110]
2724 description:[\\SAMBA-CUPS\dm9110,,110ppm HiVolume DANKA Stuttgart]
2725 comment:[110 ppm HiVolume DANKA Stuttgart]
2727 ----------------------------------------------------------------------------------
2729 ----------------------------------------------------------------------------------
2730 $ rpcclient SaMbA-cUpS -U root%secret -c 'setdriver dm9110 "Heidelberg Digimaster 9110 (PS)"'
2731 cmd = setdriver dm9110 Heidelberg Digimaster 9110 (PPD)
2732 Successfully set dm9110 to driver Heidelberg Digimaster 9110 (PS).
2733 ----------------------------------------------------------------------------------
2735 ----------------------------------------------------------------------------------
2736 $ rpcclient samba-cups -U root%secret -c 'enumprinters'
2739 name:[\\SAMBA-CUPS\dm9110]
2740 description:[\\SAMBA-CUPS\dm9110,Heidelberg Digimaster 9110 (PS),110ppm HiVolume DANKA Stuttgart]
2741 comment:[110ppm HiVolume DANKA Stuttgart]
2743 ----------------------------------------------------------------------------------
2745 ----------------------------------------------------------------------------------
2746 $ rpcclient SaMbA-cUpS -U root%secret -c 'setdriver dm9110 myphantasydrivername'
2747 cmd = setdriver dm9110 myphantasydrivername
2748 Successfully set dm9110 to myphantasydrivername.
2749 ----------------------------------------------------------------------------------
2751 ----------------------------------------------------------------------------------
2752 $ rpcclient samba-cups -U root%secret -c 'enumprinters'
2755 name:[\\SAMBA-CUPS\dm9110]
2756 description:[\\SAMBA-CUPS\dm9110,myphantasydrivername,110ppm HiVolume DANKA Stuttgart]
2757 comment:[110ppm HiVolume DANKA Stuttgart]
2759 ----------------------------------------------------------------------------------
2764 It may be not easy to recognize: but the first call to
2765 <command>enumprinters</command> showed the "dm9110" printer with an
2766 empty string where the driver should have been listed (between the 2
2767 commas in the "description" field). After the
2768 <command>setdriver</command> command succeeded, all is well. (The
2769 CUPS Printing chapter has more info about the installation of printer
2770 drivers with the help of <command>rpccclient</command>).
2775 <title>Adding new Printers with the Windows NT APW</title>
2778 By default, Samba exhibits all printer shares defined in
2779 <emphasis><filename>smb.conf</filename></emphasis> in the
2780 <emphasis>Printers...</emphasis> folder. Also located in this folder
2781 is the Windows NT Add Printer Wizard icon. The APW will be shown only
2786 <listitem><para>...the connected user is able to successfully execute
2787 an <command>OpenPrinterEx(\\server)</command> with administrative
2788 privileges (i.e. root or <emphasis>printer admin</emphasis>).
2791 <tip><para> Try this from a Windows 2K/XP DOS box command prompt:
2795 runas /netonly /user:root rundll32 printui.dll,PrintUIEntry /p /t0 /n \\SAMBA-SERVER\printersharename
2799 and click on <emphasis>Printing Preferences...</emphasis>
2800 </para></tip></listitem>
2802 <listitem><para>...<filename>smb.conf</filename> contains the setting
2803 <emphasis>show add printer wizard = yes</emphasis> (the
2804 default).</para></listitem>
2808 The APW can do various things:
2812 <listitem><para>upload a new driver to the Samba
2813 <parameter>[print$]</parameter> share;</para></listitem>
2815 <listitem><para>associate an uploaded driver with an existing (but
2816 still "driverless") print queue;</para></listitem>
2818 <listitem><para>exchange the currently used driver for an existing
2819 print queue with one that has been uploaded before;</para></listitem>
2821 <listitem><para>add an entirely new printer to the Samba host (only in
2822 conjunction with a working <parameter>add printer command</parameter>;
2823 a corresponding <parameter>delete printer command</parameter> for
2824 removing entries from the <emphasis>Printers...</emphasis> folder
2825 may be provided too)</para></listitem>
2829 The last one (add a new printer) requires more effort than the
2830 previous ones. In order to use the APW to successfully add a printer
2831 to a Samba server, the <parameter>add printer command</parameter> must
2832 have a defined value. The program hook must successfully add the
2833 printer to the Unix print system (i.e. to
2834 <filename>/etc/printcap</filename>,
2835 <filename>/etc/cups/printers.conf</filename> or other appropriate
2836 files) and to <filename>smb.conf</filename> if necessary.
2840 When using the APW from a client, if the named printer share does not
2841 exist, smbd will execute the <parameter>add printer
2842 command</parameter> and reparse to the <filename>smb.conf</filename>
2843 to attempt to locate the new printer share. If the share is still not
2844 defined, an error of <computeroutput>Access Denied</computeroutput> is
2845 returned to the client. Note that the <parameter>add printer
2846 command</parameter> is executed under the context of the connected
2847 user, not necessarily a root account. A <parameter>map to guest = bad
2848 user</parameter> may have connected you unwittingly under the wrong
2849 privilege; you should check it by using the
2850 <command>smbstatus</command> command.
2855 <title>Weird Error Message <errorname>Cannot connect under a
2856 different Name</errorname></title>
2859 Once you are connected with the wrong credentials, there is no means
2860 to reverse the situation other than to close all Explorer windows, and
2865 <listitem><para>The <command>net use \\SAMBA-SERVER\sharename
2866 /user:root</command> gives you an error message: <computeroutput>Multiple
2867 connections to a server or a shared resource by the same user
2868 utilizing the several user names are not allowed. Disconnect all
2869 previous connections to the server, resp. the shared resource, and try
2870 again.</computeroutput></para></listitem>
2872 <listitem><para>Every attempt to "connect a network drive" to
2873 <filename>\\SAMBASERVER\\print$</filename> to z: is countered by the
2874 pertinacious message. <computeroutput>This network folder is currently
2875 connected under different credentials (username and password).
2876 Disconnect first any existing connection to this network share in
2877 order to connect again under a different username and
2878 password</computeroutput>.</para></listitem>
2882 So you close all connections. You try again. You get the same
2883 message. You check from the Samba side, using
2884 <command>smbstatus</command>. Yes, there are some more
2885 connections. You kill them all. The client still gives you the same
2886 error message. You watch the smbd.log file on a very high debug level
2887 and try re-connect. Same error message, but not a single line in the
2888 log. You start to wonder if there was a connection attempt at all. You
2889 run ethereal and tcpdump while you try to connect. Result: not a
2890 single byte goes on the wire. Windows still gives the error
2891 message. You close all Explorer Windows and start it again. You try to
2892 connect - and this times it works! Windows seems to cache connection
2893 info somewhere and doesn't keep it up to date (if you are unlucky you
2894 might need to reboot to get rid of the error message).
2899 <title>Be careful when assembling Driver Files</title>
2902 You need to be very careful when you take notes about the files and
2903 belonging to a particular driver. Don't confuse the files for driver
2904 version "0" (for Win95/98/ME, going into
2905 <filename>[print$]/WIN/0/</filename>), driver version "2" (Kernel Mode
2906 driver for WinNT, going into <filename>[print$]/W32X86/2/</filename>
2907 <emphasis>may</emphasis> be used on Win2K/XP too), and driver version
2908 "3" (non-Kernel Mode driver going into
2909 <filename>[print$]/W32X86/3/</filename> <emphasis>can not</emphasis>
2910 be used on WinNT). Very often these different driver versions contain
2911 files carrying the same name; but still the files are very different!
2912 Also, if you look at them from the Windows Explorer (they reside in
2913 "<filename>%WINDOWS%\system32\spool\drivers\W32X86\</filename>") you
2914 will probably see names in capital letters, while an "enumdrivers"
2915 command from Samba would show mixed or lower case letters. So it is
2916 easy to confuse them. If you install them manually using
2917 <command>rpcclient</command> and subcommands, you may even succeed
2918 without an error message. Only later, when you try install on a
2919 client, you will encounter error messages like <computeroutput>This
2920 server has no appropriate driver for the printer</computeroutput>.
2924 Here is an example. You are invited to look very closely at the
2925 various files, compare their names and their spelling, and discover
2926 the differences in the composition of the version-2 and -3 sets
2927 Note: the version-0 set contained 40 (!)
2928 <parameter>Dependentfiles</parameter>, so I left it out for space
2934 kde4@kde-bitshop:# rpcclient -U 'Administrator%xxxx' -c 'enumdrivers 3' 10.160.50.8
2936 Printer Driver Info 3:
2938 Driver Name: [Canon iR8500 PS3]
2939 Architecture: [Windows NT x86]
2940 Driver Path: [\\10.160.50.8\print$\W32X86\3\cns3g.dll]
2941 Datafile: [\\10.160.50.8\print$\W32X86\3\iR8500sg.xpd]
2942 Configfile: [\\10.160.50.8\print$\W32X86\3\cns3gui.dll]
2943 Helpfile: [\\10.160.50.8\print$\W32X86\3\cns3g.hlp]
2945 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\aucplmNT.dll]
2946 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\ucs32p.dll]
2947 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\tnl32.dll]
2948 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\aussdrv.dll]
2949 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cnspdc.dll]
2950 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\aussapi.dat]
2951 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cns3407.dll]
2952 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\CnS3G.cnt]
2953 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\NBAPI.DLL]
2954 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\NBIPC.DLL]
2955 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcview.exe]
2956 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcdspl.exe]
2957 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcedit.dll]
2958 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcqm.exe]
2959 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcspl.dll]
2960 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cfine32.dll]
2961 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcr407.dll]
2962 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\Cpcqm407.hlp]
2963 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcqm407.cnt]
2964 Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cns3ggr.dll]
2969 Printer Driver Info 3:
2971 Driver Name: [Canon iR5000-6000 PS3]
2972 Architecture: [Windows NT x86]
2973 Driver Path: [\\10.160.50.8\print$\W32X86\2\cns3g.dll]
2974 Datafile: [\\10.160.50.8\print$\W32X86\2\IR5000sg.xpd]
2975 Configfile: [\\10.160.50.8\print$\W32X86\2\cns3gui.dll]
2976 Helpfile: [\\10.160.50.8\print$\W32X86\2\cns3g.hlp]
2978 Dependentfiles: [\\10.160.50.8\print$\W32X86\2\AUCPLMNT.DLL]
2979 Dependentfiles: [\\10.160.50.8\print$\W32X86\2\aussdrv.dll]
2980 Dependentfiles: [\\10.160.50.8\print$\W32X86\2\cnspdc.dll]
2981 Dependentfiles: [\\10.160.50.8\print$\W32X86\2\aussapi.dat]
2982 Dependentfiles: [\\10.160.50.8\print$\W32X86\2\cns3407.dll]
2983 Dependentfiles: [\\10.160.50.8\print$\W32X86\2\CnS3G.cnt]
2984 Dependentfiles: [\\10.160.50.8\print$\W32X86\2\NBAPI.DLL]
2985 Dependentfiles: [\\10.160.50.8\print$\W32X86\2\NBIPC.DLL]
2986 Dependentfiles: [\\10.160.50.8\print$\W32X86\2\cns3gum.dll]
2988 Monitorname: [CPCA Language Monitor2]
2994 If we write the "version 2" files and the "version 3" files
2995 into different text files and compare the result, we see this
3001 kde4@kde-bitshop:# sdiff 2-files 3-files
3004 iR8500sg.xpd iR8500sg.xpd
3005 cns3gui.dll cns3gui.dll
3007 AUCPLMNT.DLL | aucplmNT.dll
3010 aussdrv.dll aussdrv.dll
3011 cnspdc.dll cnspdc.dll
3012 aussapi.dat aussapi.dat
3013 cns3407.dll cns3407.dll
3017 cns3gum.dll | cpcview.exe
3032 Don't be fooled though! Driver files for each version with identical
3033 names may be different in their content, as you can see from this size
3039 kde4@kde-bitshop:# for i in cns3g.hlp cns3gui.dll cns3g.dll; do \
3040 smbclient //10.160.50.8/print\$ -U 'Administrator%xxxx' \
3041 -c "cd W32X86/3; dir $i; cd .. ; cd 2; dir $i"; \
3044 CNS3G.HLP A 122981 Thu May 30 02:31:00 2002
3045 CNS3G.HLP A 99948 Thu May 30 02:31:00 2002
3047 CNS3GUI.DLL A 1805824 Thu May 30 02:31:00 2002
3048 CNS3GUI.DLL A 1785344 Thu May 30 02:31:00 2002
3050 CNS3G.DLL A 1145088 Thu May 30 02:31:00 2002
3051 CNS3G.DLL A 15872 Thu May 30 02:31:00 2002
3056 In my example were even more differences than shown here. Conclusion:
3057 you must be very careful to select the correct driver files for each
3058 driver version. Don't rely on the names alone. Don't interchange files
3059 belonging to different driver versions.
3064 <title>Samba and Printer Ports</title>
3067 Windows NT/2000 print servers associate a port with each
3068 printer. These normally take the form of <filename>LPT1:</filename>,
3069 <filename>COM1:</filename>, <filename>FILE:</filename>, etc. Samba
3070 must also support the concept of ports associated with a printer. By
3071 default, only one printer port, named "Samba Printer Port", exists on
3072 a system. Samba does not really need such a "port" in order to print;
3073 it rather is a requirement of Windows clients. They insist on being
3074 told about an available port when they request this info, otherwise
3075 they throw an error message at you. So Samba fakes the port
3076 information to keep the Windows clients happy.
3080 Note that Samba does not support the concept of "Printer Pooling"
3081 internally either. Printer Pooling assigns a logical printer to
3082 multiple ports as a form of load balancing or fail over.
3086 If you require that multiple ports be defined for some reason or
3087 another (<quote>My users and my Boss should not know that they are
3088 working with Samba</quote>), <filename>smb.conf</filename> possesses a
3089 <parameter>enumports command</parameter> which can be used to define
3090 an external program that generates a listing of ports on a system.
3095 <title>Avoiding the most common Misconfigurations of the Client Driver</title>
3098 So - printing works, but there are still problems. Most jobs print
3099 well, some don't print at all. Some jobs have problems with fonts,
3100 which don't look good at all. Some jobs print fast, and some are
3101 dead-slow. We can't cover it all; but we want to encourage you to read
3102 the little paragraph about "Avoiding the wrong PostScript Driver
3103 Settings" in the CUPS Printing part of this document.
3109 <title>The Imprints Toolset</title>
3112 The Imprints tool set provides a UNIX equivalent of the
3113 Windows NT Add Printer Wizard. For complete information, please
3114 refer to the Imprints web site
3115 at<ulink url="http://imprints.sourceforge.net/">http://imprints.sourceforge.net/</ulink>
3116 as well as the documentation included with the imprints source
3117 distribution. This section will only provide a brief introduction
3118 to the features of Imprints.
3121 <formalpara><title>ATTENTION! MAINTAINER REQUIRED</title>
3124 Unfortunately, the Imprints toolset is no longer maintained. As of
3125 December, 2000, the project is in need of a new maintainer. The most
3126 important skill to have is decent perl coding and an interest in
3127 MS-RPC based printing using Samba. If you wish to volunteer, please
3128 coordinate your efforts on the samba-technical mailing list. The
3129 toolset is still in usable form; but only for a series of older
3130 printer models, where there are prepared packages to use. Packages for
3131 more up to date print devices are needed if Imprints should have a
3132 future.</para></formalpara>
3135 <title>What is Imprints?</title>
3138 Imprints is a collection of tools for supporting these goals:
3142 <listitem><para>Providing a central repository information regarding
3143 Windows NT and 95/98 printer driver packages</para></listitem>
3145 <listitem><para>Providing the tools necessary for creating the
3146 Imprints printer driver packages.</para></listitem>
3148 <listitem><para>Providing an installation client which will obtain
3149 printer drivers from a central internet (or intranet) Imprints Server
3150 repository and install them on remote Samba and Windows NT4 print
3151 servers.</para></listitem>
3156 <title>Creating Printer Driver Packages</title>
3159 The process of creating printer driver packages is beyond the scope of
3160 this document (refer to Imprints.txt also included with the Samba
3161 distribution for more information). In short, an Imprints driver
3162 package is a gzipped tarball containing the driver files, related INF
3163 files, and a control file needed by the installation client.
3168 <title>The Imprints Server</title>
3171 The Imprints server is really a database server that may be queried
3172 via standard HTTP mechanisms. Each printer entry in the database has
3173 an associated URL for the actual downloading of the package. Each
3174 package is digitally signed via GnuPG which can be used to verify that
3175 package downloaded is actually the one referred in the Imprints
3176 database. It is strongly recommended that this security check
3177 <emphasis>not</emphasis> be disabled.
3182 <title>The Installation Client</title>
3185 More information regarding the Imprints installation client is
3186 available in the <filename>Imprints-Client-HOWTO.ps</filename> file
3187 included with the imprints source package.
3191 The Imprints installation client comes in two forms.
3194 <listitem><para>a set of command line Perl scripts</para></listitem>
3196 <listitem><para>a GTK+ based graphical interface to the command line Perl
3197 scripts</para></listitem>
3201 The installation client (in both forms) provides a means of querying
3202 the Imprints database server for a matching list of known printer
3203 model names as well as a means to download and install the drivers on
3204 remote Samba and Windows NT print servers.
3208 The basic installation process is in four steps and perl code is
3209 wrapped around smbclient and rpcclient
3214 foreach (supported architecture for a given driver)
3216 1. rpcclient: Get the appropriate upload directory
3217 on the remote server
3218 2. smbclient: Upload the driver files
3219 3. rpcclient: Issues an AddPrinterDriver() MS-RPC
3222 4. rpcclient: Issue an AddPrinterEx() MS-RPC to actually
3228 One of the problems encountered when implementing the Imprints tool
3229 set was the name space issues between various supported client
3230 architectures. For example, Windows NT includes a driver named "Apple
3231 LaserWriter II NTX v51.8" and Windows 95 calls its version of this
3232 driver "Apple LaserWriter II NTX"
3236 The problem is how to know what client drivers have been uploaded for
3237 a printer. An astute reader will remember that the Windows NT Printer
3238 Properties dialog only includes space for one printer driver name. A
3239 quick look in the Windows NT 4.0 system registry at
3243 HKLM\System\CurrentControlSet\Control\Print\Environment
3247 will reveal that Windows NT always uses the NT driver name. This is
3248 ok as Windows NT always requires that at least the Windows NT version
3249 of the printer driver is present. However, Samba does not have the
3250 requirement internally. Therefore, how can you use the NT driver name
3251 if is has not already been installed?
3255 The way of sidestepping this limitation is to require that all
3256 Imprints printer driver packages include both the Intel Windows NT and
3257 95/98 printer drivers and that NT driver is installed first.
3263 <title>Add Network Printers at Logon without User Interaction</title>
3266 The following MS Knowledge Base article may be of some help if you
3267 need to handle Windows 2000 clients: <emphasis>How to Add Printers
3268 with No User Interaction in Windows 2000.</emphasis> ( <ulink
3269 url="http://support.microsoft.com/default.aspx?scid=kb;en-us;189105">http://support.microsoft.com/default.aspx?scid=kb;en-us;189105</ulink>
3270 ). It also applies to Windows XP Professional clients.
3274 The ideas sketched out below are inspired by this article. It
3275 describes a commandline method which can be applied to install
3276 network and local printers and their drivers. This is most useful
3277 if integrated in Logon Scripts. You can see what options are
3278 available by typing in a command prompt ("DOS box") this:
3282 rundll32 printui.dll,PrintUIEntry /?
3286 A window pops up which shows you all of the commandline switches
3287 available. An extensive list of examples is also provided. This is
3288 only for Win 2k/XP. It doesn't work on WinNT. WinNT has probably some
3289 other tools in the respective Resource Kit. Here is a suggestion about
3290 what a client logon script might contain, with a short explanation of
3291 what the lines actually do (it works if 2k/XP Windows clients access
3292 printers via Samba, but works for Windows-based print servers too):
3296 rundll32 printui.dll,PrintUIEntry /dn /n "\\sambacupsserver\infotec2105-IPDS" /q
3297 rundll32 printui.dll,PrintUIEntry /in /n "\\sambacupsserver\infotec2105-PS"
3298 rundll32 printui.dll,PrintUIEntry /y /n "\\sambacupsserver\infotec2105-PS"
3302 Here is a list of the used commandline parameters:
3306 <varlistentry><term>/dn</term>
3307 <listitem><para>deletes a network printer</para></listitem>
3309 <varlistentry><term>/q</term>
3310 <listitem><para>quiet modus</para></listitem>
3312 <varlistentry><term>/n</term>
3313 <listitem><para>names a printer</para></listitem>
3315 <varlistentry><term>/in</term>
3316 <listitem><para>adds a network printer connection</para></listitem>
3318 <varlistentry><term>/y</term>
3319 <listitem><para>sets printer as default printer</para></listitem>
3324 I have tested this with a Samba 2.2.7a and a Samba-3alpha24
3325 installation and Windows XP Professional clients. Note that this
3326 specific command set works with network print queues (installing
3327 local print queues requires different parameters, but this is of no
3332 <listitem><para>Line 1 deletes a possibly existing previous network
3333 printer <emphasis>infotec2105-IPDS</emphasis> (which had used native
3334 Windows drivers with LPRng that were removed from the server which was
3335 converted to CUPS). The <command>/q</command> at the end eliminates
3336 "Confirm" or error dialog boxes popping up. They should not be
3337 presented to the user logging on.</para></listitem>
3339 <listitem><para>Line 2 adds the new printer
3340 <emphasis>infotec2105-PS</emphasis> (which actually is same physical
3341 device but is now run by the new CUPS printing system and associated
3342 with the CUPS/Adobe PS drivers). The printer and its driver
3343 <emphasis>must</emphasis> have been added to Samba prior to the user
3344 logging in (e.g. by a procedure as discussed earlier in this chapter,
3345 or by running <command>cupsaddsmb</command>). The driver is now
3346 auto-downloaded to the client PC where the user is about to log
3347 in.</para></listitem>
3349 <listitem><para>Line 3 sets the default printer to this new network
3350 printer (there might be several other printers installed with this
3351 same method and some may be local as well -- so we deside for a
3352 default printer). The default printer selection may of course be
3353 different for different users.</para></listitem>
3357 Note that the second line only works if the printer
3358 <emphasis>infotec2105-PS</emphasis> has an already working printqueue
3359 on "sambacupsserver", and if the printer drivers have sucessfully been
3360 uploaded (via <command>APW</command> ,
3361 <command>smbclient/rpcclient</command> or
3362 <command>cupsaddsmb</command>) into the
3363 <parameter>[print$]</parameter> driver repository of Samba. Also, some
3364 Samba versions prior to version 3.0 required a re-start of smbd after
3365 the printer install and the driver upload, otherwise the script (or
3366 any other client driver download) would fail.
3370 Since there no easy way to test for the existence of an installed
3371 network printer from the logon script, the suggestion is: don't bother
3372 checking and just allow the deinstallation/reinstallation to occur
3373 every time a user logs in; it's really quick anyway (1 to 2 seconds).
3377 The additional benefits for this are:
3381 <listitem><para>It puts in place any printer default setup changes
3382 automatically at every user logon.</para></listitem>
3384 <listitem><para>It allows for "roaming" users' login into the domain from
3385 different workstations.</para></listitem>
3389 Since network printers are installed per user this much simplifies the
3390 process of keeping the installation up-to-date. The extra few seconds
3391 at logon time will not really be noticeable. Printers can be centrally
3392 added, changed, and deleted at will on the server with no user
3393 intervention required on the clients (you just need to keep the logon
3394 scripts up to date).
3399 <title>The <command>addprinter</command> command</title>
3402 The <command>addprinter</command> command can be configured to be a
3403 shell script or program executed by Samba. It is triggered by running
3404 the APW from a client against the Samba print server. The APW asks the
3405 user to fill in several fields (such as printer name, driver to be
3406 used, comment, port monitor, etc.). These parameters are passed on to
3407 Samba by the APW. If the addprinter command is designed in a way that
3408 it can create a new printer (through writing correct printcap entries
3409 on legacy systems, or execute the <command>lpadmin</command> command
3410 on more modern systems) and create the associated share in
3411 <filename>smb.conf</filename>, then the APW will in effect really
3412 create a new printer on Samba and the UNIX print subsystem!
3417 <title>Migration of "Classical" printing to Samba-3</title>
3420 The basic "NT-style" printer driver management has not changed
3421 considerably in 3.0 over the 2.2.x releases (apart from many small
3422 improvements). Here migration should be quite easy, especially if you
3423 followed previous advice to stop using deprecated parameters in your
3424 setup. For migrations from an existing 2.0.x setup, or if you
3425 continued "Win9x-style" printing in your Samba 2.2 installations, it
3426 is more of an effort. Please read the appropriate release notes and
3427 the HOWTO Collection for 2.2. You can follow several paths. Here are
3428 possible scenarios for migration:
3432 <listitem><para>You need to study and apply the new Windows NT printer
3433 and driver support. Previously used parameters "<parameter>printer
3434 driver file</parameter>", " <parameter>printer driver</parameter>" and
3435 "<parameter>printer driver location</parameter>" are no longer
3436 supported.</para></listitem>
3438 <listitem><para>If you want to take advantage of WinNT printer driver
3439 support you also need to migrate theWin9x/ME drivers to the new
3440 setup.</para></listitem>
3442 <listitem><para>An existing <filename>printers.def</filename> file
3443 (the one specified in the now removed parameter <parameter>printer
3444 driver file = ...</parameter>) will work no longer with Samba-3.0. In
3445 3.0, smbd attempts to locate a Win9x/ME driver files for the printer
3446 in <parameter>[print$]</parameter> and additional settings in the TDB
3447 and only there; if it fails it will <emphasis>not</emphasis> (as 2.2.x
3448 used to do) drop down to using a <filename>printers.def</filename>
3449 (and all associated parameters). The make_printerdef tool is removed
3450 and there is no backwards compatibility for this.</para></listitem>
3452 <listitem><para>You need to install a Windows 9x driver into the
3453 <parameter>[print$]</parameter> share for a printer on your Samba
3454 host. The driver files will be stored in the "WIN40/0" subdirectory of
3455 <parameter>[print$]</parameter>, and some other settings and info go
3456 into the printing-related TDBs.</para></listitem>
3458 <listitem><para>If you want to migrate an existing
3459 <filename>printers.def</filename> file into the new setup, the current
3460 only solution is to use the Windows NT APW to install the NT drivers
3461 and the 9x drivers. This can be scripted using smbclient and
3462 rpcclient. See the Imprints installation client at:
3466 <ulink url="http://imprints.sourceforge.net/"><emphasis>http://imprints.sourceforge.net/</emphasis></ulink>
3470 for an example. See also the discussion of rpcclient usage in the
3471 "CUPS Printing" section.</para></listitem>
3476 <title>Publishing Printer Information in Active Directory or LDAP</title>
3479 We will publish an update to this section shortly.
3484 <title>Common Errors and Problems</title>
3487 Here are a few typical errors and problems people have
3488 encountered. You can avoid them. Read on.
3492 <title>I give my root password but I don't get access</title>
3495 Don't confuse the root password which is valid for the Unix system
3496 (and in most cases stored in the form of a one-way hash in a file
3497 named <filename>/etc/shadow</filename>) with the password used to
3498 authenticate against Samba!. Samba doesn't know the UNIX password; for
3499 root to access Samba resources via Samba-type access, a Samba account
3500 for root must be created first. This is often done with the
3501 <command>smbpasswd</command> command.
3506 <title>My printjobs get spooled into the spooling directory, but then get lost</title>
3509 Don't use the existing Unix print system spool directory for the Samba
3510 spool directory. It may seem convenient and a saving of space, but it
3511 only leads to problems. The two <emphasis>must</emphasis> be separate.