Initial import
[samba] / docs / htmldocs / Samba3-HOWTO / classicalprinting.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 20. Classical Printing Support</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="index.html" title="The Official Samba-3 HOWTO and Reference Guide"><link rel="up" href="optional.html" title="Part III. Advanced Configuration"><link rel="prev" href="msdfs.html" title="Chapter 19. Hosting a Microsoft Distributed File System Tree"><link rel="next" href="CUPS-printing.html" title="Chapter 21. 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 20. Classical Printing Support</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="msdfs.html">Prev</a> </td><th width="60%" align="center">Part III. Advanced Configuration</th><td width="20%" align="right"> <a accesskey="n" href="CUPS-printing.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="classicalprinting"></a>Chapter 20. 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 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 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 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#id2589596">Features and Benefits</a></span></dt><dt><span class="sect1"><a href="classicalprinting.html#id2589820">Technical Introduction</a></span></dt><dd><dl><dt><span class="sect2"><a href="classicalprinting.html#id2589971">Client to Samba Print Job Processing</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2590030">Printing-Related Configuration Parameters</a></span></dt></dl></dd><dt><span class="sect1"><a href="classicalprinting.html#id2590131">Simple Print Configuration</a></span></dt><dd><dl><dt><span class="sect2"><a href="classicalprinting.html#id2590410">Verifying Configuration with <span><strong class="command">testparm</strong></span></a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2590608">Rapid Configuration Validation</a></span></dt></dl></dd><dt><span class="sect1"><a href="classicalprinting.html#id2590988">Extended Printing Configuration</a></span></dt><dd><dl><dt><span class="sect2"><a href="classicalprinting.html#id2591470">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#id2593995">Point'n'Print Client Drivers on Samba Servers</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2594165">The Obsoleted [printer$] Section</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2594286">Creating the [print$] Share</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2594503">[print$] Stanza Parameters</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2594799">The [print$] Share Directory</a></span></dt></dl></dd><dt><span class="sect1"><a href="classicalprinting.html#id2594938">Installing Drivers into [print$]</a></span></dt><dd><dl><dt><span class="sect2"><a href="classicalprinting.html#id2595032">Add Printer Wizard Driver Installation</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#inst-rpc">Installing Print Drivers Using <span><strong class="command">rpcclient</strong></span></a></span></dt></dl></dd><dt><span class="sect1"><a href="classicalprinting.html#id2596975">Client Driver Installation Procedure</a></span></dt><dd><dl><dt><span class="sect2"><a href="classicalprinting.html#id2596992">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#id2597541">Additional Client Driver Installation</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2597660">Always Make First Client Connection as root or &#8220;<span class="quote">printer admin</span>&#8221;</a></span></dt></dl></dd><dt><span class="sect1"><a href="classicalprinting.html#id2597823">Other Gotchas</a></span></dt><dd><dl><dt><span class="sect2"><a href="classicalprinting.html#id2597844">Setting Default Print Options for Client Drivers</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2598207">Supporting Large Numbers of Printers</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2598464">Adding New Printers with the Windows NT APW</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2598689">Error Message: &#8220;<span class="quote">Cannot connect under a different Name</span>&#8221;</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2598803">Take Care When Assembling Driver Files</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2599064">Samba and Printer Ports</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2599168">Avoiding Common Client Driver Misconfiguration</a></span></dt></dl></dd><dt><span class="sect1"><a href="classicalprinting.html#id2599205">The Imprints Toolset</a></span></dt><dd><dl><dt><span class="sect2"><a href="classicalprinting.html#id2599252">What Is Imprints?</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2599286">Creating Printer Driver Packages</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2599302">The Imprints Server</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2599319">The Installation Client</a></span></dt></dl></dd><dt><span class="sect1"><a href="classicalprinting.html#id2599452">Adding Network Printers without User Interaction</a></span></dt><dt><span class="sect1"><a href="classicalprinting.html#id2599724">The <span><strong class="command">addprinter</strong></span> Command</a></span></dt><dt><span class="sect1"><a href="classicalprinting.html#id2599763">Migration of Classical Printing to Samba</a></span></dt><dt><span class="sect1"><a href="classicalprinting.html#id2599912">Publishing Printer Information in Active Directory or LDAP</a></span></dt><dt><span class="sect1"><a href="classicalprinting.html#id2599941">Common Errors</a></span></dt><dd><dl><dt><span class="sect2"><a href="classicalprinting.html#id2599947">I Give My Root Password but I Do Not Get Access</a></span></dt><dt><span class="sect2"><a href="classicalprinting.html#id2599988">My Print Jobs Get Spooled into the Spooling Directory, but Then Get Lost</a></span></dt></dl></dd></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2589596"></a>Features and Benefits</h2></div></div></div><p>
2 <a class="indexterm" name="id2589604"></a>
3 Printing is often a mission-critical service for the users. Samba can provide this service reliably and
4 seamlessly for a client network consisting of Windows workstations.
5 </p><p>
6 <a class="indexterm" name="id2589618"></a>
7 <a class="indexterm" name="id2589625"></a>
8 <a class="indexterm" name="id2589632"></a>
9 <a class="indexterm" name="id2589639"></a>
10 <a class="indexterm" name="id2589646"></a>
11 <a class="indexterm" name="id2589653"></a>
12 <a class="indexterm" name="id2589660"></a>
13 <a class="indexterm" name="id2589666"></a>
14 <a class="indexterm" name="id2589673"></a>
15 <a class="indexterm" name="id2589680"></a>
16 <a class="indexterm" name="id2589687"></a>
17 <a class="indexterm" name="id2589694"></a>
18 <a class="indexterm" name="id2589701"></a>
19 <a class="indexterm" name="id2589708"></a>
20 A Samba print service may be run on a standalone or domain member server, side by side with file serving
21 functions, or on a dedicated print server.  It can be made as tightly or as loosely secured as needs dictate.
22 Configurations may be simple or complex. Available authentication schemes are essentially the same as
23 described for file services in previous chapters. Overall, Samba's printing support is now able to replace an
24 NT or Windows 2000 print server full-square, with additional benefits in many cases. Clients may download and
25 install drivers and printers through their familiar <code class="literal">Point'n'Print</code> mechanism. Printer
26 installations executed by <code class="literal">Logon Scripts</code> are no problem. Administrators can upload and manage
27 drivers to be used by clients through the familiar <code class="literal">Add Printer Wizard</code>. As an additional
28 benefit, driver and printer management may be run from the command line or through scripts, making it more
29 efficient in case of large numbers of printers. If a central accounting of print jobs (tracking every single
30 page and supplying the raw data for all sorts of statistical reports) is required, this function is best
31 supported by the newer Common UNIX Printing System (CUPS) as the print subsystem underneath the Samba hood.
32 </p><p>
33 <a class="indexterm" name="id2589759"></a>
34 <a class="indexterm" name="id2589765"></a>
35 This chapter outlines the fundamentals of Samba printing as implemented by the more traditional UNIX
36 BSD- and System V-style printing systems. Much of the information in this chapter applies also to CUPS.  If
37 you use CUPS, you may be tempted to jump to the next chapter, but you will certainly miss a few things if you
38 do. For further information refer to <a href="CUPS-printing.html" title="Chapter 21. CUPS Printing Support">CUPS Printing Support</a>.
39 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
40 <a class="indexterm" name="id2589791"></a>
41 <a class="indexterm" name="id2589798"></a>
42 <a class="indexterm" name="id2589805"></a>
43 Most of the following examples have been verified on Windows XP Professional clients. Where this document
44 describes the responses to commands given, bear in mind that Windows 200x/XP clients are quite similar but may
45 differ in minor details. Windows NT4 is somewhat different again.
46 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2589820"></a>Technical Introduction</h2></div></div></div><p>
47 <a class="indexterm" name="id2589828"></a>
48 <a class="indexterm" name="id2589835"></a>
49 <a class="indexterm" name="id2589842"></a>
50 Samba'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
52 printing system for further processing; therefore, it needs to communicate with both sides: the Windows print
53 clients and the UNIX printing system. Hence, we must differentiate between the various client OS types, each
54 of which behave differently, as well as the various UNIX print subsystems, which themselves have different
55 features and are accessed differently.
56 </p><p>
57 <a class="indexterm" name="id2589867"></a>
58 <a class="indexterm" name="id2589874"></a>
59 This chapter deals with the traditional way of UNIX printing. The next chapter covers in great detail the more
60 modern CUPS.
61 </p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Important</h3><p>
62 <a class="indexterm" name="id2589887"></a>
63 CUPS 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="id2589899"></a>
66 <a class="indexterm" name="id2589906"></a>
67 <a class="indexterm" name="id2589913"></a>
68 <a class="indexterm" name="id2589920"></a>
69 It is apparent from postings on the Samba mailing list that print configuration is one of the most problematic
70 aspects of Samba administration today. Many new Samba administrators have the impression that Samba performs
71 some sort of print processing. Rest assured, Samba does not perform any type of print processing. It does not
72 do any form of print filtering.
73 </p><p>
74 <a class="indexterm" name="id2589936"></a>
75 <a class="indexterm" name="id2589943"></a>
76 <a class="indexterm" name="id2589950"></a>
77 <a class="indexterm" name="id2589957"></a>
78 Samba obtains from its clients a data stream (print job) that it spools to a local spool area. When the entire
79 print job has been received, Samba invokes a local UNIX/Linux print command and passes the spooled file to it.
80 It is up to the local system printing subsystems to correctly process the print job and to submit it to the
81 printer.
82 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2589971"></a>Client to Samba Print Job Processing</h3></div></div></div><p>
83 Successful printing from a Windows client via a Samba print server to a UNIX
84 printer involves six (potentially seven) stages:
85 </p><div class="orderedlist"><ol type="1"><li><p>Windows opens a connection to the printer share.</p></li><li><p>Samba must authenticate the user.</p></li><li><p>Windows sends a copy of the print file over the network
86         into Samba's spooling area.</p></li><li><p>Windows closes the connection.</p></li><li><p>Samba invokes the print command to hand the file over
87         to the UNIX print subsystem's spooling area.</p></li><li><p>The UNIX print subsystem processes the print job.</p></li><li><p>The print file may need to be explicitly deleted
88         from the Samba spooling area. This item depends on your print spooler
89         configuration settings.</p></li></ol></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2590030"></a>Printing-Related Configuration Parameters</h3></div></div></div><p>
90 <a class="indexterm" name="id2590039"></a>
91 <a class="indexterm" name="id2590046"></a>
92 <a class="indexterm" name="id2590053"></a>
93 There are a number of configuration parameters to control Samba's printing behavior. Please refer to the man
94 page 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 <span><strong class="command">testparm</strong></span> 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" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2590131"></a>Simple Print Configuration</h2></div></div></div><p>
107 <a class="indexterm" name="id2590139"></a>
108 <a class="indexterm" name="id2590146"></a>
109 <a class="indexterm" name="id2590153"></a>
110 <a class="indexterm" name="id2590160"></a>
111 <a href="classicalprinting.html#simpleprc" title="Example 20.1. Simple Configuration with BSD Printing">Simple Configuration with BSD Printing</a> shows a simple printing configuration.
112 If you compare this with your own, you may find additional parameters that have been preconfigured by your OS
113 vendor. Following is a discussion and explanation of the parameters. This example does not use many
114 parameters.  However, in many environments these are enough to provide a valid <code class="filename">smb.conf</code> file that enables
115 all clients to print.
116 </p><div class="example"><a name="simpleprc"></a><p class="title"><b>Example 20.1. Simple Configuration with BSD Printing</b></p><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[global]</code></em></td></tr><tr><td><a class="indexterm" name="id2590212"></a><em class="parameter"><code>printing = bsd</code></em></td></tr><tr><td><a class="indexterm" name="id2590224"></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="id2590246"></a><em class="parameter"><code>path = /var/spool/samba</code></em></td></tr><tr><td><a class="indexterm" name="id2590259"></a><em class="parameter"><code>printable = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2590272"></a><em class="parameter"><code>public = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2590284"></a><em class="parameter"><code>writable = no</code></em></td></tr></table></div><p>
117 <a class="indexterm" name="id2590300"></a>
118 <a class="indexterm" name="id2590307"></a>
119 <a class="indexterm" name="id2590314"></a>
120 This is only an example configuration. Samba assigns default values to all configuration parameters. The
121 defaults are conservative and sensible. When a parameter is specified in the <code class="filename">smb.conf</code> file, this overwrites
122 the default value. The <span><strong class="command">testparm</strong></span> utility when run as root is capable of reporting all
123 settings, both default as well as <code class="filename">smb.conf</code> file settings. <span><strong class="command">Testparm</strong></span> gives warnings for all
124 misconfigured settings. The complete output is easily 360 lines and more, so you may want to pipe it through a
125 pager program.
126 </p><p>  
127 <a class="indexterm" name="id2590356"></a>
128 <a class="indexterm" name="id2590363"></a>
129 <a class="indexterm" name="id2590370"></a>
130 The syntax for the configuration file is easy to grasp. You should know that  is not very picky about its
131 syntax. As has been explained elsewhere in this book, Samba tolerates some spelling errors (such as
132 <a class="indexterm" name="id2590381"></a>browseable instead of <a class="indexterm" name="id2590388"></a>browsable), and spelling is
133 case-insensitive. It is permissible to use <em class="parameter"><code>Yes/No</code></em> or <em class="parameter"><code>True/False</code></em>
134 for Boolean settings. Lists of names may be separated by commas, spaces, or tabs.
135 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2590410"></a>Verifying Configuration with <span><strong class="command">testparm</strong></span></h3></div></div></div><p>
136 <a class="indexterm" name="id2590423"></a>
137 <a class="indexterm" name="id2590430"></a>
138 <a class="indexterm" name="id2590437"></a>
139 <a class="indexterm" name="id2590444"></a>
140 <a class="indexterm" name="id2590451"></a>
141 <a class="indexterm" name="id2590458"></a>
142 <a class="indexterm" name="id2590464"></a>
143 <a class="indexterm" name="id2590471"></a>
144 <a class="indexterm" name="id2590478"></a>
145 <a class="indexterm" name="id2590485"></a>
146 <a class="indexterm" name="id2590492"></a>
147 To see all (or at least most) printing-related settings in Samba, including the implicitly used ones, try the
148 command 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 <span><strong class="command">testparm</strong></span>'s output. This provides
151 a convenient overview of the running <span><strong class="command">smbd</strong></span> print configuration. This command does not show
152 individually created printer shares or the spooling paths they may use. Here is the output of my Samba setup,
153 with settings shown in <a href="classicalprinting.html#simpleprc" title="Example 20.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>
191 You can easily verify which settings were implicitly added by Samba's default behavior. <span class="emphasis"><em>Remember: it
192 may be important in your future dealings with Samba.</em></span>
193 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
194 The <span><strong class="command">testparm</strong></span> in Samba-3 behaves differently from that in 2.2.x: used without the
195 &#8220;<span class="quote">-v</span>&#8221; switch, it only shows you the settings actually written into! To see the complete
196 configuration used, add the &#8220;<span class="quote">-v</span>&#8221; parameter to testparm.
197 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2590608"></a>Rapid Configuration Validation</h3></div></div></div><p> 
198 <a class="indexterm" name="id2590617"></a>
199 <a class="indexterm" name="id2590624"></a>
200 <a class="indexterm" name="id2590630"></a>
201 <a class="indexterm" name="id2590637"></a>
202 Should you need to troubleshoot at any stage, please always come back to this point first and verify if
203 <span><strong class="command">testparm</strong></span> shows the parameters you expect. To give you a warning from personal experience,
204 try to just comment out the <a class="indexterm" name="id2590654"></a>load printers parameter. If your 2.2.x system behaves like
205 mine, 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="id2590687"></a>
215 <a class="indexterm" name="id2590694"></a>
216 I assumed that commenting out of this setting should prevent Samba from
217 publishing my printers, but it still did. It took some time to figure out
218 the 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="id2590738"></a>
230 Only when the parameter is explicitly set to <a class="indexterm" name="id2590746"></a>load printers = No would
231 Samba conform with my intentions. So, my strong advice is:
232 </p><div class="itemizedlist"><ul type="disc"><li><p>Never rely on commented-out parameters.</p></li><li><p>Always set parameters explicitly as you intend them to
233         behave.</p></li><li><p>Use <span><strong class="command">testparm</strong></span> to uncover hidden
234         settings that might not reflect your intentions.</p></li></ul></div><p>
235 The 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="id2590803"></a>
241 <a class="indexterm" name="id2590810"></a>
242 This example should show that you can use <span><strong class="command">testparm</strong></span> to test any Samba configuration file.
243 Actually, we encourage you <span class="emphasis"><em>not</em></span> to change your working system (unless you know exactly
244 what you are doing). Don't rely on the assumption that changes will only take effect after you restart smbd!
245 This is not the case. Samba rereads it every 60 seconds and on each new client connection. You might have to
246 face changes for your production clients that you didn't intend to apply. You will now note a few more
247 interesting things; <span><strong class="command">testparm</strong></span> is useful to identify what the Samba print configuration would
248 be 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 <span><strong class="command">testparm</strong></span> issued two warnings:
278 </p><div class="itemizedlist"><ul type="disc"><li><p>We did not specify the <em class="parameter"><code>[printers]</code></em> section as printable.</p></li><li><p>We did not tell Samba which spool directory to use.</p></li></ul></div><p>
279 <a class="indexterm" name="id2590902"></a>
280 <a class="indexterm" name="id2590910"></a>
281 <a class="indexterm" name="id2590915"></a>
282 <a class="indexterm" name="id2590920"></a>
283 However, this was not fatal, and Samba will default to values that will work. Please, do not rely on this and
284 do not use this example. This was included to encourage you to be careful to design and specify your setup to
285 do precisely what you require. The outcome on your system may vary for some parameters given, since Samba may
286 have 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
288 put the comment sign at the front). At first I regarded this as a bug in my Samba versions. But the man page
289 clearly says: <code class="literal">Internal whitespace in a parameter value is retained verbatim.</code> This means
290 that a line consisting of, for example,
291 </p><table class="simplelist" border="0" summary="Simple list"><tr><td># This defines LPRng as the printing system</td></tr><tr><td><a class="indexterm" name="id2590961"></a><em class="parameter"><code>printing =  lprng</code></em></td></tr></table><p>
292 </p><p>
293 will regard the whole of the string after the <code class="literal">=</code> sign as the value you want to define. This
294 is an invalid value that will be ignored, and a default value will be used in its place.
295 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2590988"></a>Extended Printing Configuration</h2></div></div></div><p>
296 <a class="indexterm" name="id2590997"></a>
297 <a class="indexterm" name="id2591004"></a>
298 <a class="indexterm" name="id2591011"></a>
299 <a class="indexterm" name="id2591017"></a>
300 <a href="classicalprinting.html#extbsdpr" title="Example 20.2. Extended BSD Printing Configuration">Extended BSD Printing Configuration</a> shows a more verbose configuration for
301 print-related settings in a BSD-style printing environment. What follows is a discussion and explanation of
302 the various parameters. We chose to use BSD-style printing here because it is still the most commonly used
303 system on legacy UNIX/Linux installations. New installations predominantly use CUPS, which is discussed in a
304 separate chapter. The example explicitly names many parameters that do not need to be specified because they
305 are set by default. You could use a much leaner <code class="filename">smb.conf</code> file, or you can use <span><strong class="command">testparm</strong></span> or
306 <span><strong class="command">SWAT</strong></span> 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 20.2. Extended BSD Printing Configuration</b></p><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[global]</code></em></td></tr><tr><td><a class="indexterm" name="id2591091"></a><em class="parameter"><code>printing = bsd</code></em></td></tr><tr><td><a class="indexterm" name="id2591103"></a><em class="parameter"><code>load printers = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2591116"></a><em class="parameter"><code>show add printer wizard = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2591129"></a><em class="parameter"><code>printcap name = /etc/printcap</code></em></td></tr><tr><td><a class="indexterm" name="id2591142"></a><em class="parameter"><code>printer admin = @ntadmin, root</code></em></td></tr><tr><td><a class="indexterm" name="id2591156"></a><em class="parameter"><code>max print jobs = 100</code></em></td></tr><tr><td><a class="indexterm" name="id2591168"></a><em class="parameter"><code>lpq cache time = 20</code></em></td></tr><tr><td><a class="indexterm" name="id2591181"></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="id2591203"></a><em class="parameter"><code>comment = All Printers</code></em></td></tr><tr><td><a class="indexterm" name="id2591216"></a><em class="parameter"><code>printable = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2591229"></a><em class="parameter"><code>path = /var/spool/samba</code></em></td></tr><tr><td><a class="indexterm" name="id2591241"></a><em class="parameter"><code>browseable = no</code></em></td></tr><tr><td><a class="indexterm" name="id2591254"></a><em class="parameter"><code>guest ok = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2591267"></a><em class="parameter"><code>public = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2591279"></a><em class="parameter"><code>read only = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2591292"></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="id2591314"></a><em class="parameter"><code>comment = Printer with Restricted Access</code></em></td></tr><tr><td><a class="indexterm" name="id2591327"></a><em class="parameter"><code>path = /var/spool/samba_my_printer</code></em></td></tr><tr><td><a class="indexterm" name="id2591340"></a><em class="parameter"><code>printer admin = kurt</code></em></td></tr><tr><td><a class="indexterm" name="id2591353"></a><em class="parameter"><code>browseable = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2591366"></a><em class="parameter"><code>printable = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2591378"></a><em class="parameter"><code>writable = no</code></em></td></tr><tr><td><a class="indexterm" name="id2591391"></a><em class="parameter"><code>hosts allow = 0.0.0.0</code></em></td></tr><tr><td><a class="indexterm" name="id2591404"></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="id2591417"></a><em class="parameter"><code>guest ok = no</code></em></td></tr></table></div><p>
308 <a class="indexterm" name="id2591432"></a>
309 <a class="indexterm" name="id2591437"></a>
310 <a class="indexterm" name="id2591443"></a>
311 This is an example configuration. You may not find all the settings that are in the configuration file that
312 was provided by the OS vendor. Samba configuration parameters, if not explicitly set, default to a sensible
313 value.  To see all settings, as <code class="constant">root</code> use the <span><strong class="command">testparm</strong></span> utility.
314 <span><strong class="command">testparm</strong></span> gives warnings for misconfigured settings.
315 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2591470"></a>Detailed Explanation Settings</h3></div></div></div><p>
316 The following is a discussion of the settings from <a href="classicalprinting.html#extbsdpr" title="Example 20.2. Extended BSD Printing Configuration">Extended BSD Printing
317 Configuration</a> <a href="classicalprinting.html#extbsdpr" title="Example 20.2. Extended BSD Printing Configuration">Extended BSD Printing Configuration</a>.
318 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2591494"></a>The [global] Section</h4></div></div></div><p>
319 <a class="indexterm" name="id2591502"></a>
320 <a class="indexterm" name="id2591509"></a>
321 <a class="indexterm" name="id2591516"></a>
322 <a class="indexterm" name="id2591523"></a>
323 The <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
325 for parameters that have only a global meaning. It may also contain service-level parameters that define
326 default settings for all other sections and shares. This way you can simplify the configuration and avoid
327 setting the same value repeatedly. (Within each individual section or share, you may, however, override these
328 globally set share settings and specify other values).
329 </p><div class="variablelist"><dl><dt><span class="term"><a class="indexterm" name="id2591573"></a>printing = bsd </span></dt><dd><p>
330 <a class="indexterm" name="id2591585"></a>
331 <a class="indexterm" name="id2591592"></a>
332 <a class="indexterm" name="id2591599"></a>
333 <a class="indexterm" name="id2591606"></a>
334 <a class="indexterm" name="id2591612"></a>
335 <a class="indexterm" name="id2591619"></a>
336 <a class="indexterm" name="id2591626"></a>
337 <a class="indexterm" name="id2591632"></a>
338 <a class="indexterm" name="id2591639"></a>
339 <a class="indexterm" name="id2591646"></a>
340 <a class="indexterm" name="id2591653"></a>
341 <a class="indexterm" name="id2591660"></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="indexterm" name="id2591678"></a>print command (and other queue control commands).
346                 </p><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Caution</h3><p>
347 <a class="indexterm" name="id2591690"></a>
348 <a class="indexterm" name="id2591697"></a>
349                 The <a class="indexterm" name="id2591705"></a>printing 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="indexterm" name="id2591726"></a>load printers = yes </span></dt><dd><p>
353 <a class="indexterm" name="id2591737"></a>
354 <a class="indexterm" name="id2591744"></a>
355 <a class="indexterm" name="id2591751"></a>
356 <a class="indexterm" name="id2591758"></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="indexterm" name="id2591791"></a>show add printer wizard = yes </span></dt><dd><p>
364 <a class="indexterm" name="id2591803"></a>
365 <a class="indexterm" name="id2591810"></a>
366 <a class="indexterm" name="id2591816"></a>
367 <a class="indexterm" name="id2591823"></a>
368 <a class="indexterm" name="id2591830"></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 <span><strong class="command">net
372                 view</strong></span> 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="indexterm" name="id2591895"></a>max print jobs = 100 </span></dt><dd><p>
377 <a class="indexterm" name="id2591907"></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="indexterm" name="id2591926"></a>printcap name = /etc/printcap </span></dt><dd><p>
383 <a class="indexterm" name="id2591938"></a>
384 <a class="indexterm" name="id2591945"></a>
385 <a class="indexterm" name="id2591952"></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="indexterm" name="id2591975"></a>printer admin = @ntadmin </span></dt><dd><p>
390 <a class="indexterm" name="id2591987"></a>
391 <a class="indexterm" name="id2591993"></a>
392 <a class="indexterm" name="id2592000"></a>
393 <a class="indexterm" name="id2592007"></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="indexterm" name="id2592021"></a>printer admin. 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 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="indexterm" name="id2592052"></a>printer admin 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="indexterm" name="id2592064"></a>lpq cache time = 20 </span></dt><dd><p>
402 <a class="indexterm" name="id2592075"></a>
403 <a class="indexterm" name="id2592082"></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="indexterm" name="id2592095"></a>use client driver = no </span></dt><dd><p>
407 <a class="indexterm" name="id2592107"></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" lang="en"><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="id2592161"></a>
415 <a class="indexterm" name="id2592167"></a>
416 The printers section is the second special section. If a section with this name appears in the <code class="filename">smb.conf</code>,
417 users are able to connect to any printer specified in the Samba host's printcap file, because Samba on startup
418 then creates a printer share for every printer name it finds in the printcap file. You could regard this
419 section as a convenient shortcut to share all printers with minimal configuration. It is also a container for
420 settings that should apply as default to all printers. (For more details, see the <code class="filename">smb.conf</code> man page.)
421 Settings inside this container must be share-level parameters.
422 </p><div class="variablelist"><dl><dt><span class="term"><a class="indexterm" name="id2592201"></a>comment = All printers </span></dt><dd><p>
423                 The <a class="indexterm" name="id2592213"></a>comment 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 <span><strong class="command">net view</strong></span> command, to list available shares.
426                 </p></dd><dt><span class="term"><a class="indexterm" name="id2592238"></a>printable = yes </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="indexterm" name="id2592263"></a>path
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="indexterm" name="id2592276"></a>path = /var/spool/samba </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="indexterm" name="id2592304"></a>browseable = no </span></dt><dd><p>
439                 Is always set to <code class="constant">no</code> if
440                 <a class="indexterm" name="id2592319"></a>printable = yes. It makes
441                 the <em class="parameter"><code>[printer]</code></em> share itself invisible in the list of
442                 available shares in a <span><strong class="command">net view</strong></span> 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="indexterm" name="id2592346"></a>guest ok = yes </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="indexterm" name="id2592363"></a>guest account. 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 <span><strong class="command">su - guest</strong></span> 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="indexterm" name="id2592396"></a>public = yes </span></dt><dd><p>
456                 Is a synonym for <a class="indexterm" name="id2592408"></a>guest ok = yes.
457                 Since we have <a class="indexterm" name="id2592415"></a>guest ok = yes, it
458                 really does not need to be here. (This leads to the interesting question, &#8220;<span class="quote">What if I
459                 by accident have two contradictory settings for the same share?</span>&#8221; The answer is that the
460                 last one encountered by Samba wins. <span><strong class="command">testparm</strong></span> 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="indexterm" name="id2592450"></a>read only = yes </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="indexterm" name="id2592478"></a>writable = no </span></dt><dd><p>
470                 Is a synonym for <a class="indexterm" name="id2592490"></a>read only = yes.
471                 </p></dd></dl></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2592502"></a>Any [my_printer_name] Section</h4></div></div></div><p>
472 <a class="indexterm" name="id2592510"></a>
473 <a class="indexterm" name="id2592517"></a>
474 If a <em class="parameter"><code>[my_printer_name]</code></em> section appears in the <code class="filename">smb.conf</code> file, which includes the
475 parameter <a class="indexterm" name="id2592537"></a>printable = yes Samba will configure it as a printer share.
476 Windows 9x/Me clients may have problems with connecting or loading printer drivers if the share name has more
477 than eight characters. Do not name a printer share with a name that may conflict with an existing user or file
478 share name. On client connection requests, Samba always tries to find file shares with that name first. If it
479 finds 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="indexterm" name="id2592560"></a>comment = Printer with Restricted Access </span></dt><dd><p>
481                 The comment says it all.
482                 </p></dd><dt><span class="term"><a class="indexterm" name="id2592577"></a>path = /var/spool/samba_my_printer </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="indexterm" name="id2592596"></a>printer admin = kurt </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="indexterm" name="id2592620"></a>browseable = yes </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="indexterm" name="id2592644"></a>printable = yes </span></dt><dd><p>
492                 See <a href="classicalprinting.html#ptrsect" title="The [printers] Section">Section 20.4.1.2</a>.
493                 </p></dd><dt><span class="term"><a class="indexterm" name="id2592668"></a>writable = no </span></dt><dd><p>
494                 See <a href="classicalprinting.html#ptrsect" title="The [printers] Section">Section 20.4.1.2</a>.
495                 </p></dd><dt><span class="term"><a class="indexterm" name="id2592691"></a>hosts allow = 10.160.50.,10.160.51. </span></dt><dd><p>
496                 Here we exercise a certain degree of access control by using the <a class="indexterm" name="id2592704"></a>hosts allow
497                 and <a class="indexterm" name="id2592711"></a>hosts deny 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="indexterm" name="id2592726"></a>hosts deny = turbo_xp,10.160.50.23,10.160.51.60 </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="indexterm" name="id2592745"></a>guest ok = no </span></dt><dd><p>
504                 This printer is not open for the guest account.
505                 </p></dd></dl></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2592762"></a>Print Commands</h4></div></div></div><p>
506 <a class="indexterm" name="id2592770"></a>
507 <a class="indexterm" name="id2592777"></a>
508 <a class="indexterm" name="id2592784"></a>
509 <a class="indexterm" name="id2592790"></a>
510 In each section defining a printer (or in the <em class="parameter"><code>[printers]</code></em> section),
511 a <em class="parameter"><code>print command</code></em> parameter may be defined. It sets a command to process the files
512 that have been placed into the Samba print spool directory for that printer. (That spool directory was,
513 if you remember, set up with the <a class="indexterm" name="id2592814"></a>path parameter). Typically,
514 this command will submit the spool file to the Samba host's print subsystem, using the suitable system
515 print command. But there is no requirement that this needs to be the case. For debugging or
516 some other reason, you may want to do something completely different than print the file. An example is a
517 command that just copies the print file to a temporary location for further investigation when you need
518 to debug printing. If you craft your own print commands (or even develop print command shell scripts),
519 make sure you pay attention to the need to remove the files from the Samba spool directory. Otherwise,
520 your hard disk may soon suffer from shortage of free space.
521 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2592846"></a>Default UNIX System Printing Commands</h4></div></div></div><p>
522 <a class="indexterm" name="id2592854"></a>
523 You learned earlier that Samba, in most cases, uses its built-in settings for many parameters if it cannot
524 find an explicitly stated one in its configuration file. The same is true for the <a class="indexterm" name="id2592865"></a>print command. The default print command varies depending on the <a class="indexterm" name="id2592873"></a>printing parameter
525 setting. In the commands listed in <a href="classicalprinting.html#printOptions" title="Table 20.1. Default Printing Settings">Default Printing Settings</a> , you will
526 notice 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,
527 J</em></span>, and so on. These letters stand for printer name, spool file, and job ID, respectively.  They are
528 explained in more detail in <a href="classicalprinting.html#printOptions" title="Table 20.1. Default Printing Settings">Default Printing Settings</a> presents an overview
529 of key printing options but excludes the special case of CUPS, is discussed in <a href="CUPS-printing.html" title="Chapter 21. CUPS Printing Support">CUPS Printing Support</a>.
530 </p><div class="table"><a name="printOptions"></a><p class="title"><b>Table 20.1. Default Printing Settings</b></p><table summary="Default Printing Settings" border="1"><colgroup><col align="left"><col align="left"></colgroup><thead><tr><th align="left">Setting</th><th align="left">Default Printing Commands</th></tr></thead><tbody><tr><td align="left"><a class="indexterm" name="id2592971"></a>printing = bsd|aix|lprng|plp</td><td align="left">print command is <span><strong class="command">lpr -r -P%p %s</strong></span></td></tr><tr><td align="left"><a class="indexterm" name="id2592992"></a>printing = sysv|hpux</td><td align="left">print command is <span><strong class="command">lp -c -P%p %s; rm %s</strong></span></td></tr><tr><td align="left"> <a class="indexterm" name="id2593014"></a>printing = qnx</td><td align="left">print command is <span><strong class="command">lp -r -P%p -s %s</strong></span></td></tr><tr><td align="left"><a class="indexterm" name="id2593035"></a>printing = bsd|aix|lprng|plp</td><td align="left">lpq command is <span><strong class="command">lpq -P%p</strong></span></td></tr><tr><td align="left"><a class="indexterm" name="id2593056"></a>printing = sysv|hpux</td><td align="left">lpq command is <span><strong class="command">lpstat -o%p</strong></span></td></tr><tr><td align="left"><a class="indexterm" name="id2593077"></a>printing = qnx</td><td align="left">lpq command is <span><strong class="command">lpq -P%p</strong></span></td></tr><tr><td align="left"><a class="indexterm" name="id2593098"></a>printing = bsd|aix|lprng|plp</td><td align="left">lprm command is <span><strong class="command">lprm -P%p %j</strong></span></td></tr><tr><td align="left"><a class="indexterm" name="id2593119"></a>printing = sysv|hpux</td><td align="left">lprm command is <span><strong class="command">cancel %p-%j</strong></span></td></tr><tr><td align="left"><a class="indexterm" name="id2593140"></a>printing = qnx</td><td align="left">lprm command is <span><strong class="command">cancel %p-%j</strong></span></td></tr><tr><td align="left"><a class="indexterm" name="id2593161"></a>printing = bsd|aix|lprng|plp</td><td align="left">lppause command is <span><strong class="command">lp -i %p-%j -H hold</strong></span></td></tr><tr><td align="left"><a class="indexterm" name="id2593182"></a>printing = sysv|hpux</td><td align="left">lppause command   (...is empty)</td></tr><tr><td align="left"><a class="indexterm" name="id2593198"></a>printing = qnx</td><td align="left">lppause command   (...is empty)</td></tr><tr><td align="left"><a class="indexterm" name="id2593215"></a>printing = bsd|aix|lprng|plp</td><td align="left">lpresume command is <span><strong class="command">lp -i %p-%j -H resume</strong></span></td></tr><tr><td align="left"><a class="indexterm" name="id2593236"></a>printing = sysv|hpux</td><td align="left">lpresume command   (...is empty)</td></tr><tr><td align="left"><a class="indexterm" name="id2593253"></a>printing = qnx</td><td align="left">lpresume command   (...is empty)</td></tr></tbody></table></div><p>
531 <a class="indexterm" name="id2593271"></a>
532 <a class="indexterm" name="id2593278"></a>
533 <a class="indexterm" name="id2593285"></a>
534 <a class="indexterm" name="id2593292"></a>
535 For <em class="parameter"><code>printing = CUPS</code></em>, if Samba is compiled against libcups, it uses the CUPS API to
536 submit jobs. (It is a good idea also to set <a class="indexterm" name="id2593307"></a>printcap = cups in case your
537 <code class="filename">cupsd.conf</code> is set to write its autogenerated printcap file to an unusual place).
538 Otherwise, Samba maps to the System V printing commands with the -oraw option for printing; that is, it uses
539 <span><strong class="command">lp -c -d%p -oraw; rm %s</strong></span>. With <em class="parameter"><code>printing = cups</code></em>, and if Samba is
540 compiled against libcups, any manually set print command will be ignored!
541 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2593339"></a>Custom Print Commands</h4></div></div></div><p>
542 <a class="indexterm" name="id2593347"></a>
543 <a class="indexterm" name="id2593354"></a>
544 After a print job has finished spooling to a service, the <a class="indexterm" name="id2593362"></a>print command will be used
545 by Samba via a system() call to process the spool file. Usually the command specified will submit the spool
546 file to the host's printing subsystem. But there is no requirement at all that this must be the case. The
547 print subsystem may not remove the spool file on its own, so whatever command you specify, you should ensure
548 that the spool file is deleted after it has been processed.
549 </p><p>
550 <a class="indexterm" name="id2593379"></a>
551 <a class="indexterm" name="id2593386"></a>
552 <a class="indexterm" name="id2593393"></a>
553 <a class="indexterm" name="id2593400"></a>
554 There is no difficulty with using your own customized print commands with the traditional printing systems.
555 However, if you do not wish to roll your own, you should be well informed about the default built-in commands
556 that Samba uses for each printing subsystem (see <a href="classicalprinting.html#printOptions" title="Table 20.1. Default Printing Settings">Default Printing
557 Settings</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
559 names of real objects. At the time of running a command with such a placeholder, Samba will insert the
560 appropriate value automatically. Print commands can handle all Samba macro substitutions. In regard to
561 printing, the following ones do have special relevance:
562 </p><div class="itemizedlist"><ul type="disc"><li><p><em class="parameter"><code>%s, %f</code></em>  the path to the spool file name.</p></li><li><p><em class="parameter"><code>%p</code></em>  the appropriate printer name.</p></li><li><p><em class="parameter"><code>%J</code></em>  the job name as transmitted by the client.</p></li><li><p><em class="parameter"><code>%c</code></em>  the number of printed pages of the spooled job (if known).</p></li><li><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="id2593500"></a>
564 The 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,
566 the <em class="parameter"><code>%p</code></em> will be silently removed from the print command. In this case, the job is
567 sent to the default printer.
568 </p><p>
569 <a class="indexterm" name="id2593536"></a>
570 <a class="indexterm" name="id2593543"></a>
571 If specified in the <em class="parameter"><code>[global]</code></em> section, the print command given will be
572 used for any printable service that does not have its own print command specified. If there is neither a
573 specified print command for a printable service nor a global print command, spool files will be created
574 but not processed! Most importantly, print files will not be removed, so they will consume disk space.
575 </p><p>
576 <a class="indexterm" name="id2593565"></a>
577 <a class="indexterm" name="id2593572"></a>
578 Printing may fail on some UNIX systems when using the <span class="emphasis"><em>nobody</em></span> account. If this happens, create an
579 alternative 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="id2593601"></a>
583 <a class="indexterm" name="id2593608"></a>
584 <a class="indexterm" name="id2593615"></a>
585 You can form quite complex print commands. You need to realize that print commands are just
586 passed to a UNIX shell. The shell is able to expand the included environment variables as
587 usual. (The syntax to include a UNIX environment variable <em class="parameter"><code>$variable</code></em>
588 in the Samba print command is <em class="parameter"><code>%$variable</code></em>.) To give you a working
589 <a class="indexterm" name="id2593639"></a>print command example, the following will log a print job
590 to <code class="filename">/tmp/print.log</code>, print the file, then remove it. The semicolon (&#8220;<span class="quote">;</span>&#8221;
591 is the usual separator for commands in shell scripts:
592 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2593666"></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>
593 You may have to vary your own command considerably from this example depending on how you normally print
594 files on your system. The default for the <a class="indexterm" name="id2593686"></a>print command
595 parameter varies depending on the setting of the <a class="indexterm" name="id2593695"></a>printing
596 parameter. Another example is:
597 </p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2593710"></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" lang="en"><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="id2593738"></a>
599 <a class="indexterm" name="id2593745"></a>
600 <a class="indexterm" name="id2593751"></a>
601 Prior to Samba-2.2.x, print server support for Windows clients was limited to <span class="emphasis"><em>LanMan</em></span>
602 printing calls. This is the same protocol level as Windows 9x/Me PCs offer when they share printers.
603 Beginning with the 2.2.0 release, Samba started to support the native Windows NT printing mechanisms. These
604 are implemented via <span class="emphasis"><em>MS-RPC</em></span> (Remote Procedure Calls).
605 MS-RPCs use the <span class="emphasis"><em>SPOOLSS</em></span> named pipe for all printing.
606 </p><p>
607 The additional functionality provided by the new SPOOLSS support includes:
608 </p><div class="itemizedlist"><ul type="disc"><li><p>
609 <a class="indexterm" name="id2593787"></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><p>
613 <a class="indexterm" name="id2593803"></a>
614         Uploading of printer drivers via the Windows NT <span class="emphasis"><em>Add Printer Wizard</em></span> (APW)
615         or the <a href="http://imprints.sourceforge.net/" target="_top">Imprints</a> tool set.
616         </p></li><li><p>        
617 <a class="indexterm" name="id2593826"></a>
618 <a class="indexterm" name="id2593833"></a>
619 <a class="indexterm" name="id2593840"></a>
620 <a class="indexterm" name="id2593847"></a>
621 <a class="indexterm" name="id2593854"></a>
622         Support for the native MS-RPC printing calls such as StartDocPrinter, EnumJobs(), and so on. (See the
623         <a href="http://msdn.microsoft.com/" target="_top">MSDN documentation</a> for more information on the
624         Win32 printing API).
625         </p></li><li><p>
626 <a class="indexterm" name="id2593874"></a>
627 <a class="indexterm" name="id2593880"></a>
628         Support for NT Access Control Lists (ACL) on printer objects.
629         </p></li><li><p>
630 <a class="indexterm" name="id2593893"></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="id2593912"></a>
635 <a class="indexterm" name="id2593919"></a>
636 A 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="id2593931"></a>
639 A fundamental difference exists between MS Windows NT print servers and Samba operation. Windows NT
640 permits the installation of local printers that are not shared. This is an artifact of the fact that
641 any Windows NT machine (server or client) may be used by a user as a workstation. Samba will publish all
642 printers that are made available, either by default or by specific declaration via printer-specific shares.
643 </p><p>
644 <a class="indexterm" name="id2593948"></a>
645 <a class="indexterm" name="id2593955"></a>
646 <a class="indexterm" name="id2593961"></a>
647 <a class="indexterm" name="id2593968"></a>
648 <a class="indexterm" name="id2593975"></a>
649 Windows NT/200x/XP Professional clients do not have to use the standard SMB printer share; they can
650 print directly to any printer on another Windows NT host using MS-RPC. This, of course, assumes that
651 the client has the necessary privileges on the remote host that serves the printer resource. The
652 default 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
654 printers.)
655 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2593995"></a>Point'n'Print Client Drivers on Samba Servers</h3></div></div></div><p>
656 <a class="indexterm" name="id2594004"></a>
657 There is much confusion about what all this means. The question is often asked, &#8220;<span class="quote">Is it or is
658 it not necessary for printer drivers to be installed on a Samba host in order to support printing from
659 Windows clients?</span>&#8221; The answer to this is no, it is not necessary.
660 </p><p>
661 <a class="indexterm" name="id2594022"></a>
662 <a class="indexterm" name="id2594028"></a>
663 Windows 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
665 clients. (However, a bug existed in Samba 2.2.0 that made Windows NT/2000 clients
666 require 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="id2594048"></a>
669 <a class="indexterm" name="id2594055"></a>
670 But it is a new capability to install the printer drivers into the <em class="parameter"><code>[print$]</code></em>
671 share 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
675 Samba printer share can be achieved by different means:
676 </p><div class="itemizedlist"><ul type="disc"><li><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><p>
679         Using the <span class="emphasis"><em>Imprints</em></span> toolset.
680         </p></li><li><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><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="id2594137"></a>
686 <a class="indexterm" name="id2594144"></a>
687 Samba does not use these uploaded drivers in any way to process spooled files. These drivers are utilized
688 entirely by the clients who download and install them via the &#8220;<span class="quote">Point'n'Print</span>&#8221; mechanism
689 supported 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
691 system, which is responsible for all further processing, as needed.
692 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2594165"></a>The Obsoleted [printer$] Section</h3></div></div></div><p>
693 <a class="indexterm" name="id2594173"></a>
694 <a class="indexterm" name="id2594180"></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="id2594224"></a>
705 <a class="indexterm" name="id2594231"></a>
706 <a class="indexterm" name="id2594238"></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" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2594286"></a>Creating the [print$] Share</h3></div></div></div><p>
717 <a class="indexterm" name="id2594294"></a>
718 In order to support the uploading and downloading of printer driver files, you must first configure a
719 file share named <em class="parameter"><code>[print$]</code></em>. The public name of this share is hard coded
720 in the MS Windows clients. It cannot be renamed, since Windows clients are programmed to search for a
721 service of exactly this name if they want to retrieve printer driver files.
722 </p><p>
723 You 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
725 as <a class="indexterm" name="id2594324"></a>path, are arbitrary and should be replaced with appropriate values for your
726 site). See <a href="classicalprinting.html#prtdollar" title="Example 20.3. [print$] Example">[print\$] Example</a>.
727 </p><div class="example"><a name="prtdollar"></a><p class="title"><b>Example 20.3. [print$] Example</b></p><table class="simplelist" border="0" summary="Simple list"><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="id2594374"></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="id2594412"></a><em class="parameter"><code>comment = Printer Driver Download Area</code></em></td></tr><tr><td><a class="indexterm" name="id2594425"></a><em class="parameter"><code>path = /etc/samba/drivers</code></em></td></tr><tr><td><a class="indexterm" name="id2594437"></a><em class="parameter"><code>browseable = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2594450"></a><em class="parameter"><code>guest ok = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2594463"></a><em class="parameter"><code>read only = yes</code></em></td></tr><tr><td><a class="indexterm" name="id2594475"></a><em class="parameter"><code>write list = @ntadmin, root</code></em></td></tr></table></div><p>
728 Of course, you also need to ensure that the directory named by the
729 <a class="indexterm" name="id2594493"></a>path parameter exists on the UNIX file system.
730 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2594503"></a>[print$] Stanza Parameters</h3></div></div></div><p>
731 <a class="indexterm" name="id2594511"></a>
732 <a class="indexterm" name="id2594518"></a>
733 <a class="indexterm" name="id2594524"></a>
734 <a class="indexterm" name="id2594531"></a>
735 <a class="indexterm" name="id2594538"></a>
736 The <em class="parameter"><code>[print$]</code></em> is a special section in <code class="filename">smb.conf</code>. It contains settings relevant to
737 potential printer driver download and is used by Windows clients for local print driver installation.
738 The following parameters are frequently needed in this share section:
739 </p><div class="variablelist"><dl><dt><span class="term"><a class="indexterm" name="id2594566"></a>comment = Printer Driver Download Area </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 <span><strong class="command">smbclient -L sambaserver
742                 </strong></span> output).
743                 </p></dd><dt><span class="term"><a class="indexterm" name="id2594592"></a>path = /etc/samba/printers </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="indexterm" name="id2594609"></a>browseable = no </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 <span><strong class="command">cmd</strong></span> shell:
748 </p><pre class="screen">
749 <code class="prompt">C:\&gt; </code> <span><strong class="command">net use g:\\sambaserver\print$</strong></span>
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 menu&gt;</span> from Windows Explorer.
753                 </p></dd><dt><span class="term"><a class="indexterm" name="id2594670"></a>guest ok = yes </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" 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="indexterm" name="id2594705"></a>map to guest = Bad   User
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="indexterm" name="id2594726"></a>read only = yes </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="indexterm" name="id2594744"></a>write list = @ntadmin, root </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 &#8220;<span class="quote">@</span>&#8221; 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="indexterm" name="id2594780"></a>printer admin
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" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2594799"></a>The [print$] Share Directory</h3></div></div></div><p>
781 In order for a Windows NT print server to support the downloading of driver files by multiple client
782 architectures, you must create several subdirectories within the <em class="parameter"><code>[print$]</code></em>
783 service (i.e., the UNIX directory named by the <a class="indexterm" name="id2594817"></a>path
784 parameter). These correspond to each of the supported client architectures. Samba follows this model as
785 well. Just like the name of the <em class="parameter"><code>[print$]</code></em> share itself, the subdirectories
786 must be exactly the names listed below (you may leave out the subdirectories of architectures you do
787 not need to support).
788 </p><p>
789 Therefore, create a directory tree below the
790 <em class="parameter"><code>[print$]</code></em> share for each architecture you wish
791 to 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" 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 type="disc"><li><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><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 &#8220;<span class="quote">read-only</span>&#8221; by default.
809         </p></div><p>
810 Once you have created the required <em class="parameter"><code>[print$]</code></em> service and
811 associated subdirectories, go to a Windows NT 4.0/200x/XP client workstation. Open <span class="guiicon">Network
812 Neighborhood</span> or <span class="guiicon">My Network Places</span> and browse for the Samba host. Once you
813 have located the server, navigate to its <span class="guiicon">Printers and Faxes</span> folder. You should see
814 an initial listing of printers that matches the printer shares defined on your Samba host.
815 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2594938"></a>Installing Drivers into [print$]</h2></div></div></div><p>
816 Have you successfully created the <em class="parameter"><code>[print$]</code></em> share in <code class="filename">smb.conf</code>, and have you forced
817 Samba to reread its <code class="filename">smb.conf</code> file? Good. But you are not yet ready to use the new facility. The client
818 driver files need to be installed into this share. So far, it is still an empty share. Unfortunately, it is
819 not enough to just copy the driver files over. They need to be correctly installed so that appropriate records
820 for each driver will exist in the Samba internal databases so it can provide the correct drivers as they are
821 requested from MS Windows clients. And that is a bit tricky, to say the least. We now discuss two alternative
822 ways to install the drivers into <em class="parameter"><code>[print$]</code></em>:
823 </p><div class="itemizedlist"><ul type="disc"><li><p>
824         Using the Samba command-line utility <span><strong class="command">rpcclient</strong></span> with its various subcommands (here,
825         <span><strong class="command">adddriver</strong></span> and <span><strong class="command">setdriver</strong></span>) from any UNIX workstation.
826         </p></li><li><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>
830 The latter option is probably the easier one (even if the process may seem a little bit weird at first).
831 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2595032"></a>Add Printer Wizard Driver Installation</h3></div></div></div><p>
832 The printers initially listed in the Samba host's <span class="guiicon">Printers</span> folder accessed from a
833 client's Explorer will have no real printer driver assigned to them. By default this driver name is set
834 to a null string. This must be changed now. The local <span class="guiicon">Add Printer Wizard</span> (APW), run from
835 NT/2000/XP clients, will help us in this task.
836 </p><p>
837 Installation of a valid printer driver is not straightforward. You must attempt to view the printer properties
838 for the printer to which you want the driver assigned. Open Windows Explorer, open <span class="guiicon">Network
839 Neighborhood</span>, browse to the Samba host, open Samba's <span class="guiicon">Printers</span> folder, right-click
840 on the printer icon, and select <span class="guimenu">Properties...</span>. You are now trying to view printer and
841 driver properties for a queue that has this default <code class="constant">NULL</code> driver assigned. This will
842 result in the following error message: &#8220;<span class="quote"> Device settings cannot be displayed. The driver for the
843 specified printer is not installed, only spooler properties will be displayed. Do you want to install the
844 driver now?</span>&#8221;
845 </p><p>
846 Do <span class="emphasis"><em>not</em></span> click on <span class="guibutton">Yes</span>!  Instead, click on <span class="guibutton">No</span>
847 in the error dialog.  Now you will be presented with the printer properties window. From here, the way to
848 assign a driver to a printer is open. You now have the choice of:
849 </p><div class="itemizedlist"><ul type="disc"><li><p>
850         Select a driver from the pop-up list of installed drivers. Initially this list will be empty.
851         </p></li><li><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>
855 Once the APW is started, the procedure is exactly the same as the one you are familiar with in Windows (we
856 assume here that you are familiar with the printer driver installations procedure on Windows NT). Make sure
857 your connection is, in fact, set up as a user with <a class="indexterm" name="id2595145"></a>printer admin
858 privileges (if in doubt, use <span><strong class="command">smbstatus</strong></span> to check for this). If you wish to install
859 printer drivers for client operating systems other than <span class="application">Windows NT x86</span>,
860 you will need to use the <span class="guilabel">Sharing</span> tab of the printer properties dialog.
861 </p><p>
862 Assuming you have connected with an administrative (or root) account (as named by the
863 <a class="indexterm" name="id2595178"></a>printer admin parameter), you will also be able to modify
864 other printer properties such as ACLs and default device settings using this dialog. For the default
865 device settings, please consider the advice given further in <a href="classicalprinting.html#inst-rpc" title="Installing Print Drivers Using rpcclient">Installing
866 Print Drivers Using <span><strong class="command">rpcclient</strong></span></a>.
867 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="inst-rpc"></a>Installing Print Drivers Using <span><strong class="command">rpcclient</strong></span></h3></div></div></div><p>
868 The second way to install printer drivers into <em class="parameter"><code>[print$]</code></em> and set them
869 up in a valid way is to do it from the UNIX command line. This involves four distinct steps:
870 </p><div class="orderedlist"><ol type="1"><li><p>
871         Gather information about required driver files and collect the files.
872         </p></li><li><p>
873         Deposit the driver files into the <em class="parameter"><code>[print$]</code></em> share's correct subdirectories
874         (possibly by using <span><strong class="command">smbclient</strong></span>).
875         </p></li><li><p>
876         Run the <span><strong class="command">rpcclient</strong></span> command-line utility once with the <span><strong class="command">adddriver</strong></span>
877         subcommand.
878         </p></li><li><p>
879         Run <span><strong class="command">rpcclient</strong></span> a second time with the <span><strong class="command">setdriver</strong></span> subcommand.
880         </p></li></ol></div><p>
881 We provide detailed hints for each of these steps in the paragraphs that follow.
882 </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2595299"></a>Identifying Driver Files</h4></div></div></div><p>
883 <a class="indexterm" name="id2595307"></a>
884 <a class="indexterm" name="id2595314"></a>
885 <a class="indexterm" name="id2595321"></a>
886 To find out about the driver files, you have two options. You can check the contents of the driver
887 CDROM that came with your printer. Study the <code class="filename">*.inf</code> files located on the CD-ROM. This
888 may not be possible, since the <code class="filename">*.inf</code> file might be missing. Unfortunately, vendors have now started
889 to use their own installation programs. These installations packages are often in some Windows platform
890 archive format. Additionally, the files may be re-named during the installation process. This makes it
891 extremely difficult to identify the driver files required.
892 </p><p>
893 <a class="indexterm" name="id2595352"></a>
894 Then you have the second option. Install the driver locally on a Windows client and
895 investigate which filenames and paths it uses after they are installed. (You need to repeat
896 this 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
898 clients.)
899 </p><p>
900 <a class="indexterm" name="id2595374"></a>
901 A 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
903 driver 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="id2595431"></a>
909 <a class="indexterm" name="id2595438"></a>
910 <a class="indexterm" name="id2595444"></a>
911 Another method to quickly test the driver filenames and related paths is provided by the
912 <span><strong class="command">rpcclient</strong></span> utility. Run it with <span><strong class="command">enumdrivers</strong></span> or with the
913 <span><strong class="command">getdriver</strong></span> 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
915 laptop). I installed the driver locally to TURBO_XP from a Samba server called <code class="constant">KDE-BITSHOP</code>.
916 We could run an interactive <span><strong class="command">rpcclient</strong></span> session; then we would get an
917 <span><strong class="command">rpcclient /&gt;</strong></span> prompt and would type the subcommands at this prompt. This is left as
918 a good exercise for you. For now, we use <span><strong class="command">rpcclient</strong></span> with the <code class="option">-c</code>
919 parameter to execute a single subcommand line and exit again. This is the method you use if you
920 want to create scripts to automate the procedure for a large number of printers and drivers. Note the
921 different 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>
925 cmd = getdriver "Heidelberg Digimaster 9110 (PS)" 3
926
927 [Windows NT x86]
928 Printer 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="id2595581"></a>
952 <a class="indexterm" name="id2595588"></a>
953 <a class="indexterm" name="id2595595"></a>
954 <a class="indexterm" name="id2595602"></a>
955 You 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
960 9x/Me platforms. If we want to support these, we need to install the Windows 9x/Me driver files in
961 addition to those for <span class="application">W32X86</span> (i.e., the Windows NT 2000/XP clients) onto a
962 Windows 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="id2595650"></a>
965 <a class="indexterm" name="id2595657"></a>
966 <a class="indexterm" name="id2595664"></a>
967 Since the <em class="parameter"><code>[print$]</code></em> share is usually accessible through the <span class="guiicon">Network
968 Neighborhood</span>, you can also use the UNC notation from Windows Explorer to poke at it. The Windows
969 9x/Me driver files will end up in subdirectory <code class="filename">0</code> of the <code class="filename">WIN40</code>
970 directory. The full path to access them is <code class="filename">\\WINDOWSHOST\print$\WIN40\0\</code>.
971 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
972 More recent drivers on Windows 2000 and Windows XP are installed into the &#8220;<span class="quote">3</span>&#8221; subdirectory
973 instead of the &#8220;<span class="quote">2</span>&#8221;. The version 2 of drivers, as used in Windows NT, were running in kernel
974 mode. Windows 2000 changed this. While it still can use the kernel mode drivers (if this is enabled by
975 the Admin), its native mode for printer drivers is user mode execution. This requires drivers designed
976 for this purpose. These types of drivers install into the &#8220;<span class="quote">3</span>&#8221; subdirectory.
977 </p></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2595727"></a>Obtaining Driver Files from Windows Client [print$] Shares</h4></div></div></div><p>
978 Now we need to collect all the driver files we identified in our previous step. Where do we get them
979 from? Well, why not retrieve them from the very PC and the same <em class="parameter"><code>[print$]</code></em>
980 share that we investigated in our last step to identify the files? We can use <span><strong class="command">smbclient</strong></span>
981 to do this. We will use the paths and names that were leaked to us by <span><strong class="command">getdriver</strong></span>. The
982 listing is edited to include line breaks for readability:
983 </p><pre class="screen">
984 <code class="prompt">root# </code><strong class="userinput"><code>smbclient //TURBO_XP/print\$ -U'Danka%xxxx' \ 
985    -c 'cd W32X86/2;mget HD*_de.* hd*ppd Hd*_de.* Hddm*dll HDN*Aux.DLL'</code></strong>
986
987 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
988 Got a positive name query response from 10.160.50.8 ( 10.160.50.8 )
989 Domain=[DEVELOPMENT] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
990 <code class="prompt">Get file Hddm91c1_de.ABD? </code><strong class="userinput"><code>n</code></strong>
991 <code class="prompt">Get file Hddm91c1_de.def? </code><strong class="userinput"><code>y</code></strong>
992 getting file \W32X86\2\Hddm91c1_de.def of size 428 as Hddm91c1_de.def
993 <code class="prompt">Get file Hddm91c1_de.DLL? </code><strong class="userinput"><code>y</code></strong>
994 getting file \W32X86\2\Hddm91c1_de.DLL of size 876544 as Hddm91c1_de.DLL
995 [...]
996 </pre><p>
997 After this command is complete, the files are in our current local directory. You probably have noticed
998 that this time we passed several commands to the <code class="option">-c</code> parameter, separated by semicolons.
999 This ensures that all commands are executed in sequence on the remote Windows server before
1000 <span><strong class="command">smbclient</strong></span> exits again.
1001 </p><p>
1002 <a class="indexterm" name="id2595835"></a>
1003 Remember to repeat the procedure for the <span class="application">WIN40</span> architecture should you need to
1004 support Windows 9x/Me/XP clients. Remember too, the files for these architectures are in the
1005 <code class="filename">WIN40/0/</code> subdirectory. Once this is complete, we can run <span><strong class="command">smbclient. .
1006 .put</strong></span> to store the collected files on the Samba server's <em class="parameter"><code>[print$]</code></em> share.
1007 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2595872"></a>Installing Driver Files into [print$]</h4></div></div></div><p>
1008 We are now going to locate the driver files into the <em class="parameter"><code>[print$]</code></em> share. Remember, the
1009 UNIX path to this share has been defined previously in your <code class="filename">smb.conf</code> file. You also have created
1010 subdirectories for the different Windows client types you want to support. If, for example, your
1011 <em class="parameter"><code>[print$]</code></em> share maps to the UNIX path <code class="filename">/etc/samba/drivers/</code>, your
1012 driver files should now go here:
1013 </p><div class="itemizedlist"><ul type="disc"><li><p>
1014         For all Windows NT, 2000, and XP clients, <code class="filename">/etc/samba/drivers/W32X86/</code> but
1015         not (yet) into the <code class="filename">2</code> subdirectory.
1016         </p></li><li><p>
1017         For all Windows 95, 98, and Me clients, <code class="filename">/etc/samba/drivers/WIN40/</code> but not
1018         (yet) into the <code class="filename">0</code> subdirectory.
1019         </p></li></ul></div><p>
1020 <a class="indexterm" name="id2595952"></a>
1021 <a class="indexterm" name="id2595958"></a>
1022 We again use smbclient to transfer the driver files across the network. We specify the same files
1023 and paths as were leaked to us by running <span><strong class="command">getdriver</strong></span> against the original
1024 <span class="emphasis"><em>Windows</em></span> install. However, now we are going to store the files into a
1025 <span class="emphasis"><em>Samba/UNIX</em></span> print server's <em class="parameter"><code>[print$]</code></em> share.
1026 </p><pre class="screen">
1027 <code class="prompt">root# </code><strong class="userinput"><code>smbclient //SAMBA-CUPS/print\$ -U'root%xxxx' -c \
1028   'cd W32X86; put HDNIS01_de.DLL; \
1029   put Hddm91c1_de.ppd; put HDNIS01U_de.DLL;        \
1030   put HDNIS01U_de.HLP; put Hddm91c1_de.DLL;        \
1031   put Hddm91c1_de.INI; put Hddm91c1KMMin.DLL;      \
1032   put Hddm91c1_de.dat; put Hddm91c1_de.dat;        \
1033   put Hddm91c1_de.def; put Hddm91c1_de.hre;        \
1034   put Hddm91c1_de.vnd; put Hddm91c1_de.hlp;        \
1035   put Hddm91c1_de_reg.HLP; put HDNIS01Aux.dll;     \
1036   put HDNIS01_de.NTF'</code></strong>
1037
1038 added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
1039 Got a positive name query response from 10.160.51.162 ( 10.160.51.162 )
1040 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a]
1041 putting file HDNIS01_de.DLL as \W32X86\HDNIS01_de.DLL
1042 putting file Hddm91c1_de.ppd as \W32X86\Hddm91c1_de.ppd
1043 putting file HDNIS01U_de.DLL as \W32X86\HDNIS01U_de.DLL
1044 putting file HDNIS01U_de.HLP as \W32X86\HDNIS01U_de.HLP
1045 putting file Hddm91c1_de.DLL as \W32X86\Hddm91c1_de.DLL
1046 putting file Hddm91c1_de.INI as \W32X86\Hddm91c1_de.INI
1047 putting file Hddm91c1KMMin.DLL as \W32X86\Hddm91c1KMMin.DLL
1048 putting file Hddm91c1_de.dat as \W32X86\Hddm91c1_de.dat
1049 putting file Hddm91c1_de.dat as \W32X86\Hddm91c1_de.dat
1050 putting file Hddm91c1_de.def as \W32X86\Hddm91c1_de.def
1051 putting file Hddm91c1_de.hre as \W32X86\Hddm91c1_de.hre
1052 putting file Hddm91c1_de.vnd as \W32X86\Hddm91c1_de.vnd
1053 putting file Hddm91c1_de.hlp as \W32X86\Hddm91c1_de.hlp
1054 putting file Hddm91c1_de_reg.HLP as \W32X86\Hddm91c1_de_reg.HLP
1055 putting file HDNIS01Aux.dll as \W32X86\HDNIS01Aux.dll
1056 putting file HDNIS01_de.NTF as \W32X86\HDNIS01_de.NTF
1057 </pre><p>
1058 <a class="indexterm" name="id2596031"></a>
1059 <a class="indexterm" name="id2596037"></a>
1060 <a class="indexterm" name="id2596044"></a>
1061 Whew  that was a lot of typing! Most drivers are a lot smaller  many have only three generic
1062 PostScript driver files plus one PPD. While we did retrieve the files from the <code class="filename">2</code>
1063 subdirectory of the <code class="filename">W32X86</code> directory from the Windows box, we do not put them
1064 (for now) in this same subdirectory of the Samba box. This relocation will automatically be done by the
1065 <span><strong class="command">adddriver</strong></span> command, which we will run shortly (and do not forget to also put the files
1066 for the Windows 9x/Me architecture into the <code class="filename">WIN40/</code> subdirectory should you need them).
1067 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2596091"></a><span><strong class="command">smbclient</strong></span> to Confirm Driver Installation</h4></div></div></div><p>
1068 <a class="indexterm" name="id2596103"></a>
1069 <a class="indexterm" name="id2596110"></a>
1070 For now we verify that our files are there. This can be done with <span><strong class="command">smbclient</strong></span>, too
1071 (but, of course, you can log in via SSH also and do this through a standard UNIX shell access):
1072 </p><pre class="screen">
1073 <code class="prompt">root# </code><strong class="userinput"><code>smbclient //SAMBA-CUPS/print\$ -U 'root%xxxx' \
1074         -c 'cd W32X86; pwd; dir; cd 2; pwd; dir'</code></strong>
1075  added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
1076 Got a positive name query response from 10.160.51.162 ( 10.160.51.162 )
1077 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.8a]
1078
1079 Current directory is \\SAMBA-CUPS\print$\W32X86\
1080 .                                  D        0  Sun May  4 03:56:35 2003
1081 ..                                 D        0  Thu Apr 10 23:47:40 2003
1082 2                                   D        0  Sun May  4 03:56:18 2003
1083 HDNIS01Aux.dll                      A    15356  Sun May  4 03:58:59 2003
1084 Hddm91c1KMMin.DLL                   A    46966  Sun May  4 03:58:59 2003
1085 HDNIS01_de.DLL                      A   434400  Sun May  4 03:58:59 2003
1086 HDNIS01_de.NTF                      A   790404  Sun May  4 03:56:35 2003
1087 Hddm91c1_de.DLL                     A   876544  Sun May  4 03:58:59 2003
1088 Hddm91c1_de.INI                     A      101  Sun May  4 03:58:59 2003
1089 Hddm91c1_de.dat                     A     5044  Sun May  4 03:58:59 2003
1090 Hddm91c1_de.def                     A      428  Sun May  4 03:58:59 2003
1091 Hddm91c1_de.hlp                     A    37699  Sun May  4 03:58:59 2003
1092 Hddm91c1_de.hre                     A   323584  Sun May  4 03:58:59 2003
1093 Hddm91c1_de.ppd                     A    26373  Sun May  4 03:58:59 2003
1094 Hddm91c1_de.vnd                     A    45056  Sun May  4 03:58:59 2003
1095 HDNIS01U_de.DLL                     A   165888  Sun May  4 03:58:59 2003
1096 HDNIS01U_de.HLP                     A    19770  Sun May  4 03:58:59 2003
1097 Hddm91c1_de_reg.HLP                 A   228417  Sun May  4 03:58:59 2003
1098               40976 blocks of size 262144. 709 blocks available
1099
1100 Current directory is \\SAMBA-CUPS\print$\W32X86\2\
1101 .                                  D        0  Sun May  4 03:56:18 2003
1102 ..                                 D        0  Sun May  4 03:56:35 2003
1103 ADOBEPS5.DLL                        A   434400  Sat May  3 23:18:45 2003
1104 laserjet4.ppd                       A     9639  Thu Apr 24 01:05:32 2003
1105 ADOBEPSU.DLL                        A   109568  Sat May  3 23:18:45 2003
1106 ADOBEPSU.HLP                        A    18082  Sat May  3 23:18:45 2003
1107 PDFcreator2.PPD                     A    15746  Sun Apr 20 22:24:07 2003
1108               40976 blocks of size 262144. 709 blocks available
1109 </pre><p>
1110 <a class="indexterm" name="id2596223"></a>
1111 <a class="indexterm" name="id2596230"></a>
1112 <a class="indexterm" name="id2596237"></a>
1113 Notice that there are already driver files present in the <code class="filename">2</code> subdirectory (probably from a
1114 previous installation). Once the files for the new driver are there too, you are still a few steps away from
1115 being able to use them on the clients. The only thing you could do now is retrieve them from a client just
1116 like you retrieve ordinary files from a file share, by opening print$ in Windows Explorer. But that wouldn't
1117 install them per Point'n'Print. The reason is that Samba does not yet know that these files are something
1118 special, namely <span class="emphasis"><em>printer driver files</em></span>, and it does not know to which print queue(s) these
1119 driver files belong.
1120 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2596265"></a>Running <span><strong class="command">rpcclient</strong></span> with <span><strong class="command">adddriver</strong></span></h4></div></div></div><p>
1121 <a class="indexterm" name="id2596284"></a>
1122 <a class="indexterm" name="id2596290"></a>
1123 <a class="indexterm" name="id2596298"></a>
1124 Next, you must tell Samba about the special category of the files you just uploaded into the
1125 <em class="parameter"><code>[print$]</code></em> share. This is done by the <span><strong class="command">adddriver</strong></span>
1126 command. It will prompt Samba to register the driver files into its internal TDB database files. The
1127 following command and its output has been edited for readability:
1128 </p><pre class="screen">
1129 <code class="prompt">root# </code><strong class="userinput"><code>rpcclient -Uroot%xxxx -c 'adddriver "Windows NT x86" \
1130   "dm9110:HDNIS01_de.DLL: \
1131   Hddm91c1_de.ppd:HDNIS01U_de.DLL:HDNIS01U_de.HLP:   \
1132   NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI,          \
1133   Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre,   \
1134   Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL, \
1135   HDNIS01Aux.dll,HDNIS01_de.NTF,                     \
1136   Hddm91c1_de_reg.HLP' SAMBA-CUPS</code></strong>
1137
1138 cmd = adddriver "Windows NT x86" \
1139   "dm9110:HDNIS01_de.DLL:Hddm91c1_de.ppd:HDNIS01U_de.DLL:   \
1140   HDNIS01U_de.HLP:NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI, \
1141   Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre,          \
1142   Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL,        \
1143   HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP"
1144
1145 Printer Driver dm9110 successfully installed.
1146 </pre><p>
1147 <a class="indexterm" name="id2596352"></a>
1148 <a class="indexterm" name="id2596359"></a>
1149 <a class="indexterm" name="id2596366"></a>
1150 After this step, the driver should be recognized by Samba on the print server. You need to be very
1151 careful when typing the command. Don't exchange the order of the fields. Some changes would lead to
1152 an <code class="computeroutput">NT_STATUS_UNSUCCESSFUL</code> error message. These become obvious. Other
1153 changes might install the driver files successfully but render the driver unworkable. So take care!
1154 Hints about the syntax of the adddriver command are in the man page. 
1155 provides a more detailed description, should you need it.
1156 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2596389"></a>Checking <span><strong class="command">adddriver</strong></span> Completion</h4></div></div></div><p>
1157 One indication for Samba's recognition of the files as driver files is the <code class="computeroutput">successfully
1158 installed</code> message. Another one is the fact that our files have been moved by the
1159 <span><strong class="command">adddriver</strong></span> command into the <code class="filename">2</code> subdirectory. You can check this
1160 again with <span><strong class="command">smbclient</strong></span>:
1161 </p><pre class="screen">
1162 <code class="prompt">root# </code><strong class="userinput"><code>smbclient //SAMBA-CUPS/print\$ -Uroot%xx \
1163         -c 'cd W32X86;dir;pwd;cd 2;dir;pwd'</code></strong>
1164  added interface ip=10.160.51.162 bcast=10.160.51.255 nmask=255.255.252.0
1165  Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a]
1166
1167   Current directory is \\SAMBA-CUPS\print$\W32X86\
1168   .                                  D        0  Sun May  4 04:32:48 2003
1169   ..                                 D        0  Thu Apr 10 23:47:40 2003
1170   2                                   D        0  Sun May  4 04:32:48 2003
1171                 40976 blocks of size 262144. 731 blocks available 
1172
1173   Current directory is \\SAMBA-CUPS\print$\W32X86\2\
1174   .                                  D        0  Sun May  4 04:32:48 2003
1175   ..                                 D        0  Sun May  4 04:32:48 2003
1176   DigiMaster.PPD                      A   148336  Thu Apr 24 01:07:00 2003
1177   ADOBEPS5.DLL                        A   434400  Sat May  3 23:18:45 2003
1178   laserjet4.ppd                       A     9639  Thu Apr 24 01:05:32 2003
1179   ADOBEPSU.DLL                        A   109568  Sat May  3 23:18:45 2003
1180   ADOBEPSU.HLP                        A    18082  Sat May  3 23:18:45 2003
1181   PDFcreator2.PPD                     A    15746  Sun Apr 20 22:24:07 2003
1182   HDNIS01Aux.dll                      A    15356  Sun May  4 04:32:18 2003
1183   Hddm91c1KMMin.DLL                   A    46966  Sun May  4 04:32:18 2003
1184   HDNIS01_de.DLL                      A   434400  Sun May  4 04:32:18 2003
1185   HDNIS01_de.NTF                      A   790404  Sun May  4 04:32:18 2003
1186   Hddm91c1_de.DLL                     A   876544  Sun May  4 04:32:18 2003
1187   Hddm91c1_de.INI                     A      101  Sun May  4 04:32:18 2003
1188   Hddm91c1_de.dat                     A     5044  Sun May  4 04:32:18 2003
1189   Hddm91c1_de.def                     A      428  Sun May  4 04:32:18 2003
1190   Hddm91c1_de.hlp                     A    37699  Sun May  4 04:32:18 2003
1191   Hddm91c1_de.hre                     A   323584  Sun May  4 04:32:18 2003
1192   Hddm91c1_de.ppd                     A    26373  Sun May  4 04:32:18 2003
1193   Hddm91c1_de.vnd                     A    45056  Sun May  4 04:32:18 2003
1194   HDNIS01U_de.DLL                     A   165888  Sun May  4 04:32:18 2003
1195   HDNIS01U_de.HLP                     A    19770  Sun May  4 04:32:18 2003
1196   Hddm91c1_de_reg.HLP                 A   228417  Sun May  4 04:32:18 2003
1197                 40976 blocks of size 262144. 731 blocks available
1198 </pre><p>
1199 Another verification is that the timestamp of the printing TDB files is now updated
1200 (and possibly their file size has increased).
1201 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2596493"></a>Check Samba for Driver Recognition</h4></div></div></div><p>
1202 <a class="indexterm" name="id2596501"></a>
1203 Now the driver should be registered with Samba. We can easily verify this and will do so in a
1204 moment. However, this driver is not yet associated with a particular printer. We may check the driver
1205 status of the files by at least three methods:
1206 </p><div class="itemizedlist"><ul type="disc"><li><p>
1207 <a class="indexterm" name="id2596518"></a>
1208 <a class="indexterm" name="id2596525"></a>
1209 <a class="indexterm" name="id2596532"></a>
1210 <a class="indexterm" name="id2596539"></a>
1211 <a class="indexterm" name="id2596546"></a>
1212         From any Windows client browse Network Neighborhood, find the Samba host, and open the Samba
1213         <span class="guiicon">Printers and Faxes</span> folder. Select any printer icon, right-click and select
1214         the printer <span class="guimenuitem">Properties</span>. Click the <span class="guilabel">Advanced</span>
1215         tab. Here is a field indicating the driver for that printer. A drop-down menu allows you to
1216         change that driver (be careful not to do this unwittingly). You can use this list to view
1217         all drivers known to Samba. Your new one should be among them. (Each type of client will
1218         see only its own architecture's list. If you do not have every driver installed for each platform,
1219         the list will differ if you look at it from Windows95/98/ME or Windows NT/2000/XP.)
1220         </p></li><li><p>
1221 <a class="indexterm" name="id2596586"></a>
1222         From a Windows 200x/XP client (not Windows NT) browse <span class="guiicon">Network Neighborhood</span>,
1223         search for the Samba server, open the server's <span class="guiicon">Printers</span> folder,
1224         and right-click on the white background (with no printer highlighted). Select <span class="guimenuitem">Server
1225         Properties</span>. On the <span class="guilabel">Drivers</span> tab you will see the new driver
1226         listed. This view enables you to also inspect the list of files belonging to that driver
1227         (this does not work on Windows NT, but only on Windows 2000 and Windows XP; Windows NT does not
1228         provide the <span class="guimenuitem">Drivers</span> tab). An alternative and much quicker method for
1229         Windows 2000/XP to start this dialog is by typing into a DOS box (you must of course adapt the
1230         name to your Samba server instead of <em class="replaceable"><code>SAMBA-CUPS</code></em>):
1231         </p><pre class="screen">
1232         <strong class="userinput"><code>rundll32 printui.dll,PrintUIEntry /s /t2 /n\\<em class="replaceable"><code>SAMBA-CUPS</code></em></code></strong>
1233         </pre><p>
1234         </p></li><li><p>
1235         From a UNIX prompt, run this command (or a variant thereof), where
1236         <em class="replaceable"><code>SAMBA-CUPS</code></em> is the name of the Samba host and xxxx represents the
1237         actual Samba password assigned to root:
1238         </p><pre class="screen">
1239         <strong class="userinput"><code>rpcclient -U'root%xxxx' -c 'enumdrivers' <em class="replaceable"><code>SAMBA-CUPS</code></em></code></strong>
1240         </pre><p>
1241         </p><p>
1242         You will see a listing of all drivers Samba knows about. Your new one should be among
1243         them. But it is only listed under the <em class="parameter"><code>[Windows NT x86]</code></em> heading, not under
1244         <em class="parameter"><code>[Windows 4.0]</code></em>, since you didn't install that part. Or did you?
1245         In our example it is named <code class="constant">dm9110</code>. Note that the third column shows the other
1246         installed drivers twice, one time for each supported architecture. Our new driver only shows up
1247         for <span class="application">Windows NT 4.0 or 2000</span>. To have it present for <span class="application">Windows
1248         95, 98, and Me</span>, you'll have to repeat the whole procedure with the WIN40 architecture
1249         and subdirectory.
1250         </p></li></ul></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2596720"></a>Specific Driver Name Flexibility</h4></div></div></div><p>
1251 <a class="indexterm" name="id2596728"></a>
1252 You can name the driver as you like. If you repeat the <span><strong class="command">adddriver</strong></span> step with the same
1253 files as before but with a different driver name, it will work the same:
1254 </p><pre class="screen">
1255 <code class="prompt">root# </code><strong class="userinput"><code>rpcclient -Uroot%xxxx         \
1256   -c 'adddriver "Windows NT x86"                     \
1257   "mydrivername:HDNIS01_de.DLL:              \
1258   Hddm91c1_de.ppd:HDNIS01U_de.DLL:HDNIS01U_de.HLP:   \
1259   NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI,          \
1260   Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre,   \
1261   Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL, \
1262   HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP' SAMBA-CUPS
1263   </code></strong>
1264
1265 cmd = adddriver "Windows NT x86" \
1266  "mydrivername:HDNIS01_de.DLL:Hddm91c1_de.ppd:HDNIS01U_de.DLL:\
1267   HDNIS01U_de.HLP:NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI,           \
1268   Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre,                    \
1269   Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL,                  \
1270   HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP"
1271
1272 Printer Driver mydrivername successfully installed.
1273 </pre><p>
1274 <a class="indexterm" name="id2596776"></a>
1275 <a class="indexterm" name="id2596783"></a>
1276 <a class="indexterm" name="id2596789"></a>
1277 You will be able to bind that driver to any print queue (however, you are responsible that
1278 you associate drivers to queues that make sense with respect to target printers). You cannot run the
1279 <span><strong class="command">rpcclient</strong></span> <span><strong class="command">adddriver</strong></span> command repeatedly. Each run consumes the
1280 files you had put into the <em class="parameter"><code>[print$]</code></em> share by moving them into the
1281 respective subdirectories, so you must execute an <span><strong class="command">smbclient ... put</strong></span> command before
1282 each <span><strong class="command">rpcclient ... adddriver</strong></span> command.
1283 </p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2596834"></a>Running <span><strong class="command">rpcclient</strong></span> with <span><strong class="command">setdriver</strong></span></h4></div></div></div><p> 
1284 <a class="indexterm" name="id2596853"></a>
1285 <a class="indexterm" name="id2596860"></a>
1286 Samba needs to know which printer owns which driver. Create a mapping of the driver to a printer, and
1287 store this information in Samba's memory, the TDB files. The <span><strong class="command">rpcclient setdriver</strong></span> command
1288 achieves exactly this:
1289 </p><pre class="screen">
1290 <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>
1291  cmd = setdriver dm9110 mydrivername
1292
1293 Successfully set dm9110 to driver mydrivername.
1294 </pre><p>
1295 Ah, no, I did not want to do that. Repeat, this time with the name I intended: 
1296 </p><pre class="screen">
1297 <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>
1298  cmd = setdriver dm9110 dm9110
1299 Successfully set dm9110 to driver dm9110.
1300 </pre><p>
1301 The syntax of the command is:
1302 </p><pre class="screen">
1303 <strong class="userinput"><code>rpcclient -U'root%<em class="replaceable"><code>sambapassword</code></em>' -c 'setdriver <em class="replaceable"><code>printername</code></em> \
1304  <em class="replaceable"><code>drivername</code></em>' <em class="replaceable"><code>SAMBA-Hostname</code></em></code></strong>. 
1305 </pre><p>
1306 Now we have done most of the work, but not all of it.
1307 </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
1308 The <span><strong class="command">setdriver</strong></span> command will only succeed if the printer is already known to Samba. A
1309 bug in 2.2.x prevented Samba from recognizing freshly installed printers. You had to restart Samba,
1310 or at least send an HUP signal to all running smbd processes to work around this: <strong class="userinput"><code>kill -HUP
1311 `pidof smbd`</code></strong>.
1312 </p></div></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2596975"></a>Client Driver Installation Procedure</h2></div></div></div><p>
1313 As Don Quixote said, &#8220;<span class="quote">The proof of the pudding is in the eating.</span>&#8221; The proof
1314 for our setup lies in the printing. So let's install the printer driver onto the client PCs. This is
1315 not as straightforward as it may seem. Read on.
1316 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2596992"></a>First Client Driver Installation</h3></div></div></div><p>
1317 Especially important is the installation onto the first client PC (for each architectural platform
1318 separately). Once this is done correctly, all further clients are easy to set up and shouldn't need further
1319 attention. What follows is a description for the recommended first procedure. You now work from a client
1320 workstation. You should check that your connection is not unwittingly mapped to <span class="emphasis"><em>bad
1321 user</em></span> nobody. In a DOS box type:
1322 </p><p><strong class="userinput"><code>net use \\<em class="replaceable"><code>SAMBA-SERVER</code></em>\print$ /user:root</code></strong></p><p>
1323 Replace root, if needed, by another valid <a class="indexterm" name="id2597026"></a>printer admin user as given in
1324 the definition. Should you already be connected as a different user, you will get an error message. There
1325 is no easy way to get rid of that connection, because Windows does not seem to know a concept of logging
1326 off from a share connection (do not confuse this with logging off from the local workstation; that is
1327 a different matter).  On Windows NT/200x, you can force a logoff from all smb/cifs connections by restarting the 
1328 <span class="emphasis"><em>workstation</em></span> service. You can try to close all Windows file explorers and Internet Explorer for 
1329 Windows. As a last resort, you may have to reboot. Make sure there is no automatic reconnection set up. It may be
1330 easier to go to a different workstation and try from there. After you have made sure you are connected
1331 as a printer admin user (you can check this with the <span><strong class="command">smbstatus</strong></span> command on Samba),
1332 do this from the Windows workstation:
1333 </p><div class="procedure"><ol type="1"><li><p>
1334         Open <span class="guiicon">Network Neighborhood</span>.
1335         </p></li><li><p>
1336         Browse to Samba server.
1337         </p></li><li><p>
1338         Open its <span class="guiicon">Printers and Faxes</span> folder.
1339         </p></li><li><p>
1340         Highlight and right-click on the printer.
1341         </p></li><li><p>
1342         Select <span class="guimenuitem">Connect</span> (for Windows NT4/200x
1343         it is possibly <span class="guimenuitem">Install</span>).
1344         </p></li></ol></div><p>
1345 A new printer (named <em class="replaceable"><code>printername</code></em> on Samba server) should now have
1346 appeared in your <span class="emphasis"><em>local</em></span> Printer folder (check <span class="guimenu">Start</span> -&gt;
1347 <span class="guimenuitem">Settings</span> -&gt; <span class="guimenuitem">Control Panel</span> -&gt; <span class="guiicon">Printers
1348 and Faxes</span>).
1349 </p><p>
1350 <a class="indexterm" name="id2597159"></a>
1351 Most likely you are tempted to try to print a test page. After all, you now can open the printer
1352 properties, and on the <span class="guimenu">General</span> tab there is a button offering to do just that. But
1353 chances are that you get an error message saying "<code class="literal">Unable to print Test Page</code>." The
1354 reason might be that there is not yet a valid device mode set for the driver or that the &#8220;<span class="quote">printer
1355 driver data</span>&#8221; set is still incomplete.
1356 </p><p>
1357 You must make sure that a valid <em class="parameter"><code>device mode</code></em> is set for the
1358 driver. We now explain what that means.
1359 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="prt-modeset"></a>Setting Device Modes on New Printers</h3></div></div></div><p>
1360 For a printer to be truly usable by a Windows NT/200x/XP client, it must possess:
1361 </p><div class="itemizedlist"><ul type="disc"><li><p>
1362 <a class="indexterm" name="id2597220"></a>
1363         A valid <span class="emphasis"><em>device mode</em></span> generated by the driver for the printer (defining things
1364         like paper size, orientation and duplex settings).
1365         </p></li><li><p>
1366 <a class="indexterm" name="id2597236"></a>
1367         A complete set of <span class="emphasis"><em>printer driver data</em></span> generated by the driver.
1368         </p></li></ul></div><p>
1369 <a class="indexterm" name="id2597252"></a>
1370 <a class="indexterm" name="id2597259"></a>
1371 <a class="indexterm" name="id2597266"></a>
1372 <a class="indexterm" name="id2597273"></a>
1373 <a class="indexterm" name="id2597280"></a>
1374 If either of these is incomplete, the clients can produce less than optimal output at best. In the
1375 worst cases, unreadable garbage or nothing at all comes from the printer, or it produces a harvest of
1376 error messages when attempting to print. Samba stores the named values and all printing-related information in
1377 its internal TDB database files <code class="filename">(ntprinters.tdb</code>, <code class="filename">ntdrivers.tdb</code>,
1378 <code class="filename">printing.tdb</code>, and <code class="filename">ntforms.tdb</code>).
1379 </p><p>
1380 The device mode and the set of printer driver data are basically collections
1381 of settings for all print queue properties, initialized in a sensible way. Device modes and
1382 printer driver data should initially be set on the print server (the Samba host) to healthy
1383 values so the clients can start to use them immediately. How do we set these initial healthy values?
1384 This can be achieved by accessing the drivers remotely from an NT (or 200x/XP) client, as discussed
1385 in the following paragraphs.
1386 </p><p>
1387 Be aware that a valid device mode can only be initiated by a <a class="indexterm" name="id2597332"></a>printer admin or root
1388 (the reason should be obvious). Device modes can be correctly set only by executing the printer driver program
1389 itself. Since Samba cannot execute this Win32 platform driver code, it sets this field initially to NULL
1390 (which is not a valid setting for clients to use). Fortunately, most drivers automatically generate the
1391 printer driver data that is needed when they are uploaded to the <em class="parameter"><code>[print$]</code></em> share with
1392 the help of the APW or rpcclient.
1393 </p><p>
1394 The generation and setting of a first valid device mode, however, requires some tickling from a client
1395 to set it on the Samba server. The easiest means of doing so is to simply change the page orientation on
1396 the server's printer. This executes enough of the printer driver program on the client for the desired
1397 effect to happen and feeds back the new device mode to our Samba server. You can use the native Windows
1398 NT/200x/XP printer properties page from a Window client for this:
1399 </p><div class="procedure"><a name="id2597365"></a><p class="title"><b>Procedure 20.2. Procedure to Initialize the Printer Driver Settings</b></p><ol type="1"><li><p>
1400         Browse the <span class="guiicon">Network Neighborhood</span>.
1401         </p></li><li><p>
1402         Find the Samba server.
1403         </p></li><li><p>
1404         Open the Samba server's <span class="guiicon">Printers and Faxes</span> folder.
1405         </p></li><li><p>
1406         Highlight the shared printer in question.
1407         </p></li><li><p>
1408         Right-click on the printer (you may already be here if you followed the last section's description).
1409         </p></li><li><p>
1410         At the bottom of the context menu select <span class="guimenu">Properties</span> (if the menu still offers the 
1411         <span class="guimenuitem">Connect</span> entry further above, you
1412         need to click on that one first to achieve the driver
1413         installation, as shown in the last section).
1414         </p></li><li><p>
1415         Go to the <span class="guilabel">Advanced</span> tab; click on <span class="guibutton">Printing Defaults</span>.
1416         </p></li><li><p>
1417         Change the <span class="guimenuitem">Portrait</span> page setting to <span class="guimenuitem">Landscape</span> (and back).
1418         </p></li><li><p>
1419         Make sure to apply changes between swapping the page orientation to cause the change to actually take effect.
1420         </p></li><li><p>
1421         While you are at it, you may also want to set the desired printing defaults here, which then apply to all future
1422         client driver installations.
1423         </p></li></ol></div><p>
1424 This procedure executes the printer driver program on the client platform and feeds back the correct
1425 device mode to Samba, which now stores it in its TDB files. Once the driver is installed on the client,
1426 you can follow the analogous steps by accessing the <span class="emphasis"><em>local</em></span> <span class="guiicon">Printers</span>
1427 folder, too, if you are a Samba printer admin user. From now on, printing should work as expected.
1428 </p><p>
1429 <a class="indexterm" name="id2597520"></a>
1430 Samba includes a service-level parameter name <em class="parameter"><code>default devmode</code></em> for generating a default
1431 device mode for a printer. Some drivers function well with Samba's default set of properties. Others
1432 may crash the client's spooler service. So use this parameter with caution. It is always better to have
1433 the client generate a valid device mode for the printer and store it on the server for you.
1434 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2597541"></a>Additional Client Driver Installation</h3></div></div></div><p>
1435 <a class="indexterm" name="id2597549"></a>
1436 Every additional driver may be installed in the same way as just described.  Browse <span><strong class="command">Network
1437 Neighborhood</strong></span>, open the <span class="guiicon">Printers</span> folder on Samba server, right-click on
1438 <span class="guiicon">Printer</span>, and choose <span class="guimenuitem">Connect...</span>. Once this completes (should be
1439 not more than a few seconds, but could also take a minute, depending on network conditions), you should find
1440 the new printer in your client workstation local <span class="guiicon">Printers and Faxes</span> folder.
1441 </p><p>
1442 You can also open your local <span class="guiicon">Printers and Faxes</span> folder by
1443 using this command on Windows 200x/XP Professional workstations:
1444 </p><pre class="screen">
1445 <strong class="userinput"><code>rundll32 shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder</code></strong>
1446 </pre><p>
1447 or this command on Windows NT 4.0 workstations:
1448 <a class="indexterm" name="id2597616"></a>
1449 </p><pre class="screen">
1450 <strong class="userinput"><code>rundll32 shell32.dll,Control_RunDLL MAIN.CPL @2</code></strong>
1451 </pre><p>
1452 </p><p>
1453 You can enter the commands either inside a <span class="guilabel">DOS box</span> window or in the <span class="guimenuitem">Run
1454 command...</span> field from the <span class="guimenu">Start</span> menu.
1455 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2597660"></a>Always Make First Client Connection as root or &#8220;<span class="quote">printer admin</span>&#8221;</h3></div></div></div><p>
1456 After you installed the driver on the Samba server (in its <em class="parameter"><code>[print$]</code></em> share), you
1457 should always make sure that your first client installation completes correctly. Make it a habit for yourself
1458 to build the very first connection from a client as <a class="indexterm" name="id2597681"></a>printer admin. This is to make
1459 sure that:
1460 </p><div class="itemizedlist"><ul type="disc"><li><p>
1461         A first valid <span class="emphasis"><em>device mode</em></span> is really initialized (see above <a href="classicalprinting.html#prt-modeset" title="Setting Device Modes on New Printers">Setting Device Modes on New Printers</a>) for more explanation details).
1462         </p></li><li><p>        
1463         The default print settings of your printer for all further client installations are as you want them.
1464         </p></li></ul></div><p>
1465 Do this by changing the orientation to landscape, click on <span class="guiicon">Apply</span>, and then change it
1466 back again. Next, modify the other settings (for example, you do not want the default media size set to
1467 <span class="guiicon">Letter</span> when you are all using <span class="guiicon">A4</span>, right? You may want to set the
1468 printer for <span class="guiicon">duplex</span> as the default, and so on).
1469 </p><p>
1470 <a class="indexterm" name="id2597750"></a>
1471 To connect as root to a Samba printer, try this command from a Windows 200x/XP DOS box command prompt:
1472 </p><pre class="screen">
1473 <code class="prompt">C:\&gt; </code><strong class="userinput"><code>runas /netonly /user:root "rundll32 printui.dll,PrintUIEntry /p /t3 /n 
1474         \\<em class="replaceable"><code>SAMBA-SERVER</code></em>\<em class="replaceable"><code>printername</code></em>"</code></strong>
1475 </pre><p>
1476 </p><p>
1477 You will be prompted for <code class="constant">root</code>'s Samba password; type it, wait a few seconds, click on
1478 <span class="guibutton">Printing Defaults</span>, and proceed to set the job options that should be used as defaults
1479 by all clients. Alternatively, instead of root you can name one other member of the <a class="indexterm" name="id2597799"></a>printer admin from the setting.
1480 </p><p>
1481 Now all the other users downloading and installing the driver the same way (using
1482 <code class="literal">Point'n'Print</code>) will have the same defaults set for them. If you miss this step, you'll get a
1483 lot of help desk calls from your users, but maybe you like to talk to people.
1484 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2597823"></a>Other Gotchas</h2></div></div></div><p>
1485 Your driver is installed. It is now ready for Point'n'Print installation by the clients. You may have tried to
1486 download and use it on your first client machine, but wait. Let's make sure you are acquainted first with a
1487 few tips and tricks you may find useful. For example, suppose you did not set the defaults on the printer, as
1488 advised in the preceding paragraphs. Your users complain about various issues (such as, &#8220;<span class="quote">We need to set
1489 the paper size for each job from Letter to A4 and it will not store it</span>&#8221;).
1490 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2597844"></a>Setting Default Print Options for Client Drivers</h3></div></div></div><p>
1491 The last sentence might be viewed with mixed feelings by some users and Admins. They have struggled for hours
1492 and could not arrive at a point where their settings seemed to be saved. It is not their fault. The confusing
1493 thing is that in the multitabbed dialog that pops up when you right-click on the printer name and select
1494 <span class="guimenuitem">Properties</span>, you can arrive at two dialogs that appear identical, each claiming that
1495 they help you to set printer options in three different ways. Here is the definitive answer to the Samba
1496 default driver setting FAQ:
1497 </p><p><b>&#8220;<span class="quote">I can not set and save default print options
1498 for all users on Windows 200x/XP. Why not?</span>&#8221;. </b>
1499 How are you doing it? I bet the wrong way. (It is not easy to find out, though.) There are three different
1500 ways to bring you to a dialog that seems to set everything. All three dialogs look the same, but only one of
1501 them does what you intend. You need to be Administrator or Print Administrator to do this for all users. Here
1502 is how I reproduce it in an XP Professional:
1503 </p><div class="orderedlist"><ol type="A"><li><p>The first &#8220;<span class="quote">wrong</span>&#8221; way:
1504         </p><div class="orderedlist"><ol type="1"><li><p>Open the <span class="guiicon">Printers</span> folder.</p></li><li><p>Right-click on the printer (<span class="emphasis"><em>remoteprinter on cupshost</em></span>) and
1505                 select in context menu <span class="guimenu">Printing Preferences...</span>.</p></li><li><p>Look at this dialog closely and remember what it looks like.</p></li></ol></div></li><li><p>The second &#8220;<span class="quote">wrong</span>&#8221; way:
1506                 </p><div class="orderedlist"><ol type="1"><li><p>Open the <span class="guimenu">Printers</span> folder.</p></li><li><p>Right-click on the printer (<span class="emphasis"><em>remoteprinter on
1507                         cupshost</em></span>) and select in the context menu
1508                         <span class="guimenuitem">Properties</span></p></li><li><p>Click on the <span class="guilabel">General</span>
1509                         tab.</p></li><li><p>Click on the <span class="guibutton">Printing
1510                         Preferences...</span> button.</p></li><li><p>A new dialog opens. Keep this dialog open and go back
1511                         to the parent dialog.</p></li></ol></div><p>
1512         </p></li><li><p>
1513         The third and correct way (should you do this from the beginning, just carry out steps 1
1514         and 2 from the second method above):
1515         </p><div class="orderedlist"><ol type="1"><li><p>Click on the <span class="guilabel">Advanced</span>
1516                         tab. (If everything is &#8220;<span class="quote">grayed out,</span>&#8221; then you are not logged
1517                         in as a user with enough privileges.)</p></li><li><p>Click on the <span class="guibutton">Printing
1518                         Defaults</span> button.</p></li><li><p>On any of the two new tabs,
1519                         click on the
1520                         <span class="guilabel">Advanced</span> button.</p></li><li><p>A new dialog opens. Compare
1521                         this one to the other. Are they
1522                         identical when you compare one from
1523                         &#8220;<span class="quote">B.5</span>&#8221; and one from A.3?</p></li></ol></div></li></ol></div><p>
1524 Do you see any difference in the two settings dialogs? I do not either. However, only the last one, which you
1525 arrived at with steps C.1 through C.6 will permanently save any settings which will then become the defaults
1526 for new users. If you want all clients to have the same defaults, you need to conduct these steps as
1527 administrator (<a class="indexterm" name="id2598087"></a>printer admin) before a client downloads the driver (the clients can
1528 later set their own per-user defaults by following procedures A or B above). Windows 200x/XP allow per-user
1529 default settings and the ones the administrator gives them before they set up their own. The parents of the
1530 identical-looking dialogs have a slight difference in their window names; one is called
1531 <code class="computeroutput">Default Print Values for Printer Foo on Server Bar</code> (which is the one you
1532 need) and the other is called &#8220;<span class="quote"><code class="computeroutput">Print Settings for Printer Foo on Server
1533 Bar</code></span>&#8221;. The last one is the one you arrive at when you right-click on the printer and
1534 select <span class="guimenuitem">Print Settings...</span>. This is the one that you were taught to use back in the
1535 days of Windows NT, so it is only natural to try the same way with Windows 200x/XP. You would not dream that
1536 there is now a different path to arrive at an identical-looking, but functionally different, dialog to set
1537 defaults for all users.
1538 </p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p>Try (on Windows 200x/XP) to run this command (as a user with the right privileges):
1539 <a class="indexterm" name="id2598134"></a>
1540 </p><p><strong class="userinput"><code>
1541 rundll32 printui.dll,PrintUIEntry /p /t3 /n\\<em class="replaceable"><code>SAMBA-SERVER</code></em>\<em class="replaceable"><code>printersharename</code></em>
1542 </code></strong></p><p>
1543 To see the tab with the <span class="guilabel">Printing Defaults</span> button (the one you need), also run this command:
1544 </p><p><strong class="userinput"><code>
1545 rundll32 printui.dll,PrintUIEntry /p /t0 /n\\<em class="replaceable"><code>SAMBA-SERVER</code></em>\<em class="replaceable"><code>printersharename</code></em>
1546 </code></strong></p><p>
1547 To see the tab with the <span class="guilabel">Printing Preferences</span>
1548 button (the one that does not set systemwide defaults), you can
1549 start the commands from inside a DOS box or from <span class="guimenu">Start</span> -&gt; <span class="guimenuitem">Run</span>.
1550 </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2598207"></a>Supporting Large Numbers of Printers</h3></div></div></div><p>
1551 One issue that has arisen during the recent development phase of Samba is the need to support driver
1552 downloads for hundreds of printers. Using Windows NT APW for this task is somewhat awkward (to say the least). If
1553 you do not want to acquire RSS pains from the printer installation clicking orgy alone, you need
1554 to think about a non-interactive script.
1555 </p><p>
1556 If more than one printer is using the same driver, the <span><strong class="command">rpcclient setdriver</strong></span>
1557 command can be used to set the driver associated with an installed queue. If the driver is uploaded to
1558 <em class="parameter"><code>[print$]</code></em> once and registered with the printing TDBs, it can be used by
1559 multiple print queues. In this case, you just need to repeat the <span><strong class="command">setprinter</strong></span> subcommand of
1560 <span><strong class="command">rpcclient</strong></span> for every queue (without the need to conduct the <span><strong class="command">adddriver</strong></span>
1561 repeatedly). The following is an example of how this can be accomplished:
1562 </p><pre class="screen">
1563 <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>
1564  cmd = enumdrivers
1565  
1566  [Windows NT x86]
1567  Printer Driver Info 1:
1568    Driver Name: [infotec  IS 2075 PCL 6]
1569  
1570  Printer Driver Info 1:
1571    Driver Name: [DANKA InfoStream]
1572  
1573  Printer Driver Info 1:
1574    Driver Name: [Heidelberg Digimaster 9110 (PS)]
1575  
1576  Printer Driver Info 1:
1577    Driver Name: [dm9110]
1578
1579  Printer Driver Info 1:
1580    Driver Name: [mydrivername]
1581
1582  [....]
1583 </pre><p>
1584
1585 </p><pre class="screen">
1586 <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>
1587  cmd = enumprinters
1588    flags:[0x800000]
1589    name:[\\SAMBA-CUPS\dm9110]
1590    description:[\\SAMBA-CUPS\dm9110,,110ppm HiVolume DANKA Stuttgart]
1591    comment:[110 ppm HiVolume DANKA Stuttgart]
1592  [....]
1593 </pre><p>
1594
1595 </p><pre class="screen">
1596 <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 \
1597   'setdriver <em class="replaceable"><code>dm9110</code></em> "<em class="replaceable"><code>Heidelberg Digimaster 9110 (PS)</code></em>"'</code></strong>
1598  cmd = setdriver dm9110 Heidelberg Digimaster 9110 (PPD)
1599  Successfully set dm9110 to driver Heidelberg Digimaster 9110 (PS).
1600 </pre><p>
1601
1602 </p><pre class="screen">
1603 <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>
1604  cmd = enumprinters
1605    flags:[0x800000]
1606    name:[\\SAMBA-CUPS\dm9110]
1607    description:[\\SAMBA-CUPS\dm9110,Heidelberg Digimaster 9110 (PS),\
1608      110ppm HiVolume DANKA Stuttgart]
1609    comment:[110ppm HiVolume DANKA Stuttgart]
1610  [....]
1611 </pre><p>
1612
1613 </p><pre class="screen">
1614 <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>
1615  cmd = setdriver dm9110 mydrivername
1616  Successfully set dm9110 to mydrivername.
1617 </pre><p>
1618
1619 </p><pre class="screen">
1620 <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>
1621  cmd = enumprinters
1622    flags:[0x800000]
1623    name:[\\SAMBA-CUPS\dm9110]
1624    description:[\\SAMBA-CUPS\dm9110,mydrivername,\
1625      110ppm HiVolume DANKA Stuttgart]
1626    comment:[110ppm HiVolume DANKA Stuttgart]
1627  [....]
1628 </pre><p>
1629 It may not be easy to recognize that the first call to <span><strong class="command">enumprinters</strong></span> showed the
1630 &#8220;<span class="quote">dm9110</span>&#8221; printer with an empty string where the driver should have been listed (between
1631 the two commas in the description field). After the <span><strong class="command">setdriver</strong></span> command
1632 succeeds, all is well.
1633 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2598464"></a>Adding New Printers with the Windows NT APW</h3></div></div></div><p>
1634 By default, Samba exhibits all printer shares defined in <code class="filename">smb.conf</code> in the <span class="guiicon">Printers</span>
1635 folder. Also located in this folder is the Windows NT Add Printer Wizard icon. The APW will be shown only if:
1636 </p><div class="itemizedlist"><ul type="disc"><li><p>
1637         The connected user is able to successfully execute an <span><strong class="command">OpenPrinterEx(\\server)</strong></span> with
1638         administrative privileges (i.e., root or <a class="indexterm" name="id2598502"></a>printer admin).
1639         </p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p> Try this from a Windows 200x/XP DOS box command prompt:
1640         </p><p><strong class="userinput"><code>
1641         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>
1642         </code></strong></p><p>
1643         Click on <span class="guibutton">Printing Preferences</span>.
1644         </p></div></li><li><p>... contains the setting
1645         <a class="indexterm" name="id2598544"></a>show add printer wizard = yes (the
1646         default).</p></li></ul></div><p>
1647 The APW can do various things:
1648 </p><div class="itemizedlist"><ul type="disc"><li><p>
1649         Upload a new driver to the Samba <em class="parameter"><code>[print$]</code></em> share.
1650         </p></li><li><p>
1651         Associate an uploaded driver with an existing (but still driverless) print queue.
1652         </p></li><li><p>
1653         Exchange the currently used driver for an existing print queue with one that has been uploaded before.
1654         </p></li><li><p>
1655         Add an entirely new printer to the Samba host (only in conjunction with a working
1656         <a class="indexterm" name="id2598587"></a>add printer command. A corresponding
1657         <a class="indexterm" name="id2598595"></a>delete printer command for removing entries from the
1658         <span class="guiicon">Printers</span> folder may also be provided).
1659         </p></li></ul></div><p>
1660 The last one (add a new printer) requires more effort than the previous ones. To use the APW to successfully
1661 add a printer to a Samba server, the <a class="indexterm" name="id2598616"></a>add printer command must have a defined value.
1662 The program hook must successfully add the printer to the UNIX print system (i.e., to
1663 <code class="filename">/etc/printcap</code>, <code class="filename">/etc/cups/printers.conf</code> or other appropriate files)
1664 and to <code class="filename">smb.conf</code> if necessary.
1665 </p><p>
1666 When using the APW from a client, if the named printer share does not exist, smbd will execute the
1667 <a class="indexterm" name="id2598650"></a>add printer command and reparse to attempt to locate the new printer share. If the
1668 share is still not defined, an error of "<span class="errorname">Access Denied"</span> is returned to the client. The
1669 <a class="indexterm" name="id2598663"></a>add printer command is executed under the context of the connected user, not
1670 necessarily a root account. A <a class="indexterm" name="id2598672"></a>map to guest = bad user may have connected
1671 you unwittingly under the wrong privilege. You should check it by using the <span><strong class="command">smbstatus</strong></span>
1672 command.
1673 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2598689"></a>Error Message: &#8220;<span class="quote">Cannot connect under a different Name</span>&#8221;</h3></div></div></div><p>
1674 Once you are connected with the wrong credentials, there is no means to reverse the situation other than
1675 to close all Explorer windows, and perhaps reboot.
1676 </p><div class="itemizedlist"><ul type="disc"><li><p>
1677 <a class="indexterm" name="id2598709"></a>
1678         The <span><strong class="command">net use \\SAMBA-SERVER\sharename /user:root</strong></span> gives you an error message:
1679         &#8220;<span class="quote">Multiple connections to a server or a shared resource by the same user utilizing
1680         several user names are not allowed. Disconnect all previous connections to the server,
1681         esp. the shared resource, and try again.</span>&#8221;
1682         </p></li><li><p>
1683         Every attempt to &#8220;<span class="quote">connect a network drive</span>&#8221; to <code class="filename">\\SAMBASERVER\\print$</code>
1684         to <code class="constant">z:</code> is countered by the pertinacious message: &#8220;<span class="quote">This
1685         network folder is currently connected under different credentials (username and password).
1686         Disconnect first any existing connection to this network share in order to connect again under
1687         a different username and password</span>&#8221;.
1688         </p></li></ul></div><p>
1689 So you close all connections. You try again. You get the same message. You check from the Samba side, using
1690 <span><strong class="command">smbstatus</strong></span>. Yes, there are more connections. You kill them all. The client still gives you
1691 the same error message. You watch the smbd.log file on a high debug level and try reconnect. Same error
1692 message, but not a single line in the log. You start to wonder if there was a connection attempt at all. You
1693 run ethereal and tcpdump while you try to connect. Result: not a single byte goes on the wire. Windows still
1694 gives the error message. You close all Explorer windows and start it again. You try to connect  and
1695 this times it works!  Windows seems to cache connection information somewhere and does not keep it up to date
1696 (if you are unlucky, you might need to reboot to get rid of the error message).
1697 </p><p>
1698 The easiest way to forcefully terminate all connections from your client to a server is by executing:
1699 </p><pre class="screen">
1700 <code class="prompt">C:\&gt; </code> net use * /delete
1701 </pre><p>
1702 This will also disconnect all mapped drives and will allow you create fresh connection as required.
1703 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2598803"></a>Take Care When Assembling Driver Files</h3></div></div></div><p>
1704 You need to be extremely careful when you take notes about the files belonging to a particular
1705 driver. Don't confuse the files for driver version &#8220;<span class="quote">0</span>&#8221; (for Windows 9x/Me, going into
1706 <code class="filename">[print$]/WIN/0/</code>), driver version <code class="filename">2</code> (kernel mode driver for Windows NT,
1707 going into <code class="filename">[print$]/W32X86/2/</code>; may be used on Windows 200x/XP also), and
1708 driver version &#8220;<span class="quote">3</span>&#8221; (non-kernel mode driver going into <code class="filename">[print$]/W32X86/3/</code>;
1709 cannot be used on Windows NT). Quite often these different driver versions contain
1710 files that have the same name but actually are very different. If you look at them from
1711 the Windows Explorer (they reside in <code class="filename">%WINDOWS%\system32\spool\drivers\W32X86\</code>),
1712 you will probably see names in capital letters, while an <span><strong class="command">enumdrivers</strong></span> command from Samba
1713 would show mixed or lowercase letters, so it is easy to confuse them. If you install them manually using
1714 <span><strong class="command">rpcclient</strong></span> and subcommands, you may even succeed without an error message. Only later,
1715 when you try install on a client, you will encounter error messages like <code class="computeroutput">This server
1716 has no appropriate driver for the printer</code>.
1717 </p><p>
1718 Here is an example. You are invited to look closely at the various files, compare their names and
1719 their spelling, and discover the differences in the composition of the version 2 and 3 sets. Note: the
1720 version 0 set contained 40 <em class="parameter"><code>Dependentfiles</code></em>, so I left it out for space reasons:
1721 </p><pre class="screen">
1722 <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>
1723
1724  Printer Driver Info 3:
1725          Version: [3]
1726          Driver Name: [Canon iR8500 PS3]
1727          Architecture: [Windows NT x86]
1728          Driver Path: [\\10.160.50.8\print$\W32X86\3\cns3g.dll]
1729          Datafile: [\\10.160.50.8\print$\W32X86\3\iR8500sg.xpd]
1730          Configfile: [\\10.160.50.8\print$\W32X86\3\cns3gui.dll]
1731          Helpfile: [\\10.160.50.8\print$\W32X86\3\cns3g.hlp]
1732  
1733          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\aucplmNT.dll]
1734          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\ucs32p.dll]
1735          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\tnl32.dll]
1736          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\aussdrv.dll]
1737          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cnspdc.dll]
1738          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\aussapi.dat]
1739          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cns3407.dll]
1740          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\CnS3G.cnt]
1741          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\NBAPI.DLL]
1742          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\NBIPC.DLL]
1743          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcview.exe]
1744          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcdspl.exe]
1745          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcedit.dll]
1746          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcqm.exe]
1747          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcspl.dll]
1748          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cfine32.dll]
1749          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcr407.dll]
1750          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\Cpcqm407.hlp]
1751          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cpcqm407.cnt]
1752          Dependentfiles: [\\10.160.50.8\print$\W32X86\3\cns3ggr.dll]
1753  
1754          Monitorname: []
1755          Defaultdatatype: []
1756
1757  Printer Driver Info 3:
1758          Version: [2]
1759          Driver Name: [Canon iR5000-6000 PS3]
1760          Architecture: [Windows NT x86]
1761          Driver Path: [\\10.160.50.8\print$\W32X86\2\cns3g.dll]
1762          Datafile: [\\10.160.50.8\print$\W32X86\2\IR5000sg.xpd]
1763          Configfile: [\\10.160.50.8\print$\W32X86\2\cns3gui.dll]
1764          Helpfile: [\\10.160.50.8\print$\W32X86\2\cns3g.hlp]
1765  
1766          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\AUCPLMNT.DLL]
1767          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\aussdrv.dll]
1768          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\cnspdc.dll]
1769          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\aussapi.dat]
1770          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\cns3407.dll]
1771          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\CnS3G.cnt]
1772          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\NBAPI.DLL]
1773          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\NBIPC.DLL]
1774          Dependentfiles: [\\10.160.50.8\print$\W32X86\2\cns3gum.dll]
1775  
1776          Monitorname: [CPCA Language Monitor2]
1777          Defaultdatatype: []
1778
1779 </pre><p>
1780 If we write the &#8220;<span class="quote">version 2</span>&#8221; files and the &#8220;<span class="quote">version 3</span>&#8221; files
1781 into different text files and compare the result, we see this
1782 picture:
1783 </p><pre class="screen">
1784 <code class="prompt">root# </code><strong class="userinput"><code>sdiff 2-files 3-files</code></strong>
1785
1786
1787  cns3g.dll                     cns3g.dll
1788  iR8500sg.xpd                  iR8500sg.xpd
1789  cns3gui.dll                   cns3gui.dll
1790  cns3g.hlp                     cns3g.hlp
1791  AUCPLMNT.DLL                | aucplmNT.dll
1792                              &gt; ucs32p.dll
1793                              &gt; tnl32.dll
1794  aussdrv.dll                   aussdrv.dll
1795  cnspdc.dll                    cnspdc.dll
1796  aussapi.dat                   aussapi.dat
1797  cns3407.dll                   cns3407.dll
1798  CnS3G.cnt                     CnS3G.cnt
1799  NBAPI.DLL                     NBAPI.DLL
1800  NBIPC.DLL                     NBIPC.DLL
1801  cns3gum.dll                 | cpcview.exe
1802                              &gt; cpcdspl.exe 
1803                              &gt; cpcqm.exe
1804                              &gt; cpcspl.dll
1805                              &gt; cfine32.dll
1806                              &gt; cpcr407.dll
1807                              &gt; Cpcqm407.hlp
1808                              &gt; cpcqm407.cnt
1809                              &gt; cns3ggr.dll
1810
1811 </pre><p>
1812
1813 Do not be fooled! Driver files for each version with identical
1814 names may be different in their content, as you can see from this size
1815 comparison:
1816 </p><pre class="screen">
1817 <code class="prompt">root# </code><strong class="userinput"><code>for i in cns3g.hlp cns3gui.dll cns3g.dll; do                  \
1818            smbclient //10.160.50.8/print\$ -U 'Administrator%xxxx' \
1819            -c "cd W32X86/3; dir $i; cd .. ; cd 2; dir $i";      \
1820                    done</code></strong>
1821
1822   CNS3G.HLP               A   122981  Thu May 30 02:31:00 2002
1823   CNS3G.HLP               A    99948  Thu May 30 02:31:00 2002
1824
1825   CNS3GUI.DLL             A  1805824  Thu May 30 02:31:00 2002
1826   CNS3GUI.DLL             A  1785344  Thu May 30 02:31:00 2002
1827
1828   CNS3G.DLL               A  1145088  Thu May 30 02:31:00 2002
1829   CNS3G.DLL               A    15872  Thu May 30 02:31:00 2002
1830 </pre><p>
1831 In my example were even more differences than shown here. Conclusion: you must be careful to select the
1832 correct driver files for each driver version. Don't rely on the names alone, and don't interchange files
1833 belonging to different driver versions.
1834 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2599064"></a>Samba and Printer Ports</h3></div></div></div><p>
1835 <a class="indexterm" name="id2599072"></a>
1836 <a class="indexterm" name="id2599079"></a>
1837 <a class="indexterm" name="id2599086"></a>
1838 <a class="indexterm" name="id2599093"></a>
1839 Windows NT/2000 print servers associate a port with each printer. These normally take the form of
1840 <code class="filename">LPT1:</code>, <code class="filename">COM1:</code>, <code class="filename">FILE:</code>, and so on. Samba must also
1841 support the concept of ports associated with a printer. By default, only one printer port, named &#8220;<span class="quote">Samba
1842 Printer Port</span>&#8221;, exists on a system. Samba does not really need such a &#8220;<span class="quote">port</span>&#8221; in order to
1843 print; rather it is a requirement of Windows clients. They insist on being told about an available port when
1844 they request this information; otherwise, they throw an error message at you. So Samba fakes the port
1845 information to keep the Windows clients happy.
1846 </p><p>
1847 <a class="indexterm" name="id2599137"></a>
1848 Samba does not support the concept of <code class="constant">Printer Pooling</code> internally either. Printer
1849 pooling assigns a logical printer to multiple ports as a form of load balancing or failover.
1850 </p><p>
1851 If you require multiple ports to be defined for some reason or another (my users and my boss should not know
1852 that they are working with Samba), configure the <a class="indexterm" name="id2599156"></a>enumports command,
1853 which can be used to define an external program that generates a listing of ports on a system.
1854 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2599168"></a>Avoiding Common Client Driver Misconfiguration</h3></div></div></div><p>
1855 So now the printing works, but there are still problems. Most jobs print well, some do not print at
1856 all. Some jobs have problems with fonts, which do not look good. Some jobs print fast and some
1857 are dead-slow. We cannot cover it all, but we want to encourage you to read the brief paragraph about
1858 &#8220;<span class="quote">Avoiding the Wrong PostScript Driver Settings</span>&#8221; in <a href="CUPS-printing.html" title="Chapter 21. CUPS Printing Support">CUPS Printing
1859 Chapter</a>, <a href="CUPS-printing.html#cups-avoidps1" title="Avoiding Critical PostScript Driver Settings on the Client">Avoiding Critical PostScript Driver Settings on the
1860 Client</a>.
1861 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2599205"></a>The Imprints Toolset</h2></div></div></div><p>
1862 <a class="indexterm" name="id2599213"></a>
1863 The Imprints tool set provides a UNIX equivalent of the Windows NT APW.  For complete information, please
1864 refer to the <a href="http://imprints.sourceforge.net/" target="_top">Imprints</a> Web site as well as the
1865 documentation included with the Imprints source distribution. This section provides only a brief introduction
1866 to the features of Imprints.
1867 </p><p>
1868 Unfortunately, the Imprints toolset is no longer maintained. As of December 2000, the project is in
1869 need of a new maintainer. The most important skill to have is Perl coding and an interest in MS-RPC-based
1870 printing used in Samba. If you wish to volunteer, please coordinate your efforts on the Samba technical
1871 mailing list. The toolset is still in usable form, but only for a series of older printer models where
1872 there are prepared packages to use. Packages for more up-to-date print devices are needed if Imprints
1873 should have a future. Information regarding the Imprints toolset can be obtained from the <a href="http://imprints.sourceforge.net/" target="_top">Imprints</a> home page.
1874 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2599252"></a>What Is Imprints?</h3></div></div></div><p>
1875 Imprints is a collection of tools for supporting these goals:
1876 </p><div class="itemizedlist"><ul type="disc"><li><p>
1877         Providing a central repository of information regarding Windows NT and 95/98 printer driver packages.
1878         </p></li><li><p>
1879         Providing the tools necessary for creating the Imprints printer driver packages.
1880         </p></li><li><p>
1881         Providing an installation client that will obtain printer drivers from a central Internet (or intranet) Imprints Server
1882         repository and install them on remote Samba and Windows NT4 print servers.
1883         </p></li></ul></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2599286"></a>Creating Printer Driver Packages</h3></div></div></div><p>
1884 The process of creating printer driver packages is beyond the scope of this document (refer to Imprints.txt,
1885 included with the Samba distribution for more information). In short, an Imprints driver package
1886 is a gzipped tarball containing the driver files, related INF files, and a control file needed by the
1887 installation client.
1888 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2599302"></a>The Imprints Server</h3></div></div></div><p>
1889 The Imprints server is really a database server that may be queried via standard HTTP mechanisms. Each
1890 printer entry in the database has an associated URL for the actual downloading of the package. Each
1891 package is digitally signed via GnuPG, which can be used to verify that
1892 the package downloaded is actually
1893 the one referred in the Imprints database. It is strongly recommended that this security check
1894 not be disabled.
1895 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2599319"></a>The Installation Client</h3></div></div></div><p>
1896 More information regarding the Imprints installation client is available from the documentation file
1897 <code class="filename">Imprints-Client-HOWTO.ps</code> that is included with the Imprints source package. The Imprints
1898 installation client comes in two forms:
1899 </p><div class="itemizedlist"><ul type="disc"><li><p>A set of command-line Perl scripts.</p></li><li><p>A GTK+-based graphical interface to the command-line Perl scripts.</p></li></ul></div><p>
1900 The installation client (in both forms) provides a means of querying the Imprints database server for
1901 a matching list of known printer model names as well as a means to download and install the drivers on
1902 remote Samba and Windows NT print servers.
1903 </p><p>
1904 The basic installation process is in four steps, and Perl code is wrapped around smbclient and rpcclient.
1905 </p><div class="itemizedlist"><ul type="disc"><li><p>
1906         For each supported architecture for a given driver:
1907         </p><div class="orderedlist"><ol type="1"><li><p>rpcclient: Get the appropriate upload directory on the remote server.</p></li><li><p>smbclient: Upload the driver files.</p></li><li><p>rpcclient: Issues an AddPrinterDriver() MS-RPC.</p></li></ol></div><p>
1908         </p></li><li><p>rpcclient: Issues an AddPrinterEx() MS-RPC to actually create the printer.</p></li></ul></div><p>
1909 One of the problems encountered when implementing the Imprints tool set was the namespace issues between
1910 various supported client architectures. For example, Windows NT includes a driver named &#8220;<span class="quote">Apple LaserWriter
1911 II NTX v51.8</span>&#8221;, and Windows 95 calls its version of this driver &#8220;<span class="quote">Apple LaserWriter II NTX</span>&#8221;.
1912 </p><p>
1913 The problem is how to know what client drivers have been uploaded for a printer. An astute reader will
1914 remember that the Windows NT Printer Properties dialog only includes space for one printer driver name. A
1915 quick look in the Windows NT 4.0 system registry at:
1916 </p><p><code class="filename">
1917  HKLM\System\CurrentControlSet\Control\Print\Environment
1918 </code></p><p>
1919 will reveal that Windows NT always uses the NT driver name. This is okay because Windows NT always requires
1920 that at least the Windows NT version of the printer driver is present. Samba does not have the
1921 requirement internally; therefore, &#8220;<span class="quote">How can you use the NT driver name if it has not already been installed?</span>&#8221;
1922 </p><p>
1923 The way of sidestepping this limitation is to require that all Imprints printer driver packages include both the Intel Windows NT and
1924 95/98 printer drivers and that the NT driver is installed first.
1925 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2599452"></a>Adding Network Printers without User Interaction</h2></div></div></div><p>
1926 The following MS Knowledge Base article may be of some help if you need to handle Windows 2000 clients:
1927 <span class="emphasis"><em>How to Add Printers with No User Interaction in Windows 2000,</em></span> (<a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;189105" target="_top">Microsoft KB 189105</a>).  It also
1928 applies to Windows XP Professional clients.  The ideas sketched out in this section are inspired by this
1929 article, which describes a command-line method that can be applied to install network and local printers and
1930 their drivers. This is most useful if integrated in Logon Scripts. You can see what options are available by
1931 typing in the command prompt (<span><strong class="command">DOS box</strong></span>):
1932 </p><p><strong class="userinput"><code>rundll32 printui.dll,PrintUIEntry /?</code></strong></p><p>
1933 A window pops up that shows you all of the command-line switches available. An extensive list of examples
1934 is also provided. This is only for Windows 200x/XP; it does not work on Windows NT. Windows NT probably has
1935 some other tools in the respective Resource Kit. Here is a suggestion about what a client logon script
1936 might contain, with a short explanation of what the lines actually do (it works if 200x/XP Windows
1937 clients access printers via Samba, and works for Windows-based print servers too):
1938 </p><pre class="screen">
1939 <strong class="userinput"><code>rundll32 printui.dll,PrintUIEntry /dn /n "\\cupsserver\infotec2105-IPDS" /q</code></strong>
1940 <strong class="userinput"><code>rundll32 printui.dll,PrintUIEntry /in /n "\\cupsserver\infotec2105-PS"</code></strong>
1941 <strong class="userinput"><code>rundll32 printui.dll,PrintUIEntry /y /n "\\cupsserver\infotec2105-PS"</code></strong>
1942 </pre><p>
1943 Here is a list of the used command-line parameters: 
1944 </p><div class="variablelist"><dl><dt><span class="term">/dn</span></dt><dd><p>deletes a network printer.</p></dd><dt><span class="term">/q</span></dt><dd><p>quiet modus.</p></dd><dt><span class="term">/n</span></dt><dd><p>names a printer.</p></dd><dt><span class="term">/in</span></dt><dd><p>adds a network printer connection.</p></dd><dt><span class="term">/y</span></dt><dd><p>sets printer as default printer.</p></dd></dl></div><div class="itemizedlist"><ul type="disc"><li><p>
1945         Line 1 deletes a possibly existing previous network printer <span class="emphasis"><em>infotec2105-IPDS</em></span>
1946         (which had used native Windows drivers with LPRng that were removed from the server that was
1947         converted to CUPS). The <span><strong class="command">/q</strong></span> at the end prevents confirm
1948         or error dialog boxes from popping up. They should not be presented to the user logging on.
1949         </p></li><li><p>        
1950         Line 2 adds the new printer
1951         <span class="emphasis"><em>infotec2105-PS</em></span> (which actually is the same
1952         physical device but is now run by the new CUPS printing system and associated with the
1953         CUPS/Adobe PS drivers). The printer and its driver must have been added to Samba prior to
1954         the user logging in (e.g., by a procedure as discussed earlier in this chapter or by running
1955         <span><strong class="command">cupsaddsmb</strong></span>). The driver is now autodownloaded to the client PC where the
1956         user is about to log in.
1957         </p></li><li><p>
1958         Line 3 sets the default printer to this new network printer (there might be several other
1959         printers installed with this same method, and some may be local as well, so we decide for a
1960         default printer). The default printer selection may, of course, be different for different users.
1961         </p></li></ul></div><p>
1962 The second line only works if the printer <span class="emphasis"><em>infotec2105-PS</em></span> has an already working
1963 print queue on the <code class="constant">cupsserver</code> and if the
1964 printer drivers have been successfully uploaded
1965 (via the <span><strong class="command">APW</strong></span>, <span><strong class="command">smbclient/rpcclient</strong></span>, or <span><strong class="command">cupsaddsmb</strong></span>)
1966 into the <em class="parameter"><code>[print$]</code></em> driver repository of Samba. Some Samba versions
1967 prior to version 3.0 required a restart of smbd after the printer install and the driver upload;
1968 otherwise the script (or any other client driver download) would fail.
1969 </p><p>
1970 Since there is no easy way to test for the existence of an installed network printer from the logon script,
1971 do not bother checking. Just allow the de-installation/re-installation to occur every time a user logs in;
1972 it's really quick anyway (1 to 2 seconds).
1973 </p><p>
1974 The additional benefits for this are:
1975 </p><div class="itemizedlist"><ul type="disc"><li><p>
1976         It puts in place any printer default setup changes automatically at every user logon.
1977         </p></li><li><p>
1978         It allows for &#8220;<span class="quote">roaming</span>&#8221; users' login to the domain from different workstations.
1979         </p></li></ul></div><p>
1980 Since network printers are installed per user, this much simplifies the process of keeping the installation
1981 up to date. The few extra seconds at logon time will not really be noticeable. Printers can be centrally
1982 added, changed, and deleted at will on the server with no user intervention required from the clients
1983 (you just need to keep the logon scripts up to date).
1984 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2599724"></a>The <span><strong class="command">addprinter</strong></span> Command</h2></div></div></div><p>
1985 The <span><strong class="command">addprinter</strong></span> command can be configured to be a shell script or program executed by
1986 Samba. It is triggered by running the APW from a client against the Samba print server. The APW asks
1987 the user to fill in several fields (such as printer name, driver to be used, comment, port monitor,
1988 and so on). These parameters are passed on to Samba by the APW. If the addprinter command is designed in a
1989 way that it can create a new printer (through writing correct printcap entries on legacy systems or
1990 by executing the <span><strong class="command">lpadmin</strong></span> command on more modern systems) and create the associated share,
1991 then the APW will in effect really create a new printer on Samba and the UNIX print subsystem!
1992 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2599763"></a>Migration of Classical Printing to Samba</h2></div></div></div><p>
1993 The basic NT-style printer driver management has not changed considerably in 3.0 over the 2.2.x releases
1994 (apart from many small improvements). Here migration should be quite easy, especially if you followed
1995 previous advice to stop using deprecated parameters in your setup. For migrations from an existing 2.0.x
1996 setup, or if you continued Windows 9x/Me-style printing in your Samba 2.2 installations, it is more of
1997 an effort. Please read the appropriate release notes and the HOWTO Collection for Samba-2.2.x. You can
1998 follow several paths. Here are possible scenarios for migration:
1999 </p><div class="itemizedlist"><ul type="disc"><li><p>
2000         You need to study and apply the new Windows NT printer and driver support. Previously used
2001         parameters <em class="parameter"><code>printer driver file</code></em>, <em class="parameter"><code>printer driver</code></em>,
2002         and <em class="parameter"><code>printer driver location</code></em> are no longer supported.
2003         </p></li><li><p>
2004         If you want to take advantage of Windows NT printer driver support, you also need to migrate the
2005         Windows 9x/Me drivers to the new setup.
2006         </p></li><li><p>
2007         An existing <code class="filename">printers.def</code> file (the one specified in the now removed parameter
2008         <em class="parameter"><code>printer driver file</code></em>) will no longer work with Samba-3. In 3.0, smbd attempts
2009         to locate Windows 9x/Me driver files for the printer in <em class="parameter"><code>[print$]</code></em>
2010         and additional settings in the TDB and only there; if it fails, it will <span class="emphasis"><em>not</em></span>
2011         (as 2.2.x used to do) drop down to using a <code class="filename">printers.def</code> (and all associated
2012         parameters). The make_printerdef tool is removed and there is no backward compatibility for this.
2013         </p></li><li><p>You need to install a Windows 9x/Me driver into the
2014         <em class="parameter"><code>[print$]</code></em> share for a printer on your Samba
2015         host. The driver files will be stored in the &#8220;<span class="quote">WIN40/0</span>&#8221; subdirectory of
2016         <em class="parameter"><code>[print$]</code></em>, and some other settings and information go
2017         into the printing-related TDBs.</p></li><li><p>
2018         If you want to migrate an existing <code class="filename">printers.def</code> file into the new setup, the only current
2019         solution is to use the Windows NT APW to install the NT drivers and the 9x/Me drivers. This can be scripted
2020         using smbclient and rpcclient. See the Imprints installation client on the <a href="http://imprints.sourceforge.net/" target="_top">Imprints</a> web site for example. See also the discussion of
2021         rpcclient usage in <a href="CUPS-printing.html" title="Chapter 21. CUPS Printing Support">CUPS Printing</a>.
2022         </p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2599912"></a>Publishing Printer Information in Active Directory or LDAP</h2></div></div></div><p>
2023 This topic has also been addressed in <a href="NetCommand.html" title="Chapter 12. Remote and Local Management: The Net Command">Remote and Local Management  The
2024 Net Command</a>. If you wish to volunteer your services to help document this further, please contact 
2025 <a href="mail://jht@samba.org" target="_top">John H. Terpstra</a>.
2026 </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2599941"></a>Common Errors</h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2599947"></a>I Give My Root Password but I Do Not Get Access</h3></div></div></div><p>
2027 Do not confuse the root password, which is valid for the UNIX system (and in most cases stored in the
2028 form of a one-way hash in a file named <code class="filename">/etc/shadow</code>), with the password used to
2029 authenticate against Samba. Samba does not know the UNIX password. Root access to Samba resources
2030 requires that a Samba account for root must first be created. This is done with the <span><strong class="command">smbpasswd</strong></span>
2031 command as follows:
2032 </p><pre class="screen">
2033 <code class="prompt">root# </code> smbpasswd -a root
2034 New SMB password: secret
2035 Retype new SMB password: secret
2036 </pre><p>
2037 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2599988"></a>My Print Jobs Get Spooled into the Spooling Directory, but Then Get Lost</h3></div></div></div><p>
2038 Do not use the existing UNIX print system spool directory for the Samba spool directory. It may seem
2039 convenient and a savings of space, but it only leads to problems. The two must be separate. The UNIX/Linux
2040 system print spool directory (e.g., <code class="filename">/var/spool/cups</code>) is typically owned by a
2041 non-privileged user such as <code class="literal">cups</code> or <code class="literal">lp</code>. Additionally. the permissions on
2042 the spool directory are typically restrictive to the owner and/or group. On the other hand, the Samba
2043 spool directory must be world writable, and should have the 't' bit set to ensure that only a temporary
2044 spool file owner can change or delete the file.
2045 </p><p>
2046 Depending on the type of print spooling system in use on the UNIX/Linux host, files that the spool
2047 management application finds and that are not currently part of job queue that it is managing can be deleted.
2048 This may explain the observation that jobs are spooled (by Samba) into this directory and just disappear.
2049 </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 19. 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 21. CUPS Printing Support</td></tr></table></div></body></html>