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