bloggandomene

elbryan's blog

Samba, CUPS and Windows 32/64 bit drivers

Posted by elbryan Wed, 17 Feb 2010 12:25:00 GMT

This post is provided to you by Walter “DaK_TaLeS”, my friend. So, everytime you read “I”, it refers to him and not to me.

Just to introduce you his home-computer environment, he owns an home server/desktop hybrid system that provides SAMBA file-sharing and CUPS to export his printers to the whole family computers.
As you may already imagine, other laptops run different versions of Windows (both 32 and 64 bits).

The goal that I’ve been finally able to achieve is a smart configuration setup in order to export Windows printers drivers through CUPS service using SAMBA to share the printers onto a Windows network. This is a feature that isn’t spread out, but kind of useful.
To say it shortly, the shared printers will be available and installed on Windows systems with a simple double click, no need to Google for drivers.

It’s a kind of magic. How to do so? There’s plenty of guides around the Internet so I won’t waste bits here explaining this (you can take a look at cupsaddsmb man page for further information). As the man-page states:

  cupsaddsmb  exports  printers  to  the SAMBA software (version 2.2.0 or
  higher) for use with Windows clients.
  cupsaddsmb  uses  the  new RPC-based printing support in SAMBA 2.2.x to
  provide printer drivers and PPD files to Windows  client  machines.


In order to get through the next part of the walk-through, make sure you have SAMBA and CUPS services already installed.
Let’s configure SAMBA to provide this service by editing/adding the following lines in /etc/samba/smb.conf:

 [global]
  load printers = yes
  printing = cups
  printcap name = cups

 [printers]
  comment = All Printers
  path = /var/spool/samba
  browseable = no
  public = yes
  guest ok = yes
  writable = no
  printable = yes

 [print$]
  comment = Printer Drivers
  path = /etc/samba/drivers
  browseable = yes
  guest ok = no
  read only = yes
  write list = root


Of course, you should edit your share options according to your needs.
I feel comfortable creating an user on the server and make every service run with its credentials. This makes my family happier since they don’t have to rant against annoying login popups when accessing the printers.

 [global]
  map to guest = bad user
  security = share
  guest ok = yes
  guest account = winsmb


Notice that I’ve set winsmb as guest account for accessing the sharing. If you’ve chosen another username, edit the configuration above accordingly.
At this point you should be able to see the shared printers from your Windows clients, but you won’t be able to automatically fetch the drivers through the LAN.

Now go to a Windows client (it’s important that it’s running Windows 2000 or newer).
These steps need to be performed for each kind of architecture in your Home facility. If you own two or more 32-bit version of Windows, you don’t need to do that more than once. You have to perform the following tasks once for 32-bit systems and once for 64-bit system. (If you do not own one type of architecture, just ignore).

Fire up your Windows clients and go to Windows\system32\spool\drivers\w32x86\pcc\ directory (for 32 bit systems) or go to Windows\system32\spool\drivers\x64\pcc\ (for 64 bit systems). and extract the following files from a cab file:

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

The cab file should be named something like “ntprint.inf__.cab” [ is supposed to be x86 or amd64 according to the Windows version; is a random value]. Extract the files above.
You should own two copies of these files: one from the Windows 32 bit, and another one from Windows 64 bit. Put the files in your USB pen-drive and return to the Dark Side of Human Being (linux).

Those files have to be copied inside two different directories so pay attention:
Copy the 32 bit files into /usr/share/cups/drivers/.
Copy the 64 bit files into /usr/share/cups/drivers/x64/.

Make sure the filenames are lower-case since Linux is case-sensitive.

Now double check you’ve done everything right. Fire up your favorite browser, head to CUPS website , and download the Windows driver (it should be named something like cups-windows-6.0-1.i386.tar, of course version could be different). Uncompress it somewhere and copy the included file

  cups6.inf
  cups6.ini
  cupsps6.dll
  cupsui6.dll

inside /usr/share/cups/drivers/. As you may notice, this driver is a 32-bit driver so you won’t be able to automagically install a printer on Windows 64-bit client system.

Here comes the part where I sweat blood and, thanks to me, you’re going to get through it smoothly.
The 64-bit driver is hosted on CUPS’s svn so you have to pick those directly from the nightly. So, go to the CUPS svn , copy all those files inside /usr/share/cups/drivers/x64/

That’s it. A piece of cake, uh?
Well, you have all what you need! cupsaddsmb needs you, temporarily, to switch to “security = user” in /etc/samba/smb.conf.
Log in as root and issue cupsaddsmb -a -v (all and verbose, respectively). This command will export the driver inside the previously specified [print$] directory.
Once it terminates, let’s revert your old security thing inside smb.conf.

If you’ve chosen to create a dedicated user to the printers sharing, just add it to CUPS as authorized to print and restart CUPS service.

Well if you’ve done everything right, you’ll be able to use your printers from any kind of almost any Windows/Linux Operative system running any kind of architecture.

That’s it. Happy printing!

Well, I hope you’ve enjoyed the post. Kudos to Walter :)

Posted in | Tags , , , , , | 6 comments |



Comments

Avatar
Vike
3 months later:
 

Thank you so very very much.

To get ps5ui.dll, pscript.hlp, pscript.ntf, pscript5.dll on Windows XP Professional 64 bit edition:
control panel → printers
right click, server properties
driver tab
add → next → “x64” only → next → manufacturer “generic”, driver “MS publisher imagesetter” → next → finish

Then the four files appear in C:\WINDOWS\system32\spool\drivers\x64\3

Avatar
Vike
3 months later:
 

By the way I bet that applies to Windows server 2003 64 bit edition too.

Avatar
elbryan
3 months later:
 

I’ve no way to test it with a Windows Server 2003 64bit but I’ve the same clue you have.

However, thank you for your contribution

Avatar
Alex
3 months later:
 

Thanks for this great explanation!

But I have one more question: what versions of CUPS and Samba did you use?

Avatar
elbryan
3 months later:
 

If I’m right (let’s wait dak to have a confirmation), he used samba-3.4.6 and CUPS-1.3.11

However I’ll inquiry him just to be sure.

Avatar
DaK_TaLeS
3 months later:
 

Alex:

Samba: 3.0.37
Cups: 1.3.11

Why do you ask?

Leave a comment