Howto Share Linux printers with Windows machines

I can’t profess to know a great deal about CUPS and Linux printing, but having spent ages searching for answers on how to share a Linux printer with Windows machines, it seems there is a need for a clear explanation. I hope this will be it.

This assumes the Linux machine already has a printer attached and working through CUPS. If the printer doesn’t work from the host it’s attached to, there isn’t much hope of it working from somewhere else.

First, it’s probably best to create a dedicated CUPS printer entry for the Windows machines. This enables them to use a local driver rather than the Linux one. Much as it pains me to say it, Windows printer drivers tend to be more functional than their Linux counterparts. To do this, create a duplicate CUPS printer as follows:-

Name: raw_dj970
Location: My Office
Description: HP Deskjet 970Cxi attached to myhost.mydomain.com

Click Continue, then on the next page enter the Device Type for your printer. Mine is:

USB Printer #1 (HP Deskjet 970C)

Click Continue to move forward. So far everything should have been identical to how the original CUPS printer was configured. Now comes the difference. Instead of selecting the Driver for the printer, select Raw instead. Clicking Continue will hopefully provide you with only a single printer model to chose Raw Queue. Select that and then click Continue once more. Hopefully that’s done and the printer is created.

That’s it so far as CUPS and the Linux end of the configuration is concerned. If you have firewalls, you might want to block access to your printer host from the outside world in order to prevent anyone from using your printer. Likewise, make sure your internal Windows machines do have access to the Linux host or they won’t be able to print. The port to allow/block is TCP:631.

Next, move to a windows host and run through the usual printer creation process. When asked for the url of the Internet Printer, enter:

http://myhost.mydomain:631/printers/raw_dj970

Obviously you need to change the suffix to suite whatever you called the printer in the Linux Host. If Windows accepts the entry, enter the correct Manufacturer and Model for the printer and that’s it, you’re done!

Leave a comment