<address><email>kpfeifle@danka.de</email></address>
</affiliation>
</author>
- <pubdate> (23 May 2003) </pubdate>
+ <pubdate>May 32, 2003</pubdate>
</chapterinfo>
-<title>Classical Printing Support in Samba 3.0</title>
+<title>Classical Printing Support</title>
<sect1>
-<title>Introduction</title>
-
-<sect2>
-
<title>Features and Benefits</title>
<para>
</para>
</note>
-</sect2>
-
</sect1>
<sect1>
<title>Parameters Recommended for Use</title>
<para>The following <filename>smb.conf</filename> parameters directly
-related to printing are used in Samba 3.0. See also the
+related to printing are used in Samba-3. See also the
<filename>smb.conf</filename> man page for detailed explanations:
</para>
<formalpara>
-<title>LIST OF PRINTING RELATED PARAMETERS IN SAMBA-3.0</title>
+<title>LIST OF PRINTING RELATED PARAMETERS IN Samba-3</title>
<para>
<itemizedlist><title>Global level parameters:</title>
<listitem><para><parameter>addprinter command (G)</parameter></para></listitem>
</para>
<formalpara>
-<title>"OLD" PARAMETERS, REMOVED IN SAMBA-3.0</title>
+<title>"OLD" PARAMETERS, REMOVED IN Samba-3</title>
<para>
The following <filename>smb.conf</filename> parameters have been
deprecated already in Samba 2.2 and are now completely removed from
-Samba 3.0. You cannot use them in new 3.0 installations:
+Samba-3. You cannot use them in new 3.0 installations:
<itemizedlist>
<listitem><para><parameter>printer driver file (G)</parameter></para></listitem>
</sect1>
<sect1>
-<title>A simple Configuration to Print with Samba 3.0</title>
+<title>A simple Configuration to Print with Samba-3</title>
<para>
Here is a very simple example configuration for print related settings
<filename>smb.conf</filename> which enables all clients to print.
</para>
-<para><programlisting>
+<para><screen>
[global]
printing = bsd
load printers = yes
printable = yes
public = yes
writable = no
-</programlisting></para>
+</screen></para>
<para>
This is only an example configuration. Many settings, if not
as shown above:
</para>
-<para><programlisting>
+<para><screen>
transmeta: # testparm -v | egrep "(lp|print|spool|driver|ports|\[)"
path = /var/spool/samba
printable = Yes
-</programlisting></para>
+</screen></para>
<para>
You can easily verify which settings were implicitly added by Samba's
parameter. If your 2.2.x system behaves like mine, you'll see this:
</para>
-<para><programlisting>
+<para><screen>
kde-bitshop:/etc/samba # grep "load printers" smb.conf
# load printers = Yes
kde-bitshop:/etc/samba # testparm -v smb.conf | egrep "(load printers)"
load printers = Yes
-</programlisting></para>
+</screen></para>
<para>
Despite my imagination that the commenting out of this setting should
any more... at least not by this ;-)
</para>
-<para><programlisting>
+<para><screen>
kde-bitshop:/etc/samba # grep -A1 "load printers" smb.conf
load printers = No
kde-bitshop:/etc/samba # testparm -v smb.conf.simpleprinting | egrep "(load printers)"
load printers = No
-</programlisting></para>
+</screen></para>
<para>
Only when setting the parameter explicitly to
minimal <filename>smb.conf</filename>:
</para>
-<para><programlisting>
+<para><screen>
kde-bitshop:/etc/samba # cat /etc/samba/smb.conf-minimal
[printers]
-</programlisting></para>
+</screen></para>
<para>
This example should show you that you can use testparm to test any
<filename>smb.conf</filename>:
</para>
-<para><programlisting>
+<para><screen>
kde-bitshop:~ # testparm -v /etc/samba/smb.conf-minimal | egrep "(print|lpq|spool|driver|ports|[)"
Processing section "[printers]"
[printers]
printable = Yes
-</programlisting></para>
+</screen></para>
<para>
testparm issued 2 warnings:
line consisting of, for example,
</para>
-<para><programlisting>
+<para><screen>
printing =lprng #This defines LPRng as the printing system"
-</programlisting></para>
+</screen></para>
<para>
will regard the whole of the string after the "="
</sect1>
<sect1>
-<title>Extended Sample Configuration to Print with Samba 3.0</title>
+<title>Extended Sample Configuration to Print with Samba-3</title>
<para>
Here we show a more verbose example configuration for print related
to optimize the <filename>smb.conf</filename> in environments with
hundreds or thousands of clients.</para></tip>
-<para><programlisting>
+<para><screen>
[global]
printing = bsd
load printers = yes
hosts allow = 0.0.0.0
hosts deny = turbo_xp, 10.160.50.23, 10.160.51.60
guest ok = no
-</programlisting></para>
+</screen></para>
<para>
This <emphasis>also</emphasis> is only an example configuration. You
guest user using "su - guest" and run a system print command like
</para>
-<para><programlisting>
+<para><screen>
lpr -P printername /etc/motd
-</programlisting></para>
+</screen></para>
</listitem></varlistentry>
scripts:
</para>
-<para><programlisting>
+<para><screen>
<![CDATA[
print command = echo Printing %s >> /tmp/print.log; lpr -P %p %s; rm %s
]]>
-</programlisting></para>
+</screen></para>
<para>
You may have to vary your own command considerably from this example
the <parameter>printing</parameter> parameter. Another example is:
</para>
-<para><programlisting>
+<para><screen>
print command = /usr/local/samba/bin/myprintscript %p %s
-</programlisting></para>
+</screen></para>
</sect2>
</sect1>
</itemizedlist>
<para>
-One other benefit of an update is this: Samba 3.0 is able to publish
+One other benefit of an update is this: Samba-3 is able to publish
all its printers in Active Directory (or LDAP)!
</para>
</sect2>
<sect2>
-<title>The [printer$] Section is removed from Samba 3.0</title>
+<title>The [printer$] Section is removed from Samba-3</title>
<formalpara><title>
<parameter>[print$]</parameter> vs. <parameter>[printer$]</parameter>
with appropriate values for your site):
</para>
-<para><programlisting>
+<para><screen>
[global]
; members of the ntadmin group should be able to add drivers and set
; printer properties. root is implicitly always a 'printer admin'.
guest ok = yes
read only = yes
write list = @ntadmin, root
-</programlisting></para>
+</screen></para>
<para>
Of course, you also need to ensure that the directory named by the
to support.
</para>
-<para><programlisting>
+<para><screen>
[print$]--+--
|--W32X86 # serves drivers to "Windows NT x86"
|--W32MIPS # serves drivers to "Windows NT R4000"
|--W32PPC # serves drivers to "Windows NT PowerPC"
-</programlisting></para>
+</screen></para>
<important><title>REQUIRED PERMISSIONS</title>
The initial listing of printers in the Samba host's
<emphasis>Printers</emphasis> folder accessed from a client's Explorer
will have no real printer driver assigned to them. By default, in
-Samba 3.0 (as in 2.2.1 and later) this driver name is set to a NULL
+Samba-3 (as in 2.2.1 and later) this driver name is set to a NULL
string. This must be changed now. The local <emphasis>Add Printer
Wizard</emphasis>, run from NT/2000/XP clients, will help us in this
task.
different spaces in between words:
</para>
-<para><programlisting>
+<para><screen>
kde-bitshop:~# rpcclient -U'Danka%xxxx' -c 'getdriver "Heidelberg Digimaster 9110 (PS)" 3' TURBO_XP
cmd = getdriver "Heidelberg Digimaster 9110 (PS)" 3
Monitorname: []
Defaultdatatype: []
-</programlisting></para>
+</screen></para>
<para>
You may notice, that this driver has quite a big number of
listing is edited to include linebreaks for readability:
</para>
-<para><programlisting>
+<para><screen>
kde-bitshop:~# smbclient //TURBO_XP/print\$ -U'Danka%xxxx' \
-c 'cd W32X86/2;mget HD*_de.* \
(average 737.3 kb/s)
[...,]
-</programlisting></para>
+</screen></para>
<para>
After this command is complete, the files are in our current local
<parameter>[print$]</parameter> share...
</para>
-<para><programlisting>
+<para><screen>
kde-bitshop:~# smbclient //SAMBA-CUPS/print\$ -U'root%xxxx' -c 'cd W32X86; put HDNIS01_de.DLL; \
put Hddm91c1_de.ppd; put HDNIS01U_de.DLL; \
putting file HDNIS01Aux.dll as \W32X86\HDNIS01Aux.dll (14994.6 kb/s) (average 11405.2 kb/s)
putting file HDNIS01_de.NTF as \W32X86\HDNIS01_de.NTF (23390.2 kb/s) (average 13170.8 kb/s)
-</programlisting></para>
+</screen></para>
<para>
Phewww -- that was a lot of typing! Most drivers are a lot smaller --
also and do this through a standard UNIX shell access too):
</para>
-<para><programlisting>
+<para><screen>
kde-bitshop:~# smbclient //SAMBA-CUPS/print\$ -U 'root%xxxx' -c 'cd W32X86; pwd; dir; cd 2; pwd; dir'
added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0
PDFcreator2.PPD A 15746 Sun Apr 20 22:24:07 2003
40976 blocks of size 262144. 709 blocks available
-</programlisting></para>
+</screen></para>
<para>
Notice that there are already driver files present in the
again, for readability:
</para>
-<para><programlisting>
+<para><screen>
kde-bitshop:~# rpcclient -Uroot%xxxx -c 'adddriver "Windows NT x86" "dm9110:HDNIS01_de.DLL: \
Hddm91c1_de.ppd:HDNIS01U_de.DLL:HDNIS01U_de.HLP: \
Printer Driver dm9110 successfully installed.
-</programlisting></para>
+</screen></para>
<para>
After this step the driver should be recognized by Samba on the print
<command>smbclient</command>:
</para>
-<para><programlisting>
+<para><screen>
kde-bitshop:~# smbclient //SAMBA-CUPS/print\$ -Uroot%xxxx -c 'cd W32X86;dir;pwd;cd 2;dir;pwd'
added interface ip=10.160.51.162 bcast=10.160.51.255 nmask=255.255.252.0
Hddm91c1_de_reg.HLP A 228417 Sun May 4 04:32:18 2003
40976 blocks of size 262144. 731 blocks available
-</programlisting></para>
+</screen></para>
<para>
Another verification is that the timestamp of the printing TDB files
course adapt the name to your Samba server instead of SAMBA-CUPS):
</para>
-<para><programlisting>
+<para><screen>
rundll32 printui.dll,PrintUIEntry /s /t2 /n\\SAMBA-CUPS
-</programlisting></para>
+</screen></para>
</listitem>
<listitem><para>from a UNIX prompt run this command (or a variant
represents the actual Samba password assigned to root:
</para>
-<para><programlisting>
+<para><screen>
rpcclient -U'root%xxxx' -c 'enumdrivers' SAMBA-CUPS
-</programlisting></para>
+</screen></para>
<para>
You will see a listing of all drivers Samba knows about. Your new one
with a different driver name, it will work the same:
</para>
-<para><programlisting>
+<para><screen>
kde-bitshop:~# rpcclient -Uroot%xxxx \
-c 'adddriver "Windows NT x86" \
Printer Driver myphantasydrivername successfully installed.
-</programlisting></para>
+</screen></para>
<para>
You will also be able to bind that driver to any print queue (however,
setdriver</command> command achieves exactly this:
</para>
-<para><programlisting>
+<para><screen>
kde-bitshop:~# rpcclient -U'root%xxxx' -c 'setdriver dm9110 myphantasydrivername' SAMBA-CUPS
cmd = setdriver dm9110 myphantasydrivername
Successfully set dm9110 to driver myphantasydrivername.
-</programlisting></para>
+</screen></para>
<para>
Ahhhhh -- no, I didn't want to do that. Repeat, this time with the
name I intended:
</para>
-<para><programlisting>
+<para><screen>
kde-bitshop:~# rpcclient -U'root%xxxx' -c 'setdriver dm9110 dm9110' SAMBA-CUPS
cmd = setdriver dm9110 dm9110
Succesfully set dm9110 to driver dm9110.
-</programlisting></para>
+</screen></para>
<para>
The syntax of the command is <command>rpcclient -U'root%sambapassword'
<parameter>bad user</parameter> "nobody". In a DOS box type:
</para>
-<para><programlisting>
+<para><screen>
net use \\SAMBA-SERVER\print$ /user:root
-</programlisting></para>
+</screen></para>
<para>
Replace root, if needed, by another valid 'printer admin' user as
command on Windows 2000 and Windows XP Professional workstations:
</para>
-<para><programlisting>
+<para><screen>
rundll32 shell32.dll,SHHelpShortcuts_RunDLL PrintersFolder
-</programlisting></para>
+</screen></para>
<para>
or this command on Windows NT 4.0 workstations:
</para>
-<para><programlisting>
+<para><screen>
rundll32 shell32.dll,Control_RunDLL MAIN.CPL @2
-</programlisting></para>
+</screen></para>
<para>
You can enter the commands either inside a "DOS box" window or in the
2K/XP DOS box command prompt:
</para>
-<para><programlisting>
+<para><screen>
runas /netonly /user:root "rundll32 printui.dll,PrintUIEntry /p /t3 /n \\SAMBA-SERVER\printername"
-</programlisting></para>
+</screen></para>
<para>
You will be prompted for root's Samba-password; type it, wait a few
with the right privileges):
</para>
-<para><programlisting>
+<para><screen>
rundll32 printui.dll,PrintUIEntry /p /t3 /n\\SAMBA-SERVER\printersharename
-</programlisting></para>
+</screen></para>
<para>
to see the tab with the <emphasis>Printing Defaults...</emphasis>
button (the one you need). Also run this command:
</para>
-<para><programlisting>
+<para><screen>
rundll32 printui.dll,PrintUIEntry /p /t0 /n\\SAMBA-SERVER\printersharename
-</programlisting></para>
+</screen></para>
<para>
to see the tab with the <emphasis>Printing Preferences...</emphasis>
following is an example of how this could be accomplished:
</para>
-<para><programlisting>
+<para><screen>
----------------------------------------------------------------------------------
$ rpcclient SAMBA-CUPS -U root%secret -c 'enumdrivers'
[....]
----------------------------------------------------------------------------------
-</programlisting></para>
+</screen></para>
<para>
It may be not easy to recognize: but the first call to
<tip><para> Try this from a Windows 2K/XP DOS box command prompt:
</para>
-<para><programlisting>
+<para><screen>
runas /netonly /user:root rundll32 printui.dll,PrintUIEntry /p /t0 /n \\SAMBA-SERVER\printersharename
-</programlisting></para>
+</screen></para>
<para>
and click on <emphasis>Printing Preferences...</emphasis>
reasons:
</para>
-<para><programlisting>
+<para><screen>
kde4@kde-bitshop:# rpcclient -U 'Administrator%xxxx' -c 'enumdrivers 3' 10.160.50.8
Monitorname: [CPCA Language Monitor2]
Defaultdatatype: []
-</programlisting></para>
+</screen></para>
<para>
If we write the "version 2" files and the "version 3" files
picture:
</para>
-<para><programlisting>
+<para><screen>
<![CDATA[
kde4@kde-bitshop:# sdiff 2-files 3-files
]]>
-</programlisting></para>
+</screen></para>
<para>
Don't be fooled though! Driver files for each version with identical
comparison:
</para>
-<para><programlisting>
+<para><screen>
kde4@kde-bitshop:# for i in cns3g.hlp cns3gui.dll cns3g.dll; do \
smbclient //10.160.50.8/print\$ -U 'Administrator%xxxx' \
CNS3G.DLL A 1145088 Thu May 30 02:31:00 2002
CNS3G.DLL A 15872 Thu May 30 02:31:00 2002
-</programlisting></para>
+</screen></para>
<para>
In my example were even more differences than shown here. Conclusion:
wrapped around smbclient and rpcclient
</para>
-<para><programlisting>
+<para><screen>
foreach (supported architecture for a given driver)
{
4. rpcclient: Issue an AddPrinterEx() MS-RPC to actually
create the printer
-</programlisting></para>
+</screen></para>
<para>
One of the problems encountered when implementing the Imprints tool
quick look in the Windows NT 4.0 system registry at
</para>
-<para><programlisting>
+<para><screen>
HKLM\System\CurrentControlSet\Control\Print\Environment
-</programlisting></para>
+</screen></para>
<para>
will reveal that Windows NT always uses the NT driver name. This is
available by typing in a command prompt ("DOS box") this:
</para>
-<para><programlisting>
+<para><screen>
rundll32 printui.dll,PrintUIEntry /?
-</programlisting></para>
+</screen></para>
<para>
A window pops up which shows you all of the commandline switches
printers via Samba, but works for Windows-based print servers too):
</para>
-<para><programlisting>
+<para><screen>
rundll32 printui.dll,PrintUIEntry /dn /n "\\sambacupsserver\infotec2105-IPDS" /q
rundll32 printui.dll,PrintUIEntry /in /n "\\sambacupsserver\infotec2105-PS"
rundll32 printui.dll,PrintUIEntry /y /n "\\sambacupsserver\infotec2105-PS"
-</programlisting></para>
+</screen></para>
<para>
Here is a list of the used commandline parameters:
</variablelist>
<para>
-I have tested this with a Samba 2.2.7a and a Samba 3.0alpha24
+I have tested this with a Samba 2.2.7a and a Samba-3alpha24
installation and Windows XP Professional clients. Note that this
specific command set works with network print queues (installing
local print queues requires different parameters, but this is of no
</sect1>
<sect1>
-<title>Migration of "Classical" printing to Samba 3.0</title>
+<title>Migration of "Classical" printing to Samba-3</title>
<para>
The basic "NT-style" printer driver management has not changed