Lots of doc updates. Getting ready for 2.2.5 release.
[Samba.git] / docs / docbook / projdoc / printer_driver2.sgml
blob2afba6b596865f2e9d576b8bbda3f16345cc5f9c
1 <chapter id="printing">
4 <chapterinfo>
5 <author>
6 <firstname>Gerald (Jerry)</firstname><surname>Carter</surname>
7 <affiliation>
8 <orgname>Samba Team</orgname>
9 <address>
10 <email>jerry@samba.org</email>
11 </address>
12 </affiliation>
13 </author>
16 <pubdate> (3 May 2001) </pubdate>
17 </chapterinfo>
19 <title>Printing Support in Samba 2.2.x</title>
21 <sect1>
22 <title>Introduction</title>
24 <para>Beginning with the 2.2.0 release, Samba supports
25 the native Windows NT printing mechanisms implemented via
26 MS-RPC (i.e. the SPOOLSS named pipe). Previous versions of
27 Samba only supported LanMan printing calls.</para>
29 <para>The additional functionality provided by the new
30 SPOOLSS support includes:</para>
32 <itemizedlist>
33 <listitem><para>Support for downloading printer driver
34 files to Windows 95/98/NT/2000 clients upon demand.
35 </para></listitem>
37 <listitem><para>Uploading of printer drivers via the
38 Windows NT Add Printer Wizard (APW) or the
39 Imprints tool set (refer to <ulink
40 url="http://imprints.sourceforge.net">http://imprints.sourceforge.net</ulink>).
41 </para></listitem>
43 <listitem><para>Support for the native MS-RPC printing
44 calls such as StartDocPrinter, EnumJobs(), etc... (See
45 the MSDN documentation at <ulink
46 url="http://msdn.microsoft.com/">http://msdn.microsoft.com/</ulink>
47 for more information on the Win32 printing API)
48 </para></listitem>
50 <listitem><para>Support for NT Access Control Lists (ACL)
51 on printer objects</para></listitem>
53 <listitem><para>Improved support for printer queue manipulation
54 through the use of an internal databases for spooled job
55 information</para></listitem>
56 </itemizedlist>
58 <para>
59 There has been some initial confusion about what all this means
60 and whether or not it is a requirement for printer drivers to be
61 installed on a Samba host in order to support printing from Windows
62 clients. A bug existed in Samba 2.2.0 which made Windows NT/2000 clients
63 require that the Samba server possess a valid driver for the printer.
64 This is fixed in Samba 2.2.1 and once again, Windows NT/2000 clients
65 can use the local APW for installing drivers to be used with a Samba
66 served printer. This is the same behavior exhibited by Windows 9x clients.
67 As a side note, Samba does not use these drivers in any way to process
68 spooled files. They are utilized entirely by the clients.
69 </para>
71 <para>
72 The following MS KB article, may be of some help if you are dealing with
73 Windows 2000 clients: <emphasis>How to Add Printers with No User
74 Interaction in Windows 2000</emphasis>
75 </para>
77 <para>
78 <ulink url="http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP">http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP</ulink>
79 </para>
81 </sect1>
84 <sect1>
85 <title>Configuration</title>
87 <warning>
88 <title>[print$] vs. [printer$]</title>
90 <para>
91 Previous versions of Samba recommended using a share named [printer$].
92 This name was taken from the printer$ service created by Windows 9x
93 clients when a printer was shared. Windows 9x printer servers always have
94 a printer$ service which provides read-only access via no
95 password in order to support printer driver downloads.
96 </para>
98 <para>
99 However, the initial implementation allowed for a
100 parameter named <parameter>printer driver location</parameter>
101 to be used on a per share basis to specify the location of
102 the driver files associated with that printer. Another
103 parameter named <parameter>printer driver</parameter> provided
104 a means of defining the printer driver name to be sent to
105 the client.
106 </para>
108 <para>
109 These parameters, including <parameter>printer driver
110 file</parameter> parameter, are being deprecated and should not
111 be used in new installations. For more information on this change,
112 you should refer to the <link linkend="MIGRATION">Migration section</link>
113 of this document.
114 </para>
115 </warning>
117 <sect2>
118 <title>Creating [print$]</title>
120 <para>
121 In order to support the uploading of printer driver
122 files, you must first configure a file share named [print$].
123 The name of this share is hard coded in Samba's internals so
124 the name is very important (print$ is the service used by
125 Windows NT print servers to provide support for printer driver
126 download).
127 </para>
129 <para>You should modify the server's smb.conf file to add the global
130 parameters and to create the
131 following file share (of course, some of the parameter values,
132 such as 'path' are arbitrary and should be replaced with
133 appropriate values for your site):</para>
135 <para><programlisting>
136 [global]
137 ; members of the ntadmin group should be able
138 ; to add drivers and set printer properties
139 ; root is implicitly a 'printer admin'
140 printer admin = @ntadmin
142 [print$]
143 path = /usr/local/samba/printers
144 guest ok = yes
145 browseable = yes
146 read only = yes
147 ; since this share is configured as read only, then we need
148 ; a 'write list'. Check the file system permissions to make
149 ; sure this account can copy files to the share. If this
150 ; is setup to a non-root account, then it should also exist
151 ; as a 'printer admin'
152 write list = @ntadmin,root
153 </programlisting></para>
155 <para>The <ulink url="smb.conf.5.html#WRITELIST"><parameter>
156 write list</parameter></ulink> is used to allow administrative
157 level user accounts to have write access in order to update files
158 on the share. See the <ulink url="smb.conf.5.html">smb.conf(5)
159 man page</ulink> for more information on configuring file shares.</para>
161 <para>The requirement for <ulink url="smb.conf.5.html#GUESTOK"><command>guest
162 ok = yes</command></ulink> depends upon how your
163 site is configured. If users will be guaranteed to have
164 an account on the Samba host, then this is a non-issue.</para>
166 <note>
167 <title>Author's Note</title>
169 <para>
170 The non-issue is that if all your Windows NT users are guaranteed to be
171 authenticated by the Samba server (such as a domain member server and the NT
172 user has already been validated by the Domain Controller in
173 order to logon to the Windows NT console), then guest access
174 is not necessary. Of course, in a workgroup environment where
175 you just want to be able to print without worrying about
176 silly accounts and security, then configure the share for
177 guest access. You'll probably want to add <ulink
178 url="smb.conf.5.html#MAPTOGUEST"><command>map to guest = Bad User
179 </command></ulink> in the [global] section as well. Make sure
180 you understand what this parameter does before using it
181 though. --jerry
182 </para>
183 </note>
185 <para>In order for a Windows NT print server to support
186 the downloading of driver files by multiple client architectures,
187 it must create subdirectories within the [print$] service
188 which correspond to each of the supported client architectures.
189 Samba follows this model as well.</para>
191 <para>Next create the directory tree below the [print$] share
192 for each architecture you wish to support.</para>
194 <para><programlisting>
195 [print$]-----
196 |-W32X86 ; "Windows NT x86"
197 |-WIN40 ; "Windows 95/98"
198 |-W32ALPHA ; "Windows NT Alpha_AXP"
199 |-W32MIPS ; "Windows NT R4000"
200 |-W32PPC ; "Windows NT PowerPC"
201 </programlisting></para>
203 <warning>
204 <title>ATTENTION! REQUIRED PERMISSIONS</title>
206 <para>
207 In order to currently add a new driver to you Samba host,
208 one of two conditions must hold true:
209 </para>
211 <itemizedlist>
212 <listitem><para>The account used to connect to the Samba host
213 must have a uid of 0 (i.e. a root account)</para></listitem>
215 <listitem><para>The account used to connect to the Samba host
216 must be a member of the <ulink
217 url="smb.conf.5.html#PRINTERADMIN"><parameter>printer
218 admin</parameter></ulink> list.</para></listitem>
219 </itemizedlist>
221 <para>
222 Of course, the connected account must still possess access
223 to add files to the subdirectories beneath [print$]. Remember
224 that all file shares are set to 'read only' by default.
225 </para>
226 </warning>
229 <para>
230 Once you have created the required [print$] service and
231 associated subdirectories, simply log onto the Samba server using
232 a root (or <parameter>printer admin</parameter>) account
233 from a Windows NT 4.0/2k client. Open "Network Neighbourhood" or
234 "My Network Places" and browse for the Samba host. Once you have located
235 the server, navigate to the "Printers..." folder.
236 You should see an initial listing of printers
237 that matches the printer shares defined on your Samba host.
238 </para>
239 </sect2>
241 <sect2>
242 <title>Setting Drivers for Existing Printers</title>
244 <para>The initial listing of printers in the Samba host's
245 Printers folder will have no real printer driver assigned
246 to them. By default, in Samba 2.2.0 this driver name was set to
247 <emphasis>NO PRINTER DRIVER AVAILABLE FOR THIS PRINTER</emphasis>.
248 Later versions changed this to a NULL string to allow the use
249 tof the local Add Printer Wizard on NT/2000 clients.
250 Attempting to view the printer properties for a printer
251 which has this default driver assigned will result in
252 the error message:</para>
254 <para>
255 <emphasis>Device settings cannot be displayed. The driver
256 for the specified printer is not installed, only spooler
257 properties will be displayed. Do you want to install the
258 driver now?</emphasis>
259 </para>
261 <para>
262 Click <emphasis>No</emphasis> in the error dialog and you will be presented with
263 the printer properties window. The way assign a driver to a
264 printer is to either
265 </para>
267 <itemizedlist>
268 <listitem><para>Use the "New Driver..." button to install
269 a new printer driver, or</para></listitem>
271 <listitem><para>Select a driver from the popup list of
272 installed drivers. Initially this list will be empty.</para>
273 </listitem>
274 </itemizedlist>
276 <para>If you wish to install printer drivers for client
277 operating systems other than "Windows NT x86", you will need
278 to use the "Sharing" tab of the printer properties dialog.</para>
280 <para>Assuming you have connected with a root account, you
281 will also be able modify other printer properties such as
282 ACLs and device settings using this dialog box.</para>
284 <para>A few closing comments for this section, it is possible
285 on a Windows NT print server to have printers
286 listed in the Printers folder which are not shared. Samba does
287 not make this distinction. By definition, the only printers of
288 which Samba is aware are those which are specified as shares in
289 <filename>smb.conf</filename>.</para>
291 <para>Another interesting side note is that Windows NT clients do
292 not use the SMB printer share, but rather can print directly
293 to any printer on another Windows NT host using MS-RPC. This
294 of course assumes that the printing client has the necessary
295 privileges on the remote host serving the printer. The default
296 permissions assigned by Windows NT to a printer gives the "Print"
297 permissions to the "Everyone" well-known group.
298 </para>
300 </sect2>
302 <sect2>
303 <title>DeviceModes and New Printers</title>
305 <para>
306 In order for a printer to be truly usbla eby a Windows NT/2k/XP client,
307 it must posses:
308 </para>
310 <itemizedlist>
311 <listitem><para>a valid Device Mode generated by the driver for the printer, and</para></listitem>
312 <listitem><para>a complete set of PrinterDriverData generated by the driver.</para></listitem>
313 </itemizedlist>
315 <para>
316 If either one of these is incomplete, the clients can produce less than optimal
317 output at best or in the worst cases, unreadable garbage or nothing at all.
318 Fortunately, most driver generate the printer driver that is needed.
319 However, the client must be tickled to generate a valid Device Mode and set it on the
320 server. The easist means of doing so is to simply set the page orientation on
321 the server's printer using the native Windows NT/2k printer properties page from
322 a Window clients. Make sure to apply changes between swapping the page orientation
323 to cause the change to actually take place. Be aware that this can only be done
324 by a "printer admin" (the reason should be obvious I hope).
325 </para>
327 <para>
328 Samba also includes a service level parameter name <ulink url="smb.conf.5.html#DEFAULTDEVMODE">default
329 devmode</ulink> for generating a default device mode for a printer. Some driver
330 will function fine with this default set of properties. Others may crash the client's
331 spooler service. Use this parameter with caution. It is always better to have the client
332 generate a valid device mode for the printer and store it on the server for you.
333 </para>
335 </sect2>
338 <sect2>
339 <title>Support a large number of printers</title>
341 <para>One issue that has arisen during the development
342 phase of Samba 2.2 is the need to support driver downloads for
343 100's of printers. Using the Windows NT APW is somewhat
344 awkward to say the list. If more than one printer are using the
345 same driver, the <ulink url="rpcclient.1.html"><command>rpcclient's
346 setdriver</command></ulink> command can be used to set the driver
347 associated with an installed driver. The following is example
348 of how this could be accomplished:</para>
350 <para><programlisting>
351 <prompt>$ </prompt>rpcclient pogo -U root%secret -c "enumdrivers"
352 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
354 [Windows NT x86]
355 Printer Driver Info 1:
356 Driver Name: [HP LaserJet 4000 Series PS]
358 Printer Driver Info 1:
359 Driver Name: [HP LaserJet 2100 Series PS]
361 Printer Driver Info 1:
362 Driver Name: [HP LaserJet 4Si/4SiMX PS]
364 <prompt>$ </prompt>rpcclient pogo -U root%secret -c "enumprinters"
365 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
366 flags:[0x800000]
367 name:[\\POGO\hp-print]
368 description:[POGO\\POGO\hp-print,NO DRIVER AVAILABLE FOR THIS PRINTER,]
369 comment:[]
371 <prompt>$ </prompt>rpcclient pogo -U root%secret \
372 <prompt>&gt; </prompt> -c "setdriver hp-print \"HP LaserJet 4000 Series PS\""
373 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
374 Successfully set hp-print to driver HP LaserJet 4000 Series PS.
375 </programlisting></para>
376 </sect2>
380 <sect2>
381 <title>Adding New Printers via the Windows NT APW</title>
383 <para>
384 By default, Samba offers all printer shares defined in <filename>smb.conf</filename>
385 in the "Printers..." folder. Also existing in this folder is the Windows NT
386 Add Printer Wizard icon. The APW will be show only if
387 </para>
389 <itemizedlist>
390 <listitem><para>The connected user is able to successfully
391 execute an OpenPrinterEx(\\server) with administrative
392 privileges (i.e. root or <parameter>printer admin</parameter>).
393 </para></listitem>
395 <listitem><para><ulink url="smb.conf.5.html#SHOWADDPRINTERWIZARD"><parameter>show
396 add printer wizard = yes</parameter></ulink> (the default).
397 </para></listitem>
398 </itemizedlist>
400 <para>
401 In order to be able to use the APW to successfully add a printer to a Samba
402 server, the <ulink url="smb.conf.5.html#ADDPRINTERCOMMAND"><parameter>add
403 printer command</parameter></ulink> must have a defined value. The program
404 hook must successfully add the printer to the system (i.e.
405 <filename>/etc/printcap</filename> or appropriate files) and
406 <filename>smb.conf</filename> if necessary.
407 </para>
409 <para>
410 When using the APW from a client, if the named printer share does
411 not exist, <command>smbd</command> will execute the <parameter>add printer
412 command</parameter> and reparse to the <filename>smb.conf</filename>
413 to attempt to locate the new printer share. If the share is still not defined,
414 an error of "Access Denied" is returned to the client. Note that the
415 <parameter>add printer program</parameter> is executed under the context
416 of the connected user, not necessarily a root account.
417 </para>
419 <para>
420 There is a complementing <ulink url="smb.conf.5.html#DELETEPRINTERCOMMAND"><parameter>delete
421 printer command</parameter></ulink> for removing entries from the "Printers..."
422 folder.
423 </para>
425 </sect2>
428 <sect2>
429 <title>Samba and Printer Ports</title>
431 <para>
432 Windows NT/2000 print servers associate a port with each printer. These normally
433 take the form of LPT1:, COM1:, FILE:, etc... Samba must also support the
434 concept of ports associated with a printer. By default, only one printer port,
435 named "Samba Printer Port", exists on a system. Samba does not really a port in
436 order to print, rather it is a requirement of Windows clients.
437 </para>
439 <para>
440 Note that Samba does not support the concept of "Printer Pooling" internally
441 either. This is when a logical printer is assigned to multiple ports as
442 a form of load balancing or fail over.
443 </para>
445 <para>
446 If you require that multiple ports be defined for some reason,
447 <filename>smb.conf</filename> possesses a <ulink
448 url="smb.conf.5.html#ENUMPORTSCOMMAND"><parameter>enumports
449 command</parameter></ulink> which can be used to define an external program
450 that generates a listing of ports on a system.
451 </para>
453 </sect2>
455 </sect1>
458 <sect1>
459 <title>The Imprints Toolset</title>
461 <para>The Imprints tool set provides a UNIX equivalent of the
462 Windows NT Add Printer Wizard. For complete information, please
463 refer to the Imprints web site at <ulink url="http://imprints.sourceforge.net/">
464 http://imprints.sourceforge.net/</ulink> as well as the documentation
465 included with the imprints source distribution. This section will
466 only provide a brief introduction to the features of Imprints.</para>
468 <para>As of June 16, 2002 (quite a bit earlier actually), the Imprints
469 project is in need of a new maintainer. The most important skill
470 is decent perl coding and an interest in MS-RPC based printing using Samba.
471 If you wich to volunteer, please coordinate your efforts on the samba-technical
472 mailing list.
473 </para>
476 <sect2>
477 <title>What is Imprints?</title>
479 <para>Imprints is a collection of tools for supporting the goals
480 of</para>
482 <itemizedlist>
483 <listitem><para>Providing a central repository information
484 regarding Windows NT and 95/98 printer driver packages</para>
485 </listitem>
487 <listitem><para>Providing the tools necessary for creating
488 the Imprints printer driver packages.</para></listitem>
490 <listitem><para>Providing an installation client which
491 will obtain and install printer drivers on remote Samba
492 and Windows NT 4 print servers.</para></listitem>
493 </itemizedlist>
495 </sect2>
498 <sect2>
499 <title>Creating Printer Driver Packages</title>
501 <para>The process of creating printer driver packages is beyond
502 the scope of this document (refer to Imprints.txt also included
503 with the Samba distribution for more information). In short,
504 an Imprints driver package is a gzipped tarball containing the
505 driver files, related INF files, and a control file needed by the
506 installation client.</para>
507 </sect2>
510 <sect2>
511 <title>The Imprints server</title>
513 <para>The Imprints server is really a database server that
514 may be queried via standard HTTP mechanisms. Each printer
515 entry in the database has an associated URL for the actual
516 downloading of the package. Each package is digitally signed
517 via GnuPG which can be used to verify that package downloaded
518 is actually the one referred in the Imprints database. It is
519 <emphasis>not</emphasis> recommended that this security check
520 be disabled.</para>
521 </sect2>
523 <sect2>
524 <title>The Installation Client</title>
526 <para>More information regarding the Imprints installation client
527 is available in the <filename>Imprints-Client-HOWTO.ps</filename>
528 file included with the imprints source package.</para>
530 <para>The Imprints installation client comes in two forms.</para>
532 <itemizedlist>
533 <listitem><para>a set of command line Perl scripts</para>
534 </listitem>
536 <listitem><para>a GTK+ based graphical interface to
537 the command line perl scripts</para></listitem>
538 </itemizedlist>
540 <para>The installation client (in both forms) provides a means
541 of querying the Imprints database server for a matching
542 list of known printer model names as well as a means to
543 download and install the drivers on remote Samba and Windows
544 NT print servers.</para>
546 <para>The basic installation process is in four steps and
547 perl code is wrapped around <command>smbclient</command>
548 and <command>rpcclient</command>.</para>
550 <para><programlisting>
551 foreach (supported architecture for a given driver)
553 1. rpcclient: Get the appropriate upload directory
554 on the remote server
555 2. smbclient: Upload the driver files
556 3. rpcclient: Issues an AddPrinterDriver() MS-RPC
559 4. rpcclient: Issue an AddPrinterEx() MS-RPC to actually
560 create the printer
561 </programlisting></para>
563 <para>One of the problems encountered when implementing
564 the Imprints tool set was the name space issues between
565 various supported client architectures. For example, Windows
566 NT includes a driver named "Apple LaserWriter II NTX v51.8"
567 and Windows 95 calls its version of this driver "Apple
568 LaserWriter II NTX"</para>
570 <para>The problem is how to know what client drivers have
571 been uploaded for a printer. As astute reader will remember
572 that the Windows NT Printer Properties dialog only includes
573 space for one printer driver name. A quick look in the
574 Windows NT 4.0 system registry at</para>
576 <para><filename>HKLM\System\CurrentControlSet\Control\Print\Environment
577 </filename></para>
579 <para>will reveal that Windows NT always uses the NT driver
580 name. This is ok as Windows NT always requires that at least
581 the Windows NT version of the printer driver is present.
582 However, Samba does not have the requirement internally.
583 Therefore, how can you use the NT driver name if is has not
584 already been installed?</para>
586 <para>The way of sidestepping this limitation is to require
587 that all Imprints printer driver packages include both the Intel
588 Windows NT and 95/98 printer drivers and that NT driver is
589 installed first.</para>
590 </sect2>
592 </sect1>
595 <sect1>
596 <title><anchor id="MIGRATION">Migration to from Samba 2.0.x to 2.2.x</title>
598 <para>
599 Given that printer driver management has changed (we hope improved) in
600 2.2 over prior releases, migration from an existing setup to 2.2 can
601 follow several paths. Here are the possible scenarios for
602 migration:
603 </para>
605 <itemizedlist>
606 <listitem><para>If you do not desire the new Windows NT
607 print driver support, nothing needs to be done.
608 All existing parameters work the same.</para></listitem>
610 <listitem><para>If you want to take advantage of NT printer
611 driver support but do not want to migrate the
612 9x drivers to the new setup, the leave the existing
613 <filename>printers.def</filename> file. When smbd attempts
614 to locate a
615 9x driver for the printer in the TDB and fails it
616 will drop down to using the printers.def (and all
617 associated parameters). The <command>make_printerdef</command>
618 tool will also remain for backwards compatibility but will
619 be removed in the next major release.</para></listitem>
621 <listitem><para>If you install a Windows 9x driver for a printer
622 on your Samba host (in the printing TDB), this information will
623 take precedence and the three old printing parameters
624 will be ignored (including print driver location).</para></listitem>
626 <listitem><para>If you want to migrate an existing <filename>printers.def</filename>
627 file into the new setup, the current only solution is to use the Windows
628 NT APW to install the NT drivers and the 9x drivers. This can be scripted
629 using <command>smbclient</command> and <command>rpcclient</command>. See the
630 Imprints installation client at <ulink
631 url="http://imprints.sourceforge.net/">http://imprints.sourceforge.net/</ulink>
632 for an example.
633 </para></listitem>
634 </itemizedlist>
637 <warning>
638 <title>Achtung!</title>
640 <para>
641 The following <filename>smb.conf</filename> parameters are considered to
642 be deprecated and will be removed soon. Do not use them in new
643 installations
644 </para>
646 <itemizedlist>
647 <listitem><para><parameter>printer driver file (G)</parameter>
648 </para></listitem>
650 <listitem><para><parameter>printer driver (S)</parameter>
651 </para></listitem>
653 <listitem><para><parameter>printer driver location (S)</parameter>
654 </para></listitem>
655 </itemizedlist>
656 </warning>
659 <sect2>
660 <title>Parameters in <filename>smb.conf(5)</filename> for Backwards Compatibility</title>
662 <para>
663 The have been two new parameters add in Samba 2.2.2 to for
664 better support of Samba 2.0.x backwards capability (<parameter>disable
665 spoolss</parameter>) and for using local printers drivers on Windows
666 NT/2000 clients (<parameter>use client driver</parameter>). Both of
667 these options are described in the smb.coinf(5) man page and are
668 disabled by default. Use them with caution.
669 </para>
670 </sect2>
673 </sect1>
676 </chapter>