2 <body bgcolor="#ffffff">
4 <img src="samba2_xs.gif" border="0" alt=" " height="100" width="76"
5 hspace="10" align="left" />
7 <h1 class="head0">Chapter 10. Printing</h1>
11 <p><a name="INDEX-1"/>This
12 chapter tackles the topic of setting up printers for use with Samba.
13 Aside from the "coolness factor" of
14 seeing documents from Windows word processing and graphics
15 applications appearing in the output tray of the Unix printer, this
16 facility can greatly increase the usefulness of your Samba server. In
17 many organizations, using a Unix system as the print server has led
18 to happier system administrators and users alike, due to the reduced
19 frequency of problems.</p>
21 <p>Samba allows client machines to share printers connected to the Samba
22 host system, and Samba can also send Unix documents to printers
23 shared by Windows systems. In this chapter, we discuss how to get
24 printers configured to work in either direction.</p>
26 <p>We focus in this chapter on getting Samba to serve up printers that
27 are already functioning on the Unix host. We include just a few
28 basics about setting up printers on Unix. Good references for this
29 topic include <em class="citetitle">Network Printing</em>,
30 <em class="citetitle">Essential System Administration</em>, and
31 <em class="citetitle">Running Linux</em>, all by
32 O'Reilly and Associates.</p>
36 <div class="sect1"><a name="samba2-CHP-10-SECT-1"/>
38 <h2 class="head1">Sending Print Jobs to Samba</h2>
40 <p><a name="INDEX-2"/>A
41 printer shared by the Samba server shows up in the list of shares
42 offered in the Network Neighborhood. If the printer is registered on
43 the client machine and the client has the correct printer driver
44 installed, the client can effortlessly send print jobs to a printer
45 attached to a Samba server. <a href="ch10.html#samba2-CHP-10-FIG-1">Figure 10-1</a> shows a
46 Samba printer as it appears in the Network Neighborhood of a Windows
49 <div class="figure"><a name="samba2-CHP-10-FIG-1"/><img src="figs/sam2_1001.gif"/></div><h4 class="head4">Figure 10-1. A Samba printer in the Network Neighborhood</h4>
51 <p>To administer printers with Samba, you should understand the basic
53 <a name="INDEX-3"/>printing
54 takes place on a network. On the client system, the application
55 software prints by utilizing the system's printer
56 driver for the printer that will be creating the actual output. It is
57 the printer driver software running on the client system that
58 translates the application's high-level calls into a
59 stream of binary data specific to the model of printer in use. In the
60 case of a serial, parallel, or USB printer, the data is stored in a
61 temporary file in the local system's printer queue
62 and then sent through the respective port directly to the printer.
63 For a network printer, the file is sent over the network.</p>
65 <a name="samba2-CHP-10-NOTE-150"/><blockquote class="note"><h4 class="objtitle">TIP</h4>
66 <p>Because the data has already been processed through a printer driver
67 by the time it reaches the Samba host, make sure the printer on the
68 Unix system is configured without any printer driver and that it will
69 print whatever data it receives in raw form. If you already have the
70 printer configured for use by Unix applications, you might need to
71 set up another queue for it to print documents received from Windows
72 clients correctly.</p>
75 <p>Sending a <a name="INDEX-4"/>print job to a printer on a
76 <a name="INDEX-5"/>Samba server involves four steps:</p>
79 <p>Opening and authenticating a connection to the printer share</p>
81 <p>Copying the file over the network</p>
83 <p>Closing the connection</p>
85 <p>Printing and deleting the copy of the file</p>
87 <p>When a print job arrives at a Samba server, the print data is
88 temporarily written to disk in the directory specified by the
89 <tt class="literal">path</tt> option of the printer share. Samba then
90 executes a Unix print command to send that datafile to the printer.
91 The job is then printed as the authenticated user of the share. Note
92 that this can be the guest user, depending on how the share is
96 <div class="sect2"><a name="samba2-CHP-10-SECT-1.1"/>
98 <h3 class="head2">Print Commands</h3>
100 <p><a name="INDEX-6"/>To print the
101 document, you'll need to inform Samba of the command
102 used to print and delete a file. On Linux, which uses a BSD-style
103 printing system, a command that does this is:</p>
105 <blockquote><pre class="code">lpr -r -P<em class="replaceable">printer</em> <em class="replaceable">file</em></pre></blockquote>
107 <p>This command tells <a name="INDEX-7"/><em class="emphasis">lpr</em> to retrieve the
108 name of the printer in the system configuration file
109 (<em class="filename">/etc/printcap</em>) and interpret the rules it finds
110 there to decide how to process the data and which physical device to
111 send it to. Note that because the <em class="emphasis">-r</em> option has
112 been specified, the file will be deleted after it has been printed.
113 Of course, the file removed is just a copy stored on the Samba
114 server; the original document on the client is unaffected.</p>
116 <p>The process is similar on System V Unix. Here, printing and deleting
117 become a compound command:</p>
119 <blockquote><pre class="code">lp -d<em class="replaceable">printer</em> -s <em class="replaceable">file</em>; rm <em class="replaceable">file</em></pre></blockquote>
121 <p>In this case, the <em class="filename">/etc/printcap</em> file is replaced
122 with a different set of configuration files residing in
123 <em class="filename">/usr/spool/lp</em>. Because the
124 <em class="emphasis">lp</em> command has no option to delete the file
125 after it is printed, we have added the <em class="emphasis">rm</em>
132 <div class="sect2"><a name="samba2-CHP-10-SECT-1.2"/>
134 <h3 class="head2">A Minimal Printing Setup</h3>
136 <p>Let's start with a simple yet illustrative
137 <a name="INDEX-8"/>printing
138 share. Assuming that you're on a Linux system and
139 you have a printer called <tt class="literal">netprinter</tt> listed in the
140 printer capabilities file, the following addition to your
141 <em class="filename">smb.conf</em> file makes the printer accessible
142 through the network:</p>
144 <blockquote><pre class="code">[printer1]
146 print command = /usr/bin/lpr -P%p -r %s
149 path = /var/tmp</pre></blockquote>
151 <p>The variable <tt class="literal">%s</tt> in the
152 <tt class="literal">print</tt><a name="INDEX-9"/> <tt class="literal">command</tt>
153 option is replaced with the name of the file to be printed when Samba
154 executes the command. There are four Samba configuration-file
155 variables specifically for use with
156 <a name="INDEX-10"/>printing
157 options. They are shown in <a href="ch10.html#samba2-CHP-10-TABLE-1">Table 10-1</a>.</p>
159 <a name="samba2-CHP-10-TABLE-1"/><h4 class="head4">Table 10-1. Printing variables</h4><table border="1">
175 <p><tt class="literal">%s</tt></p>
178 <p>The full pathname of the file on the Samba server to be printed</p>
183 <p><tt class="literal">%f</tt></p>
186 <p>The name of the file itself (without the preceding path) on the Samba
187 server to be printed</p>
192 <p><tt class="literal">%p</tt></p>
195 <p>The name of the Unix printer to use</p>
200 <p><tt class="literal">%j</tt></p>
203 <p>The number of the print job (for use with <tt class="literal">lprm</tt>,
204 <tt class="literal">lppause</tt>, and <tt class="literal">lpresume</tt>)</p>
210 <p>For other flavors of Unix, it is necessary to modify both the
211 <tt class="literal">printing</tt> and <tt class="literal">print</tt>
212 <tt class="literal">command</tt> options. For System V Unix, we would
215 <blockquote><pre class="code">[printer1]
217 print command = lp -d%p -s %s; rm %s</pre></blockquote>
219 <p>With the <tt class="literal">printing</tt> <tt class="literal">=</tt>
220 <tt class="literal">SYSV</tt> parameter, we notify Samba that the local
221 printing system uses the System V Unix method. As mentioned earlier,
222 the <tt class="literal">%p</tt> variable resolves to the name of the
223 printer, while the <tt class="literal">%s</tt> variable resolves to the
224 name of the file.</p>
226 <p>Clients might need to request the status of a print job sent to the
227 Samba server. Because Samba sends print jobs to the Unix printing
228 system for spooling, there might be a number of jobs in the queue at
229 any given time. Consequently, Samba needs to communicate to the
230 client not only the status of the current printing job, but also
231 which documents are waiting to be printed on that printer. Samba also
232 has to provide the client the ability to pause print jobs, resume
233 print jobs, and remove print jobs from the printing queue. Samba
234 provides options for each of these tasks. As you might expect, they
235 borrow functionality from the following existing Unix commands:</p>
238 <p><tt class="literal">lpq</tt><a name="INDEX-11"/></p>
240 <p><tt class="literal">lprm</tt><a name="INDEX-12"/></p>
242 <p><tt class="literal">lppause</tt><a name="INDEX-13"/></p>
244 <p><tt class="literal">lpresume</tt><a name="INDEX-14"/></p>
246 <p>We cover these options in more detail later in this chapter. For the
247 most part, Samba provides reasonable default values for them based on
248 the value of the <tt class="literal">printing</tt> configuration option, so
249 you can probably get by without having to formulate your own commands
252 <p>Here are a few important items to remember about
253 <a name="INDEX-15"/>printing shares:</p>
257 <tt class="literal">printable</tt><a name="INDEX-16"/> <tt class="literal">=</tt>
258 <tt class="literal">yes</tt> in all printer shares (even
259 <tt class="literal">[printers]</tt>) so that Samba knows they are printer
260 shares. If you forget, the shares will be unusable for printing and
261 will instead be treated as disk shares.</p>
263 <p>If you set the <tt class="literal">path</tt> configuration option in the
264 printer section, any files sent to the printer(s) will be copied to
265 the directory you specify instead of to the default location of
266 <em class="filename">/tmp</em>. Because the amount of disk space allocated
267 to <em class="filename">/tmp</em> can be relatively small in some Unix
268 operating systems, many administrators prefer to use
269 <em class="filename">/var/tmp, /var/spool/tmp</em>, or some other
270 directory instead.</p>
272 <p>If you set <tt class="literal">guest</tt> <tt class="literal">ok</tt>
273 <tt class="literal">=</tt> <tt class="literal">yes</tt> in a printer share and
274 Samba is configured for share-level security, anyone can send data to
275 the printer as the <tt class="literal">guest</tt>
276 <tt class="literal">account</tt> user.</p>
278 <p>Using one or more Samba machines as a print server gives you a great
279 deal of flexibility on your LAN. You can easily partition your
280 available printers, restricting some to members of one department, or
281 you can maintain a bank of printers available to all. In addition,
282 you can restrict a printer to a select few by adding the
283 <tt class="literal">valid</tt> <tt class="literal">users</tt> option to its share
286 <blockquote><pre class="code">[deskjet]
288 path = /var/spool/samba/print
289 valid users = elizabeth cozy jack heather alexander lina emerald</pre></blockquote>
291 <p>All the other share accessibility options work for printing shares as
298 <div class="sect2"><a name="samba2-CHP-10-SECT-1.3"/>
300 <h3 class="head2">The [printers] Share</h3>
303 <tt class="literal">[printers]</tt><a name="INDEX-17"/> is in the configuration file,
304 Samba will automatically read in your printer capabilities file and
305 create a printing share for each printer that appears in the file.
306 For example, if the Samba server had <tt class="literal">lp</tt>,
307 <tt class="literal">pcl</tt>, and <tt class="literal">ps</tt> printers in its
308 printer capabilities file, Samba would provide three printer shares
309 with those names, each configured with the options in the
310 <tt class="literal">[printers]</tt> share.</p>
312 <p>Recall that Samba obeys the following rules when a client requests a
313 share that has not been created with an explicit share definition in
314 the <em class="filename">smb.conf</em> file:</p>
317 <p>If the share name matches a username in the system password file and
318 a <tt class="literal">[homes]</tt> share exists, a new share is created
319 with the name of the user and is initialized using the values given
320 in the <tt class="literal">[homes]</tt> and <tt class="literal">[global]</tt>
323 <p>Otherwise, if the name matches a printer in the system printer
324 capabilities file and a <tt class="literal">[printers]</tt> share exists, a
325 new share is created with the name of the printer and initialized
326 using the values given in the <tt class="literal">[printers]</tt> section.
327 (Variables in the <tt class="literal">[global]</tt> section do not apply
330 <p>If neither of those succeeds, Samba looks for a
331 <tt class="literal">default</tt> <tt class="literal">service</tt> share. If none
332 is found, it returns an error.</p>
334 <p>This brings to light an important point: be careful that you do not
335 give a printer the same name as a user. Otherwise, users end up
336 connecting to a disk share when they might have wanted a printer
339 <p>Here is an example
340 <tt class="literal">[printers]</tt><a name="INDEX-18"/> share for a Linux system. Some of
341 these options are already defaults; however, we have listed them
342 anyway for illustrative purposes:</p>
344 <blockquote><pre class="code">[printers]
347 printcap name = /etc/printcap
348 print command = /usr/bin/lpr -P%p -r %s
349 path = /var/spool/lpd/tmp
350 min print space = 2000</pre></blockquote>
352 <p>Here, we've given Samba global options that specify
353 the printing type (BSD), a print command to send data to the printer
354 and later remove the temporary file, the location of our printer
355 capabilities file, and a minimum disk space for printing of 2MB.</p>
357 <p>In addition, we've created a
358 <tt class="literal">[printers]</tt> share for each system printer. Our
359 temporary spooling directory is specified by the
360 <tt class="literal">path</tt> option:
361 <em class="filename">/var/spool/lpd/tmp</em>. Each share is marked as
362 printable—this is a necessary option, even in the
363 <tt class="literal">[printers]</tt> section.</p>
369 <div class="sect2"><a name="samba2-CHP-10-SECT-1.4"/>
371 <h3 class="head2">Testing the Configuration</h3>
373 <p><a name="INDEX-19"/>After running
374 <em class="emphasis">testparm</em> and restarting the Samba daemons, you
375 can check to make sure everything is set up correctly by using
376 <em class="emphasis">smbclient</em><a name="INDEX-20"/><a name="INDEX-21"/> to send a file to the printer.
377 Connect to the printer using the command:</p>
379 <blockquote><pre class="code"># <tt class="userinput"><b>smbclient /</b></tt><em class="replaceable">server</em><tt class="userinput"><b>/</b></tt><em class="replaceable">printshare</em></pre></blockquote>
381 <p>and then use the <em class="emphasis">print</em> command to print a file:</p>
383 <blockquote><pre class="code">smb: /> <tt class="userinput"><b>print </b></tt><em class="replaceable">textfile</em></pre></blockquote>
385 <a name="samba2-CHP-10-NOTE-151"/><blockquote class="note"><h4 class="objtitle">TIP</h4>
386 <p>If you connect to a print share served by a Windows 95/98/Me system
387 configured to use user-mode security and cannot authenticate using
388 what you know to be a correct username and password, try
389 reconfiguring the Windows system to use share-mode security.</p>
392 <p>When you print something through the Samba server via
393 <em class="emphasis">smbclient</em>, the following actions should occur:</p>
396 <p>The job appears (briefly) in the Samba spool directory specified by
399 <p>The job shows up in your print system's spool
402 <p>The job disappears from the spool directory that Samba used.</p>
404 <p>If <em class="emphasis">smbclient</em> cannot print, you can reset the
405 <tt class="literal">print</tt> <tt class="literal">command</tt> option to collect
406 debugging information:</p>
408 <blockquote><pre class="code">print command = echo "printed %s on %p" >>/tmp/printlog</pre></blockquote>
410 <p>A <a name="INDEX-22"/>common
411 problem with Samba printer configuration is forgetting to use the
412 full pathnames for commands. Another frequent problem is not having
413 the correct permissions on the spooling directory.<a name="FNPTR-1"/><a href="#FOOTNOTE-1">[1]</a> As usual,
414 check your Samba log files and system log files for error messages.
415 If you use BSD printing, you can change the <tt class="literal">lp</tt>
416 keyword in the printer's printcap entry to something
417 other than <em class="filename">/dev/null</em>, allowing you to collect
418 error messages from the printing system.</p>
420 <a name="samba2-CHP-10-NOTE-152"/><blockquote class="note"><h4 class="objtitle">TIP</h4>
421 <p>More information on
422 <a name="INDEX-23"/>debugging printers is in the file
423 <em class="filename">docs/textdocs/Printing.txt</em> in the Samba source
424 distribution. The Unix print systems are covered in detail in
425 <a name="INDEX-24"/>Æleen
426 Frisch's <em class="emphasis">Essential Systems
427 Administration</em> (published by O'Reilly).</p>
434 <div class="sect2"><a name="samba2-CHP-10-SECT-1.5"/>
436 <h3 class="head2">Enabling SMB Printer Sharing in Mac OS X</h3>
438 <p>With Samba preinstalled with
439 <a name="INDEX-25"/><a name="INDEX-26"/>Mac OS X, sharing access to a printer
440 among Windows clients is easy. First, of course, you should set up
441 local access using the Print Center application (located in
442 <em class="filename">/Applications/Utilities</em>). Under the Printers
443 menu, select Add Printer..., and make the appropriate selection from
444 the pop-up menu. For example, if the printer is directly attached,
445 select USB; if the printer is powered on, it should appear in the
446 list. Choose the printer, and press the Add button.</p>
448 <p>Edit <em class="filename">/etc/smb.conf</em>, uncommenting the
449 <tt class="literal">[printers]</tt> share and making any additional
450 configuration changes you feel are necessary. Finally, enable the
451 Samba startup item as described in <a href="ch02.html">Chapter 2</a>,
452 either by checking Windows File Sharing in Sharing Preferences or by
453 manually editing <em class="filename">/etc/hostconfig</em>. Now your
454 printer can be used by remote Windows clients.</p>
456 <p>On Mac OS X and some other BSD-based systems, you can test your
458 <em class="emphasis">smbutil</em><a name="INDEX-27"/>. The following will send the
459 file named <em class="filename">print_test_file</em> to the printer named
460 <em class="filename">printshare</em> on the server
461 <em class="emphasis">bsdserver</em> :</p>
463 <blockquote><pre class="code">% <tt class="userinput"><b>smbutil print //bsdserver/printshare print_test_file</b></tt></pre></blockquote>
465 <p>See <a href="ch05.html">Chapter 5</a> for more information on using
466 <em class="emphasis">smbutil</em>.</p>
472 <div class="sect2"><a name="samba2-CHP-10-SECT-1.6"/>
474 <h3 class="head2">Setting Up and Testing a Windows Client</h3>
476 <p><a name="INDEX-28"/>Now that Samba is
477 offering a workable printer, you can set up your access to it on a
478 Windows client. Browse through the Samba server in the Network
479 Neighborhood. It should now show each printer that is available. For
480 example, in <a href="ch10.html#samba2-CHP-10-FIG-1">Figure 10-1</a>, we saw a printer called
481 <tt class="literal">lp</tt>.</p>
483 <p>Next, you need to have the Windows client recognize the printer.
484 Double-click the printer icon to get started. If you try to select an
485 uninstalled printer (as you just did), Windows will ask you if it
486 should help configure it for the Windows system. Click the Yes or OK
487 button, and the Printer Wizard will open.</p>
489 <p>If you are installing a printer on Windows 95/98/Me, the first thing
490 the wizard will ask is whether you need to print from DOS.
491 Let's assume you don't, so choose
492 the "No" radio button and press the
493 Next > button to get to the manufacturer/model window, as shown in
494 <a href="ch10.html#samba2-CHP-10-FIG-2">Figure 10-2</a>.</p>
496 <div class="figure"><a name="samba2-CHP-10-FIG-2"/><img src="figs/sam2_1002.gif"/></div><h4 class="head4">Figure 10-2. Setting the manufacturer and model of the printer</h4>
498 <p>In this dialog box, you should see a large list of manufacturers and
499 models for a huge number of printers. Select the manufacturer of your
500 printer in the left side of the dialog box, and then the exact model
501 of the printer in the list on the right side.</p>
503 <p>In some cases, you might not find your printer in the list, or the
504 version of the printer driver included with Windows might be out of
505 date. In cases such as these, consult the printer
506 manufacturer's documentation on how to install the
507 driver. Typically, you will click the Have Disk... button to install
508 the driver from a CD-ROM or disk file.</p>
510 <p>If you don't see your printer on the list, but you
511 know it's a PostScript printer, select Apple as the
512 manufacturer and Apple LaserWriter as the model. This will give you
513 the most basic PostScript printer setup—and arguably one of the
514 most reliable. If you already have PostScript printers attached, you
515 will be asked about replacing or reusing the existing driver. Be
516 aware that if you replace it with a new one, you might make your
517 other printers fail. Therefore, we recommend you keep using your
518 existing printer drivers as long as they're working
521 <p>Click the Next > or OK button. On Windows 95/98/Me, the Printer
522 Wizard asks you to name the printer. On Windows NT/2000/XP, you need
523 to right-click the printer's icon and select
524 Properties to assign the printer a name. <a href="ch10.html#samba2-CHP-10-FIG-3">Figure 10-3</a>
525 shows how we've named our printer to show that
526 it's shared by the <tt class="literal">mixtec</tt> Samba
529 <div class="figure"><a name="samba2-CHP-10-FIG-3"/><img src="figs/sam2_1003.gif"/></div><h4 class="head4">Figure 10-3. Setting the printer name</h4>
531 <p>Finally, on Windows 95/98/Me the Printing Wizard asks if it should
532 print a test page. Click the "Yes"
533 radio button, then the Finish button, and you should be presented
534 with the dialog box shown in <a href="ch10.html#samba2-CHP-10-FIG-4">Figure 10-4</a>. On Windows
535 NT/2000/XP, the printer test function is also accessed through the
536 printer's Properties dialog box.</p>
538 <div class="figure"><a name="samba2-CHP-10-FIG-4"/><img src="figs/sam2_1004.gif"/></div><h4 class="head4">Figure 10-4. Sending a test page to the printer</h4>
540 <p>If the test printing was unsuccessful, click the No button and the
541 Printing Wizard will walk you through some debugging steps for the
542 client side of the process. If the test printing does work, the
543 remote printer will now be available to all Windows applications
544 through the File and Print menu items.</p>
554 <div class="sect1"><a name="samba2-CHP-10-SECT-2"/>
556 <h2 class="head1">Printing to Windows Printers</h2>
558 <p><a name="INDEX-29"/>If you have printers
559 connected to systems running Windows 95/98/Me or Windows NT/2000/XP,
560 the printers can also be accessed from your Unix system using tools
561 that are part of the Samba distribution. First, it is necessary to
562 create a printer share on the Windows system. Then set up the printer
563 on the Unix side by configuring a new printer and using a Samba
564 printing program as the printer's filter.</p>
567 <div class="sect2"><a name="samba2-CHP-10-SECT-2.1"/>
569 <h3 class="head2">Sharing Windows Printers</h3>
571 <p>Sharing printers on Windows is not unlike sharing files. In fact, it
572 is a little simpler. Open the Control Panel, then double-click the
573 Printers icon to open the Printers window. Right-click the icon for
574 the printer you want to share, and select Sharing.... This opens the
575 dialog box shown in <a href="ch10.html#samba2-CHP-10-FIG-5">Figure 10-5</a> for a Windows 98
576 system, or <a href="ch10.html#samba2-CHP-10-FIG-6">Figure 10-6</a> on a Windows 2000 system.
577 (The dialog box appears slightly different on other Windows versions,
578 but functions almost identically.)</p>
580 <a name="samba2-CHP-10-NOTE-153"/><blockquote class="note"><h4 class="objtitle">TIP</h4>
581 <p>On Windows 95/98/Me systems, you may need to run file sharing in
582 share-level (rather than user-level) access control mode to access a
583 shared printer from Samba. To check or set this mode, go to Control
584 Panel, then double-click on Network, then click on the Access Control
585 tab. More detailed information on this can be found in <a href="ch05.html">Chapter 5</a>.</p>
588 <div class="figure"><a name="samba2-CHP-10-FIG-5"/><img src="figs/sam2_1005.gif"/></div><h4 class="head4">Figure 10-5. Sharing printers on Windows 98</h4>
590 <div class="figure"><a name="samba2-CHP-10-FIG-6"/><img src="figs/sam2_1006.gif"/></div><h4 class="head4">Figure 10-6. Sharing printers on Windows 2000</h4>
592 <p>Click the "Shared as" radio button,
593 then click the OK button. The printer is now accessible by other
594 systems on the network.</p>
600 <div class="sect2"><a name="samba2-CHP-10-SECT-2.2"/>
602 <h3 class="head2">Adding a Unix Printer</h3>
604 <p><a name="INDEX-30"/>The Samba distribution comes with
605 three programs that assist with printing on shared printers. The
606 <em class="emphasis">smbprint</em><a name="INDEX-31"/> program works with systems that use the
608 <em class="emphasis">smbprint.sysv</em><a name="INDEX-32"/>
609 works with systems that use System V printing, and
610 <em class="emphasis">smbspool</em><a name="INDEX-33"/>
611 works with systems that use the Common Unix Printing System (CUPS).
612 In the following sections we show you how to install printers for
616 <div class="sect3"><a name="samba2-CHP-10-SECT-2.2.1"/>
618 <h3 class="head3">BSD printers</h3>
620 <p><a name="INDEX-34"/><a name="INDEX-35"/>The
621 BSD printing system is used by many Unix variants, including Red Hat
622 Linux. With BSD printing, all the printers on the system have an
623 entry in the <em class="filename">/etc/printcap</em> file, which is the
624 database of printer capabilities used by the <em class="emphasis">lpd</em>
625 line printer daemon and other programs that assist with printing. The
626 Red Hat Linux implementation is a bit different in that
627 <em class="filename">/etc/printcap</em> is a machine-generated file, which
628 is re-created every time the <em class="emphasis">lpd</em> daemon is
629 restarted by the <em class="emphasis">/etc/rc.d/init.d/lpd</em> script.
630 Instead of editing <em class="filename">/etc/printcap</em>, we will add an
631 entry for our printer in <em class="filename">/etc/printcap.local</em>,
632 which the system automatically includes verbatim when creating
633 <em class="filename">/etc/printcap</em>.</p>
635 <a name="samba2-CHP-10-NOTE-154"/><blockquote class="note"><h4 class="objtitle">TIP</h4>
636 <p>If you are using the version of Samba installed from an RPM file as
637 on Red Hat Linux, you might be able to skip these directions and use
638 the <em class="emphasis">printconf</em> tool, which has support for SMB
639 printers. Unfortunately, this tool might not work correctly if you
640 have installed Samba from the Samba source distribution.</p>
643 <p>Here is the entry we added to our
644 <em class="filename">/etc/printcap.local</em><a name="INDEX-36"/><a name="INDEX-37"/> file to support our Hewlett-Packard
645 DeskJet 932C printer, which is shared by <tt class="literal">maya</tt>, a
646 Windows 98 system:</p>
648 <blockquote><pre class="code">lp|maya-hp932c:\
649 :cm=HP 932C on maya:\
650 :sd=/var/spool/lpd/maya:\
651 :af=/var/spool/lpd/maya/acct:\
652 :if=/usr/local/samba/bin/smbprint:\
654 :lp=/dev/null:</pre></blockquote>
656 <p>The first line creates names for the printer. We are calling it both
657 <tt class="literal">maya-hp932c</tt>, to describe its location on the
658 network and the type of printer, and <tt class="literal">lp</tt> so that
659 programs will use it as the default printer. The rest of the lines
660 specify keywords and values. The <tt class="literal">cm</tt> keyword allows
661 us to assign a comment string to the printer. The
662 <tt class="literal">sd</tt> and <tt class="literal">af</tt> keywords assign the
663 printer's spool directory and accounting files,
664 respectively. The <tt class="literal">if</tt> keyword assigns the print
665 filter. We are using the <em class="emphasis">smbprint</em> command to
666 send the output to the shared SMB printer. The <tt class="literal">mx</tt>
667 keyword is set to zero to allow any size file to be printed, and
668 <tt class="literal">lp</tt> is set to <em class="filename">/dev/null</em> to
669 discard error messages.</p>
671 <p>You can follow our model to create an entry for your own printer. If
672 you want to go beyond the capabilities we used, refer to your
673 system's <em class="emphasis">printcap(5)</em> manual
674 page for a complete listing of keywords.</p>
676 <p>Go to your Samba source distribution's root
677 directory, and install the <em class="emphasis">smbprint</em> program like
680 <blockquote><pre class="code"># <tt class="userinput"><b>cp examples/printing/smbprint /usr/local/samba/bin</b></tt></pre></blockquote>
682 <p>We next create the printer's spool directory:</p>
684 <blockquote><pre class="code"># <tt class="userinput"><b>cd /var/spool/lpd</b></tt>
685 # <tt class="userinput"><b>mkdir maya</b></tt>
686 # <tt class="userinput"><b>chown lp:lp maya</b></tt>
687 # <tt class="userinput"><b>chmod 700 maya</b></tt></pre></blockquote>
689 <p>The <em class="emphasis">smbprint</em> program looks for a file named
690 <em class="filename">.config</em> in the printer's spool
691 directory, which contains information on how to connect to the
692 printer share. We create this file and then fill in the required
695 <blockquote><pre class="code"># <tt class="userinput"><b>cd maya</b></tt>
696 # <tt class="userinput"><b>>.config</b></tt>
697 # <tt class="userinput"><b>chown lp:lp .config</b></tt>
698 # <tt class="userinput"><b>chmod 600 .config</b></tt></pre></blockquote>
700 <p>Use your preferred text editor to edit the
701 <em class="filename">.config</em> file, and enter three lines, like this:</p>
703 <blockquote><pre class="code">server=maya
705 password=""</pre></blockquote>
707 <p>This is for our shared printer having a UNC of
708 <em class="filename">\\maya\hp</em>. When we created the printer share, we
709 did not give it a password, so we use a null password here. If your
710 printer share is on a Windows NT/2000/XP system, use your domain
713 <p>Finally, restart the printer daemon:</p>
715 <blockquote><pre class="code"># <tt class="userinput"><b>/etc/rc.d/init.d/lpd restart</b></tt></pre></blockquote>
717 <p>You can now try printing something. Run the following command:</p>
719 <blockquote><pre class="code">$ <tt class="userinput"><b>lpr textfile</b></tt></pre></blockquote>
721 <p>If you have everything set up correctly, the file prints on the
722 shared printer. If you get "stair
723 stepping" of text, caused by the printer not
724 returning to the left margin at the beginning of every line, modify
725 the <tt class="literal">if</tt> keyword in your printcap entry to run
726 <em class="emphasis">smbprint</em> with the <em class="emphasis">-t</em>
727 option. <a name="INDEX-38"/><a name="INDEX-39"/></p>
734 <div class="sect3"><a name="samba2-CHP-10-SECT-2.2.2"/>
736 <h3 class="head3">System V printers</h3>
738 <p><a name="INDEX-40"/><a name="INDEX-41"/>Sending print jobs from a System V Unix
739 system is a little easier than with the BSD system. Here, you need to
740 edit the <em class="filename">smbprint.sysv</em> script in the
741 <em class="filename">examples/printing</em> directory of the Samba
742 distribution and do the following:</p>
745 <p>Change the <tt class="literal">server</tt>, <tt class="literal">service</tt>, and
746 <tt class="literal">password</tt> parameters in the script to match the
747 NetBIOS computer name, its shared printer service, and its password,
748 respectively. For example, the following entries would be correct for
749 the service in the previous example:</p>
751 <blockquote><pre class="code">server = maya
753 password = ""</pre></blockquote>
756 <p>Run the following commands, which create a reference for the new
757 printer (which we are naming <tt class="literal">hp_printer</tt>) in the
758 printer capabilities file:</p>
760 <blockquote><pre class="code"># <tt class="userinput"><b>lpadmin -p hp_printer -v /dev/null -i./smbprint.sysv</b></tt>
761 # <tt class="userinput"><b>enable hp_printer</b></tt>
762 # <tt class="userinput"><b>accept hp_printer</b></tt></pre></blockquote>
764 <p>After you've done that, restart the Samba daemons
765 and try printing to <tt class="literal">hp_printer</tt> using any standard
773 <div class="sect3"><a name="samba2-CHP-10-SECT-2.2.3"/>
775 <h3 class="head3">CUPS printers</h3>
777 <p><a name="INDEX-42"/><a name="INDEX-43"/><a name="INDEX-44"/>CUPS<a name="FNPTR-2"/><a href="#FOOTNOTE-2">[2]</a> uses
778 a set of modules, called
779 <em class="firstterm">backends</em><a name="INDEX-45"/>, to send print jobs to various
780 destinations, such as local printers attached to parallel, serial, or
781 Universal Serial Bus (USB) ports, or over the network using Unix line
782 printer daemon (LPD) protocol, Internet Printing Protocol (IPP),
783 AppleTalk Printer Access Protocol (PAP), and so on. The software
784 package does not come with a backend for SMB; the Samba suite
785 includes the <em class="emphasis">smbspool</em>
786 <a name="INDEX-46"/>utility for this purpose.</p>
788 <p>To enable printing to remote SMB printers using CUPS, create a
789 symbolic link named <em class="filename">smb</em> in the CUPS backend
790 directory pointing to <em class="emphasis">smbspool</em>. Depending on
791 installation options, these could be in a number of places in the
792 directory hierarchy, so be sure to check your system. Using a common
793 default installation, the command would look like this:</p>
795 <blockquote><pre class="code"># <tt class="userinput"><b>ln -s /usr/local/samba/bin/smbspool /usr/lib/cups/backend/smb</b></tt></pre></blockquote>
797 <p>Issue a HUP signal to the CUPS daemon, <em class="emphasis">cupsd</em>,
798 and check for the existence of SMB support with the <em class="emphasis">lpinfo
799 -v</em> command. Its output should now include a line that says
800 <tt class="literal">network</tt> <tt class="literal">smb</tt>.</p>
802 <p>To add a printer, use the CUPS web interface, accessible on the local
803 system at <em class="emphasis">http://localhost:631/</em>,
804 or use the <em class="emphasis">lpadmin</em> command:</p>
806 <blockquote><pre class="code"># <tt class="userinput"><b>lpadmin -p hp932c -E -v smb://maya/hp932c -D "HP 932C on maya"</b></tt></pre></blockquote>
808 <p>This creates and enables the new print spool called
809 <tt class="literal">hp932c</tt>. The <em class="emphasis">-v</em> argument
810 specifies the printer device, which in this case is accessed over the
811 network using an SMB URI. If the printer is not guest-accessible,
812 you'll need to provide a username and password in
813 the URI. The full format is as follows:</p>
815 <blockquote><pre class="code">smb://[<em class="replaceable">username</em>[:<em class="replaceable">password</em>]@][<em class="replaceable">workgroup</em>/]<em class="replaceable">server</em>/<em class="replaceable">printshare</em></pre></blockquote>
817 <p>The <em class="emphasis">lpadmin</em><a name="INDEX-47"/> command makes changes to
818 <em class="filename">/etc/cups/printers.conf</em> and sends a HUP signal
819 to the <em class="emphasis">cupsd</em> daemon, resulting in the creation
820 of a local raw printer spool. In this example, print data is passed
821 in raw format to the Windows system, which has the necessary printer
822 drivers and printer description files to format the data
823 appropriately. The <em class="emphasis">-D</em> option is used to give the
824 printer a comment string.</p>
826 <p>Once you have the printer set up, it's time to test
827 it out. CUPS understands both BSD-style and System V-style printing
828 commands, so you can use whichever is more comfortable. Using the BSD
829 <em class="emphasis">lpr</em> command, try something like:</p>
831 <blockquote><pre class="code">$ <tt class="userinput"><b>lpr -P hp932c textfile</b></tt></pre></blockquote>
833 <p>You should now be set up to use the printer from any application on
834 the Unix system. <a name="INDEX-48"/></p>
843 <div class="sect2"><a name="samba2-CHP-10-SECT-2.3"/>
845 <h3 class="head2">Samba Printing Options</h3>
847 <p><a href="ch10.html#samba2-CHP-10-TABLE-2">Table 10-2</a> summarizes the Samba <a name="INDEX-49"/><a name="INDEX-50"/>printing
850 <a name="samba2-CHP-10-TABLE-2"/><h4 class="head4">Table 10-2. Printing configuration options</h4><table border="1">
878 <p><tt class="literal">printing</tt></p>
881 <p><tt class="literal">bsd</tt>, <tt class="literal">sysv</tt>,
882 <tt class="literal">cups</tt>, <tt class="literal">hpux</tt>,
883 <tt class="literal">aix</tt>, <tt class="literal">qnx</tt>,
884 <tt class="literal">plp</tt>, <tt class="literal">softq</tt>, or
885 <tt class="literal">lprng</tt></p>
888 <p>Printing system type of the Samba host</p>
891 <p>System-dependent</p>
899 <p><tt class="literal">printable</tt> <tt class="literal">(print ok)</tt></p>
905 <p>Marks a share as a printing share</p>
908 <p><tt class="literal">no</tt></p>
916 <p><tt class="literal">printer</tt> <tt class="literal">(printer name)</tt></p>
919 <p>string (Unix printer name)</p>
922 <p>Name for the printer that is shown to clients</p>
925 <p>System-dependent</p>
933 <p><tt class="literal">lpq cache time</tt></p>
936 <p>numeric (time in seconds)</p>
939 <p>Amount of time in seconds that Samba will cache the printer queue
943 <p><tt class="literal">10</tt></p>
951 <p><tt class="literal">postscript</tt></p>
957 <p>Treats all print jobs as PostScript by prefixing
958 <tt class="literal">%!</tt> at the beginning of each file</p>
961 <p><tt class="literal">no</tt></p>
969 <p><tt class="literal">load printers</tt></p>
975 <p>If <tt class="literal">yes</tt>, automatically loads each printer in the
976 <em class="emphasis">printcap</em> file as printing shares</p>
979 <p><tt class="literal">yes</tt></p>
987 <p><tt class="literal">print command</tt></p>
990 <p>string (shell command)</p>
993 <p>Unix command to perform printing</p>
1004 <p><tt class="literal">lpq command</tt></p>
1007 <p>string (shell command)</p>
1010 <p>Unix command to return the status of the printing queue</p>
1021 <p><tt class="literal">lprm command</tt></p>
1024 <p>string (shell command)</p>
1027 <p>Unix command to remove a job from the printing queue</p>
1038 <p><tt class="literal">lppause command</tt></p>
1041 <p>string (shell command)</p>
1044 <p>Unix command to pause a job on the printing queue</p>
1055 <p><tt class="literal">lpresume</tt> <tt class="literal">command</tt></p>
1058 <p>string (shell command)</p>
1061 <p>Unix command to resume a paused job on the printing queue</p>
1072 <p><tt class="literal">printcap name</tt></p>
1074 <p><tt class="literal">(printcap)</tt></p>
1077 <p>string (filename)</p>
1080 <p>Location of the printer capabilities file</p>
1083 <p>System-dependent</p>
1091 <p><tt class="literal">min print space</tt></p>
1094 <p>numeric (size in kilobytes)</p>
1097 <p>Minimum amount of free disk space that must be present to print</p>
1100 <p><tt class="literal">0</tt></p>
1108 <p><tt class="literal">queuepause</tt> <tt class="literal">command</tt></p>
1111 <p>string (shell command)</p>
1114 <p>Unix command to pause a queue</p>
1125 <p><tt class="literal">queueresume</tt> <tt class="literal">command</tt></p>
1128 <p>string (shell command)</p>
1131 <p>Unix command to resume a queue</p>
1144 <div class="sect3"><a name="samba2-CHP-10-SECT-2.3.1"/>
1146 <h3 class="head3">printing</h3>
1148 <p>The <tt class="literal">printing</tt><a name="INDEX-51"/> configuration option tells
1149 Samba which <a name="INDEX-52"/>printing system to use. There are
1150 several different families of commands to control printing and print
1151 statusing. Samba supports seven different types, as shown in <a href="ch10.html#samba2-CHP-10-TABLE-3">Table 10-3</a>.</p>
1153 <a name="samba2-CHP-10-TABLE-3"/><h4 class="head4">Table 10-3. Printing system types</h4><table border="1">
1172 <p>Berkeley Unix system</p>
1188 <p>Common Unix Printing System</p>
1196 <p>IBM's AIX operating system</p>
1204 <p>Hewlett-Packard Unix</p>
1212 <p>QNX Realtime Operating System</p>
1220 <p>LPR Next Generation</p>
1236 <p>Portable Line Printer</p>
1242 <p>The value for this option must be one of these seven selections. For
1245 <blockquote><pre class="code">printing = SYSV</pre></blockquote>
1247 <p>The default value of this option is system-dependent and is
1248 configured when Samba is first compiled. For most systems, the
1249 <em class="filename">configure</em> script automatically detects the
1250 printing system to be used and configures it properly in the Samba
1251 makefile. However, if your system is a PLP, LPRNG, or QNX printing
1252 system, you need to specify this explicitly in the makefile or the
1255 <p>The most common system types are BSD, SYSV, and CUPS. Each printer on
1256 a BSD Unix server is described in the printer capabilities
1257 file—normally <em class="filename">/etc/printcap</em>. See the
1258 section on the <tt class="literal">printcap</tt> <tt class="literal">file</tt>
1259 parameter for more information on this topic.</p>
1261 <p>Setting the <tt class="literal">printing</tt> configuration option
1262 automatically sets at least three other printing options for the
1263 service in question: <tt class="literal">print</tt>
1264 <tt class="literal">command</tt>, <tt class="literal">lpq</tt>
1265 <tt class="literal">command</tt>, and <tt class="literal">lprm</tt>
1266 <tt class="literal">command</tt>. If you are running Samba on a system that
1267 doesn't support any of the printing styles listed in
1268 <a href="ch10.html#samba2-CHP-10-TABLE-3">Table 10-3</a>, simply set the commands for each of
1276 <div class="sect3"><a name="samba2-CHP-10-SECT-2.3.2"/>
1278 <h3 class="head3">printable</h3>
1280 <p>The <tt class="literal">printable</tt><a name="INDEX-53"/> option must be set to
1281 <tt class="literal">yes</tt> to flag a share as a printing service. If this
1282 option is not set, the share will be treated as a disk share instead.
1283 You can set the option as follows:</p>
1285 <blockquote><pre class="code">[printer1]
1286 printable = yes</pre></blockquote>
1293 <div class="sect3"><a name="samba2-CHP-10-SECT-2.3.3"/>
1295 <a name="INDEX-54"/><h3 class="head3">printer</h3>
1297 <p>The option, also called
1298 <tt class="literal">printer</tt><a name="INDEX-55"/> <tt class="literal">name</tt>,
1299 specifies the name of the printer on the server to which the share
1300 points. This option has no default and should be set explicitly in
1301 the configuration file, even though Unix systems themselves often
1302 recognize a default name such as <tt class="literal">lp</tt> for a printer.
1305 <blockquote><pre class="code">[deskjet]
1306 printer = hpdkjet1</pre></blockquote>
1313 <div class="sect3"><a name="samba2-CHP-10-SECT-2.3.4"/>
1315 <h3 class="head3">lpq cache time</h3>
1317 <p>The global <tt class="literal">lpq</tt><a name="INDEX-56"/> <tt class="literal">cache</tt>
1318 <tt class="literal">time</tt> option allows you to set the number of
1319 seconds for which Samba will remember the current printer status.
1320 After this time elapses, Samba will issue an <em class="emphasis">lpq</em>
1321 command (or whatever command you specify with the
1322 <tt class="literal">lpq</tt> <tt class="literal">command</tt> option) to get a
1323 more up-to-date status that it can report to users. This defaults to
1324 10 seconds, but can be increased if your <tt class="literal">lpq</tt>
1325 <tt class="literal">command</tt> takes an unusually long time to run or you
1326 have lots of clients. A time setting of 0 disables caching of queue
1327 status. The following example resets the time to 30 seconds:</p>
1329 <blockquote><pre class="code">[deskjet]
1330 lpq cache time = 30</pre></blockquote>
1337 <div class="sect3"><a name="samba2-CHP-10-SECT-2.3.5"/>
1339 <h3 class="head3">postscript</h3>
1341 <p>The <tt class="literal">postscript</tt><a name="INDEX-57"/> option forces the
1342 printer to treat all data sent to it as PostScript. It does this by
1343 prefixing the characters <tt class="literal">%!</tt> to the beginning of
1344 the first line of each job. It is normally used with PCs that insert
1345 a <tt class="literal">^D</tt> (control-D or
1346 "end-of-file" mark) in front of the
1347 first line of a PostScript file. It will not, obviously, turn a
1348 non-PostScript printer into a PostScript one. The default value of
1349 this options is <tt class="literal">no</tt>. You can override it as
1352 <blockquote><pre class="code">[deskjet]
1353 postscript = yes</pre></blockquote>
1360 <div class="sect3"><a name="samba2-CHP-10-SECT-2.3.6"/>
1362 <h3 class="head3">load printers</h3>
1364 <p>The <tt class="literal">load</tt><a name="INDEX-58"/> <tt class="literal">printers</tt>
1365 option tells Samba to create shares for all known printer names and
1366 load those shares into the browse list. Samba will create and list a
1367 printer share for each printer name in
1368 <em class="filename">/etc/printcap</em> (or the system equivalent). For
1370 <em class="filename">printcap</em><a name="INDEX-59"/> file looks
1371 like this:<a name="FNPTR-3"/><a href="#FOOTNOTE-3">[3]</a></p>
1373 <blockquote><pre class="code">lp:\
1374 :sd=/var/spool/lpd/lp:\ <i class="lineannotation">spool directory</i>
1375 :mx#0:\ <i class="lineannotation">maximum file size (none)</i>
1376 :sh:\ <i class="lineannotation">supress burst header (no)</i>
1377 :lp=/dev/lp1:\ <i class="lineannotation">device name for output</i>
1378 :if=/var/spool/lpd/lp/filter: <i class="lineannotation">text filter</i>
1381 :sd=/var/spool/lpd/laser:\ <i class="lineannotation">spool directory</i>
1382 :mx#0:\ <i class="lineannotation">maximum file size (none)</i>
1383 :sh:\ <i class="lineannotation">supress burst header (no)</i>
1384 :lp=/dev/laser:\ <i class="lineannotation">device name for output</i>
1385 :if=/var/spool/lpd/lp/filter: <i class="lineannotation">text filter</i></pre></blockquote>
1387 <p>the shares <tt class="literal">[lp]</tt> and <tt class="literal">[laser]</tt> are
1388 automatically created as valid print shares when Samba is started.
1389 Both shares borrow the configuration options specified in the
1390 <tt class="literal">[printers]</tt> section to configure themselves and are
1391 available in the browse list for the Samba server. The default value
1392 for this option is <tt class="literal">yes</tt>. If you prefer to specify
1393 each printer explicitly in your configuration file, use the
1396 <blockquote><pre class="code">[global]
1397 load printers = no</pre></blockquote>
1404 <div class="sect3"><a name="samba2-CHP-10-SECT-2.3.7"/>
1406 <a name="INDEX-60"/><a name="INDEX-61"/><a name="INDEX-62"/><a name="INDEX-63"/><a name="INDEX-64"/><h3 class="head3">print command, lpq command, lprm command,lppause command, lpresume command</h3>
1408 <p>These options tell Samba which Unix commands control and send data to
1409 the printer. The Unix commands involved are: <em class="emphasis">lpr</em>
1410 (send to Line PRinter), <em class="emphasis">lpq</em> (List Printer
1411 Queue), <em class="emphasis">lprm</em> (Line Printer ReMove), and
1412 optionally <em class="emphasis">lppause</em> and
1413 <em class="emphasis">lpresume</em>. Samba provides an option named after
1414 each command, in case you need to override any of the system
1415 defaults. For example, consider the following:</p>
1417 <blockquote><pre class="code">lpq command = /usr/ucb/lpq %p</pre></blockquote>
1419 <p>This would set <tt class="literal">lpq</tt> <tt class="literal">command</tt> to
1420 use <em class="filename">/usr/ucb/lpq</em>. Similarly:</p>
1422 <blockquote><pre class="code">lprm command = /usr/local/bin/lprm -P%p %j</pre></blockquote>
1424 <p>would set the Samba printer remove command to
1425 <em class="filename">/usr/local/bin/lprm</em> and provide it the print job
1426 number using the <tt class="literal">%j</tt> variable.</p>
1428 <p>The default values for each option are dependent on the value of the
1429 <tt class="literal">printing</tt> option. <a href="ch10.html#samba2-CHP-10-TABLE-4">Table 10-4</a>
1430 shows the default commands for each printing option. The most popular
1431 printing system is BSD.</p>
1433 <a name="samba2-CHP-10-TABLE-4"/><h4 class="head4">Table 10-4. Default commands for various printing options</h4><table border="1">
1445 <p>BSD, AIX, PLP, LPRNG</p>
1461 <p><tt class="literal">print</tt> <tt class="literal">command</tt></p>
1464 <p><tt class="literal">lpr -r -P%p %s</tt></p>
1467 <p><tt class="literal">lp -c -d%p %s; rm</tt> <tt class="literal">%s</tt></p>
1470 <p><tt class="literal">lp -r -P%p %s</tt></p>
1473 <p><tt class="literal">lp -d%p -s %s; rm %s</tt></p>
1478 <p><tt class="literal">lpq</tt> <tt class="literal">command</tt></p>
1481 <p><tt class="literal">lpq -P%p</tt></p>
1484 <p><tt class="literal">lpstat -o%p</tt></p>
1487 <p><tt class="literal">lpq -P%p</tt></p>
1490 <p><tt class="literal">lpstat -o%p</tt></p>
1495 <p><tt class="literal">lprm</tt> <tt class="literal">command</tt></p>
1498 <p><tt class="literal">lprm -P%p %j</tt></p>
1501 <p><tt class="literal">cancel %p-%j</tt></p>
1504 <p><tt class="literal">cancel %p-%j</tt></p>
1507 <p><tt class="literal">cancel %p-%j</tt></p>
1512 <p><tt class="literal">lppause</tt> <tt class="literal">command</tt></p>
1515 <p><tt class="literal">lp -i %p-%j -H</tt> <tt class="literal">hold</tt></p>
1531 <p><tt class="literal">lpresume</tt> <tt class="literal">command</tt></p>
1534 <p><tt class="literal">lp -i %p-%j -H</tt> <tt class="literal">resume</tt></p>
1545 <p><tt class="literal">qstat -s -j%j -r</tt></p>
1551 <p>It is usually unnecessary to reset these options in Samba, with the
1552 possible exception of the <tt class="literal">print</tt>
1553 <tt class="literal">command</tt>. This option might need to be set
1554 explicitly if your printing system doesn't have a
1555 <em class="emphasis">-r</em> (remove after printing) option on the
1556 printing command. For example:</p>
1558 <blockquote><pre class="code">print command = /usr/local/lpr -P%p %s; /bin/rm %s</pre></blockquote>
1560 <p>With a bit of judicious programming, these
1561 <em class="filename">smb.conf</em> options can also be used for debugging:</p>
1563 <blockquote><pre class="code">print command = cat %s >>/tmp/printlog; lpr -r -P%p %s</pre></blockquote>
1565 <p>Using the previous configuration, it is possible to verify that files
1566 are actually being delivered to the Samba server. If they are, their
1567 contents will show up in the file <em class="filename">/tmp/printlog</em>.</p>
1569 <p>After BSD, the next most popular kind of printing system is SYSV (or
1570 System V) printing, plus some SYSV variants for
1571 IBM's AIX and Hewlett-Packard's
1572 HP-UX. These systems do not have an
1573 <em class="filename">/etc/printcap</em> file. Instead, the
1574 <tt class="literal">printcap</tt> <tt class="literal">file</tt> option can be set
1575 to an appropriate <em class="emphasis">lpstat</em> command for the system.
1576 This tells Samba to get a list of printers from the
1577 <em class="emphasis">lpstat</em> command. Alternatively, you can set the
1578 global configuration option <tt class="literal">printcap</tt>
1579 <tt class="literal">name</tt> to the name of a dummy
1580 <em class="filename">printcap</em> file you provide. In the latter case,
1581 the file must contain a series of lines such as:</p>
1583 <blockquote><pre class="code">lp|print1|My Printer 1
1585 print3|My Printer 3</pre></blockquote>
1587 <p>Each line names a printer followed by aliases for it. In this
1588 example, the first printer is called <tt class="literal">lp</tt>,
1589 <tt class="literal">print1</tt>, or <tt class="literal">My</tt>
1590 <tt class="literal">Printer</tt> <tt class="literal">1</tt>, whichever the user
1591 prefers to use. The first name is used in place of
1592 <tt class="literal">%p</tt> in any command Samba executes for that printer.</p>
1594 <p>Two additional printer types are also supported by Samba: LPRNG (LPR
1595 New Generation) and PLP (Public Line Printer). These are public
1596 domain and open source printing systems and are used by many sites to
1597 overcome problems with vendor-supplied software. Samba also supports
1598 the printing systems of the SOFTQ and QNX real-time operating
1606 <div class="sect3"><a name="samba2-CHP-10-SECT-2.3.8"/>
1608 <h3 class="head3">printcap name</h3>
1610 <p>If the <tt class="literal">printcap</tt><a name="INDEX-65"/><a name="INDEX-66"/>
1611 <tt class="literal">name</tt> option (also called
1612 <tt class="literal">printcap</tt>) appears in a printing share, Samba uses
1613 the file specified as the system printer capabilities file (normally
1614 <em class="filename">/etc/printcap</em>). However, you can reset it to a
1615 file consisting of only the printers you want to share over the
1616 network. The value must be the filename (with its complete path
1617 specified) of a printer capabilities file on the server:</p>
1619 <blockquote><pre class="code">[deskjet]
1620 printcap name = /usr/local/samba/lib/printcap</pre></blockquote>
1622 <p>The CUPS printing system uses its own method of determining printer
1623 capabilities, rather than the standard <em class="filename">printcap</em>
1624 file. In this case, set <tt class="literal">printcap</tt>
1625 <tt class="literal">name</tt> as follows:</p>
1627 <blockquote><pre class="code">[global]
1629 printcap name = cups</pre></blockquote>
1636 <div class="sect3"><a name="samba2-CHP-10-SECT-2.3.9"/>
1638 <h3 class="head3">min print space</h3>
1640 <p>The <tt class="literal">min</tt><a name="INDEX-67"/> <tt class="literal">print</tt>
1641 <tt class="literal">space</tt> option sets the amount of space that must be
1642 available on the disk that contains the spool directory if printing
1643 is to be allowed. Setting it to zero (the default) turns the check
1644 off; setting it to any other number sets the amount of free space in
1645 kilobytes required. This option helps to avoid having print jobs fill
1646 up the remaining disk space on the server, which can cause other
1647 processes to fail:</p>
1649 <blockquote><pre class="code">[deskjet]
1650 min print space = 4000</pre></blockquote>
1657 <div class="sect3"><a name="samba2-CHP-10-SECT-2.3.10"/>
1659 <a name="INDEX-68"/><h3 class="head3">queuepause command</h3>
1661 <p>This configuration option specifies a command that tells Samba how to
1662 pause an entire print queue, as opposed to a single job on the queue.
1663 The default value depends on the printing type chosen. You should not
1664 need to alter this option.</p>
1671 <div class="sect3"><a name="samba2-CHP-10-SECT-2.3.11"/>
1673 <a name="INDEX-69"/><h3 class="head3">queueresume command</h3>
1675 <p>This configuration option specifies a command that tells Samba how to
1676 resume a paused print queue, as opposed to resuming a single job on
1677 the print queue. The default value depends on the printing type
1678 chosen. You should not need to alter this option. <a name="INDEX-70"/> <a name="INDEX-71"/> <a name="INDEX-72"/><a name="INDEX-73"/></p>
1689 <hr/><h4 class="head4">Footnotes</h4><blockquote><a name="FOOTNOTE-1"/> <p><a href="#FNPTR-1">[1]</a> If
1690 you are using Linux, you can use the <em class="emphasis">checkpc</em>
1691 command to check for this type of error.</p> <a name="FOOTNOTE-2"/>
1692 <p><a href="#FNPTR-2">[2]</a> CUPS is open source software (<a href="http://www.opensource.org">http://www.opensource.org</a>) developed by Easy
1693 Software Products. For more information, visit <a href="http://www.cups.org">http://www.cups.org</a>.</p> <a name="FOOTNOTE-3"/> <p><a href="#FNPTR-3">[3]</a> We have placed annotated comments off to
1694 the right in case you've never dealt with this file
1695 before.</p> </blockquote><hr/><h4 class="head4"><a href="toc.html">TOC</a></h4></body></html>