I recently set up a Linux workstation that shared out a Hewlett-Packard printer to the rest of my network -- a network that otherwise consisted entirely of Windows machines. I didn't like the idea of setting up SMB support on the Linux box, and instead, explored the possibility of having the Windows machines connect directly to the shared printer as a network printing device.
To my surprise, this turned out to be pretty easy. Here are the steps to connect your Windows machines to the shared printer:
- Set up the printer on your Linux machine and share it using CUPS via port 631. The exact method for doing this varies between distributions, so check with your distro's documentation. The end result should be a working printer, and a running CUPS service which you can access through your Web browser at http://localhost:631 from the Linux system.
- Using the CUPS Web interface, go to the Printers tab and make a note of the printer name, which is typically the Description: line). You can do this from the Windows machine where you plan to set up printer support.
- In Windows, go to Control Panel | Printers and click onAdd a printer.
- When prompted for a printer location, select Network printer, in the Add Printer Wizard.
- When prompted for the network location, select URL and use the following URL format: http://<hostname>:631/printers/<printername>.
For instance, if the Linux host has a DNS name of linuxbox and the printer is named LaserJet-5, you'd use http://linuxbox:631/printers/LaserJet-5 as the URL.
- When asked for a printer driver, select Generic as the manufacturer and MS Publisher Imagesetter as the driver. In truth, any generic PostScript driver will do, but this works as well as any.
- When finished with the wizard, print a test page to make sure everything is set up correctly.
In Windows Vista, the steps are almost exactly the same, but the nomenclature for some of the steps is a little different. In the first step of the wizard, Vista will attempt to search for a printer (via SMB, which it won't find). Click Stop to halt the search and then click The printer that I want wasn't listed to add a printer manually.
In the next step of the wizard, use Select a shared printer by name when you want to supply the printer's URL. The rest should unfold exactly as before. Adding a printer by TCP/IP address or hostname will not work. Finally, if you're using a firewall product, make sure that port 631 is not being blocked. The Microsoft firewall on the Windows machine will usually know automatically what to do, but some third-party products may not.
If you're managing a workgroup and using system images to deploy your desktops, you can use the Windows con2prt utility, or a freeware substitute like AdPrintX, as a way to automate adding references to a CUPS-managed printer. If you're dealing with multiple CUPS-driven printing systems on the Linux side, you may want to drop the cash for the CUPS Companion CD and its accompanying book. The CUPS Companion CD is now offered in lieu of the commercial UNIX printing product ESP Print Pro, which is being discontinued by the manufacturer.
This was first published in April 2007