Printers

Five tips for printer sharing in Linux

Admins often shy away from sharing a printer from Linux. But as Jack Wallen explains, following a few simple steps can go a long way toward simplifying setup and sidestepping problems.

Printer sharing in Linux isn't all that hard. But when asked to set it up, most admins would rather chew off their own arm. Why? Lack of familiarity? Ignorance? Who really knows. But the truth is, it's not hard and it makes for an incredibly reliable service.

Let's take a look at some tips that will make sharing out a printer from the Linux operating system much easier for both the admin and the end user.

1: Use the GUI

Both GNOME and KDE have incredibly easy graphical tools to help with the sharing of files, folders, and printers through Samba. The printer sharing feature is found in the Printer Preferences tool on both desktops and can be configured on both the printer and the server levels. The printer level is where the printer is actually shared out, whereas the server level is where a number of options can be set. Most instances will only need the printer-level settings.

2: Make sure Samba is configured properly

One of the issues you will find is that if Samba isn't configured properly, no amount of GUI will help. This is especially true in a mixed environment. If you do have a mixed environment (especially Windows and Linux), it will be crucial that Samba is correct. Make sure the security= line uses the right mode and that files can be shared to all necessary clients. Once you've established that, verify that the entry for the printers is correct. You'll be looking for two sections: [printers] and [print$]. The former is the global printer configuration and the latter is the configuration necessary for Windows clients.

3: Provide drivers

Unless you're okay with going to every client and installing drivers for the printers, you will want to have drivers for all flavors of Windows on your printer server for use. These are configured in the [print$] directive in the smb.conf file. The most important entry in that is the path = variable. This will be where the drivers are stored. By default, this is /var/lib/samba/printers/. Make sure you have the explicit pathname to these drivers and to make your life easy, take out any spaces in the directory names for the drivers.

4: Make sure Samba is starting at boot and iptables isn't blocking

I have found this to be a sticking point in some instances. If power goes out and the Linux machine sharing the printers goes down, Samba may not be running when the machine restarts. When this is the case, no one will be able to print. Of course, how this is done will depend upon which distribution you use. Some distributions offer a GUI tool for this task and some do not. NOTE: Do not do this through the Startup Applications GUI, as that is for user-level applications. Also, make sure your firewall isn't blocking the ports for printer sharing. The most important port you need to have open is port 631, which is the CUPS (Common UNIX Printer System) port.

5: Grab a Web-based admin tool

CUPS offers an easy-to-use printer configuration tool. Go to http://address_to_printer_server:631 and you will find a tool that makes configuring your printers a snap. To use cups for printer sharing (UNIX to UNIX), you can use the cupsctl command (man cupsctl for more information). For UNIX-to-Windows or UNIX-to-Mac printer sharing, you will need to use a Web-based tool like Webmin. NOTE: When using Webmin, your smb.conf fill will be rewritten. I would make a copy of that file before using Webmin. Samba used to have a tool called Swat for Samba printer sharing setup, but that tool is no longer maintained.

Avoiding problems

As we all know, printing is one of those administrative tasks that can go wrong for so many reasons. Add the layer of multiple platforms and the level of challenge grew even greater. But with the above tips, you should be five steps closer to having your Samba printer server up and running.

More on Linux print sharing

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

2 comments
JRLBell
JRLBell

I appreciate these tips. This next time I try to share a printer attached to a Linux system, I'll definitely refer to them (unless they change, as Linux methods often do, in my experience). Don't get me wrong, I'm not against Linux--really! However, here's how you do the very same thing in Windows: Right click on printer icon > select "Printer Properties" > click on shared tab > click "Share this printer" box > Give the printer a cute name (or meaningful--your choice) > click okay.

Neon Samurai
Neon Samurai

In general, older methods remain effective unless completely replaced by a newer method. The older method of editing smb.conf has remained available even with the availability of GUI management utilities (which normally just edit the smb.conf for you). Another example is wifi, using wpa_supplicant directly remains just as affective as ever even with the newer method of using the KDE or Gnome "network connections" utilities also being available. With these specific tips, most of them are independent of a user interface method 1. GUI managed utility - by default it's a management method dependent on how the GUI app was written. If KDE changes how it manages samba shares then you'll need to learn the new method if you use KDE. 5. Web managed utility - same as above by default since it's intention is to provide a specific management method though CUPS web interface has remained consistant as long as I can remember (The GUI apps all pretty much just edit smb.conf so you can always go directly to the config if you want the most stable and consistant management method) 2, 3, 4 - independent of any higher management method. You should make sure samba is configured regardless of the method you choose to toggle settings. Providing drivers for client nodes is also independent of how you manage your config file changes. Samba starting at boot and being allowed through the firewall.. also independent of how you flip settings. It is rare that a method disapears completely without something replacing it when your talking about something like managing Samba or similar fairly major functions. I also wouldn't complain to see it polished up a little more (Deb6 on my desktop wont talk to my NAS but Deb6 on my notebook will yet they are both based on the exact same configuration? wtf?) though either.

Editor's Picks