xref: /aosp_15_r20/external/libcups/doc/help/sharing.html (revision 5e7646d21f1134fb0638875d812ef646c12ab91e)
1*5e7646d2SAndroid Build Coastguard Worker<html>
2*5e7646d2SAndroid Build Coastguard Worker<!-- SECTION: Getting Started -->
3*5e7646d2SAndroid Build Coastguard Worker<head>
4*5e7646d2SAndroid Build Coastguard Worker	<title>Printer Sharing</title>
5*5e7646d2SAndroid Build Coastguard Worker	<LINK REL="STYLESHEET" TYPE="text/css" HREF="../cups-printable.css">
6*5e7646d2SAndroid Build Coastguard Worker</HEAD>
7*5e7646d2SAndroid Build Coastguard Worker<BODY>
8*5e7646d2SAndroid Build Coastguard Worker
9*5e7646d2SAndroid Build Coastguard Worker<H1 CLASS="title">Printer Sharing</H1>
10*5e7646d2SAndroid Build Coastguard Worker
11*5e7646d2SAndroid Build Coastguard Worker<p>This document discusses several ways to configure printer sharing.</p>
12*5e7646d2SAndroid Build Coastguard Worker
13*5e7646d2SAndroid Build Coastguard Worker<h2><a name="BASICS">The Basics</h2>
14*5e7646d2SAndroid Build Coastguard Worker
15*5e7646d2SAndroid Build Coastguard Worker<p>A "server" is any machine that communicates directly to a printer. A "client" is any machine that sends print jobs to a server for final printing. Clients can also be servers if they communicate directly with any printers of their own.</p>
16*5e7646d2SAndroid Build Coastguard Worker
17*5e7646d2SAndroid Build Coastguard Worker<p>By default, CUPS uses the Internet Printing Protocol (IPP) to send jobs from a client to a server. When printing to legacy print servers you may also use the Line Printer Daemon (LPD) protocol when printing to older UNIX-based servers or Server Message Block (SMB) when printing to Windows<sup>&reg;</sup> servers.</p>
18*5e7646d2SAndroid Build Coastguard Worker
19*5e7646d2SAndroid Build Coastguard Worker<p>Clients can automatically discover and access shared printers via DNS Service Discovery (DNS-SD a.k.a. Bonjour<sup>&reg;</sup>). SMB browsing can also be used to manually discover and access shared printers when <a href="http://www.samba.org/">Samba</a> is installed.</p>
20*5e7646d2SAndroid Build Coastguard Worker
21*5e7646d2SAndroid Build Coastguard Worker
22*5e7646d2SAndroid Build Coastguard Worker<h2><a name="SERVER_CONFIG">Configuring the Server</a></h2>
23*5e7646d2SAndroid Build Coastguard Worker
24*5e7646d2SAndroid Build Coastguard Worker<p>You must enable printer sharing on the server before clients can print through it. The simplest way to do this is to use the <a href="man-cupsctl.html">cupsctl(8)</a> command on the server:</p>
25*5e7646d2SAndroid Build Coastguard Worker
26*5e7646d2SAndroid Build Coastguard Worker<pre class="command">
27*5e7646d2SAndroid Build Coastguard Workercupsctl --share-printers
28*5e7646d2SAndroid Build Coastguard Worker</pre>
29*5e7646d2SAndroid Build Coastguard Worker
30*5e7646d2SAndroid Build Coastguard Worker<p>By default, the above command will allow printing from other clients on the same subnet as your server. To allow printing from any subnet, use the following command instead:</p>
31*5e7646d2SAndroid Build Coastguard Worker
32*5e7646d2SAndroid Build Coastguard Worker<pre class="command">
33*5e7646d2SAndroid Build Coastguard Workercupsctl --share-printers --remote-any
34*5e7646d2SAndroid Build Coastguard Worker</pre>
35*5e7646d2SAndroid Build Coastguard Worker
36*5e7646d2SAndroid Build Coastguard Worker<p>Next, tag each printer that you want to share using the <a href="man-lpadmin.html">lpadmin(8)</a> command on the server, for example:</p>
37*5e7646d2SAndroid Build Coastguard Worker
38*5e7646d2SAndroid Build Coastguard Worker<pre class="command">
39*5e7646d2SAndroid Build Coastguard Workerlpadmin -p printer -o printer-is-shared=true
40*5e7646d2SAndroid Build Coastguard Worker</pre>
41*5e7646d2SAndroid Build Coastguard Worker
42*5e7646d2SAndroid Build Coastguard Worker<p>You can require authentication for shared printing by setting the policy on each printer, for example:</p>
43*5e7646d2SAndroid Build Coastguard Worker
44*5e7646d2SAndroid Build Coastguard Worker<pre class="command">
45*5e7646d2SAndroid Build Coastguard Workerlpadmin -p printer -o printer-op-policy=authenticated
46*5e7646d2SAndroid Build Coastguard Worker</pre>
47*5e7646d2SAndroid Build Coastguard Worker
48*5e7646d2SAndroid Build Coastguard Worker
49*5e7646d2SAndroid Build Coastguard Worker<h2><a name="AUTO_IPP">Automatic Configuration using IPP</a></h2>
50*5e7646d2SAndroid Build Coastguard Worker
51*5e7646d2SAndroid Build Coastguard Worker<blockquote><b>Note:</b>
52*5e7646d2SAndroid Build Coastguard Worker<p>This method of configuration does not work on macOS 10.7 or later because sandboxed applications do not always have direct network access.</p>
53*5e7646d2SAndroid Build Coastguard Worker</blockquote>
54*5e7646d2SAndroid Build Coastguard Worker
55*5e7646d2SAndroid Build Coastguard Worker<p>CUPS can be configured to run without a local spooler and send all jobs to a
56*5e7646d2SAndroid Build Coastguard Workersingle server. However, if that server goes down then all printing will be
57*5e7646d2SAndroid Build Coastguard Workerdisabled. Use this configuration only as absolutely necessary.</p>
58*5e7646d2SAndroid Build Coastguard Worker
59*5e7646d2SAndroid Build Coastguard Worker<p>The default server is normally the local system ("localhost"). To override
60*5e7646d2SAndroid Build Coastguard Workerthe default server create a file named <var>/etc/cups/client.conf</var> with a
61*5e7646d2SAndroid Build Coastguard Workerline as follows:</p>
62*5e7646d2SAndroid Build Coastguard Worker
63*5e7646d2SAndroid Build Coastguard Worker<pre class='example'>
64*5e7646d2SAndroid Build Coastguard WorkerServerName <em>server</em>
65*5e7646d2SAndroid Build Coastguard Worker</pre>
66*5e7646d2SAndroid Build Coastguard Worker
67*5e7646d2SAndroid Build Coastguard Worker<p>The <var>server</var> name can be the hostname or IP address of the default
68*5e7646d2SAndroid Build Coastguard Workerserver. If the server is not using the default IPP port (631), you can add the
69*5e7646d2SAndroid Build Coastguard Workerport number at the end like this:</p>
70*5e7646d2SAndroid Build Coastguard Worker
71*5e7646d2SAndroid Build Coastguard Worker<pre class='example'>
72*5e7646d2SAndroid Build Coastguard WorkerServerName <em>server:port</em>
73*5e7646d2SAndroid Build Coastguard Worker</pre>
74*5e7646d2SAndroid Build Coastguard Worker
75*5e7646d2SAndroid Build Coastguard Worker<p>The default server can also be customized on a per-user basis. To set a
76*5e7646d2SAndroid Build Coastguard Workeruser-specific server create a file named <var>~/.cups/client.conf</var> instead.
77*5e7646d2SAndroid Build Coastguard WorkerThe user <var>client.conf</var> file takes precedence over the system one.</p>
78*5e7646d2SAndroid Build Coastguard Worker
79*5e7646d2SAndroid Build Coastguard Worker<p>Finally, you can set the <code>CUPS_SERVER</code> environment variable to
80*5e7646d2SAndroid Build Coastguard Workeroverride the default server for a single process, for example:</p>
81*5e7646d2SAndroid Build Coastguard Worker
82*5e7646d2SAndroid Build Coastguard Worker<pre class='command'>
83*5e7646d2SAndroid Build Coastguard WorkerCUPS_SERVER=server:port firefox http://www.cups.org
84*5e7646d2SAndroid Build Coastguard Worker</pre>
85*5e7646d2SAndroid Build Coastguard Worker
86*5e7646d2SAndroid Build Coastguard Worker<p>will run the Firefox web browser pointed to the specified server and
87*5e7646d2SAndroid Build Coastguard Workerport. The environment variable overrides both the user and system
88*5e7646d2SAndroid Build Coastguard Worker<var>client.conf</var> files, if any.</p>
89*5e7646d2SAndroid Build Coastguard Worker
90*5e7646d2SAndroid Build Coastguard Worker
91*5e7646d2SAndroid Build Coastguard Worker<h2><a name="MANUAL">Manual Configuration of Print Queues</a></h2>
92*5e7646d2SAndroid Build Coastguard Worker
93*5e7646d2SAndroid Build Coastguard Worker<blockquote><b>Note:</b>
94*5e7646d2SAndroid Build Coastguard Worker<p>This method of configuration does not work on macOS 10.7 or later because sandboxed applications do not always have direct network access.</p>
95*5e7646d2SAndroid Build Coastguard Worker</blockquote>
96*5e7646d2SAndroid Build Coastguard Worker
97*5e7646d2SAndroid Build Coastguard Worker<p>The most tedious method of configuring client machines is to configure
98*5e7646d2SAndroid Build Coastguard Workereach remote queue by hand using the <a href="man-lpadmin.html">lpadmin(8)</a>
99*5e7646d2SAndroid Build Coastguard Workercommand:</p>
100*5e7646d2SAndroid Build Coastguard Worker
101*5e7646d2SAndroid Build Coastguard Worker<pre class='command'>
102*5e7646d2SAndroid Build Coastguard Workerlpadmin -p <em>printer</em> -E -v ipp://<em>server</em>/printers/<em>printer</em> -m everywhere
103*5e7646d2SAndroid Build Coastguard Worker</pre>
104*5e7646d2SAndroid Build Coastguard Worker
105*5e7646d2SAndroid Build Coastguard Worker<p>The <var>printer</var> name is the name of the printer on the server machine.
106*5e7646d2SAndroid Build Coastguard WorkerThe <var>server</var> name is the hostname or IP address of the server machine.
107*5e7646d2SAndroid Build Coastguard WorkerRepeat the <b>lpadmin</b> command for each remote printer you wish to use.</p>
108*5e7646d2SAndroid Build Coastguard Worker
109*5e7646d2SAndroid Build Coastguard Worker
110*5e7646d2SAndroid Build Coastguard Worker</body>
111*5e7646d2SAndroid Build Coastguard Worker</html>
112