As we have said before, all previously known methods to prepare client printer drivers on the Samba server for download and Point'n'Print convenience of Windows workstations are working with CUPS, too. These methods were described in the previous chapter. In reality, this is a pure Samba business and only relates to the Samba/Windows client relationship.
18.10.1 cupsaddsmb : The Unknown Utility
The cupsaddsmb utility (shipped with all current CUPS versions) is an alternate method to transfer printer drivers into the Samba [print$] share. Remember, this share is where clients expect drivers deposited and setup for download and installation. It makes the sharing of any (or all) installed CUPS printers quite easy. cupsaddsmb can use the Adobe PostScript driver as well as the newly developed CUPS PostScript Driver for Windows NT/200x/XP. cupsaddsmb does not work with arbitrary vendor printer drivers, but only with the exact driver files that are named in its man page.
The CUPS printer driver is available from the CUPS download site. Its package name is cups-samba-[version].tar.gz . It is preferred over the Adobe drivers since it has a number of advantages:
However, currently only Windows NT, 2000 and XP are supported by the CUPS drivers. You will also need to get the respective part of Adobe driver if you need to support Windows 95, 98 and ME clients.
18.10.2 Prepare Your smb.conf for cupsaddsmb
Prior to running cupsaddsmb , you need the settings in smb.conf as shown in Example 18.3:
18.10.3 CUPS " PostScript Driver for Windows NT/200x/XP "
CUPS users may get the exact same packages from http://www.cups.org/software.html. It is a separate package from the CUPS base software files, tagged as CUPS 1.1.x Windows NT/200x/XP Printer Driver for Samba (tar.gz, 192k). The filename to download is cups-samba-1.1.x.tar.gz . Upon untar and unzipping, it will reveal these files:
root# tar xvzf cups-samba-1.1.19.tar.gz cups-samba.install cups-samba.license cups-samba.readme cups-samba.remove
Example 18.3 smb.conf for cupsaddsmb usage
[global] load printers = yes printing = cups printcap name = cups [printers] comment = All Printers path = /var/spool/samba browseable = no public = yes # setting depends on your requirements guest ok = yes writable = no printable = yes printer admin = root [print$] comment = Printer Drivers path = /etc/samba/drivers browseable = yes guest ok = no read only = yes write list = root
These have been packaged with the ESP meta packager software EPM. The *.install and *.remove files are simple shell scripts, which untars the *.ss (the *.ss is nothing else but a tar-archive, which can be untarred by " tar " too). Then it puts the content into /usr/share/cups/drivers/ . This content includes three files:
root# tar tv cups-samba.ss cupsdrvr.dll cupsui.dll cups.hlp
The cups-samba.install shell scripts are easy to handle:
root# ./cups-samba.install [....] Installing software... Updating file permissions... Running post-install commands... Installation is complete.
The script should automatically put the driver files into the /usr/share/cups/drivers/ directory.
root# cp /usr/share/drivers/cups.hlp /usr/share/cups/drivers/
This new CUPS PostScript driver is currently binary-only, but free of charge. No complete source code is provided (yet). The reason is that it has been developed with the help of the Microsoft Driver Developer Kit (DDK) and compiled with Microsoft Visual Studio 6. Driver developers are not allowed to distribute the whole of the source code as free software. However, CUPS developers released the " diff " in source code under the GPL, so anybody with a license of Visual Studio and a DDK will be able to compile for him/herself.
18.10.4 Recognizing Different Driver Files
The CUPS drivers do not support the older Windows 95/98/Me, but only the Windows NT/2000/XP client.
Windows NT, 2000 and XP are supported by:
Adobe drivers are available for the older Windows 95/98/Me as well as the Windows NT/2000/XP clients. The set of files is different from the different platforms.
Windows 95, 98 and ME are supported by:
Windows NT, 2000 and XP are supported by:
18.10.5 Acquiring the Adobe Driver Files
Acquiring the Adobe driver files seems to be unexpectedly difficult for many users. They are not available on the Adobe Web site as single files and the self-extracting and/or self-installing Windows-.exe is not easy to locate either. Probably you need to use the included native installer and run the installation process on one client once. This will install the drivers (and one Generic PostScript printer) locally on the client. When they are installed, share the Generic PostScript printer. After this, the client's [print$] share holds the Adobe files, from where you can get them with smbclient from the CUPS host.
18.10.6 ESP Print Pro PostScript Driver for Windows NT/200x/XP
Users of the ESP Print Pro software are able to install their Samba drivers package for this purpose with no problem. Retrieve the driver files from the normal download area of the ESP Print Pro software at http://www.easysw.com/software.html. You need to locate the link labelled " SAMBA " among the Download Printer Drivers for ESP Print Pro 4.x area and download the package. Once installed, you can prepare any driver by simply highlighting the printer in the Printer Manager GUI and select Export Driver... from the menu. Of course you need to have prepared Samba beforehand to handle the driver files; i.e., setup the [print$] share, and so on. The ESP Print Pro package includes the CUPS driver files as well as a (licensed) set of Adobe drivers for the Windows 95/98/Me client family.
18.10.7 Caveats to be Considered
Once you have run the install script (and possibly manually moved the cups.hlp file to /usr/share/cups/drivers/ ), the driver is ready to be put into Samba's [print$] share (which often maps to /etc/samba/drivers/ and contains a subdirectory tree with WIN40 and W32X86 branches). You do this by running cupsaddsmb (see also man cupsaddsmb for CUPS since release 1.1.16).
Once the driver files are in the [print$] share and are initialized , they are ready to be downloaded and installed by the Windows NT/200x/XP clients.
18.10.8 Windows CUPS PostScript Driver Versus Adobe Driver
Are you interested in a comparison between the CUPS and the Adobe PostScript drivers? For our purposes these are the most important items that weigh in favor of the CUPS ones:
18.10.9 Run cupsaddsmb (Quiet Mode)
The cupsaddsmb command copies the needed files into your [print$] share. Additionally, the PPD associated with this printer is copied from /etc/cups/ppd/ to [print$] . There the files wait for convenient Windows client installations via Point'n'Print. Before we can run the command successfully, we need to be sure that we can authenticate toward Samba. If you have a small network, you are probably using user -level security ( security = user).
Here is an example of a successfully run cupsaddsmb command:
root# cupsaddsmb -U root infotec_IS2027 Password for root required to access localhost via Samba: ['secret']
To share all printers and drivers, use the -a parameter instead of a printer name. Since cupsaddsmb " exports " the printer drivers to Samba, it should be obvious that it only works for queues with a CUPS driver associated.
18.10.10 Run cupsaddsmb with Verbose Output
Probably you want to see what's going on. Use the -v parameter to get a more verbose output. The output below was edited for better readability: all "\" at the end of a line indicate that I inserted an artificial line break plus some indentation here:
root# cupsaddsmb -U root -v infotec_2105 Password for root required to access localhost via GANDALF: Running command: smbclient //localhost/print\$ -N -U'root%secret' \ -c 'mkdir W32X86; \ put /var/spool/cups/tmp/3e98bf2d333b5 W32X86/infotec_2105.ppd; \ put /usr/share/cups/drivers/cupsdrvr.dll W32X86/cupsdrvr.dll; \ put /usr/share/cups/drivers/cupsui.dll W32X86/cupsui.dll; \ put /usr/share/cups/drivers/cups.hlp W32X86/cups.hlp' added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a] NT_STATUS_OBJECT_NAME_COLLISION making remote directory \W32X86 putting file /var/spool/cups/tmp/3e98bf2d333b5 as \W32X86/infotec_2105.ppd putting file /usr/share/cups/drivers/cupsdrvr.dll as \W32X86/cupsdrvr.dll putting file /usr/share/cups/drivers/cupsui.dll as \W32X86/cupsui.dll putting file /usr/share/cups/drivers/cups.hlp as \W32X86/cups.hlp Running command: rpcclient localhost -N -U'root%secret' -c 'adddriver "Windows NT x86" \ "infotec_2105:cupsdrvr.dll:infotec_2105.ppd:cupsui.dll:cups.hlp:NULL: \ RAW:NULL" cmd = adddriver "Windows NT x86" \ "infotec_2105:cupsdrvr.dll:infotec_2105.ppd:cupsui.dll:cups.hlp:NULL: \ RAW:NULL" Printer Driver infotec_2105 successfully installed. Running command: smbclient //localhost/print\$ -N -U'root%secret' \ -c 'mkdir WIN40; \ put /var/spool/cups/tmp/3e98bf2d333b5 WIN40/infotec_2105.PPD; \ put /usr/share/cups/drivers/ADFONTS.MFM WIN40/ADFONTS.MFM; \ put /usr/share/cups/drivers/ADOBEPS4.DRV WIN40/ADOBEPS4.DRV; \ put /usr/share/cups/drivers/ADOBEPS4.HLP WIN40/ADOBEPS4.HLP; \ put /usr/share/cups/drivers/DEFPRTR2.PPD WIN40/DEFPRTR2.PPD; \ put /usr/share/cups/drivers/ICONLIB.DLL WIN40/ICONLIB.DLL; \ put /usr/share/cups/drivers/PSMON.DLL WIN40/PSMON.DLL;' added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a] NT_STATUS_OBJECT_NAME_COLLISION making remote directory \WIN40 putting file /var/spool/cups/tmp/3e98bf2d333b5 as \WIN40/infotec_2105.PPD putting file /usr/share/cups/drivers/ADFONTS.MFM as \WIN40/ADFONTS.MFM putting file /usr/share/cups/drivers/ADOBEPS4.DRV as \WIN40/ADOBEPS4.DRV putting file /usr/share/cups/drivers/ADOBEPS4.HLP as \WIN40/ADOBEPS4.HLP putting file /usr/share/cups/drivers/DEFPRTR2.PPD as \WIN40/DEFPRTR2.PPD putting file /usr/share/cups/drivers/ICONLIB.DLL as \WIN40/ICONLIB.DLL putting file /usr/share/cups/drivers/PSMON.DLL as \WIN40/PSMON.DLL Running command: rpcclient localhost -N -U'root%secret' \ -c 'adddriver "Windows 4.0" \ "infotec_2105:ADOBEPS4.DRV:infotec_2105.PPD:NULL:ADOBEPS4.HLP: \ PSMON.DLL:RAW:ADOBEPS4.DRV,infotec_2105.PPD,ADOBEPS4.HLP,PSMON.DLL, \ ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL"' cmd = adddriver "Windows 4.0" "infotec_2105:ADOBEPS4.DRV: \ infotec_2105.PPD:NULL:ADOBEPS4.HLP:PSMON.DLL:RAW:ADOBEPS4.DRV,\ infotec_2105.PPD,ADOBEPS4.HLP,PSMON.DLL,ADFONTS.MFM,DEFPRTR2.PPD,\ ICONLIB.DLL" Printer Driver infotec_2105 successfully installed. Running command: rpcclient localhost -N -U'root%secret' \ -c 'setdriver infotec_2105 infotec_2105' cmd = setdriver infotec_2105 infotec_2105 Successfully set infotec_2105 to driver infotec_2105.
If you look closely, you'll discover your root password was transferred unencrypted over the wire, so beware! Also, if you look further, you'll discover error messages like NT_STATUS_OBJECT_NAME_COLLISION in between. They occur, because the directories WIN40 and W32X86 already existed in the [print$] driver download share (from a previous driver installation). They are harmless here.
18.10.11 Understanding cupsaddsmb
What has happened ? What did cupsaddsmb do? There are five stages of the procedure:
18.10.12 How to Recognize If cupsaddsmb Completed Successfully
You must always check if the utility completed successfully in all fields. You need as a minimum these three messages among the output:
These messages are probably not easily recognized in the general output. If you run cupsaddsmb with the -a parameter (which tries to prepare all active CUPS printer drivers for download), you might miss if individual printers drivers had problems installing properly. Here a redirection of the output will help you analyze the results in retrospective.
18.10.13 cupsaddsmb with a Samba PDC
Can't get the standard cupsaddsmb command to run on a Samba PDC? Are you asked for the password credential all over again and again and the command just will not take off at all? Try one of these variations:
root# cupsaddsmb -U MIDEARTH\\root -v printername root# cupsaddsmb -H SAURON -U MIDEARTH\\root -v printername root# cupsaddsmb -H SAURON -U MIDEARTH\\root -h cups-server -v printername
(Note the two backslashes: the first one is required to " escape " the second one).
18.10.14 cupsaddsmb Flowchart
Figure 18.16 shows a chart about the procedures, commandflows and dataflows of the cupaddsmb command. Note again: cupsaddsmb is not intended to, and does not work with, raw queues!
Figure 18.16. cupsaddsmb flowchart.
18.10.15 Installing the PostScript Driver on a Client
After cupsaddsmb is completed, your driver is prepared for the clients to use. Here are the steps you must perform to download and install it via Point'n'Print. From a Windows client, browse to the CUPS/Samba server:
After a few seconds, there should be a new printer in your client's local Printers folder. On Windows XP it will follow a naming convention of PrinterName on SambaServer . (In my current case it is "infotec_2105 on kde-bitshop"). If you want to test it and send your first job from an application like Winword, the new printer appears in a \\SambaServer\PrinterName entry in the drop-down list of available printers.
cupsaddsmb will only reliably work with CUPS version 1.1.15 or higher and Samba from 2.2.4. If it does not work, or if the automatic printer driver download to the clients does not succeed, you can still manually install the CUPS printer PPD on top of the Adobe PostScript driver on clients. Then point the client's printer queue to the Samba printer share for a UNC type of connection:
C:\> net use lpt1: \\sambaserver\printershare /user: ntadmin
should you desire to use the CUPS networked PostScript RIP functions. (Note that user " ntadmin " needs to be a valid Samba user with the required privileges to access the printershare.) This sets up the printer connection in the traditional LanMan way (not using MS-RPC).
18.10.16 Avoiding Critical PostScript Driver Settings on the Client
Printing works, but there are still problems. Most jobs print well, some do not print at all. Some jobs have problems with fonts, which do not look very good. Some jobs print fast and some are dead-slow. Many of these problems can be greatly reduced or even completely eliminated if you follow a few guidelines. Remember, if your print device is not PostScript-enabled, you are treating your Ghostscript installation on your CUPS host with the output your client driver settings produce. Treat it well: