• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/ap/gpl/samba-3.0.13/docs/htmldocs/Samba-HOWTO-Collection/
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter�19.�Classical Printing Support</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"><link rel="start" href="index.html" title="The Official Samba-3 HOWTO and Reference Guide"><link rel="up" href="optional.html" title="Part�III.�Advanced Configuration"><link rel="prev" href="msdfs.html" title="Chapter�18.�Hosting a Microsoft Distributed File System Tree"><link rel="next" href="CUPS-printing.html" title="Chapter�20.�CUPS Printing Support"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter�19.�Classical Printing Support</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="msdfs.html">Prev</a>�</td><th width="60%" align="center">Part�III.�Advanced Configuration</th><td width="20%" align="right">�<a accesskey="n" href="CUPS-printing.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="printing"></a>Chapter�19.�Classical Printing Support</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Kurt</span> <span class="surname">Pfeifle</span></h3><div class="affiliation"><span class="orgname"> Danka Deutschland GmbH <br></span><div class="address"><p><tt class="email">&lt;<a href="mailto:kpfeifle@danka.de">kpfeifle@danka.de</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Gerald</span> <span class="othername">(Jerry)</span> <span class="surname">Carter</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt class="email">&lt;<a href="mailto:jerry@samba.org">jerry@samba.org</a>&gt;</tt></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">John</span> <span class="othername">H.</span> <span class="surname">Terpstra</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><tt class="email">&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</tt></p></div></div></div></div><div><p class="pubdate">May 31, 2003</p></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="printing.html#id2569688">Features and Benefits</a></span></dt><dt><span class="sect1"><a href="printing.html#id2569768">Technical Introduction</a></span></dt><dd><dl><dt><span class="sect2"><a href="printing.html#id2569825">Client to Samba Print Job Processing</a></span></dt><dt><span class="sect2"><a href="printing.html#id2569884">Printing Related Configuration Parameters</a></span></dt></dl></dd><dt><span class="sect1"><a href="printing.html#id2569964">Simple Print Configuration</a></span></dt><dd><dl><dt><span class="sect2"><a href="printing.html#id2570188">Verifying Configuration with <span><b class="command">testparm</b></span></a></span></dt><dt><span class="sect2"><a href="printing.html#id2570290">Rapid Configuration Validation</a></span></dt></dl></dd><dt><span class="sect1"><a href="printing.html#id2570582">Extended Printing Configuration</a></span></dt><dd><dl><dt><span class="sect2"><a href="printing.html#id2571086">Detailed Explanation Settings</a></span></dt></dl></dd><dt><span class="sect1"><a href="printing.html#id2572848">Printing Developments Since Samba-2.2</a></span></dt><dd><dl><dt><span class="sect2"><a href="printing.html#id2572977">Point'n'Print Client Drivers on Samba Servers</a></span></dt><dt><span class="sect2"><a href="printing.html#id2573104">The Obsoleted [printer$] Section</a></span></dt><dt><span class="sect2"><a href="printing.html#id2573191">Creating the [print$] Share</a></span></dt><dt><span class="sect2"><a href="printing.html#id2573424">[print$] Section Parameters</a></span></dt><dt><span class="sect2"><a href="printing.html#id2573670">The [print$] Share Directory</a></span></dt></dl></dd><dt><span class="sect1"><a href="printing.html#id2573812">Installing Drivers into [print$]</a></span></dt><dd><dl><dt><span class="sect2"><a href="printing.html#id2573905">Add Printer Wizard Driver Installation</a></span></dt><dt><span class="sect2"><a href="printing.html#inst-rpc">Installing Print Drivers Using <span><b class="command">rpcclient</b></span></a></span></dt></dl></dd><dt><span class="sect1"><a href="printing.html#id2575540">Client Driver Installation Procedure</a></span></dt><dd><dl><dt><span class="sect2"><a href="printing.html#id2575558">First Client Driver Installation</a></span></dt><dt><span class="sect2"><a href="printing.html#id2575759">Setting Device Modes on New Printers</a></span></dt><dt><span class="sect2"><a href="printing.html#id2576048">Additional Client Driver Installation</a></span></dt><dt><span class="sect2"><a href="printing.html#id2576141">Always Make First Client Connection as root or &#8220;<span class="quote"><span class="emphasis"><em>printer admin</em></span></span>&#8221;</a></span></dt></dl></dd><dt><span class="sect1"><a href="printing.html#id2576291">Other Gotchas</a></span></dt><dd><dl><dt><span class="sect2"><a href="printing.html#id2576313">Setting Default Print Options for Client Drivers</a></span></dt><dt><span class="sect2"><a href="printing.html#id2576676">Supporting Large Numbers of Printers</a></span></dt><dt><span class="sect2"><a href="printing.html#id2576934">Adding New Printers with the Windows NT APW</a></span></dt><dt><span class="sect2"><a href="printing.html#id2577159">Error Message: &#8220;<span class="quote"><span class="emphasis"><em><span class="errorname">Cannot connect under a different Name</span></em></span></span>&#8221;</a></span></dt><dt><span class="sect2"><a href="printing.html#id2577272">Take Care When Assembling Driver Files</a></span></dt><dt><span class="sect2"><a href="printing.html#id2577537">Samba and Printer Ports</a></span></dt><dt><span class="sect2"><a href="printing.html#id2577608">Avoiding Common Client Driver Mis-configuration</a></span></dt></dl></dd><dt><span class="sect1"><a href="printing.html#id2577631">The Imprints Tool-set</a></span></dt><dd><dl><dt><span class="sect2"><a href="printing.html#id2577664">What is Imprints?</a></span></dt><dt><span class="sect2"><a href="printing.html#id2577698">Creating Printer Driver Packages</a></span></dt><dt><span class="sect2"><a href="printing.html#id2577714">The Imprints Server</a></span></dt><dt><span class="sect2"><a href="printing.html#id2577731">The Installation Client</a></span></dt></dl></dd><dt><span class="sect1"><a href="printing.html#id2577868">Adding Network Printers without User Interaction</a></span></dt><dt><span class="sect1"><a href="printing.html#id2578141">The <span><b class="command">addprinter</b></span> Command</a></span></dt><dt><span class="sect1"><a href="printing.html#id2578180">Migration of Classical Printing to Samba</a></span></dt><dt><span class="sect1"><a href="printing.html#id2578333">Publishing Printer Information in Active Directory or LDAP</a></span></dt><dt><span class="sect1"><a href="printing.html#id2578352">Common Errors</a></span></dt><dd><dl><dt><span class="sect2"><a href="printing.html#id2578358">I Give My Root Password but I Do Not Get Access</a></span></dt><dt><span class="sect2"><a href="printing.html#id2578400">My Print Jobs Get Spooled into the Spooling Directory, but Then Get Lost</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2569688"></a>Features and Benefits</h2></div></div></div><p>
2Printing is often a mission-critical service for the users. Samba can
3provide this service reliably and seamlessly for a client network
4consisting of Windows workstations.
5</p><p>
6A Samba print service may be run on a Stand-alone or Domain Member server,
7side by side with file serving functions, or on a dedicated print server.
8It can be made as tight or as loosely secured as needs dictate. Configurations
9may be simple or complex. Available authentication schemes are essentially
10the same as described for file services in previous chapters. Overall,
11Samba's printing support is now able to replace an NT or Windows 2000
12print server full-square, with additional benefits in many cases. Clients
13may download and install drivers and printers through their familiar
14&#8220;<span class="quote"><span class="emphasis"><em>Point'n'Print</em></span></span>&#8221; mechanism. Printer installations executed by
15&#8220;<span class="quote"><span class="emphasis"><em>Logon Scripts</em></span></span>&#8221; are no problem. Administrators can upload and
16manage drivers to be used by clients through the familiar &#8220;<span class="quote"><span class="emphasis"><em>Add Printer
17Wizard</em></span></span>&#8221;. As an additional benefit, driver and printer management may
18be run from the command line or through scripts, making it more efficient
19in case of large numbers of printers. If a central accounting of print jobs
20(tracking every single page and supplying the raw data for all sorts of
21statistical reports) is required, this function is best supported by
22the newer Common UNIX Printing System (CUPS)
23as the print subsystem underneath the Samba hood.
24</p><p>
25This chapter deals with the foundations of Samba printing as they
26are implemented by the more traditional UNIX (BSD- and System V-style)
27printing systems. Many things covered in this chapter apply also to CUPS.
28If you use CUPS, you may be tempted
29to jump to the next chapter but you will certainly miss a few things if
30you do. It is recommended that you read this chapter as well as <a href="CUPS-printing.html" title="Chapter�20.�CUPS Printing Support">CUPS Printing Support</a>.
31</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
32Most of the following examples have been verified on Windows XP
33Professional clients. Where this document describes the responses to
34commands given, bear in mind that Windows 200x/XP clients are quite
35similar, but may differ in minor details. Windows NT is somewhat different
36again.
37</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2569768"></a>Technical Introduction</h2></div></div></div><p>
38Samba's printing support always relies on the installed print subsystem
39of the UNIX OS it runs on. Samba is a &#8220;<span class="quote"><span class="emphasis"><em>middleman.</em></span></span>&#8221; It takes
40print files from Windows (or other SMB) clients and passes them to the real
41printing system for further processing, therefore, it needs to communicate with
42both sides: the Windows print clients and the UNIX printing system. Hence, we
43must differentiate between the various client OS types, each of which behave
44differently, as well as the various UNIX print subsystems, which themselves
45have different features and are accessed differently.
46</p><p>
47This deals with the traditional way of UNIX printing. The next chapter
48covers in great detail the more modern <span class="emphasis"><em>Common UNIX Printing
49System</em></span> (CUPS).
50</p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>CUPS users, be warned: do not just jump on to the next
51chapter. You might miss important information only found here!
52</p></div><p>
53It is apparent from postings on the Samba mailing list that print configuration
54is one of the most problematic aspects of Samba administration today. Many
55new Samba administrators have the impression that Samba performs some sort
56of print processing. Rest assured, Samba does not perform any type of print
57processing. It does not do any form of print filtering.
58</p><p>
59Samba obtains from its clients a data stream (print job) that it spools to a
60local spool area. When the entire print job has been received, Samba invokes
61a local UNIX/Linux print command and passes the spooled file to it. It is
62up to the local system printing subsystems to correctly process the print
63job and to submit it to the printer.
64</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2569825"></a>Client to Samba Print Job Processing</h3></div></div></div><p>
65Successful printing from a Windows client via a Samba print server to a UNIX
66printer involves six (potentially seven) stages:
67</p><div class="orderedlist"><ol type="1"><li><p>Windows opens a connection to the printer share.</p></li><li><p>Samba must authenticate the user.</p></li><li><p>Windows sends a copy of the print file over the network
68into Samba's spooling area.</p></li><li><p>Windows closes the connection.</p></li><li><p>Samba invokes the print command to hand the file over
69to the UNIX print subsystem's spooling area.</p></li><li><p>The UNIX print subsystem processes the print job.</p></li><li><p>The print file may need to be explicitly deleted
70from the Samba spooling area. This item depends on your print spooler
71configuration settings.</p></li></ol></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2569884"></a>Printing Related Configuration Parameters</h3></div></div></div><p>
72There are a number of configuration parameters to control Samba's
73printing behavior. Please refer to the man page for <tt class="filename">smb.conf</tt> for an
74overview of these. As with other parameters, there are Global Level
75(tagged with a <span class="emphasis"><em>G</em></span> in the listings) and Service Level
76(<span class="emphasis"><em>S</em></span>) parameters.
77</p><div class="variablelist"><dl><dt><span class="term">Global Parameters</span></dt><dd><p> These <span class="emphasis"><em>may not</em></span> go into
78		individual share definitions. If they go in by error,
79		the <span><b class="command">testparm</b></span> utility can discover this
80		(if you run it) and tell you so.
81		</p></dd><dt><span class="term">Service Level Parameters</span></dt><dd><p> These may be specified in the
82		<i class="parameter"><tt>[global]</tt></i> section of <tt class="filename">smb.conf</tt>.
83		In this case they define the default behavior of all individual
84		or service level shares (provided they do not have a different
85		setting defined for the same parameter, thus overriding the
86		global default).
87		</p></dd></dl></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2569964"></a>Simple Print Configuration</h2></div></div></div><p>
88<a href="printing.html#simpleprc" title="Example�19.1.�Simple configuration with BSD printing">Following example</a> shows a simple printing configuration.
89If you compare this with your own, you may find 
90additional parameters that have been pre-configured by your OS
91vendor. Below is a discussion and explanation of the
92parameters. This example does not use many parameters.
93However, in many environments these are enough to provide a valid
94<tt class="filename">smb.conf</tt> file that enables all clients to print.
95</p><p>
96</p><div class="example"><a name="simpleprc"></a><p class="title"><b>Example�19.1.�Simple configuration with BSD printing</b></p><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><i class="parameter"><tt>[global]</tt></i></td></tr><tr><td><a class="indexterm" name="id2570016"></a><i class="parameter"><tt>
97					
98				printing = bsd</tt></i></td></tr><tr><td><a class="indexterm" name="id2570032"></a><i class="parameter"><tt>
99					
100				load printers = yes</tt></i></td></tr><tr><td> </td></tr><tr><td><i class="parameter"><tt>[printers]</tt></i></td></tr><tr><td><a class="indexterm" name="id2570056"></a><i class="parameter"><tt>
101					
102				path = /var/spool/samba</tt></i></td></tr><tr><td><a class="indexterm" name="id2570072"></a><i class="parameter"><tt>
103					
104				printable = yes</tt></i></td></tr><tr><td><a class="indexterm" name="id2570087"></a><i class="parameter"><tt>
105					
106				public = yes</tt></i></td></tr><tr><td><a class="indexterm" name="id2570103"></a><i class="parameter"><tt>
107					
108				writable = no</tt></i></td></tr></table></div><p>
109This is only an example configuration. Samba assigns default values to
110all configuration parameters. The defaults are conservative
111and sensible. When a parameter is specified in the <tt class="filename">smb.conf</tt> file, this
112overwrites the default value. The <span><b class="command">testparm</b></span> utility when
113run as root is capable of reporting all setting, both default as well as
114<tt class="filename">smb.conf</tt> file settings. <span><b class="command">Testparm</b></span> gives warnings for all
115mis-configured settings. The complete output is easily 340 lines and more,
116so you may want to pipe it through a pager program.
117</p><p>
118The syntax for the configuration file is easy to grasp. You should
119know that  is not very picky about its syntax. As has been explained
120elsewhere in this document, Samba tolerates some spelling errors (such
121as <a class="indexterm" name="id2570158"></a>browseable instead of
122<a class="indexterm" name="id2570166"></a>browseable), and spelling is
123case-insensitive. It is permissible to use <i class="parameter"><tt>Yes/No</tt></i>
124or <i class="parameter"><tt>True/False</tt></i> for Boolean settings. Lists of names
125may be separated by commas, spaces or tabs.
126</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2570188"></a>Verifying Configuration with <span><b class="command">testparm</b></span></h3></div></div></div><p>
127To see all (or at least most) printing-related settings in Samba, including
128the implicitly used ones, try the command outlined below. This command greps
129for all occurrences of <tt class="constant">lp, print, spool, driver, ports</tt>
130and <tt class="constant">[</tt> in testparms output. This provides a convenient
131overview of the running <span><b class="command">smbd</b></span> print configuration. This
132command does not show individually created printer shares or the spooling
133paths they may use. Here is the output of my Samba setup, with settings
134shown in <a href="printing.html#simpleprc" title="Example�19.1.�Simple configuration with BSD printing">the example above</a>:
135</p><pre class="screen">
136<tt class="prompt">root# </tt><b class="userinput"><tt>testparm -s -v | egrep "(lp|print|spool|driver|ports|\[)"</tt></b>
137 Load smb config files from /etc/samba/smb.conf
138 Processing section "[homes]"
139 Processing section "[printers]"
140 
141 [global]
142        smb ports = 445 139
143        lpq cache time = 10
144        load printers = Yes
145        printcap name = /etc/printcap
146        disable spoolss = No
147        enumports command =
148        addprinter command = 
149        deleteprinter command = 
150        show add printer wizard = Yes
151        os2 driver map =
152        printer admin =
153        min print space = 0
154        max print jobs = 1000
155        printable = No
156        printing = bsd
157        print command = lpr -r -P'%p' %s
158        lpq command = lpq -P'%p'
159        lprm command = lprm -P'%p' %j
160        lppause command =
161        lpresume command =
162        printer name =
163        use client driver = No
164
165 [homes]
166
167 [printers]
168        path = /var/spool/samba
169        printable = Yes
170</pre><p>
171</p><p>
172You can easily verify which settings were implicitly added by Samba's
173default behavior. <span class="emphasis"><em>Remember: it may
174be important in your future dealings with Samba.</em></span>
175</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> testparm in Samba-3 behaves differently from that in 2.2.x: used
176without the &#8220;<span class="quote"><span class="emphasis"><em>-v</em></span></span>&#8221; switch it only shows you the settings actually
177written into! To see the complete
178configuration used, add the &#8220;<span class="quote"><span class="emphasis"><em>-v</em></span></span>&#8221; parameter to testparm.</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2570290"></a>Rapid Configuration Validation</h3></div></div></div><p>
179Should you need to troubleshoot at any stage, please always come back
180to this point first and verify if <span><b class="command">testparm</b></span> shows the parameters you
181expect. To give you a warning from personal experience,
182try to just comment out the <a class="indexterm" name="id2570307"></a>load printers
183parameter. If your 2.2.x system behaves like mine, you'll see this:
184</p><pre class="screen">
185<tt class="prompt">root# </tt>grep "load printers" /etc/samba/smb.conf
186        #  load printers = Yes
187        # This setting is commented out!!
188 
189<tt class="prompt">root# </tt>testparm -v /etc/samba/smb.conf | egrep "(load printers)"
190        load printers = Yes
191</pre><p>
192I assumed that commenting out of this setting should prevent Samba from
193publishing my printers, but it still did. It took some time to figure out
194the reason. But I am no longer fooled ... at least not by this.
195</p><pre class="screen">
196<tt class="prompt">root# </tt><b class="userinput"><tt>grep -A1 "load printers" /etc/samba/smb.conf</tt></b>
197        load printers = No
198        # The above setting is what I want!
199        #  load printers = Yes
200        # This setting is commented out!
201
202<tt class="prompt">root# </tt><b class="userinput"><tt>testparm -s -v smb.conf.simpleprinting | egrep "(load printers)"</tt></b>
203        load printers = No
204
205</pre><p>
206Only when the parameter is explicitly set to
207<a class="indexterm" name="id2570381"></a>load printers = No
208would Samba conform with my intentions. So, my strong advice is:
209</p><div class="itemizedlist"><ul type="disc"><li><p>Never rely on commented out parameters.</p></li><li><p>Always set parameters explicitly as you intend them to
210behave.</p></li><li><p>Use <span><b class="command">testparm</b></span> to uncover hidden
211settings that might not reflect your intentions.</p></li></ul></div><p>
212The following is the most minimal configuration file:
213</p><pre class="screen">
214<tt class="prompt">root# </tt><b class="userinput"><tt>cat /etc/samba/smb.conf-minimal</tt></b>
215        [printers]
216</pre><p>
217This example should show that you can use testparm to test any Samba
218configuration file. Actually, we encourage you <span class="emphasis"><em>not</em></span>
219to change your working system (unless you know exactly what you are
220doing). Don't rely on the assumption that changes will only take effect after
221you re-start smbd!  This is not the case. Samba re-reads it every 60 seconds
222and on each new client connection. You might have to face changes for your
223production clients that you didn't intend to apply. You will now
224note a few more interesting things; <span><b class="command">testparm</b></span> is useful to
225identify what the Samba print configuration would be if you used this minimalistic
226configuration. Here is what you can expect to find:
227</p><pre class="screen">
228<tt class="prompt">root# </tt><b class="userinput"><tt>testparm -v smb.conf-minimal | egrep "(print|lpq|spool|driver|ports|[)"</tt></b>
229 Processing section "[printers]"
230 WARNING: [printers] service MUST be printable!
231 No path in service printers - using /tmp
232
233        lpq cache time = 10
234        load printers = Yes
235        printcap name = /etc/printcap
236        disable spoolss = No
237        enumports command =
238        addprinter command =
239        deleteprinter command =
240        show add printer wizard = Yes
241        os2 driver map =
242        printer admin =
243        min print space = 0
244        max print jobs = 1000
245        printable = No
246        printing = bsd
247        print command = lpr -r -P%p %s
248        lpq command = lpq -P%p
249        printer name =
250        use client driver = No
251
252 [printers]
253        printable = Yes
254
255</pre><p>
256testparm issued two warnings:
257</p><div class="itemizedlist"><ul type="disc"><li><p>We did not specify the <i class="parameter"><tt>[printers]</tt></i> section as printable.</p></li><li><p>We did not tell Samba which spool directory to use.</p></li></ul></div><p>
258However, this was not fatal and Samba will default to values that will
259work. Please, do not rely on this and do not use this example. This was
260included to encourage you to be careful to design and specify your setup to do
261precisely what you require. The outcome on your system may vary for some
262parameters given, since Samba may have been built with  different compile-time
263options. <span class="emphasis"><em>Warning:</em></span> do not put a comment sign
264<span class="emphasis"><em>at the end</em></span> of a valid line. It will cause the parameter
265to be ignored (just as if you had put the comment sign at the front). At first
266I regarded this as a bug in my Samba versions. But the man page clearly says:
267&#8220;<span class="quote"><span class="emphasis"><em>Internal whitespace in a parameter value is retained verbatim.</em></span></span>&#8221;
268This means that a line consisting of, for example:
269</p><table class="simplelist" border="0" summary="Simple list"><tr><td># This defines LPRng as the printing system</td></tr><tr><td><a class="indexterm" name="id2570554"></a><i class="parameter"><tt>
270					
271				printing =  lprng</tt></i></td></tr></table><p>
272will regard the whole of the string after the
273&#8220;<span class="quote"><span class="emphasis"><em><tt class="constant">=</tt></em></span></span>&#8221; sign as the value you want to
274define. This is an invalid value that will be ignored and a default
275value will be
276used in its place.
277</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2570582"></a>Extended Printing Configuration</h2></div></div></div><p>
278<a href="printing.html#extbsdpr" title="Example�19.2.�Extended BSD Printing Configuration">Next configuration</a> shows a more verbose example configuration
279for print-related settings in a BSD-style printing environment. What follows
280is a discussion and explanation of the various parameters. We chose to
281use BSD-style printing here because it is still the most commonly used
282system on legacy UNIX/Linux installations. New installations predominantly
283use CUPS, which is discussed in a separate chapter. The example explicitly
284names many parameters that do not need to be specified because they are set
285by default. You could use a much leaner <tt class="filename">smb.conf</tt> file. Alternately, you can use
286<span><b class="command">testparm</b></span> or <span><b class="command">SWAT</b></span> to optimize the <tt class="filename">smb.conf</tt>
287file to remove all parameters that are set at default.
288</p><div class="example"><a name="extbsdpr"></a><p class="title"><b>Example�19.2.�Extended BSD Printing Configuration</b></p><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><i class="parameter"><tt>[global]</tt></i></td></tr><tr><td><a class="indexterm" name="id2570656"></a><i class="parameter"><tt>
289					
290				printing = bsd</tt></i></td></tr><tr><td><a class="indexterm" name="id2570672"></a><i class="parameter"><tt>
291					
292				load printers = yes</tt></i></td></tr><tr><td><a class="indexterm" name="id2570687"></a><i class="parameter"><tt>
293					
294				show add printer wizard = yes</tt></i></td></tr><tr><td><a class="indexterm" name="id2570703"></a><i class="parameter"><tt>
295					
296				printcap name = /etc/printcap</tt></i></td></tr><tr><td><a class="indexterm" name="id2570718"></a><i class="parameter"><tt>
297					
298				printer admin = @ntadmin, root</tt></i></td></tr><tr><td><a class="indexterm" name="id2570734"></a><i class="parameter"><tt>
299					
300				max print jobs = 100</tt></i></td></tr><tr><td><a class="indexterm" name="id2570750"></a><i class="parameter"><tt>
301					
302				lpq cache time = 20</tt></i></td></tr><tr><td><a class="indexterm" name="id2570765"></a><i class="parameter"><tt>
303					
304				use client driver = no</tt></i></td></tr><tr><td> </td></tr><tr><td><i class="parameter"><tt>[printers]</tt></i></td></tr><tr><td><a class="indexterm" name="id2570790"></a><i class="parameter"><tt>
305					
306				comment = All Printers</tt></i></td></tr><tr><td><a class="indexterm" name="id2570805"></a><i class="parameter"><tt>
307					
308				printable = yes</tt></i></td></tr><tr><td><a class="indexterm" name="id2570821"></a><i class="parameter"><tt>
309					
310				path = /var/spool/samba</tt></i></td></tr><tr><td><a class="indexterm" name="id2570836"></a><i class="parameter"><tt>
311					
312				browseable = no</tt></i></td></tr><tr><td><a class="indexterm" name="id2570852"></a><i class="parameter"><tt>
313					
314				guest ok = yes</tt></i></td></tr><tr><td><a class="indexterm" name="id2570867"></a><i class="parameter"><tt>
315					
316				public = yes</tt></i></td></tr><tr><td><a class="indexterm" name="id2570882"></a><i class="parameter"><tt>
317					
318				read only = yes</tt></i></td></tr><tr><td><a class="indexterm" name="id2570897"></a><i class="parameter"><tt>
319					
320				writable = no       </tt></i></td></tr><tr><td> </td></tr><tr><td><i class="parameter"><tt>[my_printer_name]</tt></i></td></tr><tr><td><a class="indexterm" name="id2570922"></a><i class="parameter"><tt>
321					
322				comment = Printer with Restricted Access</tt></i></td></tr><tr><td><a class="indexterm" name="id2570938"></a><i class="parameter"><tt>
323					
324				path = /var/spool/samba_my_printer</tt></i></td></tr><tr><td><a class="indexterm" name="id2570954"></a><i class="parameter"><tt>
325					
326				printer admin = kurt</tt></i></td></tr><tr><td><a class="indexterm" name="id2570969"></a><i class="parameter"><tt>
327					
328				browseable = yes</tt></i></td></tr><tr><td><a class="indexterm" name="id2570984"></a><i class="parameter"><tt>
329					
330				printable = yes</tt></i></td></tr><tr><td><a class="indexterm" name="id2571000"></a><i class="parameter"><tt>
331					
332				writable = no</tt></i></td></tr><tr><td><a class="indexterm" name="id2571015"></a><i class="parameter"><tt>
333					
334				hosts allow = 0.0.0.0</tt></i></td></tr><tr><td><a class="indexterm" name="id2571031"></a><i class="parameter"><tt>
335					
336				hosts deny = turbo_xp, 10.160.50.23, 10.160.51.60</tt></i></td></tr><tr><td><a class="indexterm" name="id2571047"></a><i class="parameter"><tt>
337					
338				guest ok = no</tt></i></td></tr></table></div><p>
339This is an example configuration. You may not find all the settings that are in 
340the configuration file that was provided by the OS vendor. Samba configuration
341parameters, if not explicitly set default to a sensible value.
342To see all settings, as <tt class="constant">root</tt> use the <span><b class="command">testparm</b></span>
343utility. <span><b class="command">testparm</b></span> gives warnings for mis-configured settings.
344</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2571086"></a>Detailed Explanation Settings</h3></div></div></div><p>
345The following is a discussion of the settings from above shown example.
346</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2571096"></a>The [global] Section</h4></div></div></div><p>
347The <i class="parameter"><tt>[global]</tt></i> section is one of four special
348sections (along with [<i class="parameter"><tt>[homes]</tt></i>,
349<i class="parameter"><tt>[printers]</tt></i>
350and <i class="parameter"><tt>[print$]</tt></i>...). The
351<i class="parameter"><tt>[global]</tt></i> contains all parameters which apply
352to the server as a whole. It is the place for parameters that have only a
353global meaning. It may also contain service level parameters that then define
354default settings for all other sections and shares. This way you can simplify
355the configuration and avoid setting the same value repeatedly. (Within each
356individual section or share you may, however, override these globally set
357share settings and specify other values).
358</p><div class="variablelist"><dl><dt><span class="term"><a class="indexterm" name="id2571148"></a>printing = bsd </span></dt><dd><p>Causes Samba to use default print commands
359		applicable for the BSD (also known as RFC 1179 style or LPR/LPD) printing
360		system. In general, the <i class="parameter"><tt>printing</tt></i> parameter informs Samba about the
361		print subsystem it should expect. Samba supports CUPS, LPD, LPRNG,
362		SYSV, HPUX, AIX, QNX, and PLP. Each of these systems defaults to a
363		different <a class="indexterm" name="id2571171"></a>print command (and other queue control
364		commands).</p><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Caution</h3><p>The <a class="indexterm" name="id2571183"></a>printing parameter is
365		normally a service level parameter. Since it is included here in the
366		<i class="parameter"><tt>[global]</tt></i> section, it will take effect for all
367		printer shares that are not defined differently. Samba-3 no longer
368		supports the SOFTQ printing system.</p></div></dd><dt><span class="term"><a class="indexterm" name="id2571204"></a>load printers = yes </span></dt><dd><p>Tells Samba to create automatically all
369		available printer shares. Available printer shares are discovered by
370		scanning the printcap file. All created printer shares are also loaded
371		for browsing. If you use this parameter, you do not need to specify
372		separate shares for each printer. Each automatically created printer
373		share will clone the configuration options found in the
374		<i class="parameter"><tt>[printers]</tt></i> section. (The <i class="parameter"><tt>load printers
375		= no</tt></i> setting will allow you to specify each UNIX printer
376		you want to share separately, leaving out some you do not want to be
377		publicly visible and available).</p></dd><dt><span class="term"><a class="indexterm" name="id2571242"></a>show add printer wizard = yes </span></dt><dd><p>Setting is normally enabled by default (even if the parameter is not specified in <tt class="filename">smb.conf</tt>).
378		It causes the <span class="guiicon">Add Printer Wizard</span> icon to appear
379		in the <span class="guiicon">Printers</span> folder of the Samba host's
380		share listing (as shown in <span class="guiicon">Network Neighborhood</span> or
381		by the <span><b class="command">net view</b></span> command). To disable it, you need to
382		explicitly set it to <tt class="constant">no</tt> (commenting it out
383		will not suffice). The <i class="parameter"><tt>Add Printer Wizard</tt></i> lets you upload printer
384		drivers to the <i class="parameter"><tt>[print$]</tt></i> share and associate it
385		with a printer (if the respective queue exists before the
386		action), or exchange a printer's driver against any other previously
387		uploaded driver.</p></dd><dt><span class="term"><a class="indexterm" name="id2571312"></a>max print jobs = 100 </span></dt><dd><p>Sets the upper limit to 100 print jobs
388		being active on the Samba server at any one time. Should a client
389		submit a job that exceeds this number, a &#8220;<span class="quote"><span class="emphasis"><em>no more space
390		available on server</em></span></span>&#8221; type of error message will be returned by
391		Samba to the client. A setting of zero (the default) means there is
392		<span class="emphasis"><em>no</em></span> limit at all.
393	</p></dd><dt><span class="term"><a class="indexterm" name="id2571340"></a>printcap name = /etc/printcap </span></dt><dd><p>Tells Samba where to look for a list of
394		available printer names. Where CUPS is used, make sure that a printcap
395		file is written. This is controlled by the <tt class="constant">Printcap</tt> directive in the 
396		<tt class="filename">cupsd.conf</tt> file.
397	</p></dd><dt><span class="term"><a class="indexterm" name="id2571368"></a>printer admin = @ntadmin </span></dt><dd><p>Members of the ntadmin group should be able to add
398		drivers and set printer properties (<tt class="constant">ntadmin</tt> is only an example name,
399		it needs to be a valid UNIX group name); root is implicitly always a
400		<a class="indexterm" name="id2571386"></a>printer admin. The @ sign precedes group names in the
401		<tt class="filename">/etc/group</tt>. A printer admin can do anything to
402		printers via the remote administration interfaces offered by MS-RPC
403		(see below). In larger installations, the <a class="indexterm" name="id2571403"></a>printer admin
404		parameter is normally a per-share parameter. This permits different groups to administer each printer share.
405	</p></dd><dt><span class="term"><a class="indexterm" name="id2571415"></a>lpq cache time = 20 </span></dt><dd><p>Controls the cache time for the results of the
406		lpq command. It prevents the lpq command being called too often and
407		reduces the load on a heavily used print server.
408	</p></dd><dt><span class="term"><a class="indexterm" name="id2571433"></a>use client driver = no </span></dt><dd><p>If set to <tt class="constant">yes</tt>, only 
409		takes effect for Windows NT/200x/XP clients (and not for Win 95/98/ME). Its
410		default value is <tt class="constant">No</tt> (or <tt class="constant">False</tt>).
411		It must <span class="emphasis"><em>not</em></span> be enabled on print shares 
412		(with a <tt class="constant">yes</tt> or <tt class="constant">true</tt> setting) that
413		have valid drivers installed on the Samba server. For more detailed
414		explanations see the <tt class="filename">smb.conf</tt> man page.
415	</p></dd></dl></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="ptrsect"></a>The [printers] Section</h4></div></div></div><p>
416This is the second special section. If a section with this name appears in
417the <tt class="filename">smb.conf</tt>, users are able to connect to any printer specified in the
418Samba host's printcap file, because Samba on startup then creates a printer
419share for every printer name it finds in the printcap file. You could regard
420this section as a general convenience shortcut to share all printers with
421minimal configuration. It is also a container for settings that should
422apply as default to all printers. (For more details see the <tt class="filename">smb.conf</tt>
423man page.) Settings inside this container must be Share Level parameters.
424</p><div class="variablelist"><dl><dt><span class="term"><a class="indexterm" name="id2571518"></a>comment = All printers </span></dt><dd><p>
425		The <a class="indexterm" name="id2571529"></a>comment is shown next to the share if
426		a client queries the server, either via <span class="guiicon">Network Neighborhood</span> or with
427		the <span><b class="command">net view</b></span> command to list available shares.
428		</p></dd><dt><span class="term"><a class="indexterm" name="id2571555"></a>printable = yes </span></dt><dd><p>
429		The <i class="parameter"><tt>[printers]</tt></i> service <span class="emphasis"><em>must</em></span>
430		be declared as printable. If you specify otherwise, smbd will refuse to load  at
431		startup. This parameter allows connected clients to open, write to and submit spool files
432		into the directory specified with the <a class="indexterm" name="id2571580"></a>path
433		parameter for this service. It is used by Samba to differentiate printer shares from
434		file shares. 
435		</p></dd><dt><span class="term"><a class="indexterm" name="id2571593"></a>path = /var/spool/samba </span></dt><dd><p>
436		Must point to a directory used by Samba to spool incoming print files. <span class="emphasis"><em>It
437		must not be the same as the spool directory specified in the configuration of your UNIX
438		print subsystem!</em></span> The path typically points to a directory that is world
439		writable, with the &#8220;<span class="quote"><span class="emphasis"><em>sticky</em></span></span>&#8221; bit set to it.
440		</p></dd><dt><span class="term"><a class="indexterm" name="id2571622"></a>browseable = no </span></dt><dd><p>
441		Is always set to <tt class="constant">no</tt> if
442		<a class="indexterm" name="id2571637"></a>printable = yes. It makes
443		the <i class="parameter"><tt>[printer]</tt></i> share itself invisible in the list of
444		available shares in a <span><b class="command">net view</b></span> command or in the Explorer browse
445		list. (You will of course see the individual printers).
446		</p></dd><dt><span class="term"><a class="indexterm" name="id2571663"></a>guest ok = yes </span></dt><dd><p>
447		If this parameter is set to <tt class="constant">yes</tt>, no password is required to
448		connect to the printer's service. Access will be granted with the privileges of the
449		<a class="indexterm" name="id2571681"></a>guest account. On many systems the guest
450		account will map to a user named &#8220;<span class="quote"><span class="emphasis"><em>nobody</em></span></span>&#8221;. This user will usually be found
451		in the UNIX passwd file with an empty password, but with no valid UNIX login. (On some
452		systems the guest account might not have the privilege to be able to print. Test this
453		by logging in as your guest user using <span><b class="command">su - guest</b></span> and run a system
454		print command like:
455		</p><p>
456		<b class="userinput"><tt>lpr -P printername /etc/motd</tt></b>
457		</p></dd><dt><span class="term"><a class="indexterm" name="id2571718"></a>public = yes </span></dt><dd><p>
458		Is a synonym for <a class="indexterm" name="id2571730"></a>guest ok = yes.
459		Since we have <a class="indexterm" name="id2571738"></a>guest ok = yes, it
460		really does not need to be here. (This leads to the interesting question: &#8220;<span class="quote"><span class="emphasis"><em>What if I
461		by accident have two contradictory settings for the same share?</em></span></span>&#8221; The answer is the
462		last one encountered by Samba wins. Testparm does not complain about different settings
463		of the same parameter for the same share. You can test this by setting up multiple
464		lines for the <i class="parameter"><tt>guest account</tt></i> parameter with different usernames,
465		and then run testparm to see which one is actually used by Samba.)
466		</p></dd><dt><span class="term"><a class="indexterm" name="id2571768"></a>read only = yes </span></dt><dd><p>
467		Normally (for other types of shares) prevents users from creating or modifying files
468		in the service's directory. However, in a &#8220;<span class="quote"><span class="emphasis"><em>printable</em></span></span>&#8221; service, it is
469		<span class="emphasis"><em>always</em></span> allowed to write to the directory (if user privileges allow the
470		connection), but only via print spooling operations. Normal write operations are not permitted.
471		</p></dd><dt><span class="term"><a class="indexterm" name="id2571797"></a>writable = no </span></dt><dd><p>
472		Is a synonym for <a class="indexterm" name="id2571809"></a>read only = yes.
473		</p></dd></dl></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2571820"></a>Any [my_printer_name] Section</h4></div></div></div><p>
474If a section appears in the <tt class="filename">smb.conf</tt> file, which when given the parameter
475<a class="indexterm" name="id2571836"></a>printable = yes causes Samba to configure it
476as a printer share. Windows 9x/Me clients may have problems with connecting or loading printer drivers
477if the share name has more than eight characters. Do not name a printer share with a name that may conflict
478with an existing user or file share name. On Client connection requests, Samba always tries to find file
479shares with that name first. If it finds one, it will connect to this and will not connect
480to a printer with the same name!
481</p><div class="variablelist"><dl><dt><span class="term"><a class="indexterm" name="id2571856"></a>comment = Printer with Restricted Access </span></dt><dd><p>
482		The comment says it all.
483		</p></dd><dt><span class="term"><a class="indexterm" name="id2571873"></a>path = /var/spool/samba_my_printer </span></dt><dd><p>
484		Sets the spooling area for this printer to a directory other than the default. It is not
485		necessary to set it differently, but the option is available.
486		</p></dd><dt><span class="term"><a class="indexterm" name="id2571892"></a>printer admin = kurt </span></dt><dd><p>
487		The printer admin definition is different for this explicitly defined printer share from the general
488		<i class="parameter"><tt>[printers]</tt></i> share. It is not a requirement; we
489		did it to show that it is possible.
490		</p></dd><dt><span class="term"><a class="indexterm" name="id2571917"></a>browseable = yes </span></dt><dd><p>
491		This makes the printer browseable so the clients may conveniently find it when browsing the
492		<span class="guiicon">Network Neighborhood</span>.
493		</p></dd><dt><span class="term"><a class="indexterm" name="id2571941"></a>printable = yes </span></dt><dd><p>
494		See <a href="printing.html#ptrsect" title="The [printers] Section">The [printers] Section</a>.
495		</p></dd><dt><span class="term"><a class="indexterm" name="id2571965"></a>writable = no </span></dt><dd><p>
496		See <a href="printing.html#ptrsect" title="The [printers] Section">The [printers] Section</a>.
497		</p></dd><dt><span class="term"><a class="indexterm" name="id2571988"></a>hosts allow = 10.160.50.,10.160.51. </span></dt><dd><p>
498		Here we exercise a certain degree of access control by using the <a class="indexterm" name="id2572001"></a>hosts allow and <a class="indexterm" name="id2572008"></a>hosts deny
499		parameters. This is not by any means a safe bet. It is not a way to secure your
500		printers. This line accepts all clients from a certain subnet in a first evaluation of
501		access control.
502		</p></dd><dt><span class="term"><a class="indexterm" name="id2572023"></a>hosts deny = turbo_xp,10.160.50.23,10.160.51.60 </span></dt><dd><p>
503		All listed hosts are not allowed here (even if they belong to the allowed subnets). As
504		you can see, you could name IP addresses as well as NetBIOS hostnames here.
505		</p></dd><dt><span class="term"><a class="indexterm" name="id2572042"></a>guest ok = no </span></dt><dd><p>
506		This printer is not open for the guest account.
507		</p></dd></dl></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2572059"></a>Print Commands</h4></div></div></div><p>
508In each section defining a printer (or in the <i class="parameter"><tt>[printers]</tt></i> section),
509a <i class="parameter"><tt>print command</tt></i> parameter may be defined. It sets a command to process the files
510that have been placed into the Samba print spool directory for that printer. (That spool directory was,
511if you remember, set up with the <a class="indexterm" name="id2572083"></a>path parameter). Typically,
512this command will submit the spool file to the Samba host's print subsystem, using the suitable system
513print command. But there is no requirement that this needs to be the case. For debugging or
514some other reason, you may want to do something completely different than print the file. An example is a
515command that just copies the print file to a temporary location for further investigation when you need
516to debug printing. If you craft your own print commands (or even develop print command shell scripts),
517make sure you pay attention to the need to remove the files from the Samba spool directory. Otherwise,
518your hard disk may soon suffer from shortage of free space.
519</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2572104"></a>Default UNIX System Printing Commands</h4></div></div></div><p>
520You learned earlier on that Samba, in most cases, uses its built-in settings for many parameters
521if it cannot find an explicitly stated one in its configuration file. The same is true for the
522<a class="indexterm" name="id2572115"></a>print command. The default print command varies depending
523on the <a class="indexterm" name="id2572123"></a>printing parameter setting. In the commands listed
524below, you will notice some parameters of the form <span class="emphasis"><em>%X</em></span> where <span class="emphasis"><em>X</em></span> is
525<span class="emphasis"><em>p, s, J</em></span>, and so on. These letters stand for printer name, spool-file and job ID, respectively.
526They are explained in more detail further below. <a href="printing.html#printOptions" title="Table�19.1.�Default Printing Settings">Next table</a> presents an overview of key
527printing options but excludes the special case of CUPS that is discussed in <a href="CUPS-printing.html" title="Chapter�20.�CUPS Printing Support">CUPS Printing Support</a>.
528</p><div class="table"><a name="printOptions"></a><p class="title"><b>Table�19.1.�Default Printing Settings</b></p><table summary="Default Printing Settings" border="1"><colgroup><col align="left"><col align="left"></colgroup><thead><tr><th align="left">Setting</th><th align="left">Default Printing Commands</th></tr></thead><tbody><tr><td align="left"><a class="indexterm" name="id2572213"></a>printing = bsd|aix|lprng|plp</td><td align="left">print command is <span><b class="command">lpr -r -P%p %s</b></span></td></tr><tr><td align="left"><a class="indexterm" name="id2572234"></a>printing = sysv|hpux</td><td align="left">print command is <span><b class="command">lp -c -P%p %s; rm %s</b></span></td></tr><tr><td align="left"> <a class="indexterm" name="id2572256"></a>printing = qnx</td><td align="left">print command is <span><b class="command">lp -r -P%p -s %s</b></span></td></tr><tr><td align="left"><a class="indexterm" name="id2572277"></a>printing = bsd|aix|lprng|plp</td><td align="left">lpq command is <span><b class="command">lpq -P%p</b></span></td></tr><tr><td align="left"><a class="indexterm" name="id2572298"></a>printing = sysv|hpux</td><td align="left">lpq command is <span><b class="command">lpstat -o%p</b></span></td></tr><tr><td align="left"><a class="indexterm" name="id2572319"></a>printing = qnx</td><td align="left">lpq command is <span><b class="command">lpq -P%p</b></span></td></tr><tr><td align="left"><a class="indexterm" name="id2572340"></a>printing = bsd|aix|lprng|plp</td><td align="left">lprm command is <span><b class="command">lprm -P%p %j</b></span></td></tr><tr><td align="left"><a class="indexterm" name="id2572361"></a>printing = sysv|hpux</td><td align="left">lprm command is <span><b class="command">cancel %p-%j</b></span></td></tr><tr><td align="left"><a class="indexterm" name="id2572382"></a>printing = qnx</td><td align="left">lprm command is <span><b class="command">cancel %p-%j</b></span></td></tr><tr><td align="left"><a class="indexterm" name="id2572403"></a>printing = bsd|aix|lprng|plp</td><td align="left">lppause command is <span><b class="command">lp -i %p-%j -H hold</b></span></td></tr><tr><td align="left"><a class="indexterm" name="id2572424"></a>printing = sysv|hpux</td><td align="left">lppause command   (...is empty)</td></tr><tr><td align="left"><a class="indexterm" name="id2572441"></a>printing = qnx</td><td align="left">lppause command   (...is empty)</td></tr><tr><td align="left"><a class="indexterm" name="id2572457"></a>printing = bsd|aix|lprng|plp</td><td align="left">lpresume command is <span><b class="command">lp -i %p-%j -H resume</b></span></td></tr><tr><td align="left"><a class="indexterm" name="id2572479"></a>printing = sysv|hpux</td><td align="left">lpresume command   (...is empty)</td></tr><tr><td align="left"><a class="indexterm" name="id2572495"></a>printing = qnx</td><td align="left">lpresume command   (...is empty)</td></tr></tbody></table></div><p>
529We excluded the special case of CUPS here, because it is discussed in the next chapter. For
530<i class="parameter"><tt>printing = CUPS</tt></i>, if Samba is compiled against libcups, it uses the CUPS API to submit
531jobs. (It is a good idea also to set <a class="indexterm" name="id2572523"></a>printcap = cups
532in case your <tt class="filename">cupsd.conf</tt> is set to write its auto-generated printcap file to an
533unusual place). Otherwise, Samba maps to the System V printing commands with the -oraw option for printing,
534i.e., it uses <span><b class="command">lp -c -d%p -oraw; rm %s</b></span>. With <i class="parameter"><tt>printing = cups</tt></i>,
535and if Samba is compiled against libcups, any manually set print command will be ignored!
536</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2572556"></a>Custom Print Commands</h4></div></div></div><p>
537After a print job has finished spooling to a service, the <a class="indexterm" name="id2572565"></a>print command
538 will be used by Samba via a <span class="emphasis"><em>system()</em></span> call to process the
539spool file. Usually the command specified will submit the spool file to the host's printing subsystem. But
540there is no requirement at all that this must be the case. The print subsystem may not remove the spool
541file on its own. So whatever command you specify, you should ensure that the spool file is deleted after
542it has been processed.
543</p><p>
544There is no difficulty with using your own customized print commands with the traditional printing
545systems. However, if you do not wish to roll your own, you should be well informed about the default
546built-in commands that Samba uses for each printing subsystem (see
547Table 17.1). In all the
548commands listed in the last paragraphs, you see parameters of the form <span class="emphasis"><em>%X</em></span>. These are
549<span class="emphasis"><em>macros</em></span>, or shortcuts, used as place-holders for the names of real objects. At the time
550of running a command with such a placeholder, Samba will insert the appropriate value automatically. Print
551commands can handle all Samba macro substitutions. In regard to printing, the following ones do have
552special relevance:
553</p><div class="itemizedlist"><ul type="disc"><li><p><i class="parameter"><tt>%s, %f</tt></i>  the path to the spool file name.</p></li><li><p><i class="parameter"><tt>%p</tt></i>  the appropriate printer name.</p></li><li><p><i class="parameter"><tt>%J</tt></i>  the job name as transmitted by the client.</p></li><li><p><i class="parameter"><tt>%c</tt></i>  the number of printed pages of the spooled job (if known).</p></li><li><p><i class="parameter"><tt>%z</tt></i>  the size of the spooled print job (in bytes).</p></li></ul></div><p>
554The print command must contain at least one occurrence of <i class="parameter"><tt>%s</tt></i> or
555the <i class="parameter"><tt>%f</tt></i>. The <i class="parameter"><tt>%p</tt></i> is optional. If no printer name is supplied,
556the <i class="parameter"><tt>%p</tt></i> will be silently removed from the print command. In this case, the job is
557sent to the default printer.
558</p><p>
559If specified in the <i class="parameter"><tt>[global]</tt></i> section, the print command given will be
560used for any printable service that does not have its own print command specified. If there is neither a
561specified print command for a printable service nor a global print command, spool files will be created
562but not processed! Most importantly, print files will not be removed, so they will consume disk space.
563</p><p>
564Printing may fail on some UNIX systems when using the &#8220;<span class="quote"><span class="emphasis"><em>nobody</em></span></span>&#8221; account. If this happens, create an
565alternative guest account and give it the privilege to print. Set up this guest account in the
566<i class="parameter"><tt>[global]</tt></i> section with the <i class="parameter"><tt>guest account</tt></i> parameter.
567</p><p>
568You can form quite complex print commands. You need to realize that print commands are just
569passed to a UNIX shell. The shell is able to expand the included environment variables as
570usual. (The syntax to include a UNIX environment variable <i class="parameter"><tt>$variable</tt></i>
571in the Samba print command is <i class="parameter"><tt>%$variable</tt></i>.) To give you a working
572<a class="indexterm" name="id2572756"></a>print command example, the following will log a print job
573to <tt class="filename">/tmp/print.log</tt>, print the file, then remove it. The semicolon (&#8220;<span class="quote"><span class="emphasis"><em>;</em></span></span>&#8221;
574is the usual separator for commands in shell scripts:
575</p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2572783"></a><i class="parameter"><tt>
576					
577				print command = echo Printing %s &gt;&gt; /tmp/print.log; lpr -P %p %s; rm %s</tt></i></td></tr></table><p>
578You may have to vary your own command considerably from this example depending on how you normally print
579files on your system. The default for the <a class="indexterm" name="id2572805"></a>print command
580parameter varies depending on the setting of the <a class="indexterm" name="id2572813"></a>printing
581parameter. Another example is:
582</p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2572828"></a><i class="parameter"><tt>
583					
584				print command = /usr/local/samba/bin/myprintscript %p %s</tt></i></td></tr></table></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2572848"></a>Printing Developments Since Samba-2.2</h2></div></div></div><p>
585Prior to Samba-2.2.x, print server support for Windows clients was limited to <span class="emphasis"><em>LanMan</em></span>
586printing calls. This is the same protocol level as Windows 9x/Me PCs offer when they share printers.
587Beginning with the 2.2.0 release, Samba started to support the native Windows NT printing mechanisms. These
588are implemented via <span class="emphasis"><em>MS-RPC</em></span> (RPC = <span class="emphasis"><em>Remote Procedure Calls</em></span>
589). MS-RPCs use the <span class="emphasis"><em>SPOOLSS</em></span> named pipe for all printing.
590</p><p>
591The additional functionality provided by the new SPOOLSS support includes:
592</p><div class="itemizedlist"><ul type="disc"><li><p>
593	Support for downloading printer driver files to Windows 95/98/NT/2000 clients upon
594	demand (<span class="emphasis"><em>Point'n'Print</em></span>).
595	</p></li><li><p>
596	Uploading of printer drivers via the Windows NT <span class="emphasis"><em>Add Printer Wizard</em></span> (APW)
597	or the <a href="http://imprints.sourceforge.net/" target="_top">Imprints</a> tool set.
598	</p></li><li><p>
599	Support for the native MS-RPC printing calls such as
600	StartDocPrinter, EnumJobs(), and so on.	(See the
601	<a href="http://msdn.microsoft.com/" target="_top">MSDN documentation</a> for more information on the
602	Win32 printing API).
603	</p></li><li><p>
604	Support for NT <span class="emphasis"><em>Access Control Lists</em></span> (ACL) on printer objects.
605	</p></li><li><p>
606	Improved support for printer queue manipulation through the use of internal databases for spooled
607	job information (implemented by various <tt class="filename">*.tdb</tt> files).
608	</p></li></ul></div><p>
609A benefit of updating is that Samba-3 is able to publish its printers to Active Directory (or LDAP).
610</p><p>
611A fundamental difference exists between MS Windows NT print servers and Samba operation. Windows NT
612permits the installation of local printers that are not shared. This is an artifact of the fact that
613any Windows NT machine (server or client) may be used by a user as a workstation. Samba will publish all
614printers that are made available, either by default or by specific declaration via printer-specific shares.
615</p><p>
616Windows NT/200x/XP Professional clients do not have to use the standard SMB printer share; they can
617print directly to any printer on another Windows NT host using MS-RPC. This, of course, assumes that
618the client has the necessary privileges on the remote host that serves the printer resource. The
619default permissions assigned by Windows NT to a printer gives the Print permissions to the well-known
620<span class="emphasis"><em>Everyone</em></span> group. (The older clients of type Windows 9x/Me can only print to shared
621printers).
622</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2572977"></a>Point'n'Print Client Drivers on Samba Servers</h3></div></div></div><p>
623There is much confusion about what all this means. The question is often asked, &#8220;<span class="quote"><span class="emphasis"><em>Is it or is
624it not necessary for printer drivers to be installed on a Samba host in order to support printing from
625Windows clients?</em></span></span>&#8221; The answer to this is no, it is not necessary.
626</p><p>
627Windows NT/2000 clients can, of course, also run their APW to install drivers <span class="emphasis"><em>locally</em></span>
628(which then connect to a Samba-served print queue). This is the same method used by Windows 9x/Me
629clients. (However, a <span class="emphasis"><em>bug</em></span> existed in Samba 2.2.0 that made Windows NT/2000 clients
630require that the Samba server possess a valid driver for the printer. This was fixed in Samba 2.2.1).
631</p><p>
632But it is a new capability to install the printer drivers into the <i class="parameter"><tt>[print$]</tt></i>
633share of the Samba server, and a big convenience, too. Then <span class="emphasis"><em>all</em></span> clients
634(including 95/98/ME) get the driver installed when they first connect to this printer share. The
635<span class="emphasis"><em>uploading</em></span> or <span class="emphasis"><em>depositing</em></span> of the driver into this
636<i class="parameter"><tt>[print$]</tt></i> share and the following binding of this driver to an existing
637Samba printer share can be achieved by different means:
638</p><div class="itemizedlist"><ul type="disc"><li><p>
639	Running the <span class="emphasis"><em>APW</em></span> on an NT/200x/XP Professional client (this does not work from 95/98/ME clients).
640	</p></li><li><p>
641	Using the <span class="emphasis"><em>Imprints</em></span> tool-set.
642	</p></li><li><p>
643	Using the <span class="emphasis"><em>smbclient</em></span> and <span class="emphasis"><em>rpcclient</em></span> command-line tools.
644	</p></li><li><p>
645	Using <span class="emphasis"><em>cupsaddsmb</em></span> (only works for the CUPS
646	printing system, not for LPR/LPD, LPRng, and so on).
647	</p></li></ul></div><p>
648Samba does not use these uploaded drivers in any way to process spooled files. These drivers are utilized
649entirely by the clients who download and install them via the &#8220;<span class="quote"><span class="emphasis"><em>Point'n'Print</em></span></span>&#8221; mechanism
650supported by Samba. The clients use these drivers to generate print files in the format the printer
651(or the UNIX print system) requires. Print files received by Samba are handed over to the UNIX printing
652system, which is responsible for all further processing, as needed.
653</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2573104"></a>The Obsoleted [printer$] Section</h3></div></div></div><p>
654	Versions of Samba prior to 2.2 made it possible to use a share named
655	<i class="parameter"><tt>[printer$]</tt></i>. This name was taken from the same named service created by
656	Windows 9x/Me clients when a printer was shared by them. Windows 9x/Me printer servers always
657	have a <i class="parameter"><tt>[printer$]</tt></i> service that provides read-only access (with
658	no password required) to support printer driver downloads. However, Samba's initial
659	implementation allowed for a parameter named <i class="parameter"><tt>printer driver location</tt></i> to
660	be used on a per share basis. This specified the location of the driver files associated with
661	that printer. Another parameter named <i class="parameter"><tt>printer driver</tt></i> provided a means of
662	defining the printer driver name to be sent to the client.
663	</p><p>
664	These parameters, including the <i class="parameter"><tt>printer driver file</tt></i> parameter,
665	are now removed and cannot be used in installations of Samba-3. The share name
666	<i class="parameter"><tt>[print$]</tt></i> is now used for the location of download-able printer
667	drivers. It is taken from the <i class="parameter"><tt>[print$]</tt></i> service created
668	by Windows NT PCs when a printer is shared by them. Windows NT print servers always have a
669	<i class="parameter"><tt>[print$]</tt></i> service that provides read-write access (in the context
670	of its ACLs) to support printer driver downloads and uploads. This does not mean Windows
671	9x/Me clients are now thrown aside. They can use Samba's <i class="parameter"><tt>[print$]</tt></i>
672	share support just fine.
673	</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2573191"></a>Creating the [print$] Share</h3></div></div></div><p>
674In order to support the uploading and downloading of printer driver files, you must first configure a
675file share named <i class="parameter"><tt>[print$]</tt></i>. The public name of this share is hard coded
676in the MS Windows clients. It cannot be renamed since Windows clients are programmed to search for a
677service of exactly this name if they want to retrieve printer driver files.
678</p><p>
679You should modify the server's file to add the global parameters and create the
680<i class="parameter"><tt>[print$]</tt></i> file share (of course, some of the parameter values, such
681as <a class="indexterm" name="id2573222"></a>path are arbitrary and should be replaced with appropriate values for your
682site). See <a href="printing.html#prtdollar" title="Example�19.3.�[print\$] example">next example</a>.
683</p><p>
684</p><div class="example"><a name="prtdollar"></a><p class="title"><b>Example�19.3.�[print\$] example</b></p><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><i class="parameter"><tt>[global]</tt></i></td></tr><tr><td># members of the ntadmin group should be able to add drivers and set</td></tr><tr><td># printer properties. root is implicitly always a 'printer admin'.</td></tr><tr><td><a class="indexterm" name="id2573278"></a><i class="parameter"><tt>
685					
686				printer admin = @ntadmin</tt></i></td></tr><tr><td>...</td></tr><tr><td> </td></tr><tr><td><i class="parameter"><tt>[printers]</tt></i></td></tr><tr><td>...</td></tr><tr><td> </td></tr><tr><td><i class="parameter"><tt>[print$]</tt></i></td></tr><tr><td><a class="indexterm" name="id2573317"></a><i class="parameter"><tt>
687					
688				comment = Printer Driver Download Area</tt></i></td></tr><tr><td><a class="indexterm" name="id2573333"></a><i class="parameter"><tt>
689					
690				path = /etc/samba/drivers</tt></i></td></tr><tr><td><a class="indexterm" name="id2573348"></a><i class="parameter"><tt>
691					
692				browseable = yes</tt></i></td></tr><tr><td><a class="indexterm" name="id2573364"></a><i class="parameter"><tt>
693					
694				guest ok = yes</tt></i></td></tr><tr><td><a class="indexterm" name="id2573379"></a><i class="parameter"><tt>
695					
696				read only = yes</tt></i></td></tr><tr><td><a class="indexterm" name="id2573394"></a><i class="parameter"><tt>
697					
698				write list = @ntadmin, root</tt></i></td></tr></table></div><p>
699</p><p>
700Of course, you also need to ensure that the directory named by the
701<a class="indexterm" name="id2573414"></a>path parameter exists on the UNIX file system.
702</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2573424"></a>[print$] Section Parameters</h3></div></div></div><p>
703The <i class="parameter"><tt>[print$]</tt></i> is a special section in <tt class="filename">smb.conf</tt>. It contains settings relevant to
704potential printer driver download and is used by windows clients for local print driver installation.
705The following parameters are frequently needed in this share section:
706</p><div class="variablelist"><dl><dt><span class="term"><a class="indexterm" name="id2573453"></a>comment = Printer Driver Download Area </span></dt><dd><p>
707		The comment appears next to the share name if it is listed in a share list (usually Windows
708		clients will not see it, but it will also appear up in a <span><b class="command">smbclient -L sambaserver
709		</b></span> output).
710		</p></dd><dt><span class="term"><a class="indexterm" name="id2573478"></a>path = /etc/samba/printers </span></dt><dd><p>
711		Is the path to the location of the Windows driver file deposit from the UNIX point of view.
712		</p></dd><dt><span class="term"><a class="indexterm" name="id2573496"></a>browseable = no </span></dt><dd><p>
713		Makes the <i class="parameter"><tt>[print$]</tt></i> share invisible to clients from the
714		<span class="guimenu">Network Neighborhood</span>. However, you can still mount it from any client
715		using the <span><b class="command">net use g:\\sambaserver\print$</b></span> command in a DOS-box or the
716		<span class="guimenu">Connect network drive menu&gt;</span> from Windows Explorer.
717		</p></dd><dt><span class="term"><a class="indexterm" name="id2573540"></a>guest ok = yes </span></dt><dd><p>
718		Gives read-only access to this share for all guest users. Access may be granted to
719		download and install printer drivers on clients. The requirement for <i class="parameter"><tt>guest ok
720		= yes</tt></i> depends on how your site is configured. If users will be guaranteed
721		to have an account on the Samba host, then this is a non-issue.
722		</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> 
723		If all your Windows NT users are guaranteed to be authenticated by the Samba server
724		(for example, if Samba authenticates via an NT domain server and the user has already been
725		validated by the Domain Controller in order to logon to the Windows NT session), then guest
726		access is not necessary. Of course, in a workgroup environment where you just want
727		to print without worrying about silly accounts and security, then configure the share for
728		guest access. You should consider adding <a class="indexterm" name="id2573575"></a>map to guest = Bad	User in the <i class="parameter"><tt>[global]</tt></i> section
729		as well. Make sure you understand what this parameter does before using it.
730		</p></div></dd><dt><span class="term"><a class="indexterm" name="id2573595"></a>read only = yes </span></dt><dd><p>
731		Because we do not want everybody to upload driver files (or even change driver settings),
732		we tagged this share as not writable.
733		</p></dd><dt><span class="term"><a class="indexterm" name="id2573613"></a>write list = @ntadmin, root </span></dt><dd><p>
734		The <i class="parameter"><tt>[print$]</tt></i> was made read-only by the previous
735		setting so we should create a <i class="parameter"><tt>write list</tt></i> entry also. UNIX
736		groups (denoted with a leading &#8220;<span class="quote"><span class="emphasis"><em>@</em></span></span>&#8221; character). Users listed here are allowed
737		write-access (as an exception to the general public's read-only access), which they need to
738		update files on the share. Normally, you will want to only name administrative-level user
739		account in this setting. Check the file system permissions to make sure these accounts
740		can copy files to the share. If this is a non-root account, then the account should also
741		be mentioned in the global <a class="indexterm" name="id2573651"></a>printer admin
742		parameter. See the <tt class="filename">smb.conf</tt> man page for more information on configuring file shares.
743		</p></dd></dl></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2573670"></a>The [print$] Share Directory</h3></div></div></div><p>
744In order for a Windows NT print server to support the downloading of driver files by multiple client
745architectures, you must create several subdirectories within the <i class="parameter"><tt>[print$]</tt></i>
746service (i.e., the UNIX directory named by the <a class="indexterm" name="id2573687"></a>path
747parameter). These correspond to each of the supported client architectures. Samba follows this model as
748well. Just like the name of the <i class="parameter"><tt>[print$]</tt></i> share itself, the subdirectories
749must be exactly the names listed below (you may leave out the subdirectories of architectures you do
750not need to support).
751</p><p>
752Therefore, create a directory tree below the
753<i class="parameter"><tt>[print$]</tt></i> share for each architecture you wish
754to support like this:
755</p><pre class="programlisting">
756[print$]--+
757          |--W32X86           # serves drivers to Windows NT x86
758          |--WIN40            # serves drivers to Windows 95/98
759          |--W32ALPHA         # serves drivers to Windows NT Alpha_AXP
760          |--W32MIPS          # serves drivers to Windows NT R4000
761          |--W32PPC           # serves drivers to Windows NT PowerPC
762</pre><p>
763</p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Required permissions</h3><p>
764	In order to add a new driver to your Samba host, one of two conditions must hold true:
765	</p><div class="itemizedlist"><ul type="disc"><li><p>
766		The account used to connect to the Samba host must have a UID of 0 (i.e., a root account).
767		</p></li><li><p>
768		The account used to connect to the Samba host must be named in the <span class="emphasis"><em>printer admin</em></span>list.
769		</p></li></ul></div><p>
770	Of course, the connected account must still have write access to add files to the subdirectories beneath
771	<i class="parameter"><tt>[print$]</tt></i>. Remember that all file shares are set to &#8220;<span class="quote"><span class="emphasis"><em>read-only</em></span></span>&#8221; by default.
772	</p></div><p>
773Once you have created the required <i class="parameter"><tt>[print$]</tt></i> service and
774associated subdirectories, go to a Windows NT 4.0/200x/XP client workstation. Open <span class="guiicon">Network
775Neighborhood</span> or <span class="guiicon">My Network Places</span> and browse for the Samba host. Once you
776have located the server, navigate to its <span class="guiicon">Printers and Faxes</span> folder. You should see
777an initial listing of printers that matches the printer shares defined on your Samba host.
778</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2573812"></a>Installing Drivers into [print$]</h2></div></div></div><p>
779Have you successfully created the <i class="parameter"><tt>[print$]</tt></i> share in <tt class="filename">smb.conf</tt>, and have your forced Samba
780to re-read its <tt class="filename">smb.conf</tt> file? Good. But you are not yet ready to use the new facility. The client driver
781files need to be installed into this share. So far it is still an empty share. Unfortunately, it is
782not enough to just copy the driver files over. They need to be
783correctly installed so that appropriate
784records for each driver will exist in the Samba internal databases so it can provide the correct
785drivers as they are requested from MS Windows clients. And that is a bit tricky, to say the least. We
786now discuss two alternative ways to install the drivers into <i class="parameter"><tt>[print$]</tt></i>:
787</p><div class="itemizedlist"><ul type="disc"><li><p>
788	Using the Samba command-line utility <span><b class="command">rpcclient</b></span> with its various subcommands (here:
789	<span><b class="command">adddriver</b></span> and <span><b class="command">setdriver</b></span>) from any UNIX workstation.
790	</p></li><li><p>
791	Running a GUI (<span class="guiicon">Printer Properties</span> and <span class="guiicon">Add Printer Wizard</span>)
792	from any Windows NT/200x/XP client workstation.
793	</p></li></ul></div><p>
794The latter option is probably the easier one (even if the process may seem a little bit weird at first).
795</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2573905"></a>Add Printer Wizard Driver Installation</h3></div></div></div><p>
796The initial listing of printers in the Samba host's <span class="guiicon">Printers</span> folder accessed from a
797client's Explorer will have no real printer driver assigned to them. By default this driver name is set
798to a null string. This must be changed now. The local <span class="guiicon">Add Printer Wizard</span> (APW), run from
799NT/2000/XP clients, will help us in this task.
800</p><p>
801Installation of a valid printer driver is not straightforward. You must attempt
802to view the printer properties for the printer to which you want the driver assigned. Open the Windows
803Explorer, open <span class="guiicon">Network Neighborhood</span>, browse to the Samba host, open Samba's <span class="guiicon">Printers</span>
804folder, right-click on the printer icon and select <span class="guimenu">Properties...</span>. You are now trying to
805view printer and driver properties for a queue that has this default <tt class="constant">NULL</tt> driver
806assigned. This will result in the following error message:
807</p><p><span class="errorname">
808	Device settings cannot be displayed. The driver for the specified printer is not installed,
809	only spooler properties will be displayed. Do you want to install the driver now?
810	</span></p><p>
811Do not click on <span class="guibutton">Yes</span>!  Instead, click on <span class="guibutton">No</span> in the error dialog.
812Only now you will be presented with the printer properties window. From here, the way to assign a driver
813to a printer is open to us. You now have the choice of:
814</p><div class="itemizedlist"><ul type="disc"><li><p>
815	Select a driver from the pop-up list of installed drivers. Initially this list will be empty.
816	</p></li><li><p>
817	Click on <span class="guibutton">New Driver</span> to install a new printer driver (which will
818	start up the APW).
819	</p></li></ul></div><p>
820Once the APW is started, the procedure is exactly the same as the one you are familiar with in Windows (we
821assume here that you are familiar with the printer driver installations procedure on Windows NT). Make sure
822your connection is, in fact, setup as a user with <a class="indexterm" name="id2574017"></a>printer admin
823privileges (if in doubt, use <span><b class="command">smbstatus</b></span> to check for this). If you wish to install
824printer drivers for client operating systems other than <span class="application">Windows NT x86</span>,
825you will need to use the <span class="guilabel">Sharing</span> tab of the printer properties dialog.
826</p><p>
827Assuming you have connected with an administrative (or root) account (as named by the
828<a class="indexterm" name="id2574050"></a>printer admin parameter), you will also be able to modify
829other printer properties such as ACLs and default device settings using this dialog. For the default
830device settings, please consider the advice given further in <a href="printing.html#inst-rpc" title="Installing Print Drivers Using rpcclient">Installing Print Drivers Using <span><b class="command">rpcclient</b></span></a>.
831</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="inst-rpc"></a>Installing Print Drivers Using <span><b class="command">rpcclient</b></span></h3></div></div></div><p>
832The second way to install printer drivers into <i class="parameter"><tt>[print$]</tt></i> and set them
833up in a valid way is to do it from the UNIX command line. This involves four distinct steps:
834</p><div class="orderedlist"><ol type="1"><li><p>
835	Gather info about required driver files and collect the files.
836	</p></li><li><p>
837	Deposit the driver files into the <i class="parameter"><tt>[print$]</tt></i> share's correct subdirectories
838	(possibly by using <span><b class="command">smbclient</b></span>).
839	</p></li><li><p>
840	Run the <span><b class="command">rpcclient</b></span> command line utility once with the <span><b class="command">adddriver</b></span>
841	subcommand.
842	</p></li><li><p>
843	Run <span><b class="command">rpcclient</b></span> a second time with the <span><b class="command">setdriver</b></span> subcommand.
844	</p></li></ol></div><p>
845We provide detailed hints for each of these steps in the paragraphs that follow.
846</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2574171"></a>Identifying Driver Files</h4></div></div></div><p>
847To find out about the driver files, you have two options. You could check the contents of the driver
848CDROM that came with your printer. Study the <tt class="filename">*.inf</tt> files lcoated on the CDROM. This
849may not be possible, since the <tt class="filename">*.inf</tt> file might be missing. Unfortunately, vendors have now started
850to use their own installation programs. These installations packages are often in some Windows platform
851archive format. Additionally, the files may be re-named during the installation process. This makes it
852extremely difficult to identify the driver files required.
853</p><p>
854Then you only have the second option. Install the driver locally on a Windows client and
855investigate which file names and paths it uses after they are installed. (You need to repeat
856this procedure for every client platform you want to support. We show it here for the
857<span class="application">W32X86</span> platform only, a name used by Microsoft for all Windows NT/200x/XP
858clients.)
859</p><p>
860A good method to recognize the driver files is to print the test page from the driver's
861<span class="guilabel">Properties</span> dialog (<span class="guilabel">General</span> tab). Then look at the list of
862driver files named on the printout. You'll need to recognize what Windows (and Samba) are calling the
863<span class="guilabel">Driver File</span>, <span class="guilabel">Data File</span>, <span class="guilabel">Config File</span>,
864<span class="guilabel">Help File</span> and (optionally) the <span class="guilabel">Dependent Driver Files</span>
865(this may vary slightly for Windows NT). You need to take a note of all file names for the next steps.
866</p><p>
867Another method to quickly test the driver filenames and related paths is provided by the
868<span><b class="command">rpcclient</b></span> utility. Run it with <span><b class="command">enumdrivers</b></span> or with the
869<span><b class="command">getdriver</b></span> subcommand, each at the <tt class="filename">3</tt> info level. In the following example,
870<span class="emphasis"><em>TURBO_XP</em></span> is the name of the Windows PC (in this case it was a Windows XP Professional
871laptop). I installed the driver locally to TURBO_XP, from a Samba server called <tt class="constant">KDE-BITSHOP</tt>.
872We could run an interactive <span><b class="command">rpcclient</b></span> session; then we would get an
873<span><b class="command">rpcclient /&gt;</b></span> prompt and would type the subcommands at this prompt. This is left as
874a good exercise to the reader. For now, we use <span><b class="command">rpcclient</b></span> with the <tt class="option">-c</tt>
875parameter to execute a single subcommand line and exit again. This is the method you would use if you
876want to create scripts to automate the procedure for a large number of printers and drivers. Note the
877different quotes used to overcome the different spaces in between words:
878</p><pre class="screen">
879<tt class="prompt">root# </tt><b class="userinput"><tt>rpcclient -U'Danka%xxxx' -c \
880	'getdriver "Heidelberg Digimaster 9110 (PS)" 3' TURBO_XP</tt></b>
881cmd = getdriver "Heidelberg Digimaster 9110 (PS)" 3
882
883[Windows NT x86]
884Printer Driver Info 3:
885  Version: [2]
886  Driver Name: [Heidelberg Digimaster 9110 (PS)]
887  Architecture: [Windows NT x86]
888  Driver Path: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01_de.DLL]
889  Datafile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.ppd]
890  Configfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01U_de.DLL]
891  Helpfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01U_de.HLP]
892  
893  Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.DLL]
894  Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.INI]
895  Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.dat]
896  Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.cat]
897  Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.def]
898  Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.hre]
899  Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.vnd]
900  Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.hlp]
901  Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01Aux.dll]
902  Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01_de.NTF]
903  
904  Monitorname: []
905  Defaultdatatype: []
906</pre><p>
907You may notice that this driver has quite a large number of <span class="guilabel">Dependent files</span>
908(there are worse cases, however). Also, strangely, the
909<span class="guilabel">Driver File</span> is tagged here
910<span class="guilabel">Driver Path</span>. We do not yet have support for the so-called
911<span class="application">WIN40</span> architecture installed. This name is used by Microsoft for the Windows
9129x/Me platforms. If we want to support these, we need to install the Windows 9x/Me driver files in
913addition to those for <span class="application">W32X86</span> (i.e., the Windows NT72000/XP clients) onto a
914Windows PC. This PC can also host the Windows 9x/Me drivers, even if it runs on Windows NT, 2000 or XP.
915</p><p>
916Since the <i class="parameter"><tt>[print$]</tt></i> share is usually accessible through the <span class="guiicon">Network
917Neighborhood</span>, you can also use the UNC notation from Windows Explorer to poke at it. The Windows
9189x/Me driver files will end up in subdirectory <tt class="filename">0</tt> of the <tt class="filename">WIN40</tt>
919directory. The full path to access them will be <tt class="filename">\\WINDOWSHOST\print$\WIN40\0\</tt>.
920</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
921More recent drivers on Windows 2000 and Windows XP are installed into the &#8220;<span class="quote"><span class="emphasis"><em>3</em></span></span>&#8221; subdirectory
922instead of the &#8220;<span class="quote"><span class="emphasis"><em>2</em></span></span>&#8221;. The version 2 of drivers, as used in Windows NT, were running in Kernel
923Mode. Windows 2000 changed this. While it still can use the Kernel Mode drivers (if this is enabled by
924the Admin), its native mode for printer drivers is User Mode execution. This requires drivers designed
925for this. These types of drivers install into the &#8220;<span class="quote"><span class="emphasis"><em>3</em></span></span>&#8221; subdirectory.
926</p></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2574502"></a>Obtaining Driver Files from Windows Client [print$] Shares</h4></div></div></div><p>
927Now we need to collect all the driver files we identified in our previous step. Where do we get them
928from? Well, why not retrieve them from the very PC and the same <i class="parameter"><tt>[print$]</tt></i>
929share that we investigated in our last step to identify the files? We can use <span><b class="command">smbclient</b></span>
930to do this. We will use the paths and names that were leaked to us by <span><b class="command">getdriver</b></span>. The
931listing is edited to include line breaks for readability:
932</p><pre class="screen">
933<tt class="prompt">root# </tt><b class="userinput"><tt>smbclient //TURBO_XP/print\$ -U'Danka%xxxx' \ 
934   -c 'cd W32X86/2;mget HD*_de.* hd*ppd Hd*_de.* Hddm*dll HDN*Aux.DLL'</tt></b>
935
936added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
937Got a positive name query response from 10.160.50.8 ( 10.160.50.8 )
938Domain=[DEVELOPMENT] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
939<tt class="prompt">Get file Hddm91c1_de.ABD? </tt><b class="userinput"><tt>n</tt></b>
940<tt class="prompt">Get file Hddm91c1_de.def? </tt><b class="userinput"><tt>y</tt></b>
941getting file \W32X86\2\Hddm91c1_de.def of size 428 as Hddm91c1_de.def
942<tt class="prompt">Get file Hddm91c1_de.DLL? </tt><b class="userinput"><tt>y</tt></b>
943getting file \W32X86\2\Hddm91c1_de.DLL of size 876544 as Hddm91c1_de.DLL
944[...]
945</pre><p>
946After this command is complete, the files are in our current local directory. You probably have noticed
947that this time we passed several commands to the <tt class="option">-c</tt> parameter, separated by semi-colons.
948This effects that all commands are executed in sequence on the remote Windows server before smbclient
949exits again.
950</p><p>
951Remember to repeat the procedure for the <span class="application">WIN40</span> architecture should
952you need to support Windows 9x/Me/XP clients. Remember too, the files for these architectures are in the
953<tt class="filename">WIN40/0/</tt> subdirectory. Once this is complete, we can run <span><b class="command">smbclient ...
954put</b></span> to store the collected files on the Samba server's <i class="parameter"><tt>[print$]</tt></i>
955share.
956</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2574636"></a>Installing Driver Files into [print$]</h4></div></div></div><p>
957We are now going to locate the driver files into the <i class="parameter"><tt>[print$]</tt></i>
958share. Remember, the UNIX path to this share has been defined
959previously in your words missing here. You
960also have created subdirectories for the different Windows client types you want to
961support. Supposing your <i class="parameter"><tt>[print$]</tt></i> share maps to the UNIX path
962<tt class="filename">/etc/samba/drivers/</tt>, your driver files should now go here:
963</p><div class="itemizedlist"><ul type="disc"><li><p>
964	For all Windows NT, 2000 and XP clients into <tt class="filename">/etc/samba/drivers/W32X86/</tt> but
965	not (yet) into the <tt class="filename">2</tt> subdirectory.
966	</p></li><li><p>
967	For all Windows 95, 98 and ME clients into <tt class="filename">/etc/samba/drivers/WIN40/</tt> but not
968	(yet) into the <tt class="filename">0</tt> subdirectory.
969	</p></li></ul></div><p>
970We again use smbclient to transfer the driver files across the network. We specify the same files
971and paths as were leaked to us by running <span><b class="command">getdriver</b></span> against the original
972<span class="emphasis"><em>Windows</em></span> install. However, now we are going to store the files into a
973<span class="emphasis"><em>Samba/UNIX</em></span> print server's <i class="parameter"><tt>[print$]</tt></i> share.
974</p><pre class="screen">
975<tt class="prompt">root# </tt><b class="userinput"><tt>smbclient //SAMBA-CUPS/print\$ -U'root%xxxx' -c \
976  'cd W32X86; put HDNIS01_de.DLL; \
977  put Hddm91c1_de.ppd; put HDNIS01U_de.DLL;        \
978  put HDNIS01U_de.HLP; put Hddm91c1_de.DLL;        \
979  put Hddm91c1_de.INI; put Hddm91c1KMMin.DLL;      \
980  put Hddm91c1_de.dat; put Hddm91c1_de.dat;        \
981  put Hddm91c1_de.def; put Hddm91c1_de.hre;        \
982  put Hddm91c1_de.vnd; put Hddm91c1_de.hlp;        \
983  put Hddm91c1_de_reg.HLP; put HDNIS01Aux.dll;     \
984  put HDNIS01_de.NTF'</tt></b>
985
986added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
987Got a positive name query response from 10.160.51.162 ( 10.160.51.162 )
988Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a]
989putting file HDNIS01_de.DLL as \W32X86\HDNIS01_de.DLL
990putting file Hddm91c1_de.ppd as \W32X86\Hddm91c1_de.ppd
991putting file HDNIS01U_de.DLL as \W32X86\HDNIS01U_de.DLL
992putting file HDNIS01U_de.HLP as \W32X86\HDNIS01U_de.HLP
993putting file Hddm91c1_de.DLL as \W32X86\Hddm91c1_de.DLL
994putting file Hddm91c1_de.INI as \W32X86\Hddm91c1_de.INI
995putting file Hddm91c1KMMin.DLL as \W32X86\Hddm91c1KMMin.DLL
996putting file Hddm91c1_de.dat as \W32X86\Hddm91c1_de.dat
997putting file Hddm91c1_de.dat as \W32X86\Hddm91c1_de.dat
998putting file Hddm91c1_de.def as \W32X86\Hddm91c1_de.def
999putting file Hddm91c1_de.hre as \W32X86\Hddm91c1_de.hre
1000putting file Hddm91c1_de.vnd as \W32X86\Hddm91c1_de.vnd
1001putting file Hddm91c1_de.hlp as \W32X86\Hddm91c1_de.hlp
1002putting file Hddm91c1_de_reg.HLP as \W32X86\Hddm91c1_de_reg.HLP
1003putting file HDNIS01Aux.dll as \W32X86\HDNIS01Aux.dll
1004putting file HDNIS01_de.NTF as \W32X86\HDNIS01_de.NTF
1005</pre><p>
1006
1007Whew  that was a lot of typing! Most drivers are a lot smaller  many only having three generic
1008PostScript driver files plus one PPD. While we did retrieve the files from the <tt class="filename">2</tt>
1009subdirectory of the <tt class="filename">W32X86</tt> directory from the Windows box, we do not put them
1010(for now) in this same subdirectory of the Samba box. This relocation will automatically be done by the
1011<span><b class="command">adddriver</b></span> command, which we will run shortly (and do not forget to also put the files
1012for the Windows 9x/Me architecture into the <tt class="filename">WIN40/</tt> subdirectory should you need them).
1013</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2574817"></a><span><b class="command">smbclient</b></span> to Confirm Driver Installation</h4></div></div></div><p>
1014For now we verify that our files are there. This can be done with <span><b class="command">smbclient</b></span>, too
1015(but, of course, you can log in via SSH also and do this through a standard UNIX shell access):
1016</p><pre class="screen">
1017<tt class="prompt">root# </tt><b class="userinput"><tt>smbclient //SAMBA-CUPS/print\$ -U 'root%xxxx' \
1018	-c 'cd W32X86; pwd; dir; cd 2; pwd; dir'</tt></b>
1019 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
1020Got a positive name query response from 10.160.51.162 ( 10.160.51.162 )
1021Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.8a]
1022
1023Current directory is \\SAMBA-CUPS\print$\W32X86\
1024.                                  D        0  Sun May  4 03:56:35 2003
1025..                                 D        0  Thu Apr 10 23:47:40 2003
10262                                   D        0  Sun May  4 03:56:18 2003
1027HDNIS01Aux.dll                      A    15356  Sun May  4 03:58:59 2003
1028Hddm91c1KMMin.DLL                   A    46966  Sun May  4 03:58:59 2003
1029HDNIS01_de.DLL                      A   434400  Sun May  4 03:58:59 2003
1030HDNIS01_de.NTF                      A   790404  Sun May  4 03:56:35 2003
1031Hddm91c1_de.DLL                     A   876544  Sun May  4 03:58:59 2003
1032Hddm91c1_de.INI                     A      101  Sun May  4 03:58:59 2003
1033Hddm91c1_de.dat                     A     5044  Sun May  4 03:58:59 2003
1034Hddm91c1_de.def                     A      428  Sun May  4 03:58:59 2003
1035Hddm91c1_de.hlp                     A    37699  Sun May  4 03:58:59 2003
1036Hddm91c1_de.hre                     A   323584  Sun May  4 03:58:59 2003
1037Hddm91c1_de.ppd                     A    26373  Sun May  4 03:58:59 2003
1038Hddm91c1_de.vnd                     A    45056  Sun May  4 03:58:59 2003
1039HDNIS01U_de.DLL                     A   165888  Sun May  4 03:58:59 2003
1040HDNIS01U_de.HLP                     A    19770  Sun May  4 03:58:59 2003
1041Hddm91c1_de_reg.HLP                 A   228417  Sun May  4 03:58:59 2003
1042              40976 blocks of size 262144. 709 blocks available
1043
1044Current directory is \\SAMBA-CUPS\print$\W32X86\2\
1045.                                  D        0  Sun May  4 03:56:18 2003
1046..                                 D        0  Sun May  4 03:56:35 2003
1047ADOBEPS5.DLL                        A   434400  Sat May  3 23:18:45 2003
1048laserjet4.ppd                       A     9639  Thu Apr 24 01:05:32 2003
1049ADOBEPSU.DLL                        A   109568  Sat May  3 23:18:45 2003
1050ADOBEPSU.HLP                        A    18082  Sat May  3 23:18:45 2003
1051PDFcreator2.PPD                     A    15746  Sun Apr 20 22:24:07 2003
1052              40976 blocks of size 262144. 709 blocks available
1053</pre><p>
1054Notice that there are already driver files present in the <tt class="filename">2</tt> subdirectory (probably
1055from a previous installation). Once the files for the new driver are there too, you are still a few
1056steps away from being able to use them on the clients. The only thing you could do now is to retrieve
1057them from a client just like you retrieve ordinary files from a file share, by opening print$ in Windows
1058Explorer. But that wouldn't install them per Point'n'Print. The reason
1059is: Samba does not yet know that
1060these files are something special, namely <span class="emphasis"><em>printer driver files</em></span> and it does not know
1061to which print queue(s) these driver files belong.
1062</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2574920"></a>Running <span><b class="command">rpcclient</b></span> with <span><b class="command">adddriver</b></span></h4></div></div></div><p>
1063Next, you must tell Samba about the special category of the files you just uploaded into the
1064<i class="parameter"><tt>[print$]</tt></i> share. This is done by the <span><b class="command">adddriver</b></span>
1065command. It will prompt Samba to register the driver files into its internal TDB database files. The
1066following command and its output has been edited, again, for readability:
1067</p><pre class="screen">
1068<tt class="prompt">root# </tt><b class="userinput"><tt>rpcclient -Uroot%xxxx -c 'adddriver "Windows NT x86" \
1069  "dm9110:HDNIS01_de.DLL: \
1070  Hddm91c1_de.ppd:HDNIS01U_de.DLL:HDNIS01U_de.HLP:   \
1071  NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI,          \
1072  Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre,   \
1073  Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL, \
1074  HDNIS01Aux.dll,HDNIS01_de.NTF,                     \
1075  Hddm91c1_de_reg.HLP' SAMBA-CUPS</tt></b>
1076
1077cmd = adddriver "Windows NT x86" \
1078  "dm9110:HDNIS01_de.DLL:Hddm91c1_de.ppd:HDNIS01U_de.DLL:   \
1079  HDNIS01U_de.HLP:NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI, \
1080  Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre,          \
1081  Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL,        \
1082  HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP"
1083
1084Printer Driver dm9110 successfully installed.
1085</pre><p>
1086After this step, the driver should be recognized by Samba on the print server. You need to be very
1087careful when typing the command. Don't exchange the order of the fields. Some changes would lead to
1088an <tt class="computeroutput">NT_STATUS_UNSUCCESSFUL</tt> error message. These become obvious. Other
1089changes might install the driver files successfully, but render the driver unworkable. So take care!
1090Hints about the syntax of the adddriver command are in the man page. The CUPS printing chapter 
1091provides a more detailed description, should you need it.
1092</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2575005"></a>Checking <span><b class="command">adddriver</b></span> Completion</h4></div></div></div><p>
1093One indication for Samba's recognition of the files as driver files is the <tt class="computeroutput">successfully
1094installed</tt> message. Another one is the fact that our files have been moved by the
1095<span><b class="command">adddriver</b></span> command into the <tt class="filename">2</tt> subdirectory. You can check this
1096again with <span><b class="command">smbclient</b></span>:
1097</p><pre class="screen">
1098<tt class="prompt">root# </tt><b class="userinput"><tt>smbclient //SAMBA-CUPS/print\$ -Uroot%xx \
1099	-c 'cd W32X86;dir;pwd;cd 2;dir;pwd'</tt></b>
1100 added interface ip=10.160.51.162 bcast=10.160.51.255 nmask=255.255.252.0
1101 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a]
1102
1103  Current directory is \\SAMBA-CUPS\print$\W32X86\
1104  .                                  D        0  Sun May  4 04:32:48 2003
1105  ..                                 D        0  Thu Apr 10 23:47:40 2003
1106  2                                   D        0  Sun May  4 04:32:48 2003
1107                40976 blocks of size 262144. 731 blocks available 
1108
1109  Current directory is \\SAMBA-CUPS\print$\W32X86\2\
1110  .                                  D        0  Sun May  4 04:32:48 2003
1111  ..                                 D        0  Sun May  4 04:32:48 2003
1112  DigiMaster.PPD                      A   148336  Thu Apr 24 01:07:00 2003
1113  ADOBEPS5.DLL                        A   434400  Sat May  3 23:18:45 2003
1114  laserjet4.ppd                       A     9639  Thu Apr 24 01:05:32 2003
1115  ADOBEPSU.DLL                        A   109568  Sat May  3 23:18:45 2003
1116  ADOBEPSU.HLP                        A    18082  Sat May  3 23:18:45 2003
1117  PDFcreator2.PPD                     A    15746  Sun Apr 20 22:24:07 2003
1118  HDNIS01Aux.dll                      A    15356  Sun May  4 04:32:18 2003
1119  Hddm91c1KMMin.DLL                   A    46966  Sun May  4 04:32:18 2003
1120  HDNIS01_de.DLL                      A   434400  Sun May  4 04:32:18 2003
1121  HDNIS01_de.NTF                      A   790404  Sun May  4 04:32:18 2003
1122  Hddm91c1_de.DLL                     A   876544  Sun May  4 04:32:18 2003
1123  Hddm91c1_de.INI                     A      101  Sun May  4 04:32:18 2003
1124  Hddm91c1_de.dat                     A     5044  Sun May  4 04:32:18 2003
1125  Hddm91c1_de.def                     A      428  Sun May  4 04:32:18 2003
1126  Hddm91c1_de.hlp                     A    37699  Sun May  4 04:32:18 2003
1127  Hddm91c1_de.hre                     A   323584  Sun May  4 04:32:18 2003
1128  Hddm91c1_de.ppd                     A    26373  Sun May  4 04:32:18 2003
1129  Hddm91c1_de.vnd                     A    45056  Sun May  4 04:32:18 2003
1130  HDNIS01U_de.DLL                     A   165888  Sun May  4 04:32:18 2003
1131  HDNIS01U_de.HLP                     A    19770  Sun May  4 04:32:18 2003
1132  Hddm91c1_de_reg.HLP                 A   228417  Sun May  4 04:32:18 2003
1133                40976 blocks of size 262144. 731 blocks available
1134</pre><p>
1135Another verification is that the timestamp of the printing TDB files is now updated
1136(and possibly their file size has increased).
1137</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2575149"></a>Check Samba for Driver Recognition</h4></div></div></div><p>
1138Now the driver should be registered with Samba. We can easily verify this, and will do so in a
1139moment. However, this driver is not yet associated with a particular printer. We may check the driver
1140status of the files by at least three methods:
1141</p><div class="itemizedlist"><ul type="disc"><li><p>
1142	From any Windows client browse Network Neighborhood, find the Samba host and open the Samba
1143	<span class="guiicon">Printers and Faxes</span> folder. Select any printer icon, right-click and select
1144	the printer <span class="guimenuitem">Properties</span>. Click the <span class="guilabel">Advanced</span>
1145	tab. Here is a field indicating the driver for that printer. A drop-down menu allows you to
1146	change that driver (be careful not to do this unwittingly). You can use this list to view
1147	all drivers known to Samba. Your new one should be among them. (Each type of client will only
1148	see his own architecture's list. If you do not have every driver installed for each platform,
1149	the list will differ if you look at it from Windows95/98/ME or Windows NT/2000/XP.)
1150	</p></li><li><p>
1151	From a Windows 200x/XP client (not Windows NT) browse <span class="guiicon">Network Neighborhood</span>,
1152	search for the Samba server and open the server's <span class="guiicon">Printers</span> folder,
1153	right-click on the white background (with no printer highlighted). Select <span class="guimenuitem">Server
1154	Properties</span>. On the <span class="guilabel">Drivers</span> tab you will see the new driver
1155	listed. This view enables you to also inspect the list of files belonging to that driver
1156	(this does not work on Windows NT, but only on Windows 2000 and Windows XP; Windows NT does not
1157	provide the <span class="guimenuitem">Drivers</span> tab). An
1158	alternative and much quicker method for
1159	Windows 2000/XP to start this dialog is by typing into a DOS box (you must of course adapt the
1160	name to your Samba server instead of <i class="replaceable"><tt>SAMBA-CUPS</tt></i>):
1161	</p><p><b class="userinput"><tt>rundll32 printui.dll,PrintUIEntry /s /t2 /n\\<i class="replaceable"><tt>SAMBA-CUPS</tt></i></tt></b></p></li><li><p>
1162	From a UNIX prompt, run this command (or a variant thereof) where
1163	<i class="replaceable"><tt>SAMBA-CUPS</tt></i> is the name of the Samba host and xxxx represents the
1164	actual Samba password assigned to root:
1165	</p><p><b class="userinput"><tt>rpcclient -U'root%xxxx' -c 'enumdrivers' <i class="replaceable"><tt>SAMBA-CUPS</tt></i></tt></b></p><p>
1166	You will see a listing of all drivers Samba knows about. Your new one should be among
1167	them. But it is only listed under the <i class="parameter"><tt>[Windows NT x86]</tt></i> heading, not under
1168	<i class="parameter"><tt>[Windows 4.0]</tt></i>, since you didn't install that part. Or did you?
1169	You will see a listing of all drivers Samba knows about. Your new one should be among them. In
1170	our example it is named <tt class="constant">dm9110</tt>. Note that the third column shows the other
1171	installed drivers twice, one time for each supported architecture. Our new driver only shows up
1172	for <span class="application">Windows NT 4.0 or 2000</span>. To have it present for <span class="application">Windows
1173	95, 98 and ME</span>, you'll have to repeat the whole procedure with the WIN40 architecture
1174	and subdirectory.
1175	</p></li></ul></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2575320"></a>Specific Driver Name Flexibility</h4></div></div></div><p>
1176You can name the driver as you like. If you repeat the <span><b class="command">adddriver</b></span> step with the same
1177files as before but with a different driver name, it will work the same:
1178</p><pre class="screen">
1179<tt class="prompt">root# </tt><b class="userinput"><tt>rpcclient -Uroot%xxxx         \
1180  -c 'adddriver "Windows NT x86"                     \
1181  "mydrivername:HDNIS01_de.DLL:              \
1182  Hddm91c1_de.ppd:HDNIS01U_de.DLL:HDNIS01U_de.HLP:   \
1183  NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI,          \
1184  Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre,   \
1185  Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL, \
1186  HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP' SAMBA-CUPS
1187  </tt></b>
1188
1189cmd = adddriver "Windows NT x86" \
1190 "mydrivername:HDNIS01_de.DLL:Hddm91c1_de.ppd:HDNIS01U_de.DLL:\
1191  HDNIS01U_de.HLP:NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI,           \
1192  Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre,                    \
1193  Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL,                  \
1194  HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP"
1195
1196Printer Driver mydrivername successfully installed.
1197</pre><p>
1198You will be able to bind that driver to any print queue (however, you are responsible that
1199you associate drivers to queues that make sense with respect to target printers). You cannot run the
1200<span><b class="command">rpcclient</b></span> <span><b class="command">adddriver</b></span> command repeatedly. Each run consumes the
1201files you had put into the <i class="parameter"><tt>[print$]</tt></i> share by moving them into the
1202respective subdirectories. So you must execute an <span><b class="command">smbclient ... put</b></span> command before
1203each <span><b class="command">rpcclient ... adddriver</b></span> command.
1204</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2575409"></a>Running <span><b class="command">rpcclient</b></span> with the <span><b class="command">setdriver</b></span></h4></div></div></div><p>
1205Samba needs to know which printer owns which driver. Create a mapping of the driver to a printer, and
1206store this info in Samba's memory, the TDB files. The <span><b class="command">rpcclient setdriver</b></span> command
1207achieves exactly this:
1208</p><pre class="screen">
1209<tt class="prompt">root# </tt><b class="userinput"><tt>rpcclient -U'root%xxxx' -c 'setdriver dm9110 mydrivername' <i class="replaceable"><tt>SAMBA-CUPS</tt></i></tt></b>
1210 cmd = setdriver dm9110 mydrivername
1211
1212Successfully set dm9110 to driver mydrivername.
1213</pre><p>
1214Ah, no, I did not want to do that. Repeat, this time with the name I intended: 
1215</p><pre class="screen">
1216<tt class="prompt">root# </tt><b class="userinput"><tt>rpcclient -U'root%xxxx' -c 'setdriver dm9110 dm9110' <i class="replaceable"><tt>SAMBA-CUPS</tt></i></tt></b>
1217 cmd = setdriver dm9110 dm9110
1218Successfully set dm9110 to driver dm9110.
1219</pre><p>
1220The syntax of the command is:
1221</p><pre class="screen">
1222<b class="userinput"><tt>rpcclient -U'root%<i class="replaceable"><tt>sambapassword</tt></i>' -c 'setdriver <i class="replaceable"><tt>printername</tt></i> \
1223 <i class="replaceable"><tt>drivername</tt></i>' <i class="replaceable"><tt>SAMBA-Hostname</tt></i></tt></b>. 
1224</pre><p>
1225Now we have done most of the work, but not all of it.
1226</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
1227The <span><b class="command">setdriver</b></span> command will only succeed if the
1228printer is already known to Samba. A
1229bug in 2.2.x prevented Samba from recognizing freshly installed printers. You had to restart Samba,
1230or at least send an HUP signal to all running smbd processes to work around this: <b class="userinput"><tt>kill -HUP
1231`pidof smbd`</tt></b>.
1232</p></div></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2575540"></a>Client Driver Installation Procedure</h2></div></div></div><p>
1233As Don Quixote said: &#8220;<span class="quote"><span class="emphasis"><em>The proof of the pudding is in the eating.</em></span></span>&#8221; The proof
1234for our setup lies in the printing. So let's install the printer driver onto the client PCs. This is
1235not as straightforward as it may seem. Read on.
1236</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2575558"></a>First Client Driver Installation</h3></div></div></div><p>
1237Especially important is the installation onto the first client PC (for each architectural platform
1238separately). Once this is done correctly, all further clients are easy to setup and shouldn't need further
1239attention. What follows is a description for the recommended first procedure. You work now from a client
1240workstation. You should guarantee that your connection is not unwittingly mapped to <span class="emphasis"><em>bad
1241user</em></span> nobody. In a DOS box type:
1242</p><p><b class="userinput"><tt>net use \\<i class="replaceable"><tt>SAMBA-SERVER</tt></i>\print$ /user:root</tt></b></p><p>
1243Replace root, if needed, by another valid <a class="indexterm" name="id2575592"></a>printer admin user as given in
1244the definition. Should you already be connected as a different user, you will get an error message. There
1245is no easy way to get rid of that connection, because Windows does not seem to know a concept of logging
1246off from a share connection (do not confuse this with logging off from the local workstation; that is
1247a different matter).  On Windows NT/2K, you can force a logoff from all smb/cifs connections by restarting the 
1248&#8220;<span class="quote"><span class="emphasis"><em>workstation</em></span></span>&#8221; service. You can try to close all Windows file explorer and Internet Explorer for 
1249Windows. As a last resort, you may have to reboot. Make sure there is no automatic reconnection set up. It may be
1250easier to go to a different workstation and try from there. After you have made sure you are connected
1251as a printer admin user (you can check this with the <span><b class="command">smbstatus</b></span> command on Samba),
1252do this from the Windows workstation:
1253</p><div class="procedure"><ol type="1"><li><p>
1254	Open <span class="guiicon">Network Neighborhood</span>.
1255	</p></li><li><p>
1256	Browse to Samba server.
1257	</p></li><li><p>
1258	Open its <span class="guiicon">Printers and Faxes</span> folder.
1259	</p></li><li><p>
1260	Highlight and right-click on the printer.
1261	</p></li><li><p>
1262	Select <span class="guimenuitem">Connect</span> (for Windows NT4/200x
1263	it is possibly <span class="guimenuitem">Install</span>).
1264	</p></li></ol></div><p>
1265A new printer (named <i class="replaceable"><tt>printername</tt></i> on Samba-server) should now have
1266appeared in your <span class="emphasis"><em>local</em></span> Printer folder (check <span class="guimenu">Start</span> --
1267<span class="guimenuitem">Settings</span> -- <span class="guimenuitem">Control Panel</span> -- <span class="guiicon">Printers
1268and Faxes</span>).
1269</p><p>
1270Most likely you are now tempted to try to print a test page. After all, you now can open the printer
1271properties, and on the <span class="guimenu">General</span> tab there is a button offering to do just that. But
1272chances are that you get an error message saying <span class="errorname">Unable to print Test Page</span>. The
1273reason might be that there is not yet a valid Device Mode set for the driver, or that the &#8220;<span class="quote"><span class="emphasis"><em>Printer
1274Driver Data</em></span></span>&#8221; set is still incomplete.
1275</p><p>
1276You must make sure that a valid <i class="parameter"><tt>Device Mode</tt></i> is set for the
1277driver. We now explain what that means.
1278</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2575759"></a>Setting Device Modes on New Printers</h3></div></div></div><p>
1279For a printer to be truly usable by a Windows NT/200x/XP client, it must possess:
1280</p><div class="itemizedlist"><ul type="disc"><li><p>
1281	A valid <span class="emphasis"><em>Device Mode</em></span> generated by the driver for the printer (defining things
1282	like paper size, orientation and duplex settings).
1283	</p></li><li><p>
1284	A complete set of <span class="emphasis"><em>Printer Driver Data</em></span> generated by the driver.
1285	</p></li></ul></div><p>
1286If either of these is incomplete, the clients can produce less than optimal output at best. In the
1287worst cases, unreadable garbage or nothing at all comes from the printer or it produces a harvest of
1288error messages when attempting to print. Samba stores the named values and all printing related information in
1289its internal TDB database files <tt class="filename">(ntprinters.tdb</tt>, <tt class="filename">ntdrivers.tdb</tt>,
1290<tt class="filename">printing.tdb</tt> and <tt class="filename">ntforms.tdb</tt>).
1291</p><p>
1292What do these two words stand for? Basically, the Device Mode and the set of Printer Driver Data is a
1293collection of settings for all print queue properties, initialized in a sensible way. Device Modes and
1294Printer Driver Data should initially be set on the print server (the Samba host) to healthy
1295values so the clients can start to use them immediately. How do we set these initial healthy values?
1296This can be achieved by accessing the drivers remotely from an NT (or 200x/XP) client, as is discussed
1297in the following paragraphs.
1298</p><p>
1299Be aware that a valid Device Mode can only be initiated by a
1300<a class="indexterm" name="id2575849"></a>printer admin, or root
1301(the reason should be obvious). Device Modes can only be correctly
1302set by executing the printer driver program itself. Since Samba cannot execute this Win32 platform driver
1303code, it sets this field initially to NULL (which is not a valid setting for clients to use). Fortunately,
1304most drivers automatically generate the Printer Driver Data that is needed when they are uploaded to the
1305<i class="parameter"><tt>[print$]</tt></i> share with the help of the APW or rpcclient.
1306</p><p>
1307The generation and setting of a first valid Device Mode, however, requires some tickling from a client,
1308to set it on the Samba server. The easiest means of doing so is to simply change the page orientation on
1309the server's printer. This executes enough of the printer driver program on the client for the desired
1310effect to happen, and feeds back the new Device Mode to our Samba server. You can use the native Windows
1311NT/200x/XP printer properties page from a Window client for this:
1312</p><div class="procedure"><ol type="1"><li><p>
1313	Browse the <span class="guiicon">Network Neighborhood.</span>
1314	</p></li><li><p>
1315	Find the Samba server.
1316	</p></li><li><p>
1317	Open the Samba server's <span class="guiicon">Printers and Faxes</span> folder.
1318	</p></li><li><p>
1319	Highlight the shared printer in question.
1320	</p></li><li><p>
1321	Right-click on the printer (you may already be here, if you followed the last section's description).
1322	</p></li><li><p>
1323	At the bottom of the context menu select <span class="guimenu">Properties</span> (if the menu still offers the 
1324	<span class="guimenuitem">Connect</span> entry further above, you
1325	need to click on that one first to achieve the driver
1326	installation as shown in the last section).
1327	</p></li><li><p>
1328	Go to the <span class="guilabel">Advanced</span> tab; click on <span class="guibutton">Printing Defaults</span>.
1329	</p></li><li><p>
1330	Change the <span class="guimenuitem">Portrait</span> page setting to <span class="guimenuitem">Landscape</span> (and back).
1331	</p></li><li><p>
1332	Make sure to apply changes between swapping the page orientation to cause the change to actually take effect.
1333	</p></li><li><p>
1334	While you are at it, you may also want to set the desired printing defaults here, which then apply to all future
1335	client driver installations on the remaining from now on.
1336	</p></li></ol></div><p>
1337This procedure has executed the printer driver program on the client platform and fed back the correct
1338Device Mode to Samba, which now stored it in its TDB files. Once the driver is installed on the client,
1339you can follow the analogous steps by accessing the <span class="emphasis"><em>local</em></span> <span class="guiicon">Printers</span>
1340folder, too, if you are a Samba printer admin user. From now on, printing should work as expected.
1341</p><p>
1342Samba includes a service level parameter name <i class="parameter"><tt>default devmode</tt></i> for generating a default
1343Device Mode for a printer. Some drivers will function well with Samba's default set of properties. Others
1344may crash the client's spooler service. So use this parameter with caution. It is always better to have
1345the client generate a valid device mode for the printer and store it on the server for you.
1346</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2576048"></a>Additional Client Driver Installation</h3></div></div></div><p>
1347Every additional driver may be installed, along the lines described
1348above. Browse network, open the
1349<span class="guiicon">Printers</span> folder on Samba server, right-click on <span class="guiicon">Printer</span> and choose
1350<span class="guimenuitem">Connect...</span>. Once this completes (should be not more than a few seconds,
1351but could also take a minute, depending on network conditions), you should find the new printer in your
1352client workstation local <span class="guiicon">Printers and Faxes</span> folder.
1353</p><p>
1354You can also open your local <span class="guiicon">Printers and Faxes</span> folder by
1355using this command on Windows 200x/XP Professional workstations:
1356</p><p><b class="userinput"><tt>rundll32 shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder</tt></b></p><p>
1357or this command on Windows NT 4.0 workstations:
1358</p><p><b class="userinput"><tt>
1359rundll32 shell32.dll,Control_RunDLL MAIN.CPL @2
1360</tt></b></p><p>
1361You can enter the commands either inside a <span class="guilabel">DOS box</span> window or in the <span class="guimenuitem">Run
1362command...</span> field from the <span class="guimenu">Start</span> menu.
1363</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2576141"></a>Always Make First Client Connection as root or &#8220;<span class="quote"><span class="emphasis"><em>printer admin</em></span></span>&#8221;</h3></div></div></div><p>
1364After you installed the driver on the Samba server (in its <i class="parameter"><tt>[print$]</tt></i>
1365share, you should always make sure that your first client installation completes correctly. Make it a
1366habit for yourself to build the very first connection from a client as <a class="indexterm" name="id2576163"></a>printer admin. This is to make sure that:
1367</p><div class="itemizedlist"><ul type="disc"><li><p>
1368	A first valid <span class="emphasis"><em>Device Mode</em></span> is really initialized (see above for more
1369	explanation details).
1370	</p></li><li><p>	
1371	The default print settings of your printer for all further client installations are as you want them.
1372	</p></li></ul></div><p>
1373Do this by changing the orientation to landscape, click on <span class="guiicon">Apply</span>, and then change it
1374back again. Next, modify the other settings (for example, you do not want the default media size set to
1375<span class="guiicon">Letter</span> when you are all using <span class="guiicon">A4</span>, right? You may want to set the
1376printer for <span class="guiicon">duplex</span> as the default, and so on).
1377</p><p>
1378To connect as root to a Samba printer, try this command from a Windows 200x/XP DOS box command prompt:
1379</p><pre class="screen">
1380<tt class="prompt">C:\&gt; </tt><b class="userinput"><tt>runas /netonly /user:root "rundll32 printui.dll,PrintUIEntry /p /t3 /n 
1381	\\<i class="replaceable"><tt>SAMBA-SERVER</tt></i>\<i class="replaceable"><tt>printername</tt></i>"</tt></b>
1382</pre><p>
1383</p><p>
1384You will be prompted for root's Samba-password; type it, wait a few
1385seconds, click on <span class="guibutton">Printing
1386Defaults</span>, and proceed to set the job options that should be used as defaults by all
1387clients. Alternately, instead of root you can name one other member of the <a class="indexterm" name="id2576266"></a>printer admin from the setting.
1388</p><p>
1389	Now all the other users downloading and installing the driver the same way (called
1390&#8220;<span class="quote"><span class="emphasis"><em>Point'n'Print</em></span></span>&#8221;) will have the same defaults set for them. If you miss this step
1391you'll get a lot of Help Desk calls from your users, but maybe you like to talk to people.
1392</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2576291"></a>Other Gotchas</h2></div></div></div><p>
1393Your driver is installed. It is now ready for Point'n'Print
1394installation by the clients. You may have tried to download and use it
1395onto your first client machine, but
1396wait. Let's make sure you are acquainted first with a few tips and tricks you may find useful. For example,
1397suppose you did not set the defaults on the printer, as advised in the preceding
1398paragraphs. Your users complain about various issues (such as, &#8220;<span class="quote"><span class="emphasis"><em>We need to set the paper size
1399for each job from Letter to A4 and it will not store it.</em></span></span>&#8221;)
1400</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2576313"></a>Setting Default Print Options for Client Drivers</h3></div></div></div><p>
1401The last sentence might be viewed with mixed feelings by some users and
1402Admins. They have struggled for hours and could not arrive at a point
1403where their settings seemed to be saved. It is not their fault. The confusing
1404thing is that in the multi-tabbed dialog that pops up when you right-click
1405on the printer name and select <span class="guimenuitem">Properties</span>, you
1406can arrive at two dialogs that appear identical, each claiming that they help
1407you to set printer options in three different ways. Here is the definite
1408answer to the Samba default driver setting FAQ:
1409</p><p><b>&#8220;<span class="quote"><span class="emphasis"><em>I can not set and save default print options
1410for all users on Windows 200x/XP. Why not?</em></span></span>&#8221;.�</b>
1411How are you doing it? I bet the wrong way. (It is not easy to find out, though). There are three different
1412ways to bring you to a dialog that seems to set everything. All three
1413dialogs look the same, but only one
1414of them does what you intend. You need to be Administrator or Print Administrator to do this for all
1415users. Here is how I reproduce it in an XP Professional:
1416</p><div class="orderedlist"><ol type="A"><li><p>The first &#8220;<span class="quote"><span class="emphasis"><em>wrong</em></span></span>&#8221; way:
1417	</p><div class="orderedlist"><ol type="1"><li><p>Open the <span class="guiicon">Printers</span> folder.</p></li><li><p>Right-click on the printer (<span class="emphasis"><em>remoteprinter on cupshost</em></span>) and
1418		select in context menu <span class="guimenu">Printing Preferences...</span>.</p></li><li><p>Look at this dialog closely and remember what it looks like.</p></li></ol></div></li><li><p>The second &#8220;<span class="quote"><span class="emphasis"><em>wrong</em></span></span>&#8221; way:
1419		</p><div class="orderedlist"><ol type="1"><li><p>Open the <span class="guimenu">Printers</span> folder.</p></li><li><p>Right-click on the printer (<span class="emphasis"><em>remoteprinter on
1420			cupshost</em></span>) and select in the context menu
1421			<span class="guimenuitem">Properties</span></p></li><li><p>Click on the <span class="guilabel">General</span>
1422			tab.</p></li><li><p>Click on the <span class="guibutton">Printing
1423			Preferences...</span> button.</p></li><li><p>A new dialog opens. Keep this dialog open and go back
1424			to the parent dialog.</p></li></ol></div><p>
1425	</p></li><li><p>
1426	The third and correct way: (should you do this from the beginning, just carry out steps 1
1427	and 2 from the second method above).
1428	</p><div class="orderedlist"><ol type="1"><li><p>Click on the <span class="guilabel">Advanced</span>
1429			tab. (If everything is &#8220;<span class="quote"><span class="emphasis"><em>grayed out,</em></span></span>&#8221; then you are not logged
1430			in as a user with enough privileges).</p></li><li><p>Click on the <span class="guibutton">Printing
1431			Defaults</span> button.</p></li><li><p>On any of the two new tabs,
1432			click on the
1433			<span class="guilabel">Advanced</span> button.</p></li><li><p>A new dialog opens. Compare
1434			this one to the other. Are they
1435			identical looking comparing one from
1436			&#8220;<span class="quote"><span class="emphasis"><em>B.5</em></span></span>&#8221; and one from A.3".</p></li></ol></div></li></ol></div><p>
1437Do you see any difference in the two settings dialogs? I do not either. However, only the last one, which
1438you arrived at with steps C.1 through 6 will permanently save any settings which will then become the defaults
1439for new users. If you want all clients to have the same defaults, you need to conduct these steps as
1440administrator (<a class="indexterm" name="id2576562"></a>printer admin in ) before
1441a client downloads the driver (the clients can later set their own per-user defaults
1442by following procedures A or B above). Windows 200x/XP allow per-user default settings and the ones the
1443administrator gives them, before they set up their own. The parents of the identically-looking dialogs have a slight difference in their window names; one is called <tt class="computeroutput">Default Print
1444Values for Printer Foo on Server Bar"</tt> (which is the one you need) and the other is called
1445&#8220;<span class="quote"><span class="emphasis"><em><tt class="computeroutput">Print Settings for Printer Foo on Server Bar</tt></em></span></span>&#8221;. The last one is the one you
1446arrive at when you right-click on the printer and select <span class="guimenuitem">Print Settings...</span>. This
1447is the one that you were taught to use back in the days of Windows NT, so it is only natural to try the
1448same way with Windows 200x/XP. You would not dream that there is now a different path to arrive at an
1449identically looking, but functionally different, dialog to set defaults for all users.
1450</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p>Try (on Windows 200x/XP) to run this command (as a user with the right privileges):
1451</p><p><b class="userinput"><tt>
1452rundll32 printui.dll,PrintUIEntry /p /t3 /n\\<i class="replaceable"><tt>SAMBA-SERVER</tt></i>\<i class="replaceable"><tt>printersharename</tt></i>
1453</tt></b></p><p>
1454To see the tab with the <span class="guilabel">Printing Defaults</span> button (the one you need),also run this command:
1455</p><p><b class="userinput"><tt>
1456rundll32 printui.dll,PrintUIEntry /p /t0 /n\\<i class="replaceable"><tt>SAMBA-SERVER</tt></i>\<i class="replaceable"><tt>printersharename</tt></i>
1457</tt></b></p><p>
1458To see the tab with the <span class="guilabel">Printing Preferences</span>
1459button (the one which does not set system-wide defaults), you can
1460start the commands from inside a DOS box" or from <span class="guimenu">Start</span> -&gt; <span class="guimenuitem">Run</span>.
1461</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2576676"></a>Supporting Large Numbers of Printers</h3></div></div></div><p>
1462One issue that has arisen during the recent development phase of Samba is the need to support driver
1463downloads for hundreds of printers. Using Windows NT APW here is somewhat awkward (to say the least). If
1464you do not want to acquire RSS pains from the printer installation clicking orgy alone, you need
1465to think about a non-interactive script.
1466</p><p>
1467If more than one printer is using the same driver, the <span><b class="command">rpcclient setdriver</b></span>
1468command can be used to set the driver associated with an installed queue. If the driver is uploaded to
1469<i class="parameter"><tt>[print$]</tt></i> once and registered with the printing TDBs, it can be used by
1470multiple print queues. In this case, you just need to repeat the <span><b class="command">setprinter</b></span> subcommand of
1471<span><b class="command">rpcclient</b></span> for every queue (without the need to conduct the <span><b class="command">adddriver</b></span>
1472repeatedly). The following is an example of how this could be accomplished:
1473</p><pre class="screen">
1474<tt class="prompt">root# </tt><b class="userinput"><tt>rpcclient <i class="replaceable"><tt>SAMBA-CUPS</tt></i> -U root%<i class="replaceable"><tt>secret</tt></i> -c 'enumdrivers'</tt></b>
1475 cmd = enumdrivers
1476 
1477 [Windows NT x86]
1478 Printer Driver Info 1:
1479   Driver Name: [infotec  IS 2075 PCL 6]
1480 
1481 Printer Driver Info 1:
1482   Driver Name: [DANKA InfoStream]
1483 
1484 Printer Driver Info 1:
1485   Driver Name: [Heidelberg Digimaster 9110 (PS)]
1486 
1487 Printer Driver Info 1:
1488   Driver Name: [dm9110]
1489
1490 Printer Driver Info 1:
1491   Driver Name: [mydrivername]
1492
1493 [....]
1494</pre><p>
1495
1496</p><pre class="screen">
1497<tt class="prompt">root# </tt><b class="userinput"><tt>rpcclient <i class="replaceable"><tt>SAMBA-CUPS</tt></i> -U root%<i class="replaceable"><tt>secret</tt></i> -c 'enumprinters'</tt></b>
1498 cmd = enumprinters
1499   flags:[0x800000]
1500   name:[\\SAMBA-CUPS\dm9110]
1501   description:[\\SAMBA-CUPS\dm9110,,110ppm HiVolume DANKA Stuttgart]
1502   comment:[110 ppm HiVolume DANKA Stuttgart]
1503 [....]
1504</pre><p>
1505
1506</p><pre class="screen">
1507<tt class="prompt">root# </tt><b class="userinput"><tt>rpcclient <i class="replaceable"><tt>SAMBA-CUPS</tt></i> -U root%<i class="replaceable"><tt>secret</tt></i> -c \
1508  'setdriver <i class="replaceable"><tt>dm9110</tt></i> "<i class="replaceable"><tt>Heidelberg Digimaster 9110 (PS)</tt></i>"'</tt></b>
1509 cmd = setdriver dm9110 Heidelberg Digimaster 9110 (PPD)
1510 Successfully set dm9110 to driver Heidelberg Digimaster 9110 (PS).
1511</pre><p>
1512
1513</p><pre class="screen">
1514<tt class="prompt">root# </tt><b class="userinput"><tt>rpcclient <i class="replaceable"><tt>SAMBA-CUPS</tt></i> -U root%<i class="replaceable"><tt>secret</tt></i> -c 'enumprinters'</tt></b>
1515 cmd = enumprinters
1516   flags:[0x800000]
1517   name:[\\SAMBA-CUPS\dm9110]
1518   description:[\\SAMBA-CUPS\dm9110,Heidelberg Digimaster 9110 (PS),\
1519     110ppm HiVolume DANKA Stuttgart]
1520   comment:[110ppm HiVolume DANKA Stuttgart]
1521 [....]
1522</pre><p>
1523
1524</p><pre class="screen">
1525<tt class="prompt">root# </tt><b class="userinput"><tt>rpcclient <i class="replaceable"><tt>SAMBA-CUPS</tt></i> -U root%<i class="replaceable"><tt>secret</tt></i> -c 'setdriver <i class="replaceable"><tt>dm9110</tt></i> <i class="replaceable"><tt>mydrivername</tt></i>'</tt></b>
1526 cmd = setdriver dm9110 mydrivername
1527 Successfully set dm9110 to mydrivername.
1528</pre><p>
1529
1530</p><pre class="screen">
1531<tt class="prompt">root# </tt><b class="userinput"><tt>rpcclient <i class="replaceable"><tt>SAMBA-CUPS</tt></i> -U root%<i class="replaceable"><tt>secret</tt></i> -c 'enumprinters'</tt></b>
1532 cmd = enumprinters
1533   flags:[0x800000]
1534   name:[\\SAMBA-CUPS\dm9110]
1535   description:[\\SAMBA-CUPS\dm9110,mydrivername,\
1536     110ppm HiVolume DANKA Stuttgart]
1537   comment:[110ppm HiVolume DANKA Stuttgart]
1538 [....]
1539</pre><p>
1540It may not be easy to recognize that the first call to <span><b class="command">enumprinters</b></span> showed the
1541&#8220;<span class="quote"><span class="emphasis"><em>dm9110</em></span></span>&#8221; printer with an empty string where the driver should have been listed (between
1542the 2 commas in the description field). After the <span><b class="command">setdriver</b></span> command
1543succeeded, all is well.
1544</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2576934"></a>Adding New Printers with the Windows NT APW</h3></div></div></div><p>
1545By default, Samba exhibits all printer shares defined in <tt class="filename">smb.conf</tt> in the <span class="guiicon">Printers</span>
1546folder. Also located in this folder is the Windows NT Add Printer Wizard icon. The APW will be shown only if:
1547</p><div class="itemizedlist"><ul type="disc"><li><p>
1548	The connected user is able to successfully execute an <span><b class="command">OpenPrinterEx(\\server)</b></span> with
1549	administrative privileges (i.e., root or <a class="indexterm" name="id2576971"></a>printer admin).
1550	</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p> Try this from a Windows 200x/XP DOS box command prompt:
1551	</p><p><b class="userinput"><tt>
1552	runas /netonly /user:root rundll32 printui.dll,PrintUIEntry /p /t0 /n \\<i class="replaceable"><tt>SAMBA-SERVER</tt></i>\<i class="replaceable"><tt>printersharename</tt></i>
1553	</tt></b></p><p>
1554	Click on <span class="guibutton">Printing Preferences</span>.
1555	</p></div></li><li><p>... contains the setting
1556	<a class="indexterm" name="id2577013"></a>show add printer wizard = yes (the
1557	default).</p></li></ul></div><p>
1558The APW can do various things:
1559</p><div class="itemizedlist"><ul type="disc"><li><p>
1560	Upload a new driver to the Samba <i class="parameter"><tt>[print$]</tt></i> share.
1561	</p></li><li><p>
1562	Associate an uploaded driver with an existing (but still driverless) print queue.
1563	</p></li><li><p>
1564	Exchange the currently used driver for an existing print queue with one that has been uploaded before.
1565	</p></li><li><p>
1566	Add an entirely new printer to the Samba host (only in conjunction with a working
1567	<a class="indexterm" name="id2577057"></a>add printer command. A corresponding
1568	<a class="indexterm" name="id2577065"></a>delete printer command for removing entries from the
1569	<span class="guiicon">Printers</span> folder may also be provided).
1570	</p></li></ul></div><p>
1571The last one (add a new printer) requires more effort than the previous ones. To use
1572the APW to successfully add a printer to a Samba server, the <a class="indexterm" name="id2577086"></a>add printer command must have a defined value. The program hook must successfully
1573add the printer to the UNIX print system (i.e., to <tt class="filename">/etc/printcap</tt>,
1574<tt class="filename">/etc/cups/printers.conf</tt> or other appropriate files) and to <tt class="filename">smb.conf</tt> if necessary.
1575</p><p>
1576When using the APW from a client, if the named printer share does not exist, smbd will execute the
1577<a class="indexterm" name="id2577120"></a>add printer command and re-parse to the to attempt to locate the new printer
1578share. If the share is still not defined, an error of <span class="errorname">Access Denied</span> is returned to
1579the client. The <a class="indexterm" name="id2577133"></a>add printer command is executed
1580under the context of the connected user, not necessarily a root account. A <a class="indexterm" name="id2577142"></a>map to guest = bad user may have connected you unwittingly under the wrong
1581privilege. You should check it by using the <span><b class="command">smbstatus</b></span> command.
1582</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2577159"></a>Error Message: &#8220;<span class="quote"><span class="emphasis"><em><span class="errorname">Cannot connect under a different Name</span></em></span></span>&#8221;</h3></div></div></div><p>
1583Once you are connected with the wrong credentials, there is no means to reverse the situation other than
1584to close all Explorer Windows, and perhaps reboot.
1585</p><div class="itemizedlist"><ul type="disc"><li><p>
1586	The <span><b class="command">net use \\SAMBA-SERVER\sharename /user:root</b></span> gives you an error message:
1587	&#8220;<span class="quote"><span class="emphasis"><em>Multiple connections to a server or a shared resource by the same user utilizing
1588	the several user names are not allowed. Disconnect all previous connections to the server,
1589	esp. the shared resource, and try again.</em></span></span>&#8221;
1590	</p></li><li><p>
1591	Every attempt to &#8220;<span class="quote"><span class="emphasis"><em>connect a network drive</em></span></span>&#8221; to <tt class="filename">\\SAMBASERVER\\print$</tt>
1592	to <tt class="constant">z:</tt> is countered by the pertinacious message: &#8220;<span class="quote"><span class="emphasis"><em>This
1593	network folder is currently connected under different credentials (username and password).
1594	Disconnect first any existing connection to this network share in order to connect again under
1595	a different username and password</em></span></span>&#8221;.
1596	</p></li></ul></div><p>
1597So you close all connections. You try again. You get the same message. You check from the Samba side,
1598using <span><b class="command">smbstatus</b></span>. Yes, there are more connections. You kill them all. The client
1599still gives you the same error message. You watch the smbd.log file on a high debug level and try
1600reconnect. Same error message, but not a single line in the log. You start to wonder if there was a
1601connection attempt at all. You run ethereal and tcpdump while you try to connect. Result: not a single
1602byte goes on the wire. Windows still gives the error message. You close all Explorer windows and start it
1603again. You try to connect  and this times it works!  Windows seems to cache connection information somewhere and
1604does not keep it up-to-date (if you are unlucky you might need to reboot to get rid of the error message).
1605</p><p>
1606The easiest way to forcefully terminate all connections from your client to a server is by executing:
1607</p><pre class="screen">
1608<tt class="prompt">C:\&gt; </tt> net use * /delete
1609</pre><p>
1610This will disconnect all mapped drives also and will allow you create fresh connection as required.
1611</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2577272"></a>Take Care When Assembling Driver Files</h3></div></div></div><p>
1612You need to be extremely careful when you take notes about the files and belonging to a particular
1613driver. Don't confuse the files for driver version &#8220;<span class="quote"><span class="emphasis"><em>0</em></span></span>&#8221; (for Windows 9x/Me, going into
1614<tt class="filename">[print$]/WIN/0/</tt>), driver version <tt class="filename">2</tt> (Kernel Mode driver for Windows NT,
1615going into <tt class="filename">[print$]/W32X86/2/</tt> may be used on Windows 200x/XP also), and
1616driver version &#8220;<span class="quote"><span class="emphasis"><em>3</em></span></span>&#8221; (non-Kernel Mode driver going into <tt class="filename">[print$]/W32X86/3/</tt>
1617cannot be used on Windows NT). Quite often these different driver versions contain
1618files that have the same name but actually are very different. If you look at them from
1619the Windows Explorer (they reside in <tt class="filename">%WINDOWS%\system32\spool\drivers\W32X86\</tt>),
1620you will probably see names in capital letters, while an <span><b class="command">enumdrivers</b></span> command from Samba
1621would show mixed or lower case letters. So it is easy to confuse them. If you install them manually using
1622<span><b class="command">rpcclient</b></span> and subcommands, you may even succeed without an error message. Only later,
1623when you try install on a client, you will encounter error messages like <tt class="computeroutput">This server
1624has no appropriate driver for the printer</tt>.
1625</p><p>
1626Here is an example. You are invited to look closely at the various files, compare their names and
1627their spelling, and discover the differences in the composition of the version 2 and 3 sets. Note: the
1628version 0 set contained 40 <i class="parameter"><tt>Dependentfiles</tt></i>, so I left it out for space reasons:
1629</p><pre class="screen">
1630<tt class="prompt">root# </tt><b class="userinput"><tt>rpcclient -U 'Administrator%<i class="replaceable"><tt>secret</tt></i>' -c 'enumdrivers 3' 10.160.50.8 </tt></b>
1631
1632 Printer Driver Info 3:
1633         Version: [3]
1634         Driver Name: [Canon iR8500 PS3]
1635         Architecture: [Windows NT x86]
1636         Driver Path: [\\10.160.50.8\print$\W32X86\3\cns3g.dll]
1637         Datafile: [\\10.160.50.8\print$\W32X86\3\iR8500sg.xpd]
1638         Configfile: [\\10.160.50.8\print$\W32X86\3\cns3gui.dll]
1639         Helpfile: [\\10.160.50.8\print$\W32X86\3\cns3g.hlp]
1640 
1641         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\aucplmNT.dll]
1642         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\ucs32p.dll]
1643         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\tnl32.dll]
1644         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\aussdrv.dll]
1645         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cnspdc.dll]
1646         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\aussapi.dat]
1647         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cns3407.dll]
1648         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\CnS3G.cnt]
1649         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\NBAPI.DLL]
1650         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\NBIPC.DLL]
1651         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcview.exe]
1652         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcdspl.exe]
1653         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcedit.dll]
1654         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcqm.exe]
1655         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcspl.dll]
1656         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cfine32.dll]
1657         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcr407.dll]
1658         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\Cpcqm407.hlp]
1659         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcqm407.cnt]
1660         Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cns3ggr.dll]
1661 
1662         Monitorname: []
1663         Defaultdatatype: []
1664
1665 Printer Driver Info 3:
1666         Version: [2]
1667         Driver Name: [Canon iR5000-6000 PS3]
1668         Architecture: [Windows NT x86]
1669         Driver Path: [\\10.160.50.8\print$\W32X86\2\cns3g.dll]
1670         Datafile: [\\10.160.50.8\print$\W32X86\2\IR5000sg.xpd]
1671         Configfile: [\\10.160.50.8\print$\W32X86\2\cns3gui.dll]
1672         Helpfile: [\\10.160.50.8\print$\W32X86\2\cns3g.hlp]
1673 
1674         Dependentfiles: [\\10.160.50.8\print$\W32X86\2\AUCPLMNT.DLL]
1675         Dependentfiles: [\\10.160.50.8\print$\W32X86\2\aussdrv.dll]
1676         Dependentfiles: [\\10.160.50.8\print$\W32X86\2\cnspdc.dll]
1677         Dependentfiles: [\\10.160.50.8\print$\W32X86\2\aussapi.dat]
1678         Dependentfiles: [\\10.160.50.8\print$\W32X86\2\cns3407.dll]
1679         Dependentfiles: [\\10.160.50.8\print$\W32X86\2\CnS3G.cnt]
1680         Dependentfiles: [\\10.160.50.8\print$\W32X86\2\NBAPI.DLL]
1681         Dependentfiles: [\\10.160.50.8\print$\W32X86\2\NBIPC.DLL]
1682         Dependentfiles: [\\10.160.50.8\print$\W32X86\2\cns3gum.dll]
1683 
1684         Monitorname: [CPCA Language Monitor2]
1685         Defaultdatatype: []
1686
1687</pre><p>
1688If we write the &#8220;<span class="quote"><span class="emphasis"><em>version 2</em></span></span>&#8221; files and the &#8220;<span class="quote"><span class="emphasis"><em>version 3</em></span></span>&#8221; files
1689into different text files and compare the result, we see this
1690picture:
1691</p><pre class="screen">
1692<tt class="prompt">root# </tt><b class="userinput"><tt>sdiff 2-files 3-files</tt></b>
1693
1694
1695 cns3g.dll                     cns3g.dll
1696 iR8500sg.xpd                  iR8500sg.xpd
1697 cns3gui.dll                   cns3gui.dll
1698 cns3g.hlp                     cns3g.hlp
1699 AUCPLMNT.DLL                | aucplmNT.dll
1700                             &gt; ucs32p.dll
1701                             &gt; tnl32.dll
1702 aussdrv.dll                   aussdrv.dll
1703 cnspdc.dll                    cnspdc.dll
1704 aussapi.dat                   aussapi.dat
1705 cns3407.dll                   cns3407.dll
1706 CnS3G.cnt                     CnS3G.cnt
1707 NBAPI.DLL                     NBAPI.DLL
1708 NBIPC.DLL                     NBIPC.DLL
1709 cns3gum.dll                 | cpcview.exe
1710                             &gt; cpcdspl.exe 
1711                             &gt; cpcqm.exe
1712                             &gt; cpcspl.dll
1713                             &gt; cfine32.dll
1714                             &gt; cpcr407.dll
1715                             &gt; Cpcqm407.hlp
1716                             &gt; cpcqm407.cnt
1717                             &gt; cns3ggr.dll
1718
1719</pre><p>
1720
1721Do not be fooled! Driver files for each version with identical
1722names may be different in their content, as you can see from this size
1723comparison:
1724</p><pre class="screen">
1725<tt class="prompt">root# </tt><b class="userinput"><tt>for i in cns3g.hlp cns3gui.dll cns3g.dll; do                  \
1726           smbclient //10.160.50.8/print\$ -U 'Administrator%xxxx' \
1727           -c "cd W32X86/3; dir $i; cd .. ; cd 2; dir $i";      \
1728		   done</tt></b>
1729
1730  CNS3G.HLP               A   122981  Thu May 30 02:31:00 2002
1731  CNS3G.HLP               A    99948  Thu May 30 02:31:00 2002
1732
1733  CNS3GUI.DLL             A  1805824  Thu May 30 02:31:00 2002
1734  CNS3GUI.DLL             A  1785344  Thu May 30 02:31:00 2002
1735
1736  CNS3G.DLL               A  1145088  Thu May 30 02:31:00 2002
1737  CNS3G.DLL               A    15872  Thu May 30 02:31:00 2002
1738</pre><p>
1739In my example were even more differences than shown here. Conclusion: you must be careful to select
1740the correct driver files for each driver version. Don't rely on the
1741names alone and don't interchange files
1742belonging to different driver versions.
1743</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2577537"></a>Samba and Printer Ports</h3></div></div></div><p>
1744Windows NT/2000 print servers associate a port with each printer. These normally take the form of
1745<tt class="filename">LPT1:</tt>, <tt class="filename">COM1:</tt>,
1746<tt class="filename">FILE:</tt>, and so on. Samba must also
1747support the concept of ports associated with a printer. By default, only one printer port, named &#8220;<span class="quote"><span class="emphasis"><em>Samba
1748Printer Port</em></span></span>&#8221;, exists on a system. Samba does not really need such a &#8220;<span class="quote"><span class="emphasis"><em>port</em></span></span>&#8221; in order
1749to print; rather it is a requirement of Windows clients. They insist on being told about an available
1750port when they request this information, otherwise they throw an error message at you. So Samba fakes the port
1751information to keep the Windows clients happy.
1752</p><p>
1753Samba does not support the concept of <tt class="constant">Printer Pooling</tt> internally either. Printer
1754Pooling assigns a logical printer to multiple ports as a form of load balancing or fail over.
1755</p><p>
1756If you require multiple ports be defined for some reason or another (my users and my boss should not know
1757that they are working with Samba), configure <a class="indexterm" name="id2577597"></a>enumports command
1758which can be used to define an external program that generates a listing of ports on a system.
1759</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2577608"></a>Avoiding Common Client Driver Mis-configuration</h3></div></div></div><p>
1760So now the printing works, but there are still problems. Most jobs print well, some do not print at
1761all. Some jobs have problems with fonts, which do not look good. Some jobs print fast and some
1762are dead-slow. We cannot cover it all, but we want to encourage you to read the brief paragraph about
1763&#8220;<span class="quote"><span class="emphasis"><em>Avoiding the Wrong PostScript Driver Settings</em></span></span>&#8221; in the CUPS Printing part of this document.
1764</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2577631"></a>The Imprints Tool-set</h2></div></div></div><p>
1765The Imprints tool set provides a UNIX equivalent of the Windows NT Add Printer
1766Wizard. For complete information, please refer to the 
1767<a href="http://imprints.sourceforge.net/" target="_top">Imprints</a> Web site as well as the documentation
1768included with the imprints source distribution. This section only provides a brief introduction to
1769the features of Imprints.
1770</p><p>
1771Unfortunately, the Imprints tool-set is no longer maintained. As of December 2000, the project is in
1772need of a new maintainer. The most important skill to have is Perl coding and an interest in MS-RPC-based
1773printing used in Samba. If you wish to volunteer, please coordinate
1774your efforts on the Samba technical
1775mailing list. The tool-set is still in usable form, but only for a series of older printer models where
1776there are prepared packages to use. Packages for more up-to-date print devices are needed if Imprints
1777should have a future.
1778</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2577664"></a>What is Imprints?</h3></div></div></div><p>
1779Imprints is a collection of tools for supporting these goals:
1780</p><div class="itemizedlist"><ul type="disc"><li><p>
1781	Providing a central repository of information regarding Windows NT and 95/98 printer driver packages.
1782	</p></li><li><p>
1783	Providing the tools necessary for creating the Imprints printer driver packages.
1784	</p></li><li><p>
1785	Providing an installation client that will obtain printer drivers from a central Internet (or intranet) Imprints Server
1786	repository and install them on remote Samba and Windows NT4 print servers.
1787	</p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2577698"></a>Creating Printer Driver Packages</h3></div></div></div><p>
1788The process of creating printer driver packages is beyond the scope of this document (refer to Imprints.txt
1789also included with the Samba distribution for more information). In short, an Imprints driver package
1790is a gzipped tarball containing the driver files, related INF files, and a control file needed by the
1791installation client.
1792</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2577714"></a>The Imprints Server</h3></div></div></div><p>
1793The Imprints server is really a database server that may be queried via standard HTTP mechanisms. Each
1794printer entry in the database has an associated URL for the actual downloading of the package. Each
1795package is digitally signed via GnuPG which can be used to verify that
1796the package downloaded is actually
1797the one referred in the Imprints database. It is strongly recommended that this security check
1798not be disabled.
1799</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2577731"></a>The Installation Client</h3></div></div></div><p>
1800More information regarding the Imprints installation client is available from the the documentation file
1801<tt class="filename">Imprints-Client-HOWTO.ps</tt> that is included with the Imprints source package. The Imprints
1802installation client comes in two forms:
1803</p><div class="itemizedlist"><ul type="disc"><li><p>A set of command line Perl scripts.</p></li><li><p>A GTK+ based graphical interface to the command line Perl scripts.</p></li></ul></div><p>
1804The installation client (in both forms) provides a means of querying the Imprints database server for
1805a matching list of known printer model names as well as a means to download and install the drivers on
1806remote Samba and Windows NT print servers.
1807</p><p>
1808The basic installation process is in four steps and Perl code is wrapped around smbclient and rpcclient.
1809</p><div class="itemizedlist"><ul type="disc"><li><p>
1810	For each supported architecture for a given driver:
1811	</p><div class="orderedlist"><ol type="1"><li><p>rpcclient: Get the appropriate upload directory on the remote server.</p></li><li><p>smbclient: Upload the driver files.</p></li><li><p>rpcclient: Issues an AddPrinterDriver() MS-RPC.</p></li></ol></div><p>
1812	</p></li><li><p>rpcclient: Issue an AddPrinterEx() MS-RPC to actually create the printer.</p></li></ul></div><p>
1813One of the problems encountered when implementing the Imprints tool set was the name space issues between
1814various supported client architectures. For example, Windows NT includes a driver named &#8220;<span class="quote"><span class="emphasis"><em>Apple LaserWriter
1815II NTX v51.8</em></span></span>&#8221; and Windows 95 calls its version of this driver &#8220;<span class="quote"><span class="emphasis"><em>Apple LaserWriter II NTX</em></span></span>&#8221;.
1816</p><p>
1817The problem is how to know what client drivers have been uploaded for a printer. An astute reader will
1818remember that the Windows NT Printer Properties dialog only includes space for one printer driver name. A
1819quick look in the Windows NT 4.0 system registry at:
1820</p><p><tt class="filename">
1821 HKLM\System\CurrentControlSet\Control\Print\Environment
1822</tt></p><p>
1823will reveal that Windows NT always uses the NT driver name. This is okay as Windows NT always requires
1824that at least the Windows NT version of the printer driver is present. Samba does not have the
1825requirement internally, therefore, &#8220;<span class="quote"><span class="emphasis"><em>How can you use the NT driver name if it has not already been installed?</em></span></span>&#8221;
1826</p><p>
1827The way of sidestepping this limitation is to require that all Imprints printer driver packages include both the Intel Windows NT and
182895/98 printer drivers and that the NT driver is installed first.
1829</p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2577868"></a>Adding Network Printers without User Interaction</h2></div></div></div><p>
1830The following MS Knowledge Base article may be of some help if you need to handle Windows 2000
1831clients: <span class="emphasis"><em>How to Add Printers with No User Interaction in Windows 2000,</em></span> (<a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;189105" target="_top">http://support.microsoft.com/default.aspx?scid=kb;en-us;189105</a>).
1832It also applies to Windows XP Professional clients.
1833The ideas sketched out in this section are inspired by this article, which describes a command-line method that can be
1834applied to install network and local printers and their drivers. This is most useful if integrated in Logon
1835Scripts. You can see what options are available by typing in the command prompt (<span><b class="command">DOS box</b></span>):
1836</p><p><b class="userinput"><tt>rundll32 printui.dll,PrintUIEntry /?</tt></b></p><p>
1837A window pops up that shows you all of the command-line switches available. An extensive list of examples
1838is also provided. This is only for Win 200x/XP, it does not work on
1839Windows NT. Windows NT probably has
1840some other tools in the respective Resource Kit. Here is a suggestion about what a client logon script
1841might contain, with a short explanation of what the lines actually do (it works if 200x/XP Windows
1842clients access printers via Samba, and works for Windows-based print servers too):
1843</p><pre class="screen">
1844<b class="userinput"><tt>rundll32 printui.dll,PrintUIEntry /dn /n "\\cupsserver\infotec2105-IPDS" /q</tt></b>
1845<b class="userinput"><tt>rundll32 printui.dll,PrintUIEntry /in /n "\\cupsserver\infotec2105-PS"</tt></b>
1846<b class="userinput"><tt>rundll32 printui.dll,PrintUIEntry /y /n "\\cupsserver\infotec2105-PS"</tt></b>
1847</pre><p>
1848Here is a list of the used command-line parameters: 
1849</p><div class="variablelist"><dl><dt><span class="term">/dn</span></dt><dd><p>deletes a network printer</p></dd><dt><span class="term">/q</span></dt><dd><p>quiet modus</p></dd><dt><span class="term">/n</span></dt><dd><p>names a printer</p></dd><dt><span class="term">/in</span></dt><dd><p>adds a network printer connection</p></dd><dt><span class="term">/y</span></dt><dd><p>sets printer as default printer</p></dd></dl></div><div class="itemizedlist"><ul type="disc"><li><p>
1850	Line 1 deletes a possibly existing previous network printer <span class="emphasis"><em>infotec2105-IPDS</em></span>
1851	(which had used native Windows drivers with LPRng that were removed from the server that was
1852	converted to CUPS). The <span><b class="command">/q</b></span> at the end eliminates Confirm
1853	or error dialog boxes from popping up. They should not be presented to the user logging on.
1854	</p></li><li><p>	
1855	Line 2 adds the new printer
1856	<span class="emphasis"><em>infotec2105-PS</em></span> (which actually is the same
1857	physical device but is now run by the new CUPS printing system and associated with the
1858	CUPS/Adobe PS drivers). The printer and its driver must have been added to Samba prior to
1859	the user logging in (e.g., by a procedure as discussed earlier in this chapter, or by running
1860	<span><b class="command">cupsaddsmb</b></span>). The driver is now auto-downloaded to the client PC where the
1861	user is about to log in.
1862	</p></li><li><p>
1863	Line 3 sets the default printer to this new network printer (there might be several other
1864	printers installed with this same method and some may be local as well, so we decide for a
1865	default printer). The default printer selection may, of course, be different for different users.
1866	</p></li></ul></div><p>
1867The second line only works if the printer <span class="emphasis"><em>infotec2105-PS</em></span> has an already working
1868print queue on the <tt class="constant">cupsserver</tt>, and if the
1869printer drivers have been successfully uploaded
1870(via the <span><b class="command">APW</b></span>, <span><b class="command">smbclient/rpcclient</b></span>, or <span><b class="command">cupsaddsmb</b></span>)
1871into the <i class="parameter"><tt>[print$]</tt></i> driver repository of Samba. Some Samba versions
1872prior to version 3.0 required a re-start of smbd after the printer install and the driver upload,
1873otherwise the script (or any other client driver download) would fail.
1874</p><p>
1875Since there no easy way to test for the existence of an installed network printer from the logon script,
1876do not bother checking, just allow the de-installation/re-installation to occur every time a user logs in;
1877it's really quick anyway (1 to 2 seconds).
1878</p><p>
1879The additional benefits for this are:
1880</p><div class="itemizedlist"><ul type="disc"><li><p>
1881	It puts in place any printer default setup changes automatically at every user logon.
1882	</p></li><li><p>
1883	It allows for &#8220;<span class="quote"><span class="emphasis"><em>roaming</em></span></span>&#8221; users' login into the domain from different workstations.
1884	</p></li></ul></div><p>
1885Since network printers are installed per user, this much simplifies the process of keeping the installation
1886up-to-date. The few extra seconds at logon time will not really be noticeable. Printers can be centrally
1887added, changed and deleted at will on the server with no user intervention required from the clients
1888(you just need to keep the logon scripts up-to-date).
1889</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2578141"></a>The <span><b class="command">addprinter</b></span> Command</h2></div></div></div><p>
1890The <span><b class="command">addprinter</b></span> command can be configured to be a shell script or program executed by
1891Samba. It is triggered by running the APW from a client against the Samba print server. The APW asks
1892the user to fill in several fields (such as printer name, driver to be used, comment, port monitor,
1893and so on). These parameters are passed on to Samba by the APW. If the addprinter command is designed in a
1894way that it can create a new printer (through writing correct printcap entries on legacy systems, or
1895execute the <span><b class="command">lpadmin</b></span> command on more modern systems) and create the associated share
1896in, then the APW will in effect really create a new printer on Samba and the UNIX print subsystem!
1897</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2578180"></a>Migration of Classical Printing to Samba</h2></div></div></div><p>
1898The basic NT-style printer driver management has not changed considerably in 3.0 over the 2.2.x releases
1899(apart from many small improvements). Here migration should be quite easy, especially if you followed
1900previous advice to stop using deprecated parameters in your setup. For migrations from an existing 2.0.x
1901setup, or if you continued Windows 9x/Me-style printing in your Samba 2.2 installations, it is more of
1902an effort. Please read the appropriate release notes and the HOWTO Collection for Samba-2.2.x. You can
1903follow several paths. Here are possible scenarios for migration:
1904</p><div class="itemizedlist"><ul type="disc"><li><p>
1905	You need to study and apply the new Windows NT printer and driver support. Previously used
1906	parameters <i class="parameter"><tt>printer driver file</tt></i>, <i class="parameter"><tt>printer driver</tt></i>
1907	and <i class="parameter"><tt>printer driver location</tt></i> are no longer supported.
1908	</p></li><li><p>
1909	If you want to take advantage of Windows NT printer driver support, you also need to migrate the
1910	Windows 9x/Me drivers to the new setup.
1911	</p></li><li><p>
1912	An existing <tt class="filename">printers.def</tt> file (the one specified in the now removed parameter
1913	<i class="parameter"><tt>printer driver file</tt></i>) will no longer work with Samba-3. In 3.0, smbd attempts
1914	to locate a Windows 9x/Me driver files for the printer in <i class="parameter"><tt>[print$]</tt></i>
1915	and additional settings in the TDB and only there; if it fails, it will <span class="emphasis"><em>not</em></span>
1916	(as 2.2.x used to do) drop down to using a <tt class="filename">printers.def</tt> (and all associated
1917	parameters). The make_printerdef tool is removed and there is no backward compatibility for this.
1918	</p></li><li><p>You need to install a Windows 9x/Me driver into the
1919	<i class="parameter"><tt>[print$]</tt></i> share for a printer on your Samba
1920	host. The driver files will be stored in the &#8220;<span class="quote"><span class="emphasis"><em>WIN40/0</em></span></span>&#8221; subdirectory of
1921	<i class="parameter"><tt>[print$]</tt></i>, and some other settings and information go
1922	into the printing-related TDBs.</p></li><li><p>If you want to migrate an existing
1923	<tt class="filename">printers.def</tt> file into the new setup, the
1924	only current
1925	solution is to use the Windows NT APW to install the NT drivers
1926	and the 9x/Me drivers. This can be scripted using smbclient and
1927	rpcclient. See the Imprints installation client at:
1928	</p><p>
1929		<a href="http://imprints.sourceforge.net/" target="_top">http://imprints.sourceforge.net/</a>
1930	</p><p>
1931	for an example. See also the discussion of rpcclient usage in the
1932	&#8220;<span class="quote"><span class="emphasis"><em>CUPS Printing</em></span></span>&#8221; section.</p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2578333"></a>Publishing Printer Information in Active Directory or LDAP</h2></div></div></div><p>
1933This will be addressed in a later update of this document. If you wish to volunteer your services to help
1934document this, please contact <a href="mail://jht@samba.org" target="_top">John H Terpstra.</a>
1935</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2578352"></a>Common Errors</h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2578358"></a>I Give My Root Password but I Do Not Get Access</h3></div></div></div><p>
1936Do not confuse the root password which is valid for the UNIX system (and in most cases stored in the
1937form of a one-way hash in a file named <tt class="filename">/etc/shadow</tt>), with the password used to
1938authenticate against Samba. Samba does not know the UNIX password. Root access to Samba resources
1939requires that a Samba account for root must first be created. This is done with the <span><b class="command">smbpasswd</b></span>
1940command as follows:
1941</p><pre class="screen">
1942<tt class="prompt">root# </tt> smbpasswd -a root
1943New SMB password: secret
1944Retype new SMB password: secret
1945</pre></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2578400"></a>My Print Jobs Get Spooled into the Spooling Directory, but Then Get Lost</h3></div></div></div><p>
1946Do not use the existing UNIX print system spool directory for the Samba spool directory. It may seem
1947convenient and a savings of space, but it only leads to problems. The two must be separate.
1948</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="msdfs.html">Prev</a>�</td><td width="20%" align="center"><a accesskey="u" href="optional.html">Up</a></td><td width="40%" align="right">�<a accesskey="n" href="CUPS-printing.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter�18.�Hosting a Microsoft Distributed File System Tree�</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">�Chapter�20.�CUPS Printing Support</td></tr></table></div></body></html>
1949