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.
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
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.