printing in linux

Not that anyone cares, but I finally got printing working in linux! w00p! I had some serious trouble with this, trust me. I’ll post some of the details in hopes it will help others.

My setup is a laptop running Gentoo linux. I am connected to a router which provides the life-flow known as the Internet to my laptop and a desktop pc. There is a printer connected to the desktop pc, and that’s what I want to print to. The desktop runs Windows XP. What I needed setup and running is this: CUPS (Common Unix Printing Structure), SAMBA suite, netbios on windows computer, and the printer being shared from within windows.
At first, I was able to print using smbclient to log in to the printer share and then use the SAMBA print command. However, this was very hackish, to say the least. It took me a long time to track it down, but I was finally able to print with the command smbspool. This is important bedcause this is what CUPS uses for the samba backend, and when you get the syntax for smbspool correct, you’ll be better off when it comes to debugging, later… if you have to. 😉

smbspool {printerURI} {job} {user} {title} {copies} {options} [filename]

mine looked like this:

smbspool smb://desktop-workgroup/desktop-netbios-name/shared-printer-name jobname guest jobtitle 1 “” test.txt

To get a list of available shares (including printers), use smbclient -L desktop-netbios-name -N. “desktop-netbios-name” with the name of your windows computer. So, if my windows computer was named “bob” and bob’s printer was shared as “pbob”, then the path to the printer would be “smb://bob/pbob”. I have my workgroup on my /etc/smb.conf file set to the same as my desktop for simplicity. You can grab a simple smb.conf file here.

CUPS

You may also have to make some changes to files in the /etc/cups/ directory. But if you’ve got CUPS installed and running, you can manage it through a web application which will be running on your computer! http://localhost:631/ This is the most significant part of the setup that I seemed to miss. Use this interface to add a SAMBA printer, and it should take care of all the nasties. You’re not done, yet. IMPORTANT: Once you’ve added the printer(s), you must enable them and tell them to accept jobs!

After you’ve done all your changes, you will want to restart SAMBA and CUPS.

/etc/init.d/samba restart && /etc/init.d/cupsd restart

Load up an application and you should see your new printer selectable! yay! (I hope I didn’t miss anything too important….)

Published
Categorized as Geek Tagged

Leave a comment

Your email address will not be published. Required fields are marked *