Printing over a network: Linux to Windows


Helped greatly by this guide I managed to get my laptop (which is dual boot Debian/Windows XP) to print across the network (which is all run on XP) using CUPS.

Package setup

First, I had to get all the required packages, which was accomplished by the following rather lengthy command:

apt-get install cupsys cupsys-bsd cupsys-client foomatic-bin samba smbclient gs-esp a2ps

I don't know what all of those do, but apparently they're necessary.

Printer/host discovery

The next thing to do is to use the samba client to have a look at the shared printers on the network:

/usr/bin/smbclient -L [host name] -U [username]

Instead of using the host name, the IP address can be used instead, with -I instead of -L.
This will bring up a list of shared resources, which will tell you the name of the printer (if you didn't know it already).

CUPS setup

The following command is to verify that CUPS has the smb backend (again, not quite sure what this is about, but the guide told me to do it...)

ls -l /usr/lib/cups/backend/smb

Lastly, you need to set up the printer(s) you want to use:

lpadmin -p [printer name] -v smb://[username]:[password]@[host name]/[printer name]

/usr/bin/enable [printer name]
/usr/sbin/accept [printer name]
/usr/sbin/lpadmin [printer name]
Integration with KDE

You should then be able to go into the KDE printing manager (application menu -> settings -> printing manager) and add your printer . Since you've already added with the above commands, KDE will find it in localhost. Down the bottom of the printing manager, where it says "Print system currently used:" select CUPS. Then you can right-click on the printer and click "Test printer..." to print a test page, which prints you a nice colour wheel and information on the page size etc.

Last words

So now I can just print straight from Linux, without having to reboot into Windows. :) Now all I need is a Linux-compatible wireless card and I won't need Windows much at all...