Push Windows Printer Drivers with CUPS

Configuring networked printer drivers for Windows desktops can be a real chore. Or you can use CUPS and Samba and it's not so bad after all.

 By Carla Schroder
Page 1 of 2
Print Article

Network printing is a leading cause of high blood pressure and premature hair loss in our long-suffering network administrator demographic. Fortunately, the FOSS world, as usual, does its best to mitigate our suffering. Today you shall learn how to use CUPS and Samba together to set up automagic client printer installations. That's right, my hardworking friends, none of this dashing about to individual workstations burdened with driver disks and Windows CDs. The goal here is to never leave your snug underground lair.

Please note that today's topic is only about printers. I know you're dying to figure out how to share your multi-function devices, so that all your LAN hosts can scan and fax. We'll get to this in a future article, especially how to share scanners, because that is something you can do in Linux that you can't do in Windows.

The Easy Way: Buy The Right Printer
In my ideal environment, all printers would have native networking and administration utilities. Samsung and HP both have a lot of printers with Linux, Mac OS X, Windows, and networking support. You can get a nice network-ready (wired and wireless) Samsung color laser for under $500, which is a lot more fun and less work than running a separate printer server.


Since we don't all have the option to purchase wonderful new printers, the next best thing is a robust Linux printer server starring CUPS and Samba. The CUPS/Samba printer we're building today will not require users to authenticate to install and use printers, so it's not for admins who need everything locked down. This setup is good for home users, businesses that don't need a lock on everything, and those unfortunate network admins who still have Windows 9x machines under their care.

You need:

  • Name resolution working reliably
  • An already-configured and working CUPS server with printers configured
  • The cups-devel package installed, also called libcups2-devel and libcupsys2-dev
  • Samba server
  • CUPS Windows drivers
  • Adobe or Microsoft Postscript drivers

The commands and examples are all from a Debian system, so you may need to adjust filenames for different systems.

Samba Server

If you don't have a Samba server already running on your network, here is a complete example configuration. All of your Windows hosts must belong to the workgroup named in smb.conf. Linux and Mac OS X don't care about workgroups, so don't worry about them.

First create these two directories:

# mkdir -m 777 /sharedstuff
# mkdir -m 777 /var/spool/samba

Then create this smb.conf, using your own LAN address and workgroup name:
	workgroup = samba2
	netbios name = xena
	server string = lan file and printer server
	hosts allow = 192.168.1.
	security = user
	load printers = yes
	printing = cups
	printcap name = cups'share1'
	path = /sharedstuff
	comment = files for everyone
	read only = no
	browseable = yes
	guest ok = yes'printers'
	comment = All Printers
	path = /var/spool/samba
	browseable = yes
	printable = yes
        writable = no 
	guest ok = yes'print$'
	comment = Printer Drivers
	path = /usr/share/cups/drivers
	browseable = yes
	guest ok = no
	read only = yes
	write list = root

Run the testparm command to check your syntax. If you get a "WARNING: passdb expand explicit = yes is deprecated" error, ignore it, it's a leftover meaningless bit of cruft. Restart Samba:

# /etc/init.d/samba restart

Now you should have a "share1" folder in Network Neighborhood and your other Samba browsers. Use this to copy the driver files between your machines, which we'll get to in a moment.

CUPS Configuration

This is a nice simple CUPS configuration for sharing printers. Make sure you have the last four lines- those are necessary for sharing Windows printers:

LogLevel info
Port 631
Browsing On

<Location />
Order Deny,Allow
Deny From All
Allow From 192.168.1.*
Allow From

<Location /admin>
AuthType Basic
AuthClass System
Allow From
Order Deny,Allow
Deny From All

application/octet-stream application/vnd.cups-raw 0 -


This article was originally published on Jul 24, 2007
Get the Latest Scoop with Networking Update Newsletter