xref: /openbsd-src/usr.sbin/lpr/lpd/lpd.8 (revision d7569e253a131da07e72517d2dd76ed2a1251675)
1*d7569e25Sjmc.\"	$OpenBSD: lpd.8,v 1.33 2023/06/17 15:35:08 jmc Exp $
2a7643117Smillert.\"	$NetBSD: lpd.8,v 1.23 2002/02/08 01:38:50 ross Exp $
383e872d1Sdownsj.\"
4df930be7Sderaadt.\" Copyright (c) 1983, 1991, 1993
5df930be7Sderaadt.\"	The Regents of the University of California.  All rights reserved.
6df930be7Sderaadt.\"
7df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without
8df930be7Sderaadt.\" modification, are permitted provided that the following conditions
9df930be7Sderaadt.\" are met:
10df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright
11df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer.
12df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright
13df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer in the
14df930be7Sderaadt.\"    documentation and/or other materials provided with the distribution.
1529295d1cSmillert.\" 3. Neither the name of the University nor the names of its contributors
16df930be7Sderaadt.\"    may be used to endorse or promote products derived from this software
17df930be7Sderaadt.\"    without specific prior written permission.
18df930be7Sderaadt.\"
19df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22df930be7Sderaadt.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29df930be7Sderaadt.\" SUCH DAMAGE.
30df930be7Sderaadt.\"
31df930be7Sderaadt.\"     @(#)lpd.8	8.3 (Berkeley) 4/19/94
32df930be7Sderaadt.\"
33*d7569e25Sjmc.Dd $Mdocdate: June 17 2023 $
34df930be7Sderaadt.Dt LPD 8
35fc8533a3Saaron.Os
36df930be7Sderaadt.Sh NAME
37df930be7Sderaadt.Nm lpd
38df930be7Sderaadt.Nd line printer spooler daemon
39df930be7Sderaadt.Sh SYNOPSIS
40df930be7Sderaadt.Nm lpd
4185a178a3Smillert.Op Fl dlrs
42a7643117Smillert.Op Fl b Ar bind-address
43a7643117Smillert.Op Fl n Ar maxchild
44a7643117Smillert.Op Fl w Ar maxwait
45f2b6cec1Sschwarze.Op Ar port
46df930be7Sderaadt.Sh DESCRIPTION
47a3e8a938Saaron.Nm
48df930be7Sderaadtis the line printer daemon (spool area handler) and is normally invoked
49df930be7Sderaadtat boot time from the
50df930be7Sderaadt.Xr rc 8
51cdbdb68aSaaronfile.
52cdbdb68aSaaronIt makes a single pass through the
53df930be7Sderaadt.Xr printcap 5
54a7643117Smillertfile to find out about the existing printers and prints any files
55a7643117Smillertleft after a crash.
56cdbdb68aSaaronIt then uses the system calls
57df930be7Sderaadt.Xr listen 2
58df930be7Sderaadtand
59df930be7Sderaadt.Xr accept 2
60a7643117Smillertto receive requests to print files in the queue, transfer files to
61a7643117Smillertthe spooling area, display the queue, or remove jobs from the queue.
62a7643117SmillertIn each case, it forks a child to handle the request so the parent
63a7643117Smillertcan continue to listen for more requests.
64df930be7Sderaadt.Pp
65a3e8a938SaaronThe options are as follows:
66df930be7Sderaadt.Bl -tag -width Ds
677cd73f2eSjmc.It Fl b Ar bind-address
68a7643117SmillertNormally, if the
69a7643117Smillert.Fl s
70a7643117Smillertoption is not specified,
71a7643117Smillert.Nm
72a7643117Smillertwill listen on all network interfaces for incoming TCP connections.
73a7643117SmillertThe
74a7643117Smillert.Fl b
75a7643117Smillertoption, followed by a
76a7643117Smillert.Ar bind-address
77a7643117Smillertspecifies that
78a7643117Smillert.Nm
79a7643117Smillertshould listen on that address instead of INADDR_ANY.
80a7643117SmillertMultiple
81a7643117Smillert.Fl b
82a7643117Smillertoptions are permitted, allowing a list of addresses to be specified.
83a7643117SmillertUse of this option silently overrides the
84a7643117Smillert.Fl s
85a7643117Smillertoption if it is also present on the command line.
86a7643117Smillert.Ar bind-address
870d928c48Sjsgcan be a numeric host name in IPv4 or IPv6 notation, or a symbolic host
88a7643117Smillertname which will be looked up in the normal way.
89a7643117Smillert.It Fl d
90a7643117SmillertThe
91a7643117Smillert.Fl d
92a7643117Smillertoption turns on the
93a7643117Smillert.Dv SO_DEBUG
94a7643117Smillert.Xr socket 2
959d0b46bcSjmcoption.
969d0b46bcSjmcSee
97a7643117Smillert.Xr setsockopt 2
98a7643117Smillertfor more details.
99df930be7Sderaadt.It Fl l
100a7643117SmillertThe
101a7643117Smillert.Fl l
102a7643117Smillertflag causes
103a3e8a938Saaron.Nm
104cdbdb68aSaaronto log valid requests received from the network.
105cdbdb68aSaaronThis can be useful for debugging purposes.
1067cd73f2eSjmc.It Fl n Ar maxchild
107a7643117SmillertThe
108a7643117Smillert.Fl n
109a7643117Smillertflag sets
110a7643117Smillert.Ar maxchild
111a7643117Smillertas the maximum number of child processes that
112a7643117Smillert.Nm
1139d0b46bcSjmcwill spawn.
1149d0b46bcSjmcThe default is 32.
115a7643117Smillert.It Fl r
116a7643117SmillertThe
117a7643117Smillert.Fl r
118a7643117Smillertflag allows the
119a7643117Smillert.Dq of
12045c81f73Scloderfilter to be used if specified for a remote
1219d0b46bcSjmcprinter.
1229d0b46bcSjmcTraditionally,
123a7643117Smillert.Nm
124a7643117Smillertwould not use the output filter for remote printers.
125a7643117Smillert.It Fl s
126a7643117SmillertThe
127a7643117Smillert.Fl s
128a7643117Smillertflag selects
129a7643117Smillert.Dq secure
130a7643117Smillertmode, in which
131a7643117Smillert.Nm
132a7643117Smillertdoes not listen on a TCP socket but only takes commands from a
133b9e0f9e6Ssobrado.Ux Ns -domain
134b9e0f9e6Ssobradosocket.
135a7643117SmillertThis is valuable when the machine on which
136a7643117Smillert.Nm
137a7643117Smillertruns is subject to attack over the network and it is desired that the
138a7643117Smillertmachine be protected from attempts to remotely fill spools and similar
139a7643117Smillertattacks.
1407cd73f2eSjmc.It Fl w Ar maxwait
141a7643117SmillertThe
142a7643117Smillert.Fl w
143a7643117Smillertflag sets
144a7643117Smillert.Ar maxwait
1459d0b46bcSjmcas the wait time (in seconds) for dead remote server detection.
1469d0b46bcSjmcIf no response is returned from a connected server within this period,
1479d0b46bcSjmcthe connection is closed and a message logged.
148ede80e17SmoritzThe default is 300 seconds.
149df930be7Sderaadt.El
150df930be7Sderaadt.Pp
151a7643117SmillertIf the
152f2b6cec1Sschwarze.Ar port
153a7643117Smillertparameter is passed,
154a7643117Smillert.Nm
155a7643117Smillertlistens on this port instead of the usual
156a7643117Smillert.Dq printer/tcp
157a7643117Smillertport from
158a7643117Smillert.Pa /etc/services .
159a7643117Smillert.Pp
160cdbdb68aSaaronAccess control is provided by two means.
161a7643117SmillertFirst, all requests must come from one of the machines listed in the file
162acafcefcSajacoutot.Pa /etc/hosts.lpd ,
163e22b9141Steduone hostname per line.
164e22b9141SteduA plus "+" may be used as a wildcard to grant access to all hosts.
165df930be7SderaadtSecond, if the
166fc8533a3Saaron.Dq rs
167df930be7Sderaadtcapability is specified in the
168a7643117Smillert.Xr printcap 5
169df930be7Sderaadtentry for the printer being accessed,
170df930be7Sderaadt.Em lpr
171df930be7Sderaadtrequests will only be honored for those users with accounts on the
172df930be7Sderaadtmachine with the printer.
173df930be7Sderaadt.Pp
174708dc065Sjmc.Nm
175708dc065Sjmcperforms reverse DNS lookups on network clients.
176708dc065SjmcIf a client hostname cannot be determined from its IP address,
177708dc065Sjmcthe print request will be silently dropped.
178708dc065SjmcThis is important to note when debugging print problems
179708dc065Sjmcin dynamic address environments.
180708dc065Sjmc.Pp
181df930be7SderaadtThe file
182df930be7Sderaadt.Em minfree
183df930be7Sderaadtin each spool directory contains the number of disk blocks to leave free
184df930be7Sderaadtso that the line printer queue won't completely fill the disk.
185df930be7SderaadtThe
186df930be7Sderaadt.Em minfree
187df930be7Sderaadtfile can be edited with your favorite text editor.
188df930be7Sderaadt.Pp
189df930be7SderaadtThe daemon begins processing files
190df930be7Sderaadtafter it has successfully set the lock for exclusive
191df930be7Sderaadtaccess (described a bit later),
192df930be7Sderaadtand scans the spool directory
193df930be7Sderaadtfor files beginning with
194df930be7Sderaadt.Em cf .
195df930be7SderaadtLines in each
196df930be7Sderaadt.Em cf
197a7643117Smillertfile specify files to be printed or non-printing actions to be performed.
198a7643117SmillertEach such line begins with a key character to specify what to do
199a7643117Smillertwith the remainder of the line.
200df930be7Sderaadt.Bl -tag -width Ds
201df930be7Sderaadt.It J
202cdbdb68aSaaronJob Name.
203cdbdb68aSaaronString to be used for the job name on the burst page.
204df930be7Sderaadt.It C
205cdbdb68aSaaronClassification.
206cdbdb68aSaaronString to be used for the classification line on the burst page.
207df930be7Sderaadt.It L
208cdbdb68aSaaronLiteral.
209a7643117SmillertThe line contains identification info from the password file and
210a7643117Smillertcauses the banner page to be printed.
211df930be7Sderaadt.It T
212cdbdb68aSaaronTitle.
213cdbdb68aSaaronString to be used as the title for
214df930be7Sderaadt.Xr pr 1 .
215df930be7Sderaadt.It H
216cdbdb68aSaaronHost Name.
217cdbdb68aSaaronName of the machine where
218fc8533a3Saaron.Xr lpr 1
219df930be7Sderaadtwas invoked.
220df930be7Sderaadt.It P
221cdbdb68aSaaronPerson.
222cdbdb68aSaaronLogin name of the person who invoked
223fc8533a3Saaron.Xr lpr 1 .
224df930be7SderaadtThis is used to verify ownership by
225fc8533a3Saaron.Xr lprm 1 .
226df930be7Sderaadt.It M
227df930be7SderaadtSend mail to the specified user when the current print job completes.
228df930be7Sderaadt.It f
229cdbdb68aSaaronFormatted File.
230cdbdb68aSaaronName of a file to print which is already formatted.
231df930be7Sderaadt.It l
232fc8533a3SaaronLike
233fc8533a3Saaron.Dq f
234fc8533a3Saaronbut passes control characters and does not make page breaks.
235df930be7Sderaadt.It p
236df930be7SderaadtName of a file to print using
237df930be7Sderaadt.Xr pr 1
238df930be7Sderaadtas a filter.
239df930be7Sderaadt.It t
240cdbdb68aSaaronTroff File.
241fb03dd6dSjmcThe file contains troff output (cat phototypesetter commands).
242df930be7Sderaadt.It n
243cdbdb68aSaaronDitroff File.
244cdbdb68aSaaronThe file contains device independent troff output.
245*d7569e25Sjmc.It d
246cdbdb68aSaaronDVI File.
247cdbdb68aSaaronThe file contains
248df930be7Sderaadt.Tn Tex l
249df930be7Sderaadtoutput
25045c81f73ScloderDVI format from Stanford.
251df930be7Sderaadt.It g
252cdbdb68aSaaronGraph File.
253cdbdb68aSaaronThe file contains data produced by
254a7643117Smillert.Ic plot .
255df930be7Sderaadt.It c
256cdbdb68aSaaronCifplot File.
257cdbdb68aSaaronThe file contains data produced by
258a7643117Smillert.Ic cifplot .
259df930be7Sderaadt.It v
260df930be7SderaadtThe file contains a raster image.
261df930be7Sderaadt.It r
262df930be7SderaadtThe file contains text data with
263df930be7SderaadtFORTRAN carriage control characters.
264df930be7Sderaadt.It \&1
265cdbdb68aSaaronTroff Font R.
266cdbdb68aSaaronName of the font file to use instead of the default.
267df930be7Sderaadt.It \&2
268cdbdb68aSaaronTroff Font I.
269cdbdb68aSaaronName of the font file to use instead of the default.
270df930be7Sderaadt.It \&3
271cdbdb68aSaaronTroff Font B.
272cdbdb68aSaaronName of the font file to use instead of the default.
273df930be7Sderaadt.It \&4
274cdbdb68aSaaronTroff Font S.
275cdbdb68aSaaronName of the font file to use instead of the default.
276df930be7Sderaadt.It W
277cdbdb68aSaaronWidth.
278cdbdb68aSaaronChanges the page width (in characters) used by
279df930be7Sderaadt.Xr pr 1
280df930be7Sderaadtand the text filters.
281df930be7Sderaadt.It I
282cdbdb68aSaaronIndent.
28331602fb3SjmcThe number of characters to indent the output by (in ASCII).
284df930be7Sderaadt.It U
285cdbdb68aSaaronUnlink.
286cdbdb68aSaaronName of file to remove upon completion of printing.
287df930be7Sderaadt.It N
288cdbdb68aSaaronFile name.
289a7643117SmillertThe name of the file which is being printed, or a blank for the
290a7643117Smillertstandard input (when
291fc8533a3Saaron.Xr lpr 1
292df930be7Sderaadtis invoked in a pipeline).
293df930be7Sderaadt.El
294df930be7Sderaadt.Pp
295df930be7SderaadtIf a file cannot be opened, a message will be logged via
296df930be7Sderaadt.Xr syslog 3
297df930be7Sderaadtusing the
298a3e8a938Saaron.Dv LOG_LPR
299df930be7Sderaadtfacility.
300a3e8a938Saaron.Nm
301a7643117Smillertwill try up to 20 times to reopen a file it expects to be there,
302a7643117Smillertafter which it will skip the file to be printed.
303df930be7Sderaadt.Pp
304a3e8a938Saaron.Nm
305df930be7Sderaadtuses
306df930be7Sderaadt.Xr flock 2
307df930be7Sderaadtto provide exclusive access to the lock file and to prevent multiple
308cdbdb68aSaarondaemons from becoming active simultaneously.
309a7643117SmillertIf the daemon should be killed or die unexpectedly, the lock file
310a7643117Smillertneed not be removed.
311df930be7SderaadtThe lock file is kept in a readable
312df930be7Sderaadt.Tn ASCII
313df930be7Sderaadtform
314df930be7Sderaadtand contains two lines.
315fc8533a3SaaronThe first is the process ID of the daemon and the second is the control
316cdbdb68aSaaronfile name of the current job being printed.
317cdbdb68aSaaronThe second line is updated to reflect the current status of
318a3e8a938Saaron.Nm
319df930be7Sderaadtfor the programs
320df930be7Sderaadt.Xr lpq 1
321df930be7Sderaadtand
322df930be7Sderaadt.Xr lprm 1 .
323df930be7Sderaadt.Sh FILES
324a7643117Smillert.Bl -tag -width "/var/spool/output/*/minfree" -compact
325df930be7Sderaadt.It Pa /etc/printcap
326df930be7Sderaadtprinter description file
327a7643117Smillert.It Pa /var/spool/output/*
328df930be7Sderaadtspool directories
329a7643117Smillert.It Pa /var/spool/output/*/minfree
330df930be7Sderaadtminimum free space to leave
331df930be7Sderaadt.It Pa /dev/lp*
332df930be7Sderaadtline printer devices
33383e872d1Sdownsj.It Pa /var/run/printer
334df930be7Sderaadtsocket for local requests
335df930be7Sderaadt.It Pa /etc/hosts.lpd
336acafcefcSajacoutotlists machine names allowed printer access
337df930be7Sderaadt.El
338df930be7Sderaadt.Sh SEE ALSO
339df930be7Sderaadt.Xr lpq 1 ,
340350bb3b8Salex.Xr lpr 1 ,
341df930be7Sderaadt.Xr lprm 1 ,
342df930be7Sderaadt.Xr syslog 3 ,
343708dc065Sjmc.Xr hosts 5 ,
344350bb3b8Salex.Xr printcap 5 ,
345708dc065Sjmc.Xr resolv.conf 5 ,
3468966a36aSjmc.Xr lpc 8
347df930be7Sderaadt.Rs
348093fc5b9Sjsg.\" 4.4BSD SMM:7
349093fc5b9Sjsg.%A Ralph Campbell
350a7643117Smillert.%T "4.3BSD Line Printer Spooler Manual"
351df930be7Sderaadt.Re
352df930be7Sderaadt.Sh HISTORY
353df930be7SderaadtAn
354df930be7Sderaadt.Nm
355a3e8a938Saarondaemon appeared in
35601c04610Sjsg.At v5 .
35785a178a3Smillert.Pp
35885a178a3Smillert.Nm
35985a178a3Smillertpreviously required that clients connected using a privileged port
36085a178a3Smillert(below 1024).
36185a178a3SmillertThis restriction was removed because it does not provide additional
36285a178a3Smillertsecurity and also because many modern clients connect using an
36385a178a3Smillertunprivileged port.
364