<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML ><HEAD ><TITLE >Sharing Printers With Windows PCs</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Debian and Windows Shared Printing mini-HOWTO" HREF="index.html"><LINK REL="PREVIOUS" TITLE="Printing To Windows PCs" HREF="printing_to_windows.html"><LINK REL="NEXT" TITLE="Troubleshooting" HREF="troubleshooting.html"></HEAD ><BODY CLASS="sect1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Debian and Windows Shared Printing mini-HOWTO</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="printing_to_windows.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="troubleshooting.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="sect1" ><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="sharing_with_windows.html#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" ><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" ><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="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="printing_to_windows.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="troubleshooting.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Printing To Windows PCs</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Troubleshooting</TD ></TR ></TABLE ></DIV ></BODY ></HTML >