Printers

TechRepublic Tutorial: Automate desktop printer setup with Samba

Shows you how to eliminate the headache of printer driver deployment by using a Samba print server to automatically download printer driver files to workstations


Printing—it’s often one of an administrator’s primary sources of grief. Samba makes some printing hurdles easier to manage by giving administrators the ability to easily tackle keeping drivers readily available and providing a reliable printing environment.

In my experience, the major problems with printing have been driver issues—especially getting printer drivers installed on every machine where users need a particular printer. I’ll show you how this problem can be quickly and easily solved by using a Samba print server to automatically download printer driver files to a user’s workstation when he or she initially attempts to connect to a printer.

I’m using Samba 2.2.2 on Red Hat Linux 7.1. If you’re following along and using different versions, you may have to make modifications before some of the examples will work properly. Also keep in mind that the particular Samba installation presented here uses workgroup authentication, which means that no Windows NT or 2000 domain controllers are present.

Winbind
If you would like to join your Samba server to an existing Windows domain, read my previous Daily Drill Down, ”Easy Samba user administration with winbind.”

Before I discuss how to solve this problem, I want to make sure you know how to quickly share a UNIX printer with Samba.

Automatic download of drivers
The updated feature in Samba 2.2.x that allows driver files to be automatically downloaded to a user’s workstation is another example of how Samba is making it easier for Windows networks to include Linux. Let’s get it set up.

Smb.conf
In some installations, the smb.conf file may be located in /etc/samba/.

The first step is to add entries to the smb.conf file to allow the uploading of printer driver files to the server. Without this entry, the feature won’t work. Using Pico, my favorite text editor, I’ll add the following information to the /usr/local/lib/smb.conf file:
[global]
    .
    .  { your other smb.conf global directives are here }
    .
    printer admin = slowe

[print$]
    path = /usr/local/samba/print
    guest ok = yes
    browseable = yes
    read only = yes
    write list = root,slowe


This says:
  • ·        The path where the driver files will be stored is /usr/local/samba/print.
  • ·        This path is read-only, browseable in Network Neighborhood, and allows guest users to access it. I’ve enabled guest access to this folder so that users without Samba accounts are able to use the printer drivers that are uploaded. Obviously, if you’re stricter in your print accounting, you’ll change this.
  • ·        I’ve specified a “write list,” which is a list of users that are able to write to the directory to upload drivers. (I use “root” and “slowe” for write-enabled users. My username is slowe, and it keeps the confusion level down to use it for certain administrative tasks in my lab.)

Notice that all of these parameters, with the exception of printer admin, are in a share named print$. This name is not optional. For printing services in Samba to work properly, the share must be named print.

The next step in getting this process to work is to create a directory structure for the driver files that will be served up by the Samba server. Table A shows the directory structure I’ll use for my installation.

Table A
Location Description
/usr/local/samba/print Main driver directory
/usr/local/samba/print/win40 Drivers for Windows 9x clients
/usr/local/samba/print/w32x86 Drivers for Windows NT clients

Uploading drivers and testing
At this point, I have completed the steps necessary to enable the driver download features in Samba. The next steps are to actually upload some drivers and then connect to the Samba server from another Windows machine to test everything. For testing, I’m using an HP LaserJet 4M Plus and two Windows 2000 Professional workstations.

Uploading the driver is a simple task, assuming everything above works properly. First, I’ll navigate to my Samba server by typing \\pear at the Start | Run prompt. (Remember, Pear is the name of my Samba server.) Once I do this, I’m greeted with a list of shares and printers that are configured on my Samba server. Figure A shows that the printer wkbd that I shared at the beginning of this discussion is listed as a share here.

Figure A
Wkbd is an existing shared printer on my Samba server.


If I want to enable users printing to this printer to automatically download its drivers, I first need to double-click Printers, right-click wkbd from the list of printers, and choose Properties. Since no drivers are installed on my Windows workstation for this printer, I’m presented with the message shown in Figure B.

Figure B
To install the driver, I'll answer No to the question.


It might not seem to make sense at the moment to answer negatively, but it’ll make sense in the next paragraph when I add the driver.

With this option, the properties for the printer will be shown. By clicking on the Advanced tab, a new driver can be uploaded to the Samba server.

Figure C
The Printer Properties Advanced tab lets you configure a new driver and the default printing properties.


Latest driver
Before you take the next step, download the latest drivers from your printer’s site.

For my test lab installation, I’ll use a new driver for my HP LaserJet 4M Plus printer by clicking the New Driver button on the Advanced tab and following the instructions to install the driver. If you’re following along, choose the appropriate printer driver for your installation and click Next to continue. The final screen of the wizard just provides a summary, so I’ll click Finish. In Figure C, the driver has already been loaded.

Since I can also serve Windows 9x clients with this Samba server, I’ll install that set of drivers and associate them with this printer. To do this, I’ll open the properties for this printer again, choose the Sharing tab, and then click on the Additional Drivers button.

Figure D
Choosing additional drivers


As shown in Figure D, to install the Windows 95 or 98 drivers, you’ll check the box next to that entry, click OK, and follow the instructions. Once this process is complete, you should be able to serve Windows 9x machines' printing needs via Samba as well.

I now have a working Samba print server with a setup that allows automatic downloading of drivers to Windows 2000 and Windows 9x clients. To test this, I’ll go to another Windows 2000 client to see if the driver does indeed download automatically.

Figure E 
Point and print in action


On my other Windows 2000 client, when I browse to \\pear, I see a list of shares and the wkbd printer that I have been working with. When I double-click the wkdb printer, Windows asks me if I want it to be automatically set up (see Figure E).

When I answer "Yes" to the question, Windows automatically downloads and installs the appropriate driver for my operating system.

All in all, this wasn't very difficult. My only stumbling block when I was learning how to set this up ended up being a simple mistake on my part. I was attempting to install the initial driver from the wrong tab in the printer properties. With the advice of a member of the Samba team, I recognized my error and was able to continue.

That’s all there is to getting the automatic download of drivers working. I should warn you that certain printer models don’t work well with this method, though. I haven’t run into this problem, but a number of the messages on the Samba lists (samba@lists.samba.org, linux-discussion@freelists.org) indicate this is the case. If you run into trouble with a particular printer model, be sure to consult these lists, as users often have devised workarounds to the problems.

"Windows-only printers" (read "not-natively-supported”) such as certain low-end HP and Lexmark ink-jet printers present one problem in general with printing. Users can get around this by using a program such as GhostScript on the Windows box to act as a translator. In general, referring to the lists and to the Internet for help will enable you to solve most Samba printing problems.

Conclusion
Samba has the potential to be of great service to organizations faced with managing many remote printers. With its ability to automatically manage the driver installation process, it can be used to save a lot of time for administrators and make life easier for end users who rely on a reliable printing environment.

More Samba
Still not enough Samba? If you’d like to see more Samba content on TechProGuild, send Jack Wallen, Jr. a note and let him know exactly what you need.

 

Editor's Picks

Free Newsletters, In your Inbox