Return to Linux Home Page.

Printing to Windows 2000/XP From RedHat Linux using SMB

by Jeff Hunter, Sr. Database Administrator


The following article provides a quick and easy way to configure your RedHat Linux workstation to print to a locally connected Windows 2000/XP printer. In this example, I have an HP DeskJet 960c printer hooked to my Windows XP machine. The name of the Windows XP machine is bartman and will setup the HP DeskJet 960c printer to be sharable in order to be used by other computers on the network.
Setting up Windows Printer for Sharing

In most cases, you will already have your printer configured and working through Windows 2000/XP. In this step, you will ensure the printer is sharable and that there is a valid username/password that can be used by the SMB client in RedHat Linux.

First lets setup the local Windows printer for sharing. From the Control Panel, select Printers. Click on your printer to configure, right-clink and select properties. There should be a tab labeled "Sharing". In my example, I make the printer sharable and call it alex-lp:

Printer Properties

After making your printer sharable, you will need to create an account on your Windows XP/2000 machine. In my example, I created a user account called JHUNTER/JHUNTER.

Configuring Linux to Print to Windows Printer

The easiest way to configure printing in Linux is with the Red Hat Printer Config application. From the command-line, execute /usr/bin/redhat-config-printer-gui to start the utility. This will bring up Red hat Printer Config utility as shown below:

Red Hat Printer Config application

To configure the remote Windows printer, start off by hitting the New button. This will start the wizard process. Simply hit the Forward button when the introduction screen (Add A New Print Queue) comes up. On the next screen, Set the Print Queue Name and Type, type in the name of the Queue, in my case HP960c and then select the Windows Printer - SMB Queue Type and hit the Forward button.

Set the Print Queue Name and Type

The next screen is where you configure the Windows Print Queue. As you can see from the screenshot below, I put in for the Share: \\<Machine Name>\<Windows Printer Share Name>. I also put in the Windows username/password for the Windows account we created earlier. Hit the Forward button to continue.

Configure a Windows Print Queue

The next screen is where you select the printer driver for your Windows printer. In my case for the HP DeskJet 960c I selected:

HP -> Desk Jet 960C -> cdj970
After selecting your printer driver, hit the Forward button.

Select a Print Driver

The final screen is a confirmation screen. Simply hit the Apply to complete the wizard.

Finish, and Create the New Print Queue

The process is almost complete. You will need to restart the lp deamon by hitting the Apply button in the original Red Hat Printer Config application. If the lpd service was successfully start, you should see the following dialog:

lpd restart Information Dialog

Finally, perform a test by selecting any of the documents in the Test pull-down menu in the Red Hat Printer Config application.

Setup the Shell Environment

As a final step, setup your shell account by setting the $PRINTER environment variable. This should be set to the name of the Queue - in my example HP960c:
% PRINTER=HP960c; export PRINTER
% ls -l | lp

Last modified on: Saturday, 18-Sep-2010 18:21:15 EDT
Page Count: 35844