Adding Windows Drivers To Samba Server

Adding Windows Drivers To Samba Server

If you're running a SAMBA domain server, you may want to share your network printers out to both your Linux workstations using CUPS and to your Windows workstations using SAMBA. Nobody likes having to run around to all the workstations, download drivers and install the new printer. It's much easier if the SAMBA server will automatically push the drivers out to Windows computers.

The setup for printer sharing is pretty easy, but it can be a headache to have the SAMBA server push out the Windows drivers needed for the Windows desktops to make installation simple.

I'm going to assume you have both CUPS and SAMBA already working, and you're just trying to solve the problem of pushing Windows printer drivers out.

Make sure your /etc/samba/smb.conf file has a [print$] section that looks something like this:

[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = yes
   use client driver = yes
   # you can modify the next two lines to match your needed permissions
   valid users = "Domain Users"
   write list = "Domain Admins"

At the end of your /etc/cupsd.conf file, add the following lines:

mime.convs:
application/octet-stream application/vnd.cups-raw 0 -

mime.types:
application/octet-stream

Download and install the CUPS Windows driver set from their website. It will be named something like:

cups-windows-6.0-source.tar.gz.

Unzip and install:

sudo apt-get install libcups2-dev
tar -zxvf cups-windows-6.0-source.tar.gz
cd cups-windows*
sudo make install

Now you need a copy of the Windows postscript driver files. I installed a simple HP postscript printer in windows connected to LPT1: (that really didn't exist) to get them. After you've installed a postscript compatible printer in a Windows machine, you should find the files you need somewhere underneath c:windowssystem32spooldriversw32x86 Mine were in a "3" subdirectory underneath that. Look for the following files:

ps5ui.dll
pscript5.dll
pscript.hlp
pscript.ntf

Copy those files to the same directory: /usr/share/cups/drivers/, but make sure you change the name of each file to all lowercase.

Your final directory should look something like:

tony@alexandria:/usr/share/cups/drivers# ls -l
total 2360
-rw-r--r-- 1 root root     803 2009-03-15 15:52 cups6.inf
-rw-r--r-- 1 root root      72 2009-03-15 15:52 cups6.ini
-rw-r--r-- 1 root root   12568 2009-03-15 15:52 cupsps6.dll
-rw-r--r-- 1 root root   13672 2009-03-15 15:52 cupsui6.dll
-rw-r--r-- 1 root root  728576 2009-03-15 16:10 ps5ui.dll
-rw-r--r-- 1 root root  543232 2009-03-15 16:01 pscript5.dll
-rw-r--r-- 1 root root   26038 2009-03-15 16:01 pscript.hlp
-rw-r--r-- 1 root root 1060548 2009-03-15 16:01 pscript.ntf
tony@alexandria:/usr/share/cups/drivers#

Now we need to make sure that the appropriate users have rights to add printer drivers. We already set the SAMBA share as the "Domain Admins" group for write, but we need to change ownership of the share directory in Linux to be sure that the Linux permissions don't conflict. The following will change ownership to root with the "Domain Admins" group, and give the group write ability:

sudo chown -R root:"Domain Admins" /var/lib/samba/printers/*
sudo chmod -R g+w /var/lib/samba/printers/*

Last, use cupsaddsmb to add the drivers to each available shared printer:

cupsaddsmb -H localhost -U tony -a -v

Obviously, replace "tony" with a user in the "Domain Admins" group specified in the permissions above.

If all goes well (it did for me anyway) you should be able to right click on a printer in Windows and click "Connect" without having to manually install any drivers on the Windows desktop.

Posted by Tony on Mar 17, 2009 |