Win Lin Chapter
Win Lin Chapter
Chapter
5
Printer Sharing between
Windows and Linux
Ah, printers. They’re the enterprise’s necessary evil. They consume paper, toner, time, and
patience. And oftentimes our enterprises have a lot of printers. Maybe it would be better if we had
fewer? Or, if not fewer, we could at least get more people printing on the printers we do have.
That’s what this chapter is about. That is, you can leverage your existing Linux or Windows
printer investment and share it.
Then the fun begins.
As with previous chapters, we’ll ensure things are set up and working first by making our
Windows clients talk to printers on Windows servers and our Linux clients talk to printers on
Linux servers. In Figure 5.1, you can see our intended design. That is, we want to have a Win-
dows 2003 server host a printer and also have our Linux server host a printer. Then, we want
to have our Windows and Linux clients be able to print to whichever printer we want.
FIGURE 5.1 We will be setting up our Linux Samba server and our Windows 2003 server
to share printers and have our Windows and Linux clients print to them.
Linux Server
Member of Active Directory domain
Unix LPD printing
Samba printing LinPrinter1
CUPS printing
(adsambafp1.ad.corp.com)
2. Then, we’ll share the printer so Windows computers and Linux computers running Samba
can find it.
3. We’ll enable Windows’ Internet Printing, otherwise known as IPP (Internet Printing Pro-
tocol), which will allow for both Windows and Linux clients to simply point to a web
address to find the printer.
4. We’ll enable “old-school” Unix printing support via the LPD (Line Printer Daemon)
protocol.
4428.book Page 267 Tuesday, August 2, 2005 8:54 PM
Everything in Windows that involves anything http means that Windows IIS needs to be con-
figured. At installation time, we recommended that you install IIS on your Windows server, so
you should be ready to go here. If you haven’t loaded IIS, you’ll have to do that now. Again, IPP
is optional but very neat, and we’ll be setting it up so our Windows and Linux clients will know
the web address of our printers and be able to be off and running.
Here’s the trick, though. Windows doesn’t call it IPP, they have their own name: Windows
Internet Printing. In addition, Microsoft’s Windows Internet Printing doesn’t use the standard
port 631—it uses regular ol’ port 80. According to Microsoft, this is because the original RFC
didn’t specify a port, and that’s what Microsoft wrote to. Now the RFC specifies port 631, but
Microsoft was already committed to port 80. This really isn’t a problem, though it might be nice
if Microsoft had an easy-breezy way to make Windows Internet Printing completely support the
RFC standard. But they don’t. So, as we go along in this journey, we’ll tell our Linux clients how
to use Windows Internet Printing over port 80 so the Windows server can pick up the traffic,
run with it, and start printing.
Let’s configure it now.
Enabling anonymous printing allows a Linux user to send bazillions of pages of print jobs to
any printer hosted by the Windows print server. As it stands now, Windows users can already
do this, but you should know what you’re getting into.
To do this:
1. In the IIS manager, drill down to WinDC1 Web Sites Default Web Site Printers.
Right-click “Printers” and select “Properties.”
2. Select the “Directory Security” tab. In the “Authentication and access control” section
select “Edit” to open the “Authentication Methods” dialog.
3. In the “Authentication Methods” dialog, select “Enable anonymous access” and ensure
“Integrated Windows authentication” is enabled, as shown in Figure 5.3. You can leave
everything else the same.
4. Click “OK” to return to the “Printers Properties” dialog.
5. Click “OK” to return to the IIS Manager. Close the IIS Manager.
4428.book Page 270 Tuesday, August 2, 2005 8:54 PM
FIGURE 5.3 You can secure IIS to allow authentication in a number of ways. Here, we
suggest you specify only “Integrated Windows authentication.”
You can also control access to Internet printers based on the IP address (as
opposed to user credentials). To specify which computers can use the printers,
in the Printers Properties screen, select “Edit” under “IP address and domain
name restrictions.”
around, it might be in your best interest to enable those computers to automatically download
the drivers from this Windows server.
To do that, right-click over the printer definition in the Printers applet in Control Panel and
select “Properties.” In the “Sharing” tab, select “Additional Drivers” (in the lower right side).
Then select the category of driver you want to additionally install, such as Windows NT 4.0.
Note that in Figure 5.4, no older client drivers are actually selected.
Once you select the additional drivers, you’ll be prompted for the files. This is where the pain
can occur. That is, you need to dig up the drivers from either the old NT 4 CD-ROM or down-
load them from a manufacturer’s website—or maybe they don’t exist at all.
FIGURE 5.4 If desired, you can add automatic downloading driver support for older
Windows clients.
4428.book Page 272 Tuesday, August 2, 2005 8:54 PM
So we’ll teach Windows to run the LPD (via a service called “Print Services for Unix”) so
an older Unix or Linux machine needn’t change in any way to print to Windows. Again, this
isn’t the preferred method—it’s here for completeness. Additionally, the “Print Services for
Unix” are not part of the Services for Unix 3.5 we loaded in earlier chapters. “Print Services
for Unix” are just a regular, built-in part of Windows 2003 and Windows XP.
To enable Print Services for Unix:
1. Select Start Control Panel Add or Remove Programs.
2. Select “Add / Remove Windows Components.”
3. In the list of components, double-click “Other Network File and Print Services” and select
the “Print Services for Unix,” as shown in Figure 5.5.
4. Click “OK” to return to the Windows Components screen and click “Next” to continue.
5. Click “Finish” when finished.
FIGURE 5.5 “Print Services for Unix” is built into Windows 2003 and Windows XP and
enables LPD printing.
4428.book Page 273 Tuesday, August 2, 2005 8:54 PM
Using \\servername\printername
The most common way to connect to a Windows printer is by opening the “Printers and Faxes”
applet in Control Panel and selecting “Add a printer” to start the “Add Printer Wizard.”
At the “Local or Network Printer” screen, you’ll be able to select “A network printer, or a
printer attached to another computer.” You’ll then have the option to “Connect to this printer
(or to browse for a printer, select this option and click Next),” as shown in Figure 5.6. Either
type the name of the printer (\\windc1\WinPrinter1 ), or leave it blank and click “Next” and
browse for the printer.
Note that browsing for the printer is different from searching for the printer. Browsing relies
on Windows’ Browser service. Searching, as we’ll perform at the end of the chapter, relies on
records within Active Directory that we can search for.
When ready, enter the name of the server and printer as shown in Figure 5.6 and click “Next.”
You will be asked if you want to make this the default printer. Click “Next” to say yes, then click
“Finish” to close the wizard.
FIGURE 5.6 You can enter the SMB name of the printer in the “Add Printer Wizard.”
You already installed the printer in the previous step, so re-installing it here
won’t have any effect.
FIGURE 5.7 Windows Internet Printing offers an easy way to connect to printers.
4428.book Page 275 Tuesday, August 2, 2005 8:54 PM
7. On the “Printer model” page, pull down the “Manufacturer” menu and pick “Canon.”
Then scroll through the list of models and pick “BJC 7000.” Click “Forward.”
8. The “Finish, and Create the New Print Queue” page appears. Click “Finished.”
9. When asked whether you wish to print a test page, click the “Yes” button. A test page will
emerge from your printer after a short delay.
For a more interesting test, we also suggest launching OpenOffice Writer from the “Office”
section of the “Applications” menu. Create a simple document and pick “Print” from the “File”
menu. Be sure to select “WinPrinter1ViaLPD” as the printer to use, then click “Print” in the
“Print” dialog to send your test document to the Windows-hosted printer.
FIGURE 5.8 Once your Windows server has LPD set up, you can choose LPD printing as
an option.
configuration tool doesn’t support searching it. Given these facts, we think your best choice is
to set up Windows Internet Printing. However, when you can’t, SMB printing from Linux is a
fine alternative.
Setting up adlincli1 to print via SMB isn’t difficult. Once again, we’ll use Fedora’s stan-
dard printer configuration tool. The Printer Queue Setup Wizard works fine for SMB printing,
except for a problem we observed in our tests of the “print a test page” feature.
1. Pull down the “Applications” menu and drill down to System Settings Printing. Wait for
the printer configuration tool to come up.
2. Click the “New” button to add a new print queue.
3. Click “Forward” on the following page.
4. On the “Queue name” page, enter WinPrinter1ViaSMB in the “Name” field. In the “Short
description” field, enter Windows Printer One Via SMB or another descriptive name that
you like. Click “Forward.”
5. On the “Queue type” page, pull down the “Select a queue type” menu and pick “Net-
worked Windows (SMB).”
6. A list of shares appears. If the server you want appears, great—click the arrow to the left
of it to display a list of shares and double-click the shared printer you want. The “Authen-
tication” dialog should appear with the “Workgroup,” “Server” and “Share” fields already
filled in. If it does not, as in our tests, click the “Specify” button.
7. If not already done, set the “Workgroup” field to AD, as shown in Figure 5.9.
8. If not already done, set the “Server” field to WinDC1.
9. If not already done, set the “Share” field to WinPrinter1 .
10. Set the “User name” field to administrator .
11. Set the “Password” field to p@ssw0rd.
FIGURE 5.9 Select your Windows queue and then enter your Active Directory
credentials.
4428.book Page 278 Tuesday, August 2, 2005 8:54 PM
For the record, Windows applications that provide SMB print services are ker-
berized. That means, theoretically, you shouldn’t have to enter your username
and password when printing from Windows clients to Windows servers. How-
ever, the Linux client GUI isn’t quite there yet with kerberization. So, when
printing from Linux to Windows clients, you will likely still need to enter your
credentials. See Chapter 4 for more information about kerberization.
Let’s jump right to the end of this little story by taking a look at the dialog box we’ll enter
our printer information into, as shown in Figure 5.10. (Don’t worry, we’ll describe all the step-
by-steps in a second.)
FIGURE 5.10 Printing to a Windows server with Windows Internet Printing requires you
to specifically enter the port number (80) and the printer path.
To talk to a Windows Internet Printing server, we need to know three pieces of information:
Server The “Server” field will always look like this
servername:80
In our example, the server name is WinDC1, so the correct setting is:
WinDC1:80
/printers/printername/.printer
In our example, the printer name is WinPrinter1, so the correct setting is:
/printers/WinPrinter1/.printer
The /printers/ prefix is necessary because Windows Internet Printing is delivered by the web
server, which may have other uses. So printers don’t belong in the top folder. The /.printer
suffix is a common convention and mandatory when using Windows Internet Printing.
Now we know enough to set up our Fedora system as a client of Windows Internet Printing.
To have our Linux client print to Windows via IPP:
1. Pull down the “Applications” menu and drill down to System Settings Printing. Wait for
the “Printer configuration” tool to appear.
2. Click the “New” button to add a new print queue.
4428.book Page 280 Tuesday, August 2, 2005 8:54 PM
Of course, in today’s office environment and even in the home, printers are not always con-
nected directly to a Linux or Windows server. Instead, printers are often connected directly to
the network via a device called a dedicated print server. The sole function of a dedicated print
server is to accept a stream of printer commands from print clients and to communicate those
commands to the attached printer.
However, even though a printer has a dedicated print server, it still needs support from a gen-
eral purpose computer running Windows or Linux to provide temporary print job storage and
to host additional management features too complex to store in the limited memory of the net-
work print device.
Printing to a dedicated print server from Windows is generally straightforward because man-
ufacturers provide Microsoft with drivers for their network print devices along with drivers for
their printers. But what about Linux?
Examples of IPP-compatible print servers on the market as of this writing include the Linksys
WPS54GU2, which offers a wireless network interface and support for both parallel and USB
printers. Another similar unit is the Netgear PS101NA, a less expensive device with a wired
Ethernet interface and a parallel printer port.
Newer models of Jetdirect printer servers offer a browser-based configuration interface that can be
accessed from any operating system. Once the printer server has been configured, you can click the
“New” button in the Fedora printer configuration tool and select the “Networked Jetdirect” queue
type on the first page of the wizard. When prompted, enter the IP address of the Jetdirect box in the
“Printer” field and leave the port number set to 9100 to talk to a standard Jetdirect box. The rest of
the steps are identical to those for a local printer.
4428.book Page 282 Tuesday, August 2, 2005 8:54 PM
Of course, not all printers understood Postscript even at the height of its popularity. Cheaper
printers in general rarely had Postscript interpreters built in. These printers instead “spoke”
much simpler languages like HP’s PCL (Printer Command Language) or Epson’s ESCP2 (named
for the escape sequence of characters that enabled it). These languages were interpreted at the
host computer so that only control characters were sent to the printer itself. Using these printers
on a Linux system required an open-source page rendering solution.
Matters grew worse with the introduction of Winprinters, which were (and sometimes still
are) printers that, to save a few pennies, do not offer even the rudimentary smarts to handle a
language like PCL or ESCP2. Instead, the computer to which they are attached is required to
micromanage printing, right down to the precisely timed transmission of rows of pixels. The
specifications for these printers were rarely made available to open source developers. Generally
speaking, no one much cared for Winprinters because they put considerable and largely unnec-
essary demands on the host computer. They also couldn’t be easily moved to computers running
alternative operating systems.
Today, computers have CPU and memory to spare, and an open-source Postscript inter-
preter, called Ghostscript, is a standard part of every Fedora Linux system. Ghostscript sup-
ports many different printer languages on the back end, including hundreds of printers that do
not speak Postscript natively (and even quite a few Winprinters!). Ghostscript accepts Postscript
as input and renders a bitmap of the actual pages. Then it feeds the results to the printer in its
native control language. If Ghostscript supports your printer, or it speaks Postscript natively,
then you can attach that printer to a Linux system.
www.linuxprinting.org/printer_list.cgi
If you’re shopping for a new printer specifically for your Linux system, compatibility should
be your first consideration. You can find Linux printer recommendations at:
www.linuxprinting.org/suggested.html
Office Application
Postscript
CUPS daemon
Spooling services
Postscript
PPD Files
Postscript
Filter program
Postscript
Ghostscript
Non-Postscript
Postscript Printers
printers
Linux server what to tell new Windows clients when they want to print. In other words, other
clients will pick up the printer type information saved on the server and avoid even the need to
pick a driver.
Additionally, you might have some old-and-crusty printer that doesn’t have proper “net-
working” drivers available. If the printer is supported by Ghostscript, then the printer can
always be shared over the network. For instance, you could take that $50 low-end inkjet printer
and get it on your network. That’s cool.
What if we needed to use a printer that wasn’t supported by Fedora? We’d check
www.linuxprinting.org for an appropriate driver. www.linuxprinting.org
offers PPD files for many printers. These can then be imported into the CUPS
printing system using the “Import PPD” option on the “Actions” menu of the
Fedora printer configuration tool.
1. Pull down the “Applications” menu and drill down to System Settings Printing. Wait for
the printer configuration tool to appear.
2. Click the “New” button to add a new print queue.
3. Click “Forward” on the explanatory page that follows.
4. On the “Queue name” page, enter LinPrinter1 in the “Name” field. In the “Short
description” field, enter Linux Printer One or another descriptive name that you like.
Click “Forward.”
5. On the “Queue type” page, pull down the “Select a queue type” menu and pick “Locally-
connected” as shown in Figure 5.12.
6. In the list box beneath that menu, select “/dev/lp0.” Then click “Forward.”
7. On the “Printer model” page, pull down the “Manufacturer” menu and pick “Canon.”
Then scroll through the list of models and pick “BJC 7000.” Click “Forward.”
8. The “Finish, and Create the New Print Queue” page appears. Click “Finished.”
9. When asked whether you wish to print a test page, click the “Yes” button. A test page will
emerge after a short delay.
10. Leave the printer configuration tool on the screen in order to continue with the next section.
4. On the “Queue name” page, enter LinPrinter1Raw in the “Name” field. In the “Short
description” field, enter Linux Printer One Raw Spool or another descriptive name that
you like. Click “Forward.”
5. On the “Queue type” page, pull down the “Select a queue type” menu and pick “Locally-
connected.”
6. In the list box beneath that menu, select “/dev/lp0.” Then click “Forward.”
7. On the “Printer model” page, pull down the “Manufacturer” menu and pick “Generic.” Then
scroll through the list of generic printer types and print “Raw Queue.” Click “Forward.”
8. The “Finish, and Create the New Print Queue” page appears. Click “Finished.”
9. When asked whether you wish to print a test page, click the “Yes” button. A test page will
emerge after a short delay.
10. Leave the printer configuration tool on the screen in order to continue with the next section.
4. The “Sharing Properties” dialog appears. Make sure the “Queue” tab is selected. Check the
box labeled “This queue is available to other computers.” This enables IPP printer sharing.
5. To lock the printer down so that only certain client computers can print to it, select the
“Allowed Hosts” list box and make sure “All Hosts” is selected. Then click “Remove,” fol-
lowed by “Add” to display the “Add allowed hosts” dialog.
6. Click the “Network Address” radio button.
7. Now we'll specify the local network address to prohibit computers on other networks from
printing to this printer. In the first field beneath “Network Address,” enter 192.168.2.0 .
This is the network address that is allowed to access the printer.
8. In the second field, to the right of the first, enter 255.255.255.0 . This is the network mask.
A zero for the last byte means that clients with addresses beginning with 192.168.2 and
ending with any byte are allowed to print.
9. Click “OK.”
10. Click the “General” tab.
11. Click the radio box labeled “Enable LPD protocol.”
12. Click “OK.”
13. Choose “Quit” from the “Action” menu or just click the “X” button in the upper-right cor-
ner to close the printer configuration tool.
14. When the message “Do you want to save the changes you have made to your printer con-
figuration?” appears, be sure to click “Save.”
15. Repeat steps 1–14 for LinPrinter1Raw. Be sure to select “LinPrinter1Raw” rather than
“LinPrinter1” when repeating step 2.
Why do we share both of the print spools? Isn’t LinPrinter1Raw the only appropri-
ate spool for Windows clients? Well, no. We can use a Postscript queue with Win-
dows SMB clients if we want to. All we have to do is choose a Postscript printer
driver instead of the Canon i560 driver on the client side. In this chapter, though,
we’ll use Postscript drivers for LPD and IPP printing and the native Canon i560
driver for SMB printing. Just bear in mind that you’re not required to do it that way.
Samba needs a spool directory to store print jobs in. Conveniently, Fedora ships Samba with
a ready-made directory for this purpose: /var/spool/samba. We’ll just specify this directory
when prompted for the spool directory.
4428.book Page 290 Tuesday, August 2, 2005 8:54 PM
2. Log into Webmin with the username root and the password p@ssw0rd at the URL:
https://adsambafp1.ad.corp.com:10000/, if you haven’t already.
3. If you are not already at the Windows File Sharing page, click “Servers,” then “Samba Win-
dows File Sharing.”
4. Click the “Create a new file share” link. The “Create File Share” page appears.
5. Make sure the radio box next to “Share name” is selected. In the “Share name” text field,
enter print$ .
6. In the “Directory to share” field, enter /usr/local/samba/windrivers/W32X86 .
7. Click the “No” box for “Automatically create directory?”
8. Click the “Yes” box for “Available?”
9. Click the “Yes” box for “Browseable?”
10. In the “Share Comment” field, enter Click And Print Drivers .
11. Click “Save.”
12. print$ should appear in the list of shares. Click print$.
13. The “Edit File Share” page appears. Click “Security and Access Control.”
14. Make sure “Writable” is set to “No.”
15. On the “Read/Write Users” line, enter AD\administrator .
16. Verify that “Guest Access” is set to “None” and “Limit to possible list” is set to “No.”
17. Click “Save.” The “Samba Windows File Sharing” page will reappear.
18. Scroll to the bottom of the page and click “Restart Samba Servers.”
That’s it—the server is configured! Time to test our new printing capabilities.
But bear in mind that Active Directory plays no role in this and the procedure would be exactly
the same in a pure Linux environment.
Everything we need to do can be accomplished with the Fedora printer configuration tool on
adlincli1.
To configure our Linux client to print to a Linux server:
1. Pull down the “Applications” menu and drill down to System Settings Printing. Wait for
the printer configuration tool to appear.
2. Click the “New” button to add a new print queue.
3. Click “Forward” on the explanatory page that follows.
4. Double-click the right-pointing arrow next to “Browsed queues.”
5. LinPrinter1 appears in the list. Select it with the mouse.
6. Pull down the “Test” menu and pick “CUPS Test Page.” Click “Yes” after the page appears
successfully.
As before, we suggest using OpenOffice Writer to carry out a more interesting test. Select
“LinPrinter1” as the printer to use. Notice that we didn’t have to explicitly add this printer,
since it is automatically detected on the local network.
Before we move on, there are two scenarios that we’re not going to specifically cover in step-
by-steps, and you might be asking yourself why not.
CUPS can only automatically find printers on the same subnet. What if I need to print to a CUPS
printer that isn’t on the same LAN? It is possible to set up automatic relaying of printer
browsing information between CUPS hosts on separate subnets. However, the relevant options,
BrowsePoll and BrowseRelay, are not currently supported by the Fedora GUI. Currently con-
figuration files must be edited by hand to implement this. We simply don’t have space to address
this in detail in this book, but you can learn more with this command:
man cupsd.conf
We can also, of course, add a CUPS printer manually. To do that, we would follow the same
steps used earlier to add a queue for a Windows Internet Printing shared printer. The only dif-
ference would be in the “Server” field, which would not require the :80 at the end. That’s
because the CUPS IPP server listens on port 631, the default IPP port, instead of port 80. This
is also good to know in certain types of VPN environments and other situations where “broad-
casting” does not work.
What about printing from Linux clients to Linux servers using LPD or SMB? We don’t
really recommend either when you have control over both the client and the server. IPP is both
modern and an open standard. However, when an older Unix server that cannot be upgraded
offers an LPD server, you may find it useful to follow exactly the same procedure we demon-
strated earlier to print to a Windows server using LPD. Printing from Linux to Linux with SMB
is not the best option, but it can be accomplished following the same procedure we used to print
from Linux to Windows using LPD.
4428.book Page 293 Tuesday, August 2, 2005 8:54 PM
http://servername:631/printers/printername
http://adsambafp1:631/printers/LinPrinter1
Communicating with a printer via IPP to a Linux CUPS server also requires that we manually
select a printer driver on the Windows side. When we do, we need to make a choice. We can
choose a Postscript printer, which will work well with the LinPrinter1 spool, or we can choose
to install the Canon i560 driver software from Canon’s website or driver CD-ROM, which will
work correctly with the LinPrinter1Raw spool.
For this example, we’ll go with Postscript. This is always a good bet when talking to a Linux
print server. To convince Windows to use a Postscript driver, we select Apple from the Manu-
facturer list. Then we select Apple Color LaserWriter 12/600 from the Printers list. The Apple
Color LaserWriter 12/600 is a true Postscript printer, one that accepts Postscript as its native
language. So Windows will send Postscript to CUPS, believing it is destined for a true Postscript
printer, and CUPS will automatically recognize it and translate it to the native language of our
actual printer using Ghostscript.
4428.book Page 294 Tuesday, August 2, 2005 8:54 PM
Now you know everything you need to know to make IPP work between Windows and a
Linux CUPS server. To configure our Windows client to print via IPP to a Linux server with a
generic Postscript driver:
1. Open the “Printers and Faxes” applet in Control Panel and select “Add a printer.” This
launches the “Add Printer Wizard” as we’ve seen before.
2. At the “Local or Network Printer” screen, select “A network printer, or a printer attached
to another computer.” Then click “Next.”
3. On the page that follows, select the radio box labeled “Connect to a printer on the Internet
or on a home or office network.” In the “URL” field, enter the following:
http://adsambafp1:631/printers/LinPrinter1
4. Click “Next.” The client will talk to the server for a moment and then the “Select the man-
ufacturer and model of your printer” dialog will appear.
5. Select “Apple” from the manufacturers list. Select “Apple Color LaserWriter 12/600” from
the Printers list. Click “Next” to move on.
6. You will be asked whether to make this the default printer; click “Yes” or “No” as suits
your preference.
7. Click “Finish” on the confirmation screen to end the wizard.
8. You can now test actual printing using the “Print” option on the “File” menu of an appli-
cation such as Microsoft Word. Just select “LinPrinter1” from the list of printers available
when printing.
can install a printer on a Windows machine, then upload the drivers to the Linux print server
where they are available to any other Windows clients who print to that print server.
So here, we’ll do the job in two steps, as shown in Figure 5.13.
First, we’ll log on to a client workstation as a domain administrator in order to install the
driver locally on that one workstation and then upload it to the Linux print server to be shared.
Next, we’ll log on to a separate client workstation as an ordinary user, who will discover that
the driver automatically downloads when they first access the printer via the print server. All
other users will experience the same benefit. That’s click-and-print.
Of course, to demonstrate driver uploading, we need to use a printer driver that doesn’t come
with Windows as “standard” equipment. So for this test, we’ll use a real Canon i560 driver that we
downloaded from Canon’s website. We’ll have to install this driver on our first Windows client. To
do this, we’ll run Canon’s installation program, then quit at the point where it would otherwise
begin searching for a printer connected directly to the client. It’s a bit confusing, but the installation
program does install the driver before that point, and that’s all we need.
Printer driver installation programs can be a bit baffling when it comes to installing a driver
you intend to upload to a network server. That’s not surprising, since with a true Windows print
server you would run the installation program on the server itself. If step 2 later in this section
doesn’t work well for your model of printer, we suggest connecting the printer directly to the
first client and fully installing the driver software. Then you can move the printer to the server
and continue with the steps.
FIGURE 5.13 We’ll leverage a Windows workstation to upload any required printer
drivers to our Linux server. Then we’ll log on to another Windows workstation and watch
the drivers automatically download.
All other
Windows clients Canon i560 printer (or any
other printer that only has
downloadable Windows drivers)
4428.book Page 296 Tuesday, August 2, 2005 8:54 PM
Keep in mind that we could have chosen to use a Postscript printer driver
for SMB as well. If we had, there would be no need to set up click-and-print
because the Postscript driver ships as standard equipment with Windows.
However, since printer drivers occasionally have desirable features that can’t
be reached conveniently through the Postscript driver, it’s worthwhile to dem-
onstrate how to use native drivers and click-and-print as well.
Ideally, before you begin, we suggest that you configure a second XP client system if you
don’t have one just lying around. It’s on this new XP client system that we’ll actually witness the
proper downloading of the driver (which we’re initially loading on xppro1 and uploading to
our Linux Samba server).
If you want to have another machine handy, here are our suggestions. Follow exactly the
same procedure you followed for xppro1 except:
The hostname should be xppro2.
The IP address should be 192.168.2.115.
Once xppro2 is ready, we can demonstrate SMB printing and click-and-print driver
downloading.
First things first: let’s get our printer drivers loaded on our first client machine (xppro1).
Then, we’ll upload them via Samba for our other clients, such as xppro2, to utilize.
To load our printer drivers onto our Windows XP system:
1. Make sure you are logged in as AD\Administrator.
2. Install the Canon i560 driver software on xppro1 from the printer manufacturer’s CD or
website. When you reach the point where the installation program says it is trying to detect
a printer connected to the local computer, click “Cancel.”
3. Open the “Printers and Faxes” applet in Control Panel and select “Add a printer.” This
launches the “Add Printer Wizard” as we’ve seen several times before.
4. At the “Local or Network Printer” screen, select “A network printer, or a printer attached
to another computer.” Then click “Next.”
5. On the page that follows, select the radio box “Connect to this printer (or to browse, for a
printer, select this option and click “Next”).” Then click “Next” to browse for the printer.
6. A list of print servers will appear, including ADSAMBAFP1. Double-click ADSAMBAFP1
to make LinPrinter1Raw visible and select it with the mouse as shown in Figure 5.14. Then
click “Next.”
7. A message box will appear saying that “the server for the printer does not have the correct
driver installed.” Click “OK” to manually select the correct driver on this first client.
8. The “Select the manufacturer and model of your printer” dialog will appear. Select “Canon”
from the manufacturers list. Select “i560” from the Printers list. Click “Next” to move on.
9. You will be asked whether to make this the default printer; click “Yes” or “No” as suits
your preference.
4428.book Page 297 Tuesday, August 2, 2005 8:54 PM
FIGURE 5.14 Selecting LinPrinter1Raw from the Samba server via SMB browsing on a
Windows client
4428.book Page 298 Tuesday, August 2, 2005 8:54 PM
Our first client is now ready to print to LinPrinter1Raw. More importantly, we can now add a sec-
ond client without the need to manually install the Canon i560 driver. It’s time to demonstrate that.
Now we’re ready to try a new client and see if it will automatically download the drivers
from our Samba server. To test the automatic driver downloads from our Samba server:
1. Log in as any domain user. AD\salesperson1 is a reasonable choice.
2. Open the “Printers and Faxes” applet in Control Panel and select “Add a printer” to launch
the “Add Printer Wizard.”
3. At the “Local or Network Printer” screen, select “A network printer, or a printer attached
to another computer.” Then click “Next.”
4. On the page that follows, select the radio box labeled “Connect to this printer (or to
browse, for a printer, select this option and click “Next”).” Then click “Next” to browse
for the printer.
5. A list of print servers will appear, including ADSAMBAFP1. Double-click ADSAMBAFP1
to make LinPrinter1Raw visible and select it with the mouse as shown in Figure 5.14. Then
click “Next.”
6. A “Copying Files” progress box will appear. The driver software will download from the
server automatically. This is click-and-print at work.
7. You will be asked whether to make this the default printer; click “Yes” or “No” as suits
your preference.
8. Click “Finish” on the confirmation screen to end the wizard.
9. You can now test actual printing using the “Print” option on the “File” menu of an appli-
cation such as Microsoft Word. Just select “LinPrinter1Raw” from the list of printers avail-
able when printing.
Again, the amazing thing here is that we’re using a Linux Samba print server to serve up Win-
dows print drivers to Windows boxes. Now that’s slick.
4. On the “Select a Printer Port” page, click the “Create a new port” box and select “LPR
Port” from the menu. Click “Next” to move on.
5. The “Add LPR compatible printer” dialog appears. Enter adsambafp1.ad.corp.com in
the “Name or address of server providing lpd” field. Enter linprinter1 in the “Name of
printer or print queue on that server” field. Then click “OK.”
6. At the “Install Printer Software” dialog, select the Manufacturer and Printer model. We’ll
stick to our Postscript approach in this example, so select Apple as the manufacturer and
Apple Color LaserWriter 12/600 as the model. Then click “Next.”
7. At the “Name your Printer” screen, you can enter a name for the printer. Replace the sug-
gested name with LinPrinter1ViaLPR , then click “Next.”
8. At the “Printer Sharing” screen, you can give a share name for others to see. This might seem
strange, but it’s actually a fine idea if you wish to “re-export” the printer via SMB. Well, it
might not be a fine idea from a Windows XP machine, but if this were a Windows 2003 print
server, this might be a fun idea. Once you do so, other clients can access the printer via tra-
ditional SMB Windows network printing without the need to additionally go through the
hassle of installing the “Print Services for Unix” LPD driver.
9. At the “Location and Comment” screen enter what you like. When ready, click “Next.”
10. At the “Print Test Page” prompt, select “Yes” to verify that we added the printer suc-
cessfully.
In this section, we’re specifically concerned with getting all the printers we know into Active
Directory, as well as having both Windows and Linux clients search Active Directory to find the
printers in the most expeditious manner possible.
Here’s the bad news, though: There’s no great way (that we know of) to allow for Linux
clients to perform an easy-breezy search of Active Directory to find printers. Maybe someday,
but not today. However, at least we can give our Windows clients the ability to search Active
Directory and easily pick the printer they want to, even if it lives on a Samba server.
FIGURE 5.15 The “Sharing” tab determines if the printer should be listed in
Active Directory.
2. Pick a location in Active Directory where you want to publish the printer. This can be just
about anywhere inside Active Directory, and in most cases location isn’t really that impor-
tant. One option is to create an OU that just contains published printers, but that’s at your
option. Once decided, right-click the OU and select New Printer. The “New Object –
Printer” dialog appears.
3. In the “New Object – Printer” dialog, enter the queue name. For instance, if you want to pub-
lish LinPrinter1 from ADSAMBAFP1, enter the SMB name, \\adsambafp1\linprinter1
as seen in Figure 5.16.
4. Click “OK,” and it will validate that the queue exists. Then it will put it into Active Directory.
Once performed, Active Directory will represent the printer with an icon within the OU you
specify. If you’re feeling particularly frisky, you can set certain attributes about these printers
in Active Directory, such as the location, if it’s color-capable, if it can print dual sided, and
more. All you need to do is to select the properties of the entry. The resulting screen can be seen
in Figure 5.17.
This way you can make it easy to search Active Directory for particular printers with par-
ticular attributes.
At this point you should repeat these steps for the other queue you created: LinPrinterRaw. That
way, if someone on a Windows client wants to print to the printer using the native Windows drivers,
they can easily search for it in Active Directory and have the drivers automatically download.
4428.book Page 302 Tuesday, August 2, 2005 8:54 PM
FIGURE 5.16 You can add any SMB printer to Active Directory to make it searchable.
FIGURE 5.17 You can select and enter attributes that can help users search for
specific printers.
4428.book Page 303 Tuesday, August 2, 2005 8:54 PM
It should be noted that the “Location” field has a super-secret special super
power to help Active Directory clients locate printers. I simply don’t have room
to go into it all here, but I’ve written it up in detail. To read the article, come to
my website at www.moskowitz-inc.com/writing/articles.html and look for
“October 2002: (Feature): Printer Magic.” You’ll find it in no time.
FIGURE 5.18 Just find the printer you want, double-click it, and go!
Here’s the command we used to successfully list published printers from the command line
of adldaplincl1.ad.corp.com, which is already configured to communicate with the LDAP
server on windc1.ad.corp.com:
This command binds to the Active Directory LDAP server using the usual credentials
from Chapter 3 and, using the filter objectclass=printQueue, prints information about
all published printers. There’s quite a bit of information there, but the most interesting
fields are uNCName (for printers shared via SMB) and url (for printers shared via IPP). For
instance, this command:
uNCName: \\WinDC1.ad.corp.com\WinPrinter1
uNCName: \\ADSAMBAFP1\LinPrinter1Raw
uNCName: \\ADSAMBAFP1\LinPrinter1
Armed with this information, we suspect it won’t be long before someone decides to add a
friendly GUI for this purpose to Fedora Linux.
4428.book Page 305 Tuesday, August 2, 2005 8:54 PM
Final Thoughts
Printer interoperability is a main selling point in getting Windows and Linux to play nicely. It’s
one of those features that users just expect to work all the time. If you can leverage the printers
you have, you’ll be the big hero.
Both Windows and Linux do a great job in working with standards for printing. The main
standards that are supported on both sides are LPR/LPD for older-style Unix printing, SMB
printing for Windows/Samba, and IPP. As mentioned previously, Windows’ IPP doesn’t use
the RFC compliant port of 631, it uses port 80, so be sure to compensate, as we’ve specified
in the chapter.
Samba does a great job in setting up new printers and automatically allowing driver down-
loads when necessary. Windows does a great job in making it easy to search for printers in
Active Directory.
In all, it’s a match made in printer heaven.