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