source: vendor/current/docs/htmldocs/Samba3-HOWTO/classicalprinting.html@ 740

Last change on this file since 740 was 740, checked in by Silvan Scherrer, 12 years ago

Samba Server: update vendor to 3.6.0

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