This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.(This used to...
[ira/wip.git] / docs / htmldocs / printing.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >Printing Support</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
9 "><LINK
10 REL="HOME"
11 TITLE="SAMBA Project Documentation"
12 HREF="samba-howto-collection.html"><LINK
13 REL="UP"
14 TITLE="Optional configuration"
15 HREF="optional.html"><LINK
16 REL="PREVIOUS"
17 TITLE="Hosting a Microsoft Distributed File System tree on Samba"
18 HREF="msdfs.html"><LINK
19 REL="NEXT"
20 TITLE="Unified Logons between Windows NT and UNIX using Winbind"
21 HREF="winbind.html"></HEAD
22 ><BODY
23 CLASS="CHAPTER"
24 BGCOLOR="#FFFFFF"
25 TEXT="#000000"
26 LINK="#0000FF"
27 VLINK="#840084"
28 ALINK="#0000FF"
29 ><DIV
30 CLASS="NAVHEADER"
31 ><TABLE
32 SUMMARY="Header navigation table"
33 WIDTH="100%"
34 BORDER="0"
35 CELLPADDING="0"
36 CELLSPACING="0"
37 ><TR
38 ><TH
39 COLSPAN="3"
40 ALIGN="center"
41 >SAMBA Project Documentation</TH
42 ></TR
43 ><TR
44 ><TD
45 WIDTH="10%"
46 ALIGN="left"
47 VALIGN="bottom"
48 ><A
49 HREF="msdfs.html"
50 ACCESSKEY="P"
51 >Prev</A
52 ></TD
53 ><TD
54 WIDTH="80%"
55 ALIGN="center"
56 VALIGN="bottom"
57 ></TD
58 ><TD
59 WIDTH="10%"
60 ALIGN="right"
61 VALIGN="bottom"
62 ><A
63 HREF="winbind.html"
64 ACCESSKEY="N"
65 >Next</A
66 ></TD
67 ></TR
68 ></TABLE
69 ><HR
70 ALIGN="LEFT"
71 WIDTH="100%"></DIV
72 ><DIV
73 CLASS="CHAPTER"
74 ><H1
75 ><A
76 NAME="PRINTING">Chapter 14. Printing Support</H1
77 ><DIV
78 CLASS="SECT1"
79 ><H1
80 CLASS="SECT1"
81 ><A
82 NAME="AEN1920">14.1. Introduction</H1
83 ><P
84 >Beginning with the 2.2.0 release, Samba supports 
85 the native Windows NT printing mechanisms implemented via 
86 MS-RPC (i.e. the SPOOLSS named pipe).  Previous versions of 
87 Samba only supported LanMan printing calls.</P
88 ><P
89 >The additional functionality provided by the new 
90 SPOOLSS support includes:</P
91 ><P
92 ></P
93 ><UL
94 ><LI
95 ><P
96 >Support for downloading printer driver 
97         files to Windows 95/98/NT/2000 clients upon demand.
98         </P
99 ></LI
100 ><LI
101 ><P
102 >Uploading of printer drivers via the 
103         Windows NT Add Printer Wizard (APW) or the 
104         Imprints tool set (refer to <A
105 HREF="http://imprints.sourceforge.net"
106 TARGET="_top"
107 >http://imprints.sourceforge.net</A
108 >). 
109         </P
110 ></LI
111 ><LI
112 ><P
113 >Support for the native MS-RPC printing 
114         calls such as StartDocPrinter, EnumJobs(), etc...  (See 
115         the MSDN documentation at <A
116 HREF="http://msdn.microsoft.com/"
117 TARGET="_top"
118 >http://msdn.microsoft.com/</A
119
120         for more information on the Win32 printing API)
121         </P
122 ></LI
123 ><LI
124 ><P
125 >Support for NT Access Control Lists (ACL) 
126         on printer objects</P
127 ></LI
128 ><LI
129 ><P
130 >Improved support for printer queue manipulation 
131         through the use of an internal databases for spooled job 
132         information</P
133 ></LI
134 ></UL
135 ><P
136 >There has been some initial confusion about what all this means
137 and whether or not it is a requirement for printer drivers to be 
138 installed on a Samba host in order to support printing from Windows 
139 clients. As a side note, Samba does not use these drivers in any way to process 
140 spooled files.  They are utilized entirely by the clients.</P
141 ><P
142 >The following MS KB article, may be of some help if you are dealing with
143 Windows 2000 clients:  <SPAN
144 CLASS="emphasis"
145 ><I
146 CLASS="EMPHASIS"
147 >How to Add Printers with No User 
148 Interaction in Windows 2000</I
149 ></SPAN
150 ></P
151 ><P
152 ><A
153 HREF="http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP"
154 TARGET="_top"
155 >http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP</A
156 ></P
157 ></DIV
158 ><DIV
159 CLASS="SECT1"
160 ><H1
161 CLASS="SECT1"
162 ><A
163 NAME="AEN1942">14.2. Configuration</H1
164 ><DIV
165 CLASS="WARNING"
166 ><P
167 ></P
168 ><TABLE
169 CLASS="WARNING"
170 WIDTH="100%"
171 BORDER="0"
172 ><TR
173 ><TD
174 WIDTH="25"
175 ALIGN="CENTER"
176 VALIGN="TOP"
177 ><IMG
178 SRC="../images/warning.gif"
179 HSPACE="5"
180 ALT="Warning"></TD
181 ><TH
182 ALIGN="LEFT"
183 VALIGN="CENTER"
184 ><B
185 >[print$] vs. [printer$]</B
186 ></TH
187 ></TR
188 ><TR
189 ><TD
190 >&nbsp;</TD
191 ><TD
192 ALIGN="LEFT"
193 VALIGN="TOP"
194 ><P
195 >Previous versions of Samba recommended using a share named [printer$].  
196 This name was taken from the printer$ service created by Windows 9x 
197 clients when a printer was shared.  Windows 9x printer servers always have 
198 a printer$ service which provides read-only access via no 
199 password in order to support printer driver downloads.</P
200 ><P
201 >However, the initial implementation allowed for a 
202 parameter named <TT
203 CLASS="PARAMETER"
204 ><I
205 >printer driver location</I
206 ></TT
207
208 to be used on a per share basis to specify the location of 
209 the driver files associated with that printer.  Another 
210 parameter named <TT
211 CLASS="PARAMETER"
212 ><I
213 >printer driver</I
214 ></TT
215 > provided 
216 a means of defining the printer driver name to be sent to 
217 the client.</P
218 ></TD
219 ></TR
220 ></TABLE
221 ></DIV
222 ><DIV
223 CLASS="SECT2"
224 ><H2
225 CLASS="SECT2"
226 ><A
227 NAME="AEN1950">14.2.1. Creating [print$]</H2
228 ><P
229 >In order to support the uploading of printer driver 
230 files, you must first configure a file share named [print$].  
231 The name of this share is hard coded in Samba's internals so 
232 the name is very important (print$ is the service used by 
233 Windows NT print servers to provide support for printer driver 
234 download).</P
235 ><P
236 >You should modify the server's smb.conf file to add the global
237 parameters and to create the 
238 following file share (of course, some of the parameter values,
239 such as 'path' are arbitrary and should be replaced with
240 appropriate values for your site):</P
241 ><P
242 ><PRE
243 CLASS="PROGRAMLISTING"
244 >[global]
245     ; members of the ntadmin group should be able
246     ; to add drivers and set printer properties
247     ; root is implicitly a 'printer admin'
248     printer admin = @ntadmin
249
250 [print$]
251     path = /usr/local/samba/printers
252     guest ok = yes
253     browseable = yes
254     read only = yes
255     ; since this share is configured as read only, then we need
256     ; a 'write list'.  Check the file system permissions to make
257     ; sure this account can copy files to the share.  If this
258     ; is setup to a non-root account, then it should also exist
259     ; as a 'printer admin'
260     write list = @ntadmin,root</PRE
261 ></P
262 ><P
263 >The <A
264 HREF="smb.conf.5.html#WRITELIST"
265 TARGET="_top"
266 ><TT
267 CLASS="PARAMETER"
268 ><I
269 >write list</I
270 ></TT
271 ></A
272 > is used to allow administrative 
273 level user accounts to have write access in order to update files 
274 on the share.  See the <A
275 HREF="smb.conf.5.html"
276 TARGET="_top"
277 >smb.conf(5) 
278 man page</A
279 > for more information on configuring file shares.</P
280 ><P
281 >The requirement for <A
282 HREF="smb.conf.5.html#GUESTOK"
283 TARGET="_top"
284 ><B
285 CLASS="COMMAND"
286 >guest 
287 ok = yes</B
288 ></A
289 > depends upon how your
290 site is configured.  If users will be guaranteed to have 
291 an account on the Samba host, then this is a non-issue.</P
292 ><DIV
293 CLASS="NOTE"
294 ><P
295 ></P
296 ><TABLE
297 CLASS="NOTE"
298 WIDTH="100%"
299 BORDER="0"
300 ><TR
301 ><TD
302 WIDTH="25"
303 ALIGN="CENTER"
304 VALIGN="TOP"
305 ><IMG
306 SRC="../images/note.gif"
307 HSPACE="5"
308 ALT="Note"></TD
309 ><TH
310 ALIGN="LEFT"
311 VALIGN="CENTER"
312 ><B
313 >Author's Note</B
314 ></TH
315 ></TR
316 ><TR
317 ><TD
318 >&nbsp;</TD
319 ><TD
320 ALIGN="LEFT"
321 VALIGN="TOP"
322 ><P
323 >The non-issue is that if all your Windows NT users are guaranteed to be 
324 authenticated by the Samba server (such as a domain member server and the NT 
325 user has already been validated by the Domain Controller in 
326 order to logon to the Windows NT console), then guest access 
327 is not necessary.  Of course, in a workgroup environment where 
328 you just want to be able to print without worrying about 
329 silly accounts and security, then configure the share for 
330 guest access.  You'll probably want to add <A
331 HREF="smb.conf.5.html#MAPTOGUEST"
332 TARGET="_top"
333 ><B
334 CLASS="COMMAND"
335 >map to guest = Bad User</B
336 ></A
337 > in the [global] section as well.  Make sure 
338 you understand what this parameter does before using it 
339 though. --jerry</P
340 ></TD
341 ></TR
342 ></TABLE
343 ></DIV
344 ><P
345 >In order for a Windows NT print server to support 
346 the downloading of driver files by multiple client architectures,
347 it must create subdirectories within the [print$] service
348 which correspond to each of the supported client architectures.
349 Samba follows this model as well.</P
350 ><P
351 >Next create the directory tree below the [print$] share 
352 for each architecture you wish to support.</P
353 ><P
354 ><PRE
355 CLASS="PROGRAMLISTING"
356 >[print$]-----
357         |-W32X86           ; "Windows NT x86"
358         |-WIN40            ; "Windows 95/98"
359         |-W32ALPHA         ; "Windows NT Alpha_AXP"
360         |-W32MIPS          ; "Windows NT R4000"
361         |-W32PPC           ; "Windows NT PowerPC"</PRE
362 ></P
363 ><DIV
364 CLASS="WARNING"
365 ><P
366 ></P
367 ><TABLE
368 CLASS="WARNING"
369 WIDTH="100%"
370 BORDER="0"
371 ><TR
372 ><TD
373 WIDTH="25"
374 ALIGN="CENTER"
375 VALIGN="TOP"
376 ><IMG
377 SRC="../images/warning.gif"
378 HSPACE="5"
379 ALT="Warning"></TD
380 ><TH
381 ALIGN="LEFT"
382 VALIGN="CENTER"
383 ><B
384 >ATTENTION!  REQUIRED PERMISSIONS</B
385 ></TH
386 ></TR
387 ><TR
388 ><TD
389 >&nbsp;</TD
390 ><TD
391 ALIGN="LEFT"
392 VALIGN="TOP"
393 ><P
394 >In order to currently add a new driver to you Samba host, 
395 one of two conditions must hold true:</P
396 ><P
397 ></P
398 ><UL
399 ><LI
400 ><P
401 >The account used to connect to the Samba host 
402         must have a uid of 0 (i.e. a root account)</P
403 ></LI
404 ><LI
405 ><P
406 >The account used to connect to the Samba host
407         must be a member of the <A
408 HREF="smb.conf.5.html#PRINTERADMIN"
409 TARGET="_top"
410 ><TT
411 CLASS="PARAMETER"
412 ><I
413 >printer 
414         admin</I
415 ></TT
416 ></A
417 > list.</P
418 ></LI
419 ></UL
420 ><P
421 >Of course, the connected account must still possess access
422 to add files to the subdirectories beneath [print$]. Remember
423 that all file shares are set to 'read only' by default.</P
424 ></TD
425 ></TR
426 ></TABLE
427 ></DIV
428 ><P
429 >Once you have created the required [print$] service and 
430 associated subdirectories, simply log onto the Samba server using 
431 a root (or <TT
432 CLASS="PARAMETER"
433 ><I
434 >printer admin</I
435 ></TT
436 >) account
437 from a Windows NT 4.0/2k client.  Open "Network Neighbourhood" or
438 "My Network Places" and browse for the Samba host.  Once you have located
439 the server, navigate to the "Printers..." folder.
440 You should see an initial listing of printers
441 that matches the printer shares defined on your Samba host.</P
442 ></DIV
443 ><DIV
444 CLASS="SECT2"
445 ><H2
446 CLASS="SECT2"
447 ><A
448 NAME="AEN1985">14.2.2. Setting Drivers for Existing Printers</H2
449 ><P
450 >The initial listing of printers in the Samba host's 
451 Printers folder will have no real printer driver assigned 
452 to them. This defaults to a NULL string to allow the use
453 of the local Add Printer Wizard on NT/2000 clients.
454 Attempting to view the printer properties for a printer
455 which has this default driver assigned will result in 
456 the error message:</P
457 ><P
458 ><SPAN
459 CLASS="emphasis"
460 ><I
461 CLASS="EMPHASIS"
462 >Device settings cannot be displayed.  The driver 
463 for the specified printer is not installed, only spooler 
464 properties will be displayed.  Do you want to install the 
465 driver now?</I
466 ></SPAN
467 ></P
468 ><P
469 >Click "No" in the error dialog and you will be presented with
470 the printer properties window.  The way to assign a driver to a 
471 printer is to either</P
472 ><P
473 ></P
474 ><UL
475 ><LI
476 ><P
477 >Use the "New Driver..." button to install 
478         a new printer driver, or</P
479 ></LI
480 ><LI
481 ><P
482 >Select a driver from the popup list of 
483         installed drivers.  Initially this list will be empty.</P
484 ></LI
485 ></UL
486 ><P
487 >If you wish to install printer drivers for client 
488 operating systems other than "Windows NT x86", you will need 
489 to use the "Sharing" tab of the printer properties dialog.</P
490 ><P
491 >Assuming you have connected with a root account, you 
492 will also be able modify other printer properties such as 
493 ACLs and device settings using this dialog box.</P
494 ><P
495 >A few closing comments for this section, it is possible 
496 on a Windows NT print server to have printers
497 listed in the Printers folder which are not shared.  Samba does
498 not make this distinction.  By definition, the only printers of
499 which Samba is aware are those which are specified as shares in
500 <TT
501 CLASS="FILENAME"
502 >smb.conf</TT
503 >.</P
504 ><P
505 >Another interesting side note is that Windows NT clients do
506 not use the SMB printer share, but rather can print directly 
507 to any printer on another Windows NT host using MS-RPC.  This
508 of course assumes that the printing client has the necessary
509 privileges on the remote host serving the printer.  The default
510 permissions assigned by Windows NT to a printer gives the "Print"
511 permissions to the "Everyone" well-known group.</P
512 ></DIV
513 ><DIV
514 CLASS="SECT2"
515 ><H2
516 CLASS="SECT2"
517 ><A
518 NAME="AEN2001">14.2.3. Support a large number of printers</H2
519 ><P
520 >One issue that has arisen during the development
521 phase of Samba 2.2 is the need to support driver downloads for
522 100's of printers.  Using the Windows NT APW is somewhat 
523 awkward to say the list.  If more than one printer are using the 
524 same driver, the <A
525 HREF="rpcclient.1.html"
526 TARGET="_top"
527 ><B
528 CLASS="COMMAND"
529 >rpcclient's
530 setdriver command</B
531 ></A
532 > can be used to set the driver
533 associated with an installed driver.  The following is example
534 of how this could be accomplished:</P
535 ><P
536 ><PRE
537 CLASS="PROGRAMLISTING"
538
539 <TT
540 CLASS="PROMPT"
541 >$ </TT
542 >rpcclient pogo -U root%secret -c "enumdrivers"
543 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
544  
545 [Windows NT x86]
546 Printer Driver Info 1:
547      Driver Name: [HP LaserJet 4000 Series PS]
548  
549 Printer Driver Info 1:
550      Driver Name: [HP LaserJet 2100 Series PS]
551  
552 Printer Driver Info 1:
553      Driver Name: [HP LaserJet 4Si/4SiMX PS]
554                                   
555 <TT
556 CLASS="PROMPT"
557 >$ </TT
558 >rpcclient pogo -U root%secret -c "enumprinters"
559 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
560      flags:[0x800000]
561      name:[\\POGO\hp-print]
562      description:[POGO\\POGO\hp-print,NO DRIVER AVAILABLE FOR THIS PRINTER,]
563      comment:[]
564                                   
565 <TT
566 CLASS="PROMPT"
567 >$ </TT
568 >rpcclient pogo -U root%secret \
569 <TT
570 CLASS="PROMPT"
571 >&gt; </TT
572 > -c "setdriver hp-print \"HP LaserJet 4000 Series PS\""
573 Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
574 Successfully set hp-print to driver HP LaserJet 4000 Series PS.</PRE
575 ></P
576 ></DIV
577 ><DIV
578 CLASS="SECT2"
579 ><H2
580 CLASS="SECT2"
581 ><A
582 NAME="AEN2012">14.2.4. Adding New Printers via the Windows NT APW</H2
583 ><P
584 >By default, Samba offers all printer shares defined in <TT
585 CLASS="FILENAME"
586 >smb.conf</TT
587 >
588 in the "Printers..." folder.  Also existing in this folder is the Windows NT 
589 Add Printer Wizard icon.  The APW will be show only if</P
590 ><P
591 ></P
592 ><UL
593 ><LI
594 ><P
595 >The connected user is able to successfully
596         execute an OpenPrinterEx(\\server) with administrative
597         privileges (i.e. root or <TT
598 CLASS="PARAMETER"
599 ><I
600 >printer admin</I
601 ></TT
602 >).
603         </P
604 ></LI
605 ><LI
606 ><P
607 ><A
608 HREF="smb.conf.5.html#SHOWADDPRINTERWIZARD"
609 TARGET="_top"
610 ><TT
611 CLASS="PARAMETER"
612 ><I
613 >show 
614         add printer wizard = yes</I
615 ></TT
616 ></A
617 > (the default).
618         </P
619 ></LI
620 ></UL
621 ><P
622 >In order to be able to use the APW to successfully add a printer to a Samba 
623 server, the <A
624 HREF="smb.conf.5.html#ADDPRINTERCOMMAND"
625 TARGET="_top"
626 ><TT
627 CLASS="PARAMETER"
628 ><I
629 >add 
630 printer command</I
631 ></TT
632 ></A
633 > must have a defined value.  The program
634 hook must successfully add the printer to the system (i.e. 
635 <TT
636 CLASS="FILENAME"
637 >/etc/printcap</TT
638 > or appropriate files) and 
639 <TT
640 CLASS="FILENAME"
641 >smb.conf</TT
642 > if necessary.</P
643 ><P
644 >When using the APW from a client, if the named printer share does 
645 not exist, <B
646 CLASS="COMMAND"
647 >smbd</B
648 > will execute the <TT
649 CLASS="PARAMETER"
650 ><I
651 >add printer 
652 command</I
653 ></TT
654 > and reparse to the <TT
655 CLASS="FILENAME"
656 >smb.conf</TT
657 >
658 to attempt to locate the new printer share.  If the share is still not defined,
659 an error of "Access Denied" is returned to the client.  Note that the 
660 <TT
661 CLASS="PARAMETER"
662 ><I
663 >add printer program</I
664 ></TT
665 > is executed under the context
666 of the connected user, not necessarily a root account.</P
667 ><P
668 >There is a complementary <A
669 HREF="smb.conf.5.html#DELETEPRINTERCOMMAND"
670 TARGET="_top"
671 ><TT
672 CLASS="PARAMETER"
673 ><I
674 >delete
675 printer command</I
676 ></TT
677 ></A
678 > for removing entries from the "Printers..."
679 folder.</P
680 ><P
681 >The following is an example <A
682 HREF="smb.conf.5.html#ADDPRINTERCOMMAN"
683 TARGET="_top"
684 ><TT
685 CLASS="PARAMETER"
686 ><I
687 >add printer command</I
688 ></TT
689 ></A
690 > script. It adds the appropriate entries to <TT
691 CLASS="FILENAME"
692 >/etc/printcap.local</TT
693 > (change that to what you need) and returns a line of 'Done' which is needed for the whole process to work.</P
694 ><PRE
695 CLASS="PROGRAMLISTING"
696 >#!/bin/sh
697
698 # Script to insert a new printer entry into printcap.local
699 #
700 # $1, printer name, used as the descriptive name
701 # $2, share name, used as the printer name for Linux
702 # $3, port name
703 # $4, driver name
704 # $5, location, used for the device file of the printer
705 # $6, win9x location
706
707 #
708 # Make sure we use the location that RedHat uses for local printer defs
709 PRINTCAP=/etc/printcap.local
710 DATE=`date +%Y%m%d-%H%M%S`
711 LP=lp
712 RESTART="service lpd restart"
713
714 # Keep a copy
715 cp $PRINTCAP $PRINTCAP.$DATE
716 # Add the printer to $PRINTCAP
717 echo ""                                                 &#62;&#62; $PRINTCAP
718 echo "$2|$1:\\"                                         &#62;&#62; $PRINTCAP
719 echo "  :sd=/var/spool/lpd/$2:\\"                       &#62;&#62; $PRINTCAP
720 echo "  :mx=0:ml=0:sh:\\"                               &#62;&#62; $PRINTCAP
721 echo "  :lp=/usr/local/samba/var/print/$5.prn:"         &#62;&#62; $PRINTCAP
722
723 touch "/usr/local/samba/var/print/$5.prn" &#62;&#62; /tmp/printadd.$$ 2&#62;&#38;1
724 chown $LP "/usr/local/samba/var/print/$5.prn" &#62;&#62; /tmp/printadd.$$ 2&#62;&#38;1
725
726 mkdir /var/spool/lpd/$2
727 chmod 700 /var/spool/lpd/$2
728 chown $LP /var/spool/lpd/$2
729 #echo $1 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
730 #echo $2 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
731 #echo $3 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
732 #echo $4 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
733 #echo $5 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
734 #echo $6 &#62;&#62; "/usr/local/samba/var/print/$5.prn"
735 $RESTART &#62;&#62; "/usr/local/samba/var/print/$5.prn"
736 # Not sure if this is needed
737 touch /usr/local/samba/lib/smb.conf
738 #
739 # You need to return a value, but I am not sure what it means.
740 #
741 echo "Done"
742 exit 0</PRE
743 ></DIV
744 ><DIV
745 CLASS="SECT2"
746 ><H2
747 CLASS="SECT2"
748 ><A
749 NAME="AEN2042">14.2.5. Samba and Printer Ports</H2
750 ><P
751 >Windows NT/2000 print servers associate a port with each printer.  These normally
752 take the form of LPT1:, COM1:, FILE:, etc...  Samba must also support the
753 concept of ports associated with a printer.  By default, only one printer port,
754 named "Samba Printer Port", exists on a system.  Samba does not really a port in
755 order to print, rather it is a requirement of Windows clients.  </P
756 ><P
757 >Note that Samba does not support the concept of "Printer Pooling" internally 
758 either.  This is when a logical printer is assigned to multiple ports as 
759 a form of load balancing or fail over.</P
760 ><P
761 >If you require that multiple ports be defined for some reason,
762 <TT
763 CLASS="FILENAME"
764 >smb.conf</TT
765 > possesses a <A
766 HREF="smb.conf.5.html#ENUMPORTSCOMMAND"
767 TARGET="_top"
768 ><TT
769 CLASS="PARAMETER"
770 ><I
771 >enumports 
772 command</I
773 ></TT
774 ></A
775 > which can be used to define an external program 
776 that generates a listing of ports on a system.</P
777 ></DIV
778 ></DIV
779 ><DIV
780 CLASS="SECT1"
781 ><H1
782 CLASS="SECT1"
783 ><A
784 NAME="AEN2050">14.3. The Imprints Toolset</H1
785 ><P
786 >The Imprints tool set provides a UNIX equivalent of the 
787         Windows NT Add Printer Wizard.  For complete information, please 
788         refer to the Imprints web site at <A
789 HREF="http://imprints.sourceforge.net/"
790 TARGET="_top"
791 >       http://imprints.sourceforge.net/</A
792 > as well as the documentation 
793         included with the imprints source distribution.  This section will 
794         only provide a brief introduction to the features of Imprints.</P
795 ><DIV
796 CLASS="SECT2"
797 ><H2
798 CLASS="SECT2"
799 ><A
800 NAME="AEN2054">14.3.1. What is Imprints?</H2
801 ><P
802 >Imprints is a collection of tools for supporting the goals 
803                 of</P
804 ><P
805 ></P
806 ><UL
807 ><LI
808 ><P
809 >Providing a central repository information 
810                         regarding Windows NT and 95/98 printer driver packages</P
811 ></LI
812 ><LI
813 ><P
814 >Providing the tools necessary for creating 
815                         the Imprints printer driver packages.</P
816 ></LI
817 ><LI
818 ><P
819 >Providing an installation client which 
820                         will obtain and install printer drivers on remote Samba 
821                         and Windows NT 4 print servers.</P
822 ></LI
823 ></UL
824 ></DIV
825 ><DIV
826 CLASS="SECT2"
827 ><H2
828 CLASS="SECT2"
829 ><A
830 NAME="AEN2064">14.3.2. Creating Printer Driver Packages</H2
831 ><P
832 >The process of creating printer driver packages is beyond
833                 the scope of this document (refer to Imprints.txt also included
834                 with the Samba distribution for more information).  In short,
835                 an Imprints driver package is a gzipped tarball containing the
836                 driver files, related INF files, and a control file needed by the
837                 installation client.</P
838 ></DIV
839 ><DIV
840 CLASS="SECT2"
841 ><H2
842 CLASS="SECT2"
843 ><A
844 NAME="AEN2067">14.3.3. The Imprints server</H2
845 ><P
846 >The Imprints server is really a database server that 
847                 may be queried via standard HTTP mechanisms.  Each printer 
848                 entry in the database has an associated URL for the actual
849                 downloading of the package.  Each package is digitally signed
850                 via GnuPG which can be used to verify that package downloaded
851                 is actually the one referred in the Imprints database.  It is 
852                 <SPAN
853 CLASS="emphasis"
854 ><I
855 CLASS="EMPHASIS"
856 >not</I
857 ></SPAN
858 > recommended that this security check 
859                 be disabled.</P
860 ></DIV
861 ><DIV
862 CLASS="SECT2"
863 ><H2
864 CLASS="SECT2"
865 ><A
866 NAME="AEN2071">14.3.4. The Installation Client</H2
867 ><P
868 >More information regarding the Imprints installation client 
869                 is available in the <TT
870 CLASS="FILENAME"
871 >Imprints-Client-HOWTO.ps</TT
872
873                 file included with the imprints source package.</P
874 ><P
875 >The Imprints installation client comes in two forms.</P
876 ><P
877 ></P
878 ><UL
879 ><LI
880 ><P
881 >a set of command line Perl scripts</P
882 ></LI
883 ><LI
884 ><P
885 >a GTK+ based graphical interface to 
886                         the command line perl scripts</P
887 ></LI
888 ></UL
889 ><P
890 >The installation client (in both forms) provides a means
891                 of querying the Imprints database server for a matching
892                 list of known printer model names as well as a means to 
893                 download and install the drivers on remote Samba and Windows
894                 NT print servers.</P
895 ><P
896 >The basic installation process is in four steps and 
897                 perl code is wrapped around <B
898 CLASS="COMMAND"
899 >smbclient</B
900
901                 and <B
902 CLASS="COMMAND"
903 >rpcclient</B
904 >.</P
905 ><P
906 ><PRE
907 CLASS="PROGRAMLISTING"
908 >       
909 foreach (supported architecture for a given driver)
910 {
911      1.  rpcclient: Get the appropriate upload directory 
912          on the remote server
913      2.  smbclient: Upload the driver files
914      3.  rpcclient: Issues an AddPrinterDriver() MS-RPC
915 }
916         
917 4.  rpcclient: Issue an AddPrinterEx() MS-RPC to actually
918     create the printer</PRE
919 ></P
920 ><P
921 >One of the problems encountered when implementing 
922                 the Imprints tool set was the name space issues between 
923                 various supported client architectures.  For example, Windows 
924                 NT includes a driver named "Apple LaserWriter II NTX v51.8" 
925                 and Windows 95 calls its version of this driver "Apple 
926                 LaserWriter II NTX"</P
927 ><P
928 >The problem is how to know what client drivers have 
929                 been uploaded for a printer.  As astute reader will remember 
930                 that the Windows NT Printer Properties dialog only includes 
931                 space for one printer driver name.  A quick look in the 
932                 Windows NT 4.0 system registry at</P
933 ><P
934 ><TT
935 CLASS="FILENAME"
936 >HKLM\System\CurrentControlSet\Control\Print\Environment
937                 </TT
938 ></P
939 ><P
940 >will reveal that Windows NT always uses the NT driver 
941                 name.  This is ok as Windows NT always requires that at least 
942                 the Windows NT version of the printer driver is present.  
943                 However, Samba does not have the requirement internally.  
944                 Therefore, how can you use the NT driver name if is has not 
945                 already been installed?</P
946 ><P
947 >The way of sidestepping this limitation is to require 
948                 that all Imprints printer driver packages include both the Intel 
949                 Windows NT and 95/98 printer drivers and that NT driver is 
950                 installed first.</P
951 ></DIV
952 ></DIV
953 ><DIV
954 CLASS="SECT1"
955 ><H1
956 CLASS="SECT1"
957 ><A
958 NAME="AEN2093">14.4. Diagnosis</H1
959 ><DIV
960 CLASS="SECT2"
961 ><H2
962 CLASS="SECT2"
963 ><A
964 NAME="AEN2095">14.4.1. Introduction</H2
965 ><P
966 >This is a short description of how to debug printing problems with
967 Samba. This describes how to debug problems with printing from a SMB
968 client to a Samba server, not the other way around. For the reverse
969 see the examples/printing directory.</P
970 ><P
971 >Ok, so you want to print to a Samba server from your PC. The first
972 thing you need to understand is that Samba does not actually do any
973 printing itself, it just acts as a middleman between your PC client
974 and your Unix printing subsystem. Samba receives the file from the PC
975 then passes the file to a external "print command". What print command
976 you use is up to you.</P
977 ><P
978 >The whole things is controlled using options in smb.conf. The most
979 relevant options (which you should look up in the smb.conf man page)
980 are:</P
981 ><P
982 ><PRE
983 CLASS="PROGRAMLISTING"
984 >      [global]
985         print command     - send a file to a spooler
986         lpq command       - get spool queue status
987         lprm command      - remove a job
988       [printers]
989         path = /var/spool/lpd/samba</PRE
990 ></P
991 ><P
992 >The following are nice to know about:</P
993 ><P
994 ><PRE
995 CLASS="PROGRAMLISTING"
996 >        queuepause command   - stop a printer or print queue
997         queueresume command  - start a printer or print queue</PRE
998 ></P
999 ><P
1000 >Example:</P
1001 ><P
1002 ><PRE
1003 CLASS="PROGRAMLISTING"
1004 >        print command = /usr/bin/lpr -r -P%p %s
1005         lpq command   = /usr/bin/lpq    -P%p %s
1006         lprm command  = /usr/bin/lprm   -P%p %j
1007         queuepause command = /usr/sbin/lpc -P%p stop
1008         queuepause command = /usr/sbin/lpc -P%p start</PRE
1009 ></P
1010 ><P
1011 >Samba should set reasonable defaults for these depending on your
1012 system type, but it isn't clairvoyant. It is not uncommon that you
1013 have to tweak these for local conditions.  The commands should
1014 always have fully specified pathnames,  as the smdb may not have
1015 the correct PATH values.</P
1016 ><P
1017 >When you send a job to Samba to be printed,  it will make a temporary
1018 copy of it in the directory specified in the [printers] section.
1019 and it should be periodically cleaned out.  The lpr -r option
1020 requests that the temporary copy be removed after printing; If
1021 printing fails then you might find leftover files in this directory,
1022 and it should be periodically cleaned out.  Samba used the lpq
1023 command to determine the "job number" assigned to your print job
1024 by the spooler.</P
1025 ><P
1026 >The %&gt;letter&lt; are "macros" that get dynamically replaced with appropriate
1027 values when they are used. The %s gets replaced with the name of the spool
1028 file that Samba creates and the %p gets replaced with the name of the
1029 printer. The %j gets replaced with the "job number" which comes from
1030 the lpq output.</P
1031 ></DIV
1032 ><DIV
1033 CLASS="SECT2"
1034 ><H2
1035 CLASS="SECT2"
1036 ><A
1037 NAME="AEN2111">14.4.2. Debugging printer problems</H2
1038 ><P
1039 >One way to debug printing problems is to start by replacing these
1040 command with shell scripts that record the arguments and the contents
1041 of the print file. A simple example of this kind of things might
1042 be:</P
1043 ><P
1044 ><PRE
1045 CLASS="PROGRAMLISTING"
1046 >       print command = /tmp/saveprint %p %s
1047
1048     #!/bin/saveprint
1049     # we make sure that we are the right user
1050     /usr/bin/id -p &#62;/tmp/tmp.print
1051     # we run the command and save the error messages
1052     # replace the command with the one appropriate for your system
1053     /usr/bin/lpr -r -P$1 $2 2&#62;&#62;&#38;/tmp/tmp.print</PRE
1054 ></P
1055 ><P
1056 >Then you print a file and try removing it.  You may find that the
1057 print queue needs to be stopped in order to see the queue status
1058 and remove the job:</P
1059 ><P
1060 ><PRE
1061 CLASS="PROGRAMLISTING"
1062 >&#13;h4: {42} % echo hi &#62;/tmp/hi
1063 h4: {43} % smbclient //localhost/lw4
1064 added interface ip=10.0.0.4 bcast=10.0.0.255 nmask=255.255.255.0
1065 Password: 
1066 Domain=[ASTART] OS=[Unix] Server=[Samba 2.0.7]
1067 smb: \&#62; print /tmp/hi
1068 putting file /tmp/hi as hi-17534 (0.0 kb/s) (average 0.0 kb/s)
1069 smb: \&#62; queue
1070 1049     3            hi-17534
1071 smb: \&#62; cancel 1049
1072 Error cancelling job 1049 : code 0
1073 smb: \&#62; cancel 1049
1074 Job 1049 cancelled
1075 smb: \&#62; queue
1076 smb: \&#62; exit</PRE
1077 ></P
1078 ><P
1079 >The 'code 0' indicates that the job was removed.  The comment
1080 by the  smbclient is a bit misleading on this.
1081 You can observe the command output and then and look at the
1082 /tmp/tmp.print file to see what the results are.  You can quickly
1083 find out if the problem is with your printing system.  Often people
1084 have problems with their /etc/printcap file or permissions on
1085 various print queues.</P
1086 ></DIV
1087 ><DIV
1088 CLASS="SECT2"
1089 ><H2
1090 CLASS="SECT2"
1091 ><A
1092 NAME="AEN2120">14.4.3. What printers do I have?</H2
1093 ><P
1094 >You can use the 'testprns' program to check to see if the printer
1095 name you are using is recognized by Samba.  For example,  you can
1096 use:</P
1097 ><P
1098 ><PRE
1099 CLASS="PROGRAMLISTING"
1100 >    testprns printer /etc/printcap</PRE
1101 ></P
1102 ><P
1103 >Samba can get its printcap information from a file or from a program.
1104 You can try the following to see the format of the extracted
1105 information:</P
1106 ><P
1107 ><PRE
1108 CLASS="PROGRAMLISTING"
1109 >    testprns -a printer /etc/printcap
1110
1111     testprns -a printer '|/bin/cat printcap'</PRE
1112 ></P
1113 ></DIV
1114 ><DIV
1115 CLASS="SECT2"
1116 ><H2
1117 CLASS="SECT2"
1118 ><A
1119 NAME="AEN2128">14.4.4. Setting up printcap and print servers</H2
1120 ><P
1121 >You may need to set up some printcaps for your Samba system to use.
1122 It is strongly recommended that you use the facilities provided by
1123 the print spooler to set up queues and printcap information.</P
1124 ><P
1125 >Samba requires either a printcap or program to deliver printcap
1126 information.  This printcap information has the format:</P
1127 ><P
1128 ><PRE
1129 CLASS="PROGRAMLISTING"
1130 >  name|alias1|alias2...:option=value:...</PRE
1131 ></P
1132 ><P
1133 >For almost all printing systems, the printer 'name' must be composed
1134 only of alphanumeric or underscore '_' characters.  Some systems also
1135 allow hyphens ('-') as well.  An alias is an alternative name for the
1136 printer,  and an alias with a space in it is used as a 'comment'
1137 about the printer.  The printcap format optionally uses a \ at the end of lines
1138 to extend the printcap to multiple lines.</P
1139 ><P
1140 >Here are some examples of printcap files:</P
1141 ><P
1142 ><P
1143 ></P
1144 ><OL
1145 TYPE="1"
1146 ><LI
1147 ><P
1148 >pr              just printer name</P
1149 ></LI
1150 ><LI
1151 ><P
1152 >pr|alias        printer name and alias</P
1153 ></LI
1154 ><LI
1155 ><P
1156 >pr|My Printer   printer name, alias used as comment</P
1157 ></LI
1158 ><LI
1159 ><P
1160 >pr:sh:\        Same as pr:sh:cm= testing
1161   :cm= \ 
1162   testing</P
1163 ></LI
1164 ><LI
1165 ><P
1166 >pr:sh           Same as pr:sh:cm= testing
1167   :cm= testing</P
1168 ></LI
1169 ></OL
1170 ></P
1171 ><P
1172 >Samba reads the printcap information when first started.  If you make
1173 changes in the printcap information, then you must do the following:</P
1174 ><P
1175 ></P
1176 ><OL
1177 TYPE="1"
1178 ><LI
1179 ><P
1180 >make sure that the print spooler is aware of these changes.
1181 The LPRng system uses the 'lpc reread' command to do this.</P
1182 ></LI
1183 ><LI
1184 ><P
1185 >make sure that the spool queues, etc., exist and have the
1186 correct permissions.  The LPRng system uses the 'checkpc -f'
1187 command to do this.</P
1188 ></LI
1189 ><LI
1190 ><P
1191 >You now should send a SIGHUP signal to the smbd server to have
1192 it reread the printcap information.</P
1193 ></LI
1194 ></OL
1195 ></DIV
1196 ><DIV
1197 CLASS="SECT2"
1198 ><H2
1199 CLASS="SECT2"
1200 ><A
1201 NAME="AEN2156">14.4.5. Job sent, no output</H2
1202 ><P
1203 >This is the most frustrating part of printing.  You may have sent the
1204 job,  verified that the job was forwarded,  set up a wrapper around
1205 the command to send the file,  but there was no output from the printer.</P
1206 ><P
1207 >First,  check to make sure that the job REALLY is getting to the
1208 right print queue.  If you are using a BSD or LPRng print spooler,
1209 you can temporarily stop the printing of jobs.  Jobs can still be
1210 submitted, but they will not be printed.  Use:</P
1211 ><P
1212 ><PRE
1213 CLASS="PROGRAMLISTING"
1214 >  lpc -Pprinter stop</PRE
1215 ></P
1216 ><P
1217 >Now submit a print job and then use 'lpq -Pprinter' to see if the
1218 job is in the print queue.  If it is not in the print queue then
1219 you will have to find out why it is not being accepted for printing.</P
1220 ><P
1221 >Next, you may want to check to see what the format of the job really
1222 was.  With the assistance of the system administrator you can view
1223 the submitted jobs files.  You may be surprised to find that these
1224 are not in what you would expect to call a printable format.
1225 You can use the UNIX 'file' utitily to determine what the job
1226 format actually is:</P
1227 ><P
1228 ><PRE
1229 CLASS="PROGRAMLISTING"
1230 >    cd /var/spool/lpd/printer   # spool directory of print jobs
1231     ls                          # find job files
1232     file dfA001myhost</PRE
1233 ></P
1234 ><P
1235 >You should make sure that your printer supports this format OR that
1236 your system administrator has installed a 'print filter' that will
1237 convert the file to a format appropriate for your printer.</P
1238 ></DIV
1239 ><DIV
1240 CLASS="SECT2"
1241 ><H2
1242 CLASS="SECT2"
1243 ><A
1244 NAME="AEN2167">14.4.6. Job sent, strange output</H2
1245 ><P
1246 >Once you have the job printing, you can then start worrying about
1247 making it print nicely.</P
1248 ><P
1249 >The most common problem is extra pages of output: banner pages
1250 OR blank pages at the end.</P
1251 ><P
1252 >If you are getting banner pages,  check and make sure that the
1253 printcap option or printer option is configured for no banners.
1254 If you have a printcap,  this is the :sh (suppress header or banner
1255 page) option.  You should have the following in your printer.</P
1256 ><P
1257 ><PRE
1258 CLASS="PROGRAMLISTING"
1259 >   printer: ... :sh</PRE
1260 ></P
1261 ><P
1262 >If you have this option and are still getting banner pages,  there
1263 is a strong chance that your printer is generating them for you
1264 automatically.  You should make sure that banner printing is disabled
1265 for the printer.  This usually requires using the printer setup software
1266 or procedures supplied by the printer manufacturer.</P
1267 ><P
1268 >If you get an extra page of output,  this could be due to problems
1269 with your job format,  or if you are generating PostScript jobs,
1270 incorrect setting on your printer driver on the MicroSoft client.
1271 For example, under Win95 there is a option:</P
1272 ><P
1273 ><PRE
1274 CLASS="PROGRAMLISTING"
1275 >  Printers|Printer Name|(Right Click)Properties|Postscript|Advanced|</PRE
1276 ></P
1277 ><P
1278 >that allows you to choose if a Ctrl-D is appended to all jobs.
1279 This is a very bad thing to do, as most spooling systems will
1280 automatically add a ^D to the end of the job if it is detected as
1281 PostScript.  The multiple ^D may cause an additional page of output.</P
1282 ></DIV
1283 ><DIV
1284 CLASS="SECT2"
1285 ><H2
1286 CLASS="SECT2"
1287 ><A
1288 NAME="AEN2179">14.4.7. Raw PostScript printed</H2
1289 ><P
1290 >This is a problem that is usually caused by either the print spooling
1291 system putting information at the start of the print job that makes
1292 the printer think the job is a text file, or your printer simply
1293 does not support PostScript.  You may need to enable 'Automatic
1294 Format Detection' on your printer.</P
1295 ></DIV
1296 ><DIV
1297 CLASS="SECT2"
1298 ><H2
1299 CLASS="SECT2"
1300 ><A
1301 NAME="AEN2182">14.4.8. Advanced Printing</H2
1302 ><P
1303 >Note that you can do some pretty magic things by using your
1304 imagination with the "print command" option and some shell scripts.
1305 Doing print accounting is easy by passing the %U option to a print
1306 command shell script. You could even make the print command detect
1307 the type of output and its size and send it to an appropriate
1308 printer.</P
1309 ></DIV
1310 ><DIV
1311 CLASS="SECT2"
1312 ><H2
1313 CLASS="SECT2"
1314 ><A
1315 NAME="AEN2185">14.4.9. Real debugging</H2
1316 ><P
1317 >If the above debug tips don't help, then maybe you need to bring in
1318 the bug guns, system tracing. See Tracing.txt in this directory.</P
1319 ></DIV
1320 ></DIV
1321 ></DIV
1322 ><DIV
1323 CLASS="NAVFOOTER"
1324 ><HR
1325 ALIGN="LEFT"
1326 WIDTH="100%"><TABLE
1327 SUMMARY="Footer navigation table"
1328 WIDTH="100%"
1329 BORDER="0"
1330 CELLPADDING="0"
1331 CELLSPACING="0"
1332 ><TR
1333 ><TD
1334 WIDTH="33%"
1335 ALIGN="left"
1336 VALIGN="top"
1337 ><A
1338 HREF="msdfs.html"
1339 ACCESSKEY="P"
1340 >Prev</A
1341 ></TD
1342 ><TD
1343 WIDTH="34%"
1344 ALIGN="center"
1345 VALIGN="top"
1346 ><A
1347 HREF="samba-howto-collection.html"
1348 ACCESSKEY="H"
1349 >Home</A
1350 ></TD
1351 ><TD
1352 WIDTH="33%"
1353 ALIGN="right"
1354 VALIGN="top"
1355 ><A
1356 HREF="winbind.html"
1357 ACCESSKEY="N"
1358 >Next</A
1359 ></TD
1360 ></TR
1361 ><TR
1362 ><TD
1363 WIDTH="33%"
1364 ALIGN="left"
1365 VALIGN="top"
1366 >Hosting a Microsoft Distributed File System tree on Samba</TD
1367 ><TD
1368 WIDTH="34%"
1369 ALIGN="center"
1370 VALIGN="top"
1371 ><A
1372 HREF="optional.html"
1373 ACCESSKEY="U"
1374 >Up</A
1375 ></TD
1376 ><TD
1377 WIDTH="33%"
1378 ALIGN="right"
1379 VALIGN="top"
1380 >Unified Logons between Windows NT and UNIX using Winbind</TD
1381 ></TR
1382 ></TABLE
1383 ></DIV
1384 ></BODY
1385 ></HTML
1386 >