1526 lines
26 KiB
HTML
1526 lines
26 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
<HTML
|
||
><HEAD
|
||
><TITLE
|
||
>Debian and Windows Shared Printing mini-HOWTO</TITLE
|
||
><META
|
||
NAME="GENERATOR"
|
||
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"></HEAD
|
||
><BODY
|
||
CLASS="article"
|
||
BGCOLOR="#FFFFFF"
|
||
TEXT="#000000"
|
||
LINK="#0000FF"
|
||
VLINK="#840084"
|
||
ALINK="#0000FF"
|
||
><DIV
|
||
CLASS="ARTICLE"
|
||
><DIV
|
||
CLASS="TITLEPAGE"
|
||
><H1
|
||
CLASS="title"
|
||
><A
|
||
NAME="AEN2"
|
||
></A
|
||
>Debian and Windows Shared Printing mini-HOWTO</H1
|
||
><H3
|
||
CLASS="author"
|
||
><A
|
||
NAME="AEN4"
|
||
>Ian Ward</A
|
||
></H3
|
||
><DIV
|
||
CLASS="affiliation"
|
||
><DIV
|
||
CLASS="address"
|
||
><P
|
||
CLASS="address"
|
||
><br>
|
||
<TT
|
||
CLASS="email"
|
||
><<A
|
||
HREF="mailto:ian at excess dot org"
|
||
>ian at excess dot org</A
|
||
>></TT
|
||
><br>
|
||
</P
|
||
></DIV
|
||
></DIV
|
||
><P
|
||
CLASS="pubdate"
|
||
>2005-07-01<BR></P
|
||
><DIV
|
||
CLASS="revhistory"
|
||
><TABLE
|
||
WIDTH="100%"
|
||
BORDER="0"
|
||
><TR
|
||
><TH
|
||
ALIGN="LEFT"
|
||
VALIGN="TOP"
|
||
COLSPAN="3"
|
||
><B
|
||
>Revision History</B
|
||
></TH
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revision 1.6</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>2005-07-01</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revised by: iw</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
COLSPAN="3"
|
||
>Clarified hpijs requirement, added lpinfo and lpoptions commands</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revision 1.5</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>2005-06-19</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revised by: iw</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
COLSPAN="3"
|
||
>Added note about becoming root to execute commands</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revision 1.4</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>2004-01-05</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revised by: iw</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
COLSPAN="3"
|
||
>Wording corrections</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revision 1.3</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>2003-11-18</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revised by: iw</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
COLSPAN="3"
|
||
>Removed incorrect lpadmin -h usage</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revision 1.2</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>2003-10-03</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revised by: iw</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
COLSPAN="3"
|
||
>Note about woody and gs-esp, conflict with bash's enable command and fix for XP/2000 clients</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revision 1.1</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>2003-06-26</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revised by: iw</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
COLSPAN="3"
|
||
>Added passwords on windows shared printers, Corrections</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revision 1.0</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>2003-05-15</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revised by: tmm</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
COLSPAN="3"
|
||
>Initial release, reviewed by LDP</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revision 0.8</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>2003-04-11</TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
>Revised by: iw</TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
ALIGN="LEFT"
|
||
COLSPAN="3"
|
||
>converted from LaTeX</TD
|
||
></TR
|
||
></TABLE
|
||
></DIV
|
||
><HR></DIV
|
||
><DIV
|
||
CLASS="TOC"
|
||
><DL
|
||
><DT
|
||
><B
|
||
>Table of Contents</B
|
||
></DT
|
||
><DT
|
||
>1. <A
|
||
HREF="#introduction"
|
||
>Introduction</A
|
||
></DT
|
||
><DT
|
||
>2. <A
|
||
HREF="#getting_started"
|
||
>Getting Started</A
|
||
></DT
|
||
><DD
|
||
><DL
|
||
><DT
|
||
>2.1. <A
|
||
HREF="#linuxprintingcomponents"
|
||
>Linux Printing Components</A
|
||
></DT
|
||
><DT
|
||
>2.2. <A
|
||
HREF="#packages"
|
||
>Required Packages</A
|
||
></DT
|
||
><DT
|
||
>2.3. <A
|
||
HREF="#basicprconfig"
|
||
>CUPS Local Printer Configuration</A
|
||
></DT
|
||
><DT
|
||
>2.4. <A
|
||
HREF="#basics"
|
||
>Linux Printing Basics</A
|
||
></DT
|
||
></DL
|
||
></DD
|
||
><DT
|
||
>3. <A
|
||
HREF="#printing_to_windows"
|
||
>Printing To Windows PCs</A
|
||
></DT
|
||
><DD
|
||
><DL
|
||
><DT
|
||
>3.1. <A
|
||
HREF="#to_windows"
|
||
>Connecting To Windows</A
|
||
></DT
|
||
><DT
|
||
>3.2. <A
|
||
HREF="#to_windows_cupsconfig"
|
||
>CUPS Configuration</A
|
||
></DT
|
||
></DL
|
||
></DD
|
||
><DT
|
||
>4. <A
|
||
HREF="#sharing_with_windows"
|
||
>Sharing Printers With Windows PCs</A
|
||
></DT
|
||
><DD
|
||
><DL
|
||
><DT
|
||
>4.1. <A
|
||
HREF="#sharing_basics"
|
||
>Sharing Basics</A
|
||
></DT
|
||
><DT
|
||
>4.2. <A
|
||
HREF="#share_samba_config"
|
||
>Samba Configuration</A
|
||
></DT
|
||
><DT
|
||
>4.3. <A
|
||
HREF="#share_cups_config"
|
||
>CUPS Configuration</A
|
||
></DT
|
||
></DL
|
||
></DD
|
||
><DT
|
||
>5. <A
|
||
HREF="#troubleshooting"
|
||
>Troubleshooting</A
|
||
></DT
|
||
><DD
|
||
><DL
|
||
><DT
|
||
>5.1. <A
|
||
HREF="#connect_failure"
|
||
>Failing To Connect To Windows Printers</A
|
||
></DT
|
||
><DT
|
||
>5.2. <A
|
||
HREF="#other_failure"
|
||
>Other Failures</A
|
||
></DT
|
||
></DL
|
||
></DD
|
||
><DT
|
||
>6. <A
|
||
HREF="#license"
|
||
>License</A
|
||
></DT
|
||
></DL
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect1"
|
||
><H1
|
||
CLASS="sect1"
|
||
><A
|
||
NAME="introduction"
|
||
></A
|
||
>1. Introduction</H1
|
||
><P
|
||
> Debian GNU/Linux
|
||
(<A
|
||
HREF="http://www.debian.org"
|
||
TARGET="_top"
|
||
>http://www.debian.org</A
|
||
>)
|
||
is the premier volunteer-supported Linux distribution.
|
||
Unfortunately, setting up printers in Debian can be difficult. Also,
|
||
simple step-by-step instructions for sharing printers between Windows
|
||
and Linux using the latest tools are hard to find. This HOWTO was
|
||
written to address both problems.
|
||
</P
|
||
><P
|
||
> This HOWTO will demonstrate how to use command-line tools to configure your
|
||
Debian system for printing. It will explain how to send documents
|
||
from Linux to Windows printers and how to share Linux printers with
|
||
Windows PCs. Some troubleshooting examples are also given.
|
||
</P
|
||
><P
|
||
> The primary url for this document is
|
||
<A
|
||
HREF="http://excess.org/docs/linux_windows_printing.html"
|
||
TARGET="_top"
|
||
> http://excess.org/docs/linux_windows_printing.html</A
|
||
>.
|
||
The source Docbook/XML and EPS files for this document may be downloaded from
|
||
<A
|
||
HREF="http://excess.org/docs/src/"
|
||
TARGET="_top"
|
||
> http://excess.org/docs/src/</A
|
||
>.
|
||
Please forward bug reports, corrections and suggestions regarding this document
|
||
to ian at excess dot org.
|
||
</P
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect1"
|
||
><HR><H1
|
||
CLASS="sect1"
|
||
><A
|
||
NAME="getting_started"
|
||
></A
|
||
>2. Getting Started</H1
|
||
><DIV
|
||
CLASS="sect2"
|
||
><H2
|
||
CLASS="sect2"
|
||
><A
|
||
NAME="linuxprintingcomponents"
|
||
></A
|
||
>2.1. Linux Printing Components</H2
|
||
><P
|
||
> The main components we will be using include:
|
||
<P
|
||
></P
|
||
><UL
|
||
><LI
|
||
><P
|
||
> CUPS
|
||
</P
|
||
><P
|
||
> The Common UNIX Printing System
|
||
(<A
|
||
HREF="http://www.cups.org"
|
||
TARGET="_top"
|
||
>http://www.cups.org</A
|
||
>)
|
||
is a print spooler and a set
|
||
of support programs for using and administering printers.
|
||
</P
|
||
></LI
|
||
><LI
|
||
><P
|
||
> Samba
|
||
</P
|
||
><P
|
||
> Samba
|
||
(<A
|
||
HREF="http://www.samba.org"
|
||
TARGET="_top"
|
||
>http://www.samba.org</A
|
||
>)
|
||
is software that allows non-Windows computers to act
|
||
like Windows computers on a network by implementing Windows file
|
||
and printer sharing protocols.
|
||
</P
|
||
></LI
|
||
><LI
|
||
><P
|
||
> Printer Drivers
|
||
</P
|
||
><P
|
||
> LinuxPrinting.org
|
||
(<A
|
||
HREF="http://www.linuxprinting.org"
|
||
TARGET="_top"
|
||
>http://www.linuxprinting.org</A
|
||
>)
|
||
offers the largest number of printer drivers
|
||
and maintains a database of printers supported under Linux. You must
|
||
download a printer driver for each model of printer you want to use
|
||
in Linux. A printer driver consists of a PPD file and a filter
|
||
program, or only a PPD file for PostScript printers.
|
||
</P
|
||
></LI
|
||
></UL
|
||
>
|
||
</P
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect2"
|
||
><HR><H2
|
||
CLASS="sect2"
|
||
><A
|
||
NAME="packages"
|
||
></A
|
||
>2.2. Required Packages</H2
|
||
><P
|
||
> All of the required programs and libraries are part of the standard
|
||
Debian archive. You may download and install these packages with the
|
||
usual Debian packaging tools. The following is a list of packages
|
||
you need:
|
||
</P
|
||
><P
|
||
></P
|
||
><DIV
|
||
CLASS="variablelist"
|
||
><DL
|
||
><DT
|
||
>cupsys</DT
|
||
><DD
|
||
><P
|
||
>CUPS server</P
|
||
></DD
|
||
><DT
|
||
>cupsys-bsd</DT
|
||
><DD
|
||
><P
|
||
>CUPS BSD commands</P
|
||
></DD
|
||
><DT
|
||
>cupsys-client</DT
|
||
><DD
|
||
><P
|
||
>CUPS client programs</P
|
||
></DD
|
||
><DT
|
||
>foomatic-bin</DT
|
||
><DD
|
||
><P
|
||
>LinuxPrinting.org printer support programs</P
|
||
></DD
|
||
><DT
|
||
>samba</DT
|
||
><DD
|
||
><P
|
||
>Samba SMB/CIFS server for UNIX</P
|
||
></DD
|
||
><DT
|
||
>smbclient</DT
|
||
><DD
|
||
><P
|
||
>Samba SMB/CIFS client for UNIX</P
|
||
></DD
|
||
><DT
|
||
>gs-esp</DT
|
||
><DD
|
||
><P
|
||
>ESP Ghostscript
|
||
(<A
|
||
HREF="http://www.cups.org/ghostscript.php"
|
||
TARGET="_top"
|
||
> http://www.cups.org/ghostscript.php</A
|
||
>)</P
|
||
><P
|
||
>Not available as a Debian GNU/Linux 3.0 (a.k.a. woody) package,
|
||
use <SPAN
|
||
CLASS="QUOTE"
|
||
>"gs"</SPAN
|
||
> instead.</P
|
||
></DD
|
||
><DT
|
||
>a2ps</DT
|
||
><DD
|
||
><P
|
||
>GNU A2PS
|
||
(<A
|
||
HREF="http://www.gnu.org/software/a2ps/"
|
||
TARGET="_top"
|
||
> http://www.gnu.org/software/a2ps/</A
|
||
>)</P
|
||
></DD
|
||
></DL
|
||
></DIV
|
||
><P
|
||
> The following commands will install these packages.
|
||
You will have to become root or use <B
|
||
CLASS="command"
|
||
>sudo</B
|
||
> to execute these commands:
|
||
</P
|
||
><P
|
||
> <TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>apt-get update
|
||
apt-get install cupsys cupsys-bsd cupsys-client foomatic-bin samba smbclient gs-esp a2ps
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> Additional packages may be required for specific printers. For example,
|
||
the <EM
|
||
>hpijs</EM
|
||
> package must be installed for many HP InkJet,
|
||
DeskJet and LaserJet printers to function properly. The PPD files for these
|
||
printers are identified by the string <TT
|
||
CLASS="filename"
|
||
>hpijs</TT
|
||
> in their
|
||
filenames.
|
||
</P
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect2"
|
||
><HR><H2
|
||
CLASS="sect2"
|
||
><A
|
||
NAME="basicprconfig"
|
||
></A
|
||
>2.3. CUPS Local Printer Configuration</H2
|
||
><P
|
||
> The <B
|
||
CLASS="command"
|
||
>lpadmin</B
|
||
> command is used to configure printers. The
|
||
following is an example of setting up a laser printer with CUPS.
|
||
You will have to become root or use <B
|
||
CLASS="command"
|
||
>sudo</B
|
||
> to execute these commands:
|
||
</P
|
||
><TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>/usr/sbin/lpadmin -p Laser -v parallel:/dev/lp0 -P /root/laser.ppd
|
||
/usr/bin/enable Laser
|
||
/usr/sbin/accept Laser
|
||
/usr/sbin/lpadmin -d Laser
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
><P
|
||
> Please note that bash has a builtin command called
|
||
<B
|
||
CLASS="command"
|
||
>enable</B
|
||
>, so bash users must use the full path
|
||
(<B
|
||
CLASS="command"
|
||
>/usr/bin/enable</B
|
||
>) to enable printers.
|
||
</P
|
||
><P
|
||
> The first command creates a new printer called <SPAN
|
||
CLASS="QUOTE"
|
||
>"Laser"</SPAN
|
||
>
|
||
that is connected to the first parallel port and is using the PPD
|
||
file <TT
|
||
CLASS="filename"
|
||
>/root/laser.ppd</TT
|
||
>.
|
||
<SPAN
|
||
CLASS="QUOTE"
|
||
>"Laser"</SPAN
|
||
> is then enabled and told to accept jobs with
|
||
the <B
|
||
CLASS="command"
|
||
>enable</B
|
||
> and <B
|
||
CLASS="command"
|
||
>accept</B
|
||
> commands.
|
||
The last command sets <SPAN
|
||
CLASS="QUOTE"
|
||
>"Laser"</SPAN
|
||
> as the default printer.
|
||
</P
|
||
><P
|
||
> If your printer is connected to a USB port or if you do not know the
|
||
correct device-uri for your printer try running
|
||
<B
|
||
CLASS="command"
|
||
>/usr/sbin/lpinfo -v</B
|
||
> to get a list of available
|
||
printer devices.
|
||
</P
|
||
><P
|
||
> Make sure your printer's page size and other options are set correctly
|
||
by running <B
|
||
CLASS="command"
|
||
>/usr/bin/lpoptions -l</B
|
||
>.
|
||
More detailed information about printer configuration
|
||
is available in the CUPS documentation.
|
||
</P
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect2"
|
||
><HR><H2
|
||
CLASS="sect2"
|
||
><A
|
||
NAME="basics"
|
||
></A
|
||
>2.4. Linux Printing Basics</H2
|
||
><DIV
|
||
CLASS="figure"
|
||
><A
|
||
NAME="printlocal"
|
||
></A
|
||
><P
|
||
><B
|
||
>Figure 1. Printing Locally</B
|
||
></P
|
||
><P
|
||
><IMG
|
||
SRC="printing_basics.png"></P
|
||
></DIV
|
||
><P
|
||
> Documents are spooled by using either <B
|
||
CLASS="command"
|
||
>lpr</B
|
||
> or
|
||
<B
|
||
CLASS="command"
|
||
>lp</B
|
||
> followed
|
||
by the file name. You may view the printer queue and check the printer
|
||
status with the command <B
|
||
CLASS="command"
|
||
>lpstat -o</B
|
||
> or
|
||
<B
|
||
CLASS="command"
|
||
>lpstat -p</B
|
||
>. To cancel a print job use either
|
||
<B
|
||
CLASS="command"
|
||
>cancel</B
|
||
> or <B
|
||
CLASS="command"
|
||
>lprm</B
|
||
> followed by the job id.
|
||
</P
|
||
><P
|
||
> The CUPS spooler daemon is called <EM
|
||
>cupsd</EM
|
||
>.
|
||
It converts documents
|
||
to PostScript, then converts them to a format native to the printer
|
||
<A
|
||
HREF="#printlocal"
|
||
>Figure 1</A
|
||
>. Printers that do not understand PostScript
|
||
use a rasterized, or bitmap, format for documents. Rasterized formats
|
||
can be much larger than the original PostScript, and will take longer
|
||
to send to the printer.
|
||
</P
|
||
><P
|
||
> Filters are programs used to convert documents from one format to
|
||
another. The CUPS spooler will do its best to find a suitable filter
|
||
for the documents you send. If no filter suitable for converting your
|
||
document is installed you will receive an error similar to <TT
|
||
CLASS="computeroutput"
|
||
>lpr:
|
||
unable to print file: client-error-document-format-not-supported.</TT
|
||
>
|
||
</P
|
||
><P
|
||
> Many applications do not include filters for their documents formats.
|
||
Documents created with these applications can only be printed from
|
||
within the application itself, unless the document is exported to
|
||
PostScript or another standard format.
|
||
</P
|
||
></DIV
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect1"
|
||
><HR><H1
|
||
CLASS="sect1"
|
||
><A
|
||
NAME="printing_to_windows"
|
||
></A
|
||
>3. Printing To Windows PCs</H1
|
||
><DIV
|
||
CLASS="sect2"
|
||
><H2
|
||
CLASS="sect2"
|
||
><A
|
||
NAME="to_windows"
|
||
></A
|
||
>3.1. Connecting To Windows</H2
|
||
><DIV
|
||
CLASS="figure"
|
||
><A
|
||
NAME="netprint"
|
||
></A
|
||
><P
|
||
><B
|
||
>Figure 2. Network Printing</B
|
||
></P
|
||
><P
|
||
><IMG
|
||
SRC="to_windows.png"></P
|
||
></DIV
|
||
><P
|
||
> SMB and CIFS are the Windows file and printer sharing protocols.
|
||
We use Samba to speak to the Windows PCs using these protocols. Before
|
||
configuring CUPS we should make sure we can connect to the Windows
|
||
PC with <B
|
||
CLASS="command"
|
||
>smbclient</B
|
||
>, the Samba SMB/CIFS client
|
||
<A
|
||
HREF="#netprint"
|
||
>Figure 2</A
|
||
>.
|
||
</P
|
||
><P
|
||
> The following is an example of creating a connection to a Windows
|
||
PC:
|
||
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>/usr/bin/smbclient -L rice -U fred
|
||
|
||
added interface ip=10.6.7.234 bcast=10.6.7.255 nmask=255.255.255.0
|
||
Got a positive name query response from 10.6.7.8 ( 10.6.7.8 )
|
||
Password: (not shown)
|
||
|
||
Sharename Type Comment
|
||
PRINTER$ Disk
|
||
INKJET Printer
|
||
STUFF Disk
|
||
IPC$ IPC Remote Inter Process Communication
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> The command shown asks for a list of shares on a Windows PC
|
||
named <SPAN
|
||
CLASS="QUOTE"
|
||
>"rice"</SPAN
|
||
>, with the user id <SPAN
|
||
CLASS="QUOTE"
|
||
>"fred"</SPAN
|
||
>.
|
||
The result shows a printer named <SPAN
|
||
CLASS="QUOTE"
|
||
>"INKJET"</SPAN
|
||
>.
|
||
</P
|
||
><P
|
||
> If Windows naming service is unavailable you will need to specify
|
||
the IP address of the Windows PC with the <TT
|
||
CLASS="option"
|
||
>-I</TT
|
||
> switch as in:
|
||
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>/usr/bin/smbclient -I 10.6.7.8 -L rice -N
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> For more information see the Samba documentation about
|
||
<B
|
||
CLASS="command"
|
||
>smbclient</B
|
||
> usage.
|
||
</P
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect2"
|
||
><HR><H2
|
||
CLASS="sect2"
|
||
><A
|
||
NAME="to_windows_cupsconfig"
|
||
></A
|
||
>3.2. CUPS Configuration</H2
|
||
><P
|
||
> Once you have found a Windows printer you may configure CUPS. First
|
||
verify that your installation of CUPS has the smb backend with the
|
||
following command:
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>ls -l /usr/lib/cups/backend/smb
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> If this file does not exist create it by issuing the following:
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>ln -s `which smbspool` /usr/lib/cups/backend/smb
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> The following is an example of setting up the printer shown above.
|
||
You will have to become root or use <B
|
||
CLASS="command"
|
||
>sudo</B
|
||
> to execute these commands:
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>/usr/sbin/lpadmin -p RicePrinter -v smb://fred:mypass@rice/INKJET -P /root/inkjet.ppd
|
||
/usr/bin/enable RicePrinter
|
||
/usr/sbin/accept RicePrinter
|
||
/usr/sbin/lpadmin -d RicePrinter
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> As mentioned above, bash has a builtin command called
|
||
<B
|
||
CLASS="command"
|
||
>enable</B
|
||
>, so bash users must use the full path
|
||
(<B
|
||
CLASS="command"
|
||
>/usr/bin/enable</B
|
||
>) to enable printers.
|
||
</P
|
||
><P
|
||
> The <SPAN
|
||
CLASS="QUOTE"
|
||
>"lpadmin"</SPAN
|
||
> command sets up a the shared Windows printer by
|
||
giving the username, password, netbios name and printer name as a single
|
||
parameter.
|
||
See <A
|
||
HREF="#basicprconfig"
|
||
>Section 2.3</A
|
||
> for a further explanation of the commands
|
||
above.
|
||
</P
|
||
><P
|
||
> Your printer is now ready to test. Send a file to the printer with
|
||
the <B
|
||
CLASS="command"
|
||
>lp</B
|
||
> command followed by a filename, or
|
||
by printing a document from within an application.
|
||
</P
|
||
></DIV
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect1"
|
||
><HR><H1
|
||
CLASS="sect1"
|
||
><A
|
||
NAME="sharing_with_windows"
|
||
></A
|
||
>4. Sharing Printers With Windows PCs</H1
|
||
><DIV
|
||
CLASS="sect2"
|
||
><H2
|
||
CLASS="sect2"
|
||
><A
|
||
NAME="sharing_basics"
|
||
></A
|
||
>4.1. Sharing Basics</H2
|
||
><DIV
|
||
CLASS="figure"
|
||
><A
|
||
NAME="printshare"
|
||
></A
|
||
><P
|
||
><B
|
||
>Figure 3. Printer Sharing</B
|
||
></P
|
||
><P
|
||
><IMG
|
||
SRC="from_windows.png"></P
|
||
></DIV
|
||
><P
|
||
> Samba uses <EM
|
||
>nmbd</EM
|
||
> and <EM
|
||
>smbd</EM
|
||
>
|
||
daemons to share files and printers with Windows PCs.
|
||
<EM
|
||
>nmbd</EM
|
||
> acts as a Windows naming service,
|
||
broadcasting your computer's name to Windows PCs on the LAN.
|
||
<EM
|
||
>smbd</EM
|
||
> accepts file and printer requests from
|
||
Windows PCs <A
|
||
HREF="#printshare"
|
||
>Figure 3</A
|
||
>.
|
||
</P
|
||
><P
|
||
> You will need to download and install Windows printer drivers for
|
||
each Linux printer you are sharing. Windows printer drivers can be
|
||
found by searching the web site of your printer manufacturer.
|
||
</P
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect2"
|
||
><HR><H2
|
||
CLASS="sect2"
|
||
><A
|
||
NAME="share_samba_config"
|
||
></A
|
||
>4.2. Samba Configuration</H2
|
||
><P
|
||
> If you are allowing anonymous access to your printer you will need
|
||
to create a user account for remote print jobs:
|
||
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>/usr/sbin/adduser --system --disabled-password smbprint
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> This command adds a user called <SPAN
|
||
CLASS="QUOTE"
|
||
>"smbprint"</SPAN
|
||
> to your system. Make
|
||
sure there is enough disk space in <TT
|
||
CLASS="filename"
|
||
>/home/smbprint</TT
|
||
>, the
|
||
<SPAN
|
||
CLASS="QUOTE"
|
||
>"smbprint"</SPAN
|
||
> user's home directory, to spool files. Check
|
||
that the <SPAN
|
||
CLASS="QUOTE"
|
||
>"smbprint"</SPAN
|
||
> user does not have permission on your
|
||
system to read or modify sensitive files and directories. If you have
|
||
configured CUPS to restrict printing to certain users on your system,
|
||
you must allow the <SPAN
|
||
CLASS="QUOTE"
|
||
>"smbprint"</SPAN
|
||
> user to access printers you
|
||
want to share.
|
||
</P
|
||
><P
|
||
> The Samba configuration file is <TT
|
||
CLASS="filename"
|
||
>/etc/samba/smb.conf</TT
|
||
>.
|
||
The following is an example configuration file set up to use CUPS with
|
||
the <SPAN
|
||
CLASS="QUOTE"
|
||
>"smbprint"</SPAN
|
||
> user:
|
||
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>[global]
|
||
printcap name = cups
|
||
printing = cups
|
||
security = share
|
||
[printers]
|
||
browseable = yes
|
||
printable = yes
|
||
public = yes
|
||
create mode = 0700
|
||
guest only = yes
|
||
use client driver = yes
|
||
guest account = smbprint
|
||
path = /home/smbprint
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> Please note that this configuration will allow printing by anyone
|
||
that can make a network connection to your computer and is
|
||
not recommended for computers on untrusted networks, such as
|
||
computers with direct Internet connections. If you need to
|
||
implement access control, set <EM
|
||
>security = user</EM
|
||
> or
|
||
<EM
|
||
>security = domain</EM
|
||
>
|
||
and read the Samba man pages for further information.
|
||
</P
|
||
><P
|
||
> Once you have added the above settings to your Samba configuration
|
||
file you must restart Samba with the command:
|
||
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>/etc/init.d/samba restart
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect2"
|
||
><HR><H2
|
||
CLASS="sect2"
|
||
><A
|
||
NAME="share_cups_config"
|
||
></A
|
||
>4.3. CUPS Configuration</H2
|
||
><P
|
||
> Windows printer drivers format their output for the printer before
|
||
sending it across the network. You must configure CUPS to accept
|
||
the pre-formatted output by uncommenting the following line from
|
||
<TT
|
||
CLASS="filename"
|
||
>/etc/cups/mime.convs</TT
|
||
>:
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>application/octet-stream application/vnd.cups-raw 0 -
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> Also uncomment the following line from
|
||
<TT
|
||
CLASS="filename"
|
||
>/etc/cups/mime.types</TT
|
||
>:
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>application/octet-stream
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> Now CUPS must be told to allow connections from other machines on
|
||
the network. Add these lines to <TT
|
||
CLASS="filename"
|
||
>/etc/cups/cupsd.conf</TT
|
||
>:
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
><Location /printers>
|
||
AuthType None
|
||
Order Deny,Allow
|
||
Deny From None
|
||
Allow From All
|
||
</Location>
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
As in the Samba configuration, this configuration allows any computer
|
||
to connect to your printers and is not recommended for computers on
|
||
untrusted networks. For information about tightening access control
|
||
to your printers, see the <TT
|
||
CLASS="filename"
|
||
>cupsd.conf</TT
|
||
> man page
|
||
and the CUPS documentation.
|
||
</P
|
||
><P
|
||
> Finally, restart cups with the following command:
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>/etc/init.d/cupsys restart
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> Your Linux printers should now be shared to Windows PCs on the LAN.
|
||
Follow the usual steps for adding a network printer to your Windows
|
||
PCs, and remember to print a test page.
|
||
</P
|
||
></DIV
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect1"
|
||
><HR><H1
|
||
CLASS="sect1"
|
||
><A
|
||
NAME="troubleshooting"
|
||
></A
|
||
>5. Troubleshooting</H1
|
||
><DIV
|
||
CLASS="sect2"
|
||
><H2
|
||
CLASS="sect2"
|
||
><A
|
||
NAME="connect_failure"
|
||
></A
|
||
>5.1. Failing To Connect To Windows Printers</H2
|
||
><P
|
||
> When <EM
|
||
>smbspool</EM
|
||
>, the
|
||
<B
|
||
CLASS="command"
|
||
>smbclient</B
|
||
> utility CUPS uses,
|
||
fails to connect properly it emits error messages
|
||
that are humorous but not very helpful. One such message is <TT
|
||
CLASS="computeroutput"
|
||
>Unable
|
||
to connect to SAMBA host: Success.</TT
|
||
> Another sign of connection failures
|
||
is when documents seem to get stuck on the queue when printing to
|
||
Windows printers.
|
||
</P
|
||
><P
|
||
> View the most recent entries in the CUPS log with the following command:
|
||
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>/usr/bin/tail /var/log/cups/error_log
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> If you see a message similar to <TT
|
||
CLASS="computeroutput"
|
||
>cli_connect() failed...</TT
|
||
> then
|
||
<EM
|
||
>smbspool</EM
|
||
> could not find the Windows PC you are
|
||
trying to connect to.
|
||
Check the spelling of the Windows PC's host name. Check that the
|
||
Windows PC is turned on and that its network connection is functioning
|
||
properly. Make sure you can connect to it using
|
||
<B
|
||
CLASS="command"
|
||
>smbclient</B
|
||
> as shown in <A
|
||
HREF="#to_windows"
|
||
>Section 3.1</A
|
||
>.
|
||
</P
|
||
><P
|
||
> If you see a message similar to <TT
|
||
CLASS="computeroutput"
|
||
>SMB tree connect failed: ERRSRV
|
||
- ERRinvnetname</TT
|
||
> then <B
|
||
CLASS="command"
|
||
>smbclient</B
|
||
> connected
|
||
to the Windows PC
|
||
but could not connect to the printer you requested. Check the spelling
|
||
of the shared printer using <B
|
||
CLASS="command"
|
||
>smbclient</B
|
||
> as shown in
|
||
<A
|
||
HREF="#to_windows"
|
||
>Section 3.1</A
|
||
>.
|
||
</P
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect2"
|
||
><HR><H2
|
||
CLASS="sect2"
|
||
><A
|
||
NAME="other_failure"
|
||
></A
|
||
>5.2. Other Failures</H2
|
||
><P
|
||
> Other failures include being unable to print to a local printer and
|
||
having your print jobs disappear from the queue without being printed.
|
||
You may also see vague error messages such as <TT
|
||
CLASS="computeroutput"
|
||
>Child process 2384
|
||
exited with status 32.</TT
|
||
>
|
||
</P
|
||
><P
|
||
> Increase CUPS' logging level to <SPAN
|
||
CLASS="QUOTE"
|
||
>"debug"</SPAN
|
||
> to see more messages about
|
||
what happened before the print job failed.
|
||
</P
|
||
><P
|
||
></P
|
||
><OL
|
||
TYPE="1"
|
||
><LI
|
||
><P
|
||
> Open the main CUPS configuration file <TT
|
||
CLASS="filename"
|
||
>/etc/cups/cupsd.conf</TT
|
||
> in
|
||
a text editor.
|
||
</P
|
||
></LI
|
||
><LI
|
||
><P
|
||
> Change the line that reads <SPAN
|
||
CLASS="QUOTE"
|
||
>"LogLevel warn"</SPAN
|
||
> to <SPAN
|
||
CLASS="QUOTE"
|
||
>"LogLevel debug"</SPAN
|
||
>.
|
||
</P
|
||
></LI
|
||
><LI
|
||
><P
|
||
> Save the configuration file and exit the text editor.
|
||
</P
|
||
></LI
|
||
><LI
|
||
><P
|
||
>Restart the CUPS server with the command:
|
||
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>/etc/init.d/cupsys restart
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
></LI
|
||
></OL
|
||
><P
|
||
> You can follow the CUPS log with the following command:
|
||
|
||
<TABLE
|
||
BORDER="0"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="100%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="programlisting"
|
||
>/usr/bin/tail -f /var/log/cups/error_log
|
||
</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
>
|
||
</P
|
||
><P
|
||
> You should see a line that reads <TT
|
||
CLASS="computeroutput"
|
||
>Scheduler shutting down due to
|
||
SIGTERM</TT
|
||
>. This indicates that the CUPS server was stopped successfully.
|
||
</P
|
||
><P
|
||
> Send your print job again and watch for useful debug messages that
|
||
appear. One example of a useful debug message is <TT
|
||
CLASS="computeroutput"
|
||
>GNU Ghostscript
|
||
7.05: Can't start ijs server 'hpijs'.</TT
|
||
> In this case the solution
|
||
is to install the <SPAN
|
||
CLASS="QUOTE"
|
||
>"hpijs"</SPAN
|
||
> package.
|
||
</P
|
||
><P
|
||
> If you cannot determine the cause of the failure, do an Internet search
|
||
for key terms in error messages you see; it is likely that someone
|
||
has solved your problem before. You may also try upgrading the packages
|
||
listed in <A
|
||
HREF="#packages"
|
||
>Section 2.2</A
|
||
> to their latest versions.
|
||
</P
|
||
></DIV
|
||
></DIV
|
||
><DIV
|
||
CLASS="sect1"
|
||
><HR><H1
|
||
CLASS="sect1"
|
||
><A
|
||
NAME="license"
|
||
></A
|
||
>6. License</H1
|
||
><P
|
||
> Copyright <20> 2003 Ian Ward.
|
||
</P
|
||
><P
|
||
> This manual is free software; you may redistribute it and/or modify it under
|
||
the terms of the GNU General Public License as published by the Free Software
|
||
Foundation; either version 2, or (at your option) any later version.
|
||
</P
|
||
><P
|
||
> This is distributed in the hope that it will be useful, but without any
|
||
warranty; without even the implied warranty of merchantability or fitness for
|
||
a particular purpose. See the GNU General Public License for more details.
|
||
</P
|
||
><P
|
||
> A copy of the GNU General Public License is available as
|
||
/usr/share/common-licenses/GPL in the Debian GNU/Linux distribution or on the
|
||
World Wide Web at http://www.gnu.org/copyleft/gpl.html. You can also obtain it
|
||
by writing to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||
Boston, MA 02111-1307, USA.
|
||
</P
|
||
></DIV
|
||
></DIV
|
||
></BODY
|
||
></HTML
|
||
> |