Getting Windows Printer Drivers from CUPS – A Method That Works!

Wouldn’t it be great if you could install your printer drivers directly from the CUPS server, just like you would with a Windows print server?, rather than having to install them manually for each workstation? Getting CUPS and SAMBA to push print drivers to Windows PCs could be a real pain, especially when there so little information on the web, and the few that exists leaves important details out, making you spend hours and even days trying to figure out what you are doing wrong. I went through this myself; that is why I decided to write this tutorial. Please don’t rush though it, follow it step by step and make sure you don’t skip anything.  This tutorial assumes that you have all printers already setup in CUPS.  I will be using Ubuntu 10.04 as my print server. The method is same for any other Debian based Linux distribution, but you might have to change some commands for other distributions.


Copy PostScript Drivers from Windows to CUPS Server

Go into any Windows machine that has postscript printer drivers installed and enter the following directory:

c:\windows\system32\spool\drivers\w32x86\3

Copy the following files to the /usr/share/cups/drivers directory in your CUPS server:

PS5UI.DLL
PSCRIPT5.DLL
PSCRIPT.HLP
PSCRIPT.NTF

As you can see the files are all uppercase. You must convert every single letter in their filename to lowercase.


Install CUPS PostScript Windows Drivers

Go to the CUPS software download page and download the file cups-windows-6.0-sourde-tar.gz, this file contains the CUPS printer drivers for Windows. Uncompress it to a folder. Get inside the folder with your terminal screen and run:

sudo make intall

This will create 4 files in your /usr/share/cups/drivers directory. The following picture shows how the directory should look like in your CUPS server.


Prepare SAMBA

Log in to your Linux server as “root”, (in Ubuntu you have to enable the root account)

Create a SAMBA user, this user must match a user that already exist on Linux, we are going to choose root.  So go to your shell prompt and issue the following commands:

smbpasswd -a root

Create samba spool directory with full permissions by issuing the command:

mkdir -m 777 /var/spool/samba

Set privileges to the Windows drivers directory at the CUPS server by issuing the following commands at your shell prompt:

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


Smb.conf Configuration Setup

Open your SAMBA configuration file smb.conf, in Ubuntu it is located under  /etc/samba/smb.comf. To edit it, use the following command in your terminal screen prompt:

gksudo gedit /etc/samba/smb.conf


[global]
          log file = /var/log/samba/log.%m
          public = yes
          dns proxy = no
          workgroup = workgroup
          os level = 20
          syslog = 0
          usershare allow guests = yes
          max log size = 1000
          pam password change = yes
          server string = lan file and printer server
          hosts allow = all
          security = share          ## <--Change "share" to "user" for running the cupsaddsmb ##
          load printers = yes
          printing = cups
          printcap name = cups
[printers]
          comment = All Printers
          path = /var/spool/samba          ## <--Directory created by you will full permissions ##
          browseable = yes
          public = yes
          printable = yes
          writable = no
          guest ok = yes
[print$]
          comment = Printer Drivers
          path = /usr/share/cups/drivers          ## <--Windows drivers location ##
          browseable = yes
          guest ok = yes
          read only = yes
          write list = root          ## <--Important ##


CUPS.conf Configuration Setup

Open your CUPS configuration file and add the following command at the shell prompt:

gksudo gedit /etc/cups.conf

Add the following 4 lines at the bottom of the file:

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

mime.types:
application/octet-stream


Export Printers to SAMBA

Run the cupsaddsmb command to export CUPS printer drivers to SAMBA so they can bee acquired by Windows PCs:

cupsaddsmb -H localhost -U root -a -v

If the command fails check your “security” statement on the smb.conf file under [global], the command won’t run if it is set to “share” you need to set it to “user”, and restart samba. After the command runs you can change it back.


Remember to change the security statement on your smb.conf file under [global] from “user” back to “share” (if you happen to use this setting) otherwise you might not be able to see the printer list without entering a username and password.  Restart CUPS and SAMBA with the following commands at your shell prompt:

sudo /etc/init.d/cups restart
sudo restart smbd


And we are done! Just remember that you have to run the cupsaddsmb command every time you install a new printer. Now you should be able to to navigate to the list of printers on your CUPS server from any Windows computer, right click on the one you wish to install,  click on “connect” and driver should be automatically loaded in the windows machine. No more having to spend time manually installing drivers on each machine, now you can do it all with the click of a button.

7 comments:

  1. nemozny, 30. July 2011, 13:50

    Uff, I finally did it! The problem was when you are doing the
    cupsaddsmb -U root -a -v

    work, mind that you might have
    invalid users = root

    in smb.conf! It’s pain in the ..

    Nevertheless, excellent howto!

     
  2. Matthew, 25. March 2011, 10:35

    Thank you SO SO much. I have spent a lot of time for find this solution.
    Thank you for sharing your knowledge.

     
  3. Ryan Bingham, 29. January 2011, 15:37

    This is awesome! Thank you so much for sharing your experience and expertise with the rest of us!

     
  4. Doug, 28. November 2010, 17:04

    NIce, but note that the instructions will need to change for Ubuntu 10.10. I had to give up part way because of missing files or directories. Please consider an update.

    All the best,
    Doug

     
  5. Pablo Garcia, 11. October 2010, 23:37

    Thank you. I corrected the error, its actually PSCRIPT.NTF

     
  6. _yes, 11. October 2010, 5:48

    PS5UI.DLL
    PSCRIPT5.DLL
    PSCRIPT.HLP
    PSCRIPT5.DLL -> PSCRIPT5.NTF

     
  7. Erick Ramirez, 26. September 2010, 14:04

    Excellent work!

     

Write a comment:


You will receive an email when your comment is answered

Time limit is exhausted. Please reload the CAPTCHA.

.