17.6 Installing Drivers into [print$]
Have you successfully created the [print$] share in smb.conf , and have your forced Samba to re-read its smb.conf file? Good. But you are not yet ready to use the new facility. The client driver files need to be installed into this share. So far it is still an empty share. Unfortunately, it is not enough to just copy the driver files over. They need to be correctly installed so that appropriate records for each driver will exist in the Samba internal databases so it can provide the correct drivers as they are requested from MS Windows clients . And that is a bit tricky, to say the least. We now discuss two alternative ways to install the drivers into [print$] :
The latter option is probably the easier one (even if the process may seem a little bit weird at first).
17.6.1 Add Printer Wizard Driver Installation
The initial listing of printers in the Samba host's Printers folder accessed from a client's Explorer will have no real printer driver assigned to them. By default this driver name is set to a null string. This must be changed now. The local Add Printer Wizard (APW), run from NT/2000/XP clients, will help us in this task.
Installation of a valid printer driver is not straightforward. You must attempt to view the printer properties for the printer to which you want the driver assigned. Open the Windows Explorer, open Network Neighborhood , browse to the Samba host, open Samba's Printers folder, right-click on the printer icon and select Properties... . You are now trying to view printer and driver properties for a queue that has this default NULL driver assigned. This will result in the following error message:
Device settings cannot be displayed. The driver for the specified printer is not installed, only spooler properties will be displayed. Do you want to install the driver now?
Do not click on Yes! Instead, click on No in the error dialog. Only now you will be presented with the printer properties window. From here, the way to assign a driver to a printer is open to us. You now have the choice of:
Once the APW is started, the procedure is exactly the same as the one you are familiar with in Windows (we assume here that you are familiar with the printer driver installations procedure on Windows NT). Make sure your connection is, in fact, setup as a user with printer admin privileges (if in doubt, use smbstatus to check for this). If you wish to install printer drivers for client operating systems other than Windows NT x86, you will need to use the Sharing tab of the printer properties dialog.
Assuming you have connected with an administrative (or root) account (as named by the printer admin parameter), you will also be able to modify other printer properties such as ACLs and default device settings using this dialog. For the default device settings, please consider the advice given further in Section 17.6.2.
17.6.2 Installing Print Drivers Using rpcclient
The second way to install printer drivers into [print$] and set them up in a valid way is to do it from the UNIX command line. This involves four distinct steps:
We provide detailed hints for each of these steps in the paragraphs that follow.
126.96.36.199 Identifying Driver Files
To find out about the driver files, you have two options. You could check the contents of the driver CDROM that came with your printer. Study the *.inf files lcoated on the CDROM. This may not be possible, since the *.inf file might be missing. Unfortunately, vendors have now started to use their own installation programs. These installations packages are often in some Windows platform archive format. Additionally, the files may be re-named during the installation process. This makes it extremely difficult to identify the driver files required.
Then you only have the second option. Install the driver locally on a Windows client and investigate which file names and paths it uses after they are installed. (You need to repeat this procedure for every client platform you want to support. We show it here for the W32X86 platform only, a name used by Microsoft for all Windows NT/200x/XP clients.)
A good method to recognize the driver files is to print the test page from the driver's Properties dialog ( General tab). Then look at the list of driver files named on the printout. You'll need to recognize what Windows (and Samba) are calling the Driver File , Data File , Config File , Help File and ( optionally ) the Dependent Driver Files (this may vary slightly for Windows NT). You need to take a note of all file names for the next steps.
Another method to quickly test the driver filenames and related paths is provided by the rpcclient utility. Run it with enumdrivers or with the getdriver subcommand, each at the 3 info level. In the following example, TURBO_XP is the name of the Windows PC (in this case it was a Windows XP Professional laptop). I installed the driver locally to TURBO_XP, from a Samba server called KDE-BITSHOP . We could run an interactive rpcclient session; then we would get an rpcclient /> prompt and would type the subcommands at this prompt. This is left as a good exercise to the reader. For now, we use rpcclient with the -c parameter to execute a single subcommand line and exit again. This is the method you would use if you want to create scripts to automate the procedure for a large number of printers and drivers. Note the different quotes used to overcome the different spaces in between words:
root# rpcclient -U'Danka%xxxx' -c \ 'getdriver "Heidelberg Digimaster 9110 (PS)" 3' TURBO_XP cmd = getdriver "Heidelberg Digimaster 9110 (PS)" 3 [Windows NT x86] Printer Driver Info 3: Version:  Driver Name: [Heidelberg Digimaster 9110 (PS)] Architecture: [Windows NT x86] Driver Path : [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01_de.DLL] Datafile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.ppd] Configfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01U_de.DLL] Helpfile: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01U_de.HLP] Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.DLL] Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.INI] Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.dat] Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.cat] Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.def] Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.hre] Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.vnd] Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\Hddm91c1_de.hlp] Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01Aux.dll] Dependentfiles: [C:\WINNT\System32\spool\DRIVERS\W32X86\2\HDNIS01_de.NTF] Monitorname:  Defaultdatatype: 
You may notice that this driver has quite a large number of Dependent files (there are worse cases, however). Also, strangely, the Driver File is tagged here Driver Path . We do not yet have support for the so-called WIN40 architecture installed. This name is used by Microsoft for the Windows 9x/Me platforms. If we want to support these, we need to install the Windows 9x/Me driver files in addition to those for W32X86 (i.e., the Windows NT72000/XP clients) onto a Windows PC. This PC can also host the Windows 9x/Me drivers, even if it runs on Windows NT, 2000 or XP.
Since the [print$] share is usually accessible through the Network Neighborhood , you can also use the UNC notation from Windows Explorer to poke at it. The Windows 9x/Me driver files will end up in subdirectory of the WIN40 directory. The full path to access them will be \\WINDOWSHOST\print$\WIN40\0\ .
188.8.131.52 Obtaining Driver Files from Windows Client [print$] Shares
Now we need to collect all the driver files we identified in our previous step. Where do we get them from? Well, why not retrieve them from the very PC and the same [print$] share that we investigated in our last step to identify the files? We can use smbclient to do this. We will use the paths and names that were leaked to us by getdriver . The listing is edited to include linebreaks for readability:
root# smbclient //TURBO_XP/print\$ -U'Danka%xxxx' \ -c 'cd W32X86/2;mget HD*_de.* hd*ppd Hd*_de.* Hddm*dll HDN*Aux.DLL' added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0 Got a positive name query response from 10.160.50.8 ( 10.160.50.8 ) Domain=[DEVELOPMENT] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager] Get file Hddm91c1_de.ABD? n Get file Hddm91c1_de.def? y getting file \W32X86\2\Hddm91c1_de.def of size 428 as Hddm91c1_de.def Get file Hddm91c1_de.DLL? y getting file \W32X86\2\Hddm91c1_de.DLL of size 876544 as Hddm91c1_de.DLL [...]
After this command is complete, the files are in our current local directory. You probably have noticed that this time we passed several commands to the -c parameter, separated by semi-colons. This effects that all commands are executed in sequence on the remote Windows server before smbclient exits again.
Remember to repeat the procedure for the WIN40 architecture should you need to support Windows 9x/Me/XP clients. Remember too, the files for these architectures are in the WIN40/0/ subdirectory. Once this is complete, we can run smbclient ... put to store the collected files on the Samba server's [print$] share.
184.108.40.206 Installing Driver Files into [print$]
We are now going to locate the driver files into the [print$] share. Remember, the UNIX path to this share has been defined previously in your words missing here. You also have created subdirectories for the different Windows client types you want to support. Supposing your [print$] share maps to the UNIX path /etc/samba/drivers/ , your driver files should now go here:
We again use smbclient to transfer the driver files across the network. We specify the same files and paths as were leaked to us by running getdriver against the original Windows install. However, now we are going to store the files into a Samba/UNIX print server's [print$] share.
root# smbclient //SAMBA-CUPS/print\$ -U'root%xxxx' -c \ 'cd W32X86; put HDNIS01_de.DLL; \ put Hddm91c1_de.ppd; put HDNIS01U_de.DLL; \ put HDNIS01U_de.HLP; put Hddm91c1_de.DLL; \ put Hddm91c1_de.INI; put Hddm91c1KMMin.DLL; \ put Hddm91c1_de.dat; put Hddm91c1_de.dat; \ put Hddm91c1_de.def; put Hddm91c1_de.hre; \ put Hddm91c1_de.vnd; put Hddm91c1_de.hlp; \ put Hddm91c1_de_reg.HLP; put HDNIS01Aux.dll; \ put HDNIS01_de.NTF' added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0 Got a positive name query response from 10.160.51.162 ( 10.160.51.162 ) Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a] putting file HDNIS01_de.DLL as \W32X86\HDNIS01_de.DLL putting file Hddm91c1_de.ppd as \W32X86\Hddm91c1_de.ppd putting file HDNIS01U_de.DLL as \W32X86\HDNIS01U_de.DLL putting file HDNIS01U_de.HLP as \W32X86\HDNIS01U_de.HLP putting file Hddm91c1_de.DLL as \W32X86\Hddm91c1_de.DLL putting file Hddm91c1_de.INI as \W32X86\Hddm91c1_de.INI putting file Hddm91c1KMMin.DLL as \W32X86\Hddm91c1KMMin.DLL putting file Hddm91c1_de.dat as \W32X86\Hddm91c1_de.dat putting file Hddm91c1_de.dat as \W32X86\Hddm91c1_de.dat putting file Hddm91c1_de.def as \W32X86\Hddm91c1_de.def putting file Hddm91c1_de.hre as \W32X86\Hddm91c1_de.hre putting file Hddm91c1_de.vnd as \W32X86\Hddm91c1_de.vnd putting file Hddm91c1_de.hlp as \W32X86\Hddm91c1_de.hlp putting file Hddm91c1_de_reg.HLP as \W32X86\Hddm91c1_de_reg.HLP putting file HDNIS01Aux.dll as \W32X86\HDNIS01Aux.dll putting file HDNIS01_de.NTF as \W32X86\HDNIS01_de.NTF
Whew that was a lot of typing! Most drivers are a lot smaller many only having three generic PostScript driver files plus one PPD. While we did retrieve the files from the 2 subdirectory of the W32X86 directory from the Windows box, we do not put them (for now) in this same subdirectory of the Samba box. This relocation will automatically be done by the adddriver command, which we will run shortly (and do not forget to also put the files for the Windows 9x/Me architecture into the WIN40/ subdirectory should you need them).
220.127.116.11 smbclient to Confirm Driver Installation
For now we verify that our files are there. This can be done with smbclient , too (but, of course, you can log in via SSH also and do this through a standard UNIX shell access):
root# 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 Got a positive name query response from 10.160.51.162 ( 10.160.51.162 ) Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.8a] Current directory is \\SAMBA-CUPS\print$\W32X86\ . D 0 Sun May 4 03:56:35 2003 .. D 0 Thu Apr 10 23:47:40 2003 2 D 0 Sun May 4 03:56:18 2003 HDNIS01Aux.dll A 15356 Sun May 4 03:58:59 2003 Hddm91c1KMMin.DLL A 46966 Sun May 4 03:58:59 2003 HDNIS01_de.DLL A 434400 Sun May 4 03:58:59 2003 HDNIS01_de.NTF A 790404 Sun May 4 03:56:35 2003 Hddm91c1_de.DLL A 876544 Sun May 4 03:58:59 2003 Hddm91c1_de.INI A 101 Sun May 4 03:58:59 2003 Hddm91c1_de.dat A 5044 Sun May 4 03:58:59 2003 Hddm91c1_de.def A 428 Sun May 4 03:58:59 2003 Hddm91c1_de.hlp A 37699 Sun May 4 03:58:59 2003 Hddm91c1_de.hre A 323584 Sun May 4 03:58:59 2003 Hddm91c1_de.ppd A 26373 Sun May 4 03:58:59 2003 Hddm91c1_de.vnd A 45056 Sun May 4 03:58:59 2003 HDNIS01U_de.DLL A 165888 Sun May 4 03:58:59 2003 HDNIS01U_de.HLP A 19770 Sun May 4 03:58:59 2003 Hddm91c1_de_reg.HLP A 228417 Sun May 4 03:58:59 2003 40976 blocks of size 262144. 709 blocks available Current directory is \\SAMBA-CUPS\print$\W32X86\2\ . D 0 Sun May 4 03:56:18 2003 .. D 0 Sun May 4 03:56:35 2003 ADOBEPS5.DLL A 434400 Sat May 3 23:18:45 2003 laserjet4.ppd A 9639 Thu Apr 24 01:05:32 2003 ADOBEPSU.DLL A 109568 Sat May 3 23:18:45 2003 ADOBEPSU.DLL A 18082 Sat May 3 23:18:45 2003 PDFcreator2.PPD A 15746 Sun Apr 20 22:24:07 2003 40976 blocks of size 262144. 709 blocks available
Notice that there are already driver files present in the 2 subdirectory (probably from a previous installation). Once the files for the new driver are there too, you are still a few steps away from being able to use them on the clients. The only thing you could do now is to retrieve them from a client just like you retrieve ordinary files from a file share, by opening print$ in Windows Explorer. But that wouldn't install them per Point'n'Print. The reason is: Samba does not yet know that these files are something special, namely printer driver files and it does not know to which print queue(s) these driver files belong.
18.104.22.168 Running rpcclient with adddriver
Next, you must tell Samba about the special category of the files you just uploaded into the [print$] share. This is done by the adddriver command. It will prompt Samba to register the driver files into its internal TDB database files. The following command and its output has been edited, again, for readability:
root# rpcclient -Uroot%xxxx -c 'adddriver "Windows NT x86" \ "dm9110:HDNIS01_de.DLL \ Hddm91c1_de.ppd:HDNIS01U_de.DLL:HDNIS01U_de.HLP: \ NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI, \ Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre, \ Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL, \ HDNIS01Aux.dll,HDNIS01_de.NTF, \ Hddm91c1_de_reg.HLP' SAMBA-CUPS cmd = adddriver "Windows NT x86" \ "dm9110:HDNIS01_de.DLL:Hddm91c1_de.ppd:HDNIS01U_de.DLL: \ HDNIS01U_de.HLP:NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI, \ Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre, \ Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL, \ HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP" Printer Driver dm9110 successfully installed.
After this step, the driver should be recognized by Samba on the print server. You need to be very careful when typing the command. Don't exchange the order of the fields. Some changes would lead to an NT_STATUS_UNSUCCESSFUL error message. These become obvious. Other changes might install the driver files successfully, but render the driver unworkable. So take care! Hints about the syntax of the adddriver command are in the man page. The CUPS printing chapter provides a more detailed description, should you need it.
22.214.171.124 Checking adddriver Completion
One indication for Samba's recognition of the files as driver files is the successfully installed message. Another one is the fact that our files have been moved by the adddriver command into the 2 subdirectory. You can check this again with smbclient:
root# smbclient //SAMBA-CUPS/print\$ -Uroot%xx \ -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 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a] Current directory is \\SAMBA-CUPS\print$\W32X86\ . D 0 Sun May 4 04:32:48 2003 .. D 0 Thu Apr 10 23:47:40 2003 2 D 0 Sun May 4 04:32:48 2003 40976 blocks of size 262144. 731 blocks available Current directory is \\SAMBA-CUPS\print$\W32X86\2\ . D 0 Sun May 4 04:32:48 2003 .. D 0 Sun May 4 04:32:48 2003 DigiMaster.PPD A 148336 Thu Apr 24 01:07:00 2003 ADOBEPS5.DLL A 434400 Sat May 3 23:18:45 2003 laserjet4.ppd A 9639 Thu Apr 24 01:05:32 2003 ADOBEPSU.DLL A 109568 Sat May 3 23:18:45 2003 ADOBEPSU.HLP A 18082 Sat May 3 23:18:45 2003 PDFcreator2.PPD A 15746 Sun Apr 20 22:24:07 2003 HDNIS01Aux.dll A 15356 Sun May 4 04:32:18 2003 Hddm91c1KMMin.DLL A 46966 Sun May 4 04:32:18 2003 HDNIS01_de.DLL A 434400 Sun May 4 04:32:18 2003 HDNIS01_de.NTF A 790404 Sun May 4 04:32:18 2003 Hddm91c1_de.DLL A 876544 Sun May 4 04:32:18 2003 Hddm91c1_de.INI A 101 Sun May 4 04:32:18 2003 Hddm91c1_de.dat A 5044 Sun May 4 04:32:18 2003 Hddm91c1_de.def A 428 Sun May 4 04:32:18 2003 Hddm91c1_de.hlp A 37699 Sun May 4 04:32:18 2003 Hddm91c1_de.hre A 323584 Sun May 4 04:32:18 2003 Hddm91c1_de.ppd A 26373 Sun May 4 04:32:18 2003 Hddm91c1_de.vnd A 45056 Sun May 4 04:32:18 2003 HDNIS01U_de.DLL A 165888 Sun May 4 04:32:18 2003 HDNIS01U_de.HLP A 19770 Sun May 4 04:32:18 2003 Hddm91c1_de_reg.HLP A 228417 Sun May 4 04:32:18 2003 40976 blocks of size 262144. 731 blocks available
Another verification is that the timestamp of the printing TDB files is now updated (and possibly their file size has increased).
126.96.36.199 Check Samba for Driver Recognition
Now the driver should be registered with Samba. We can easily verify this, and will do so in a moment. However, this driver is not yet associated with a particular printer. We may check the driver status of the files by at least three methods :
188.8.131.52 Specific Driver Name Flexibility
You can name the driver as you like. If you repeat the adddriver step with the same files as before but with a different driver name, it will work the same:
root# rpcclient -Uroot%xxxx \ -c 'adddriver "Windows NT x86" \ "mydrivername:HDNIS01_de.DLL: \ Hddm91c1_de.ppd:HDNIS01U_de.DLL:HDNIS01U_de.HLP: \ NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI, \ Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre, \ Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL, \ HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP' SAMBA-CUPS cmd = adddriver "Windows NT x86" \ "mydrivername:HDNIS01_de.DLL:Hddm91c1_de.ppd:HDNIS01U_de.DLL:\ HDNIS01U_de.HLP:NULL:RAW:Hddm91c1_de.DLL,Hddm91c1_de.INI, \ Hddm91c1_de.dat,Hddm91c1_de.def,Hddm91c1_de.hre, \ Hddm91c1_de.vnd,Hddm91c1_de.hlp,Hddm91c1KMMin.DLL, \ HDNIS01Aux.dll,HDNIS01_de.NTF,Hddm91c1_de_reg.HLP" Printer Driver mydrivername successfully installed.
You will be able to bind that driver to any print queue (however, you are responsible that you associate drivers to queues that make sense with respect to target printers). You cannot run the rpcclient adddriver command repeatedly. Each run consumes the files you had put into the [print$] share by moving them into the respective subdirectories. So you must execute an smbclient ... put command before each rpcclient ... adddriver command.
184.108.40.206 Running rpcclient with the setdriver
Samba needs to know which printer owns which driver. Create a mapping of the driver to a printer, and store this info in Samba's memory, the TDB files. The rpcclient setdriver command achieves exactly this:
root# rpcclient -U'root%xxxx' -c 'setdriver dm9110 mydrivername' SAMBA-CUPS cmd = setdriver dm9110 mydrivername Successfully set dm9110 to driver mydrivername.
Ah, no, I did not want to do that. Repeat, this time with the name I intended:
root# rpcclient -U'root%xxxx' -c 'setdriver dm9110 dm9110' SAMBA-CUPS cmd = setdriver dm9110 dm9110 Successfully set dm9110 to driver dm9110.
The syntax of the command is:
rpcclient -U'root%sambapassword' -c 'setdriver printername \ drivername' SAMBA-Hostname.
Now we have done most of the work, but not all of it.