xref: /openbsd/usr.sbin/lpr/lpd/lpd.8 (revision 9b7c3dbb)
1.\"	$OpenBSD: lpd.8,v 1.29 2015/11/17 17:10:36 jmc Exp $
2.\"	$NetBSD: lpd.8,v 1.23 2002/02/08 01:38:50 ross Exp $
3.\"
4.\" Copyright (c) 1983, 1991, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"     @(#)lpd.8	8.3 (Berkeley) 4/19/94
32.\"
33.Dd $Mdocdate: November 17 2015 $
34.Dt LPD 8
35.Os
36.Sh NAME
37.Nm lpd
38.Nd line printer spooler daemon
39.Sh SYNOPSIS
40.Nm lpd
41.Op Fl dlrs
42.Op Fl b Ar bind-address
43.Op Fl n Ar maxchild
44.Op Fl w Ar maxwait
45.Op Ar port
46.Sh DESCRIPTION
47.Nm
48is the line printer daemon (spool area handler) and is normally invoked
49at boot time from the
50.Xr rc 8
51file.
52It makes a single pass through the
53.Xr printcap 5
54file to find out about the existing printers and prints any files
55left after a crash.
56It then uses the system calls
57.Xr listen 2
58and
59.Xr accept 2
60to receive requests to print files in the queue, transfer files to
61the spooling area, display the queue, or remove jobs from the queue.
62In each case, it forks a child to handle the request so the parent
63can continue to listen for more requests.
64.Pp
65The options are as follows:
66.Bl -tag -width Ds
67.It Fl b Ar bind-address
68Normally, if the
69.Fl s
70option is not specified,
71.Nm
72will listen on all network interfaces for incoming TCP connections.
73The
74.Fl b
75option, followed by a
76.Ar bind-address
77specifies that
78.Nm
79should listen on that address instead of INADDR_ANY.
80Multiple
81.Fl b
82options are permitted, allowing a list of addresses to be specified.
83Use of this option silently overrides the
84.Fl s
85option if it is also present on the command line.
86.Ar bind-address
87can be a numeric host name in IPV4 or IPV6 notation, or a symbolic host
88name which will be looked up in the normal way.
89.It Fl d
90The
91.Fl d
92option turns on the
93.Dv SO_DEBUG
94.Xr socket 2
95option.
96See
97.Xr setsockopt 2
98for more details.
99.It Fl l
100The
101.Fl l
102flag causes
103.Nm
104to log valid requests received from the network.
105This can be useful for debugging purposes.
106.It Fl n Ar maxchild
107The
108.Fl n
109flag sets
110.Ar maxchild
111as the maximum number of child processes that
112.Nm
113will spawn.
114The default is 32.
115.It Fl r
116The
117.Fl r
118flag allows the
119.Dq of
120filter to be used if specified for a remote
121printer.
122Traditionally,
123.Nm
124would not use the output filter for remote printers.
125.It Fl s
126The
127.Fl s
128flag selects
129.Dq secure
130mode, in which
131.Nm
132does not listen on a TCP socket but only takes commands from a
133.Ux Ns -domain
134socket.
135This is valuable when the machine on which
136.Nm
137runs is subject to attack over the network and it is desired that the
138machine be protected from attempts to remotely fill spools and similar
139attacks.
140.It Fl w Ar maxwait
141The
142.Fl w
143flag sets
144.Ar maxwait
145as the wait time (in seconds) for dead remote server detection.
146If no response is returned from a connected server within this period,
147the connection is closed and a message logged.
148The default is 300 seconds.
149.El
150.Pp
151If the
152.Ar port
153parameter is passed,
154.Nm
155listens on this port instead of the usual
156.Dq printer/tcp
157port from
158.Pa /etc/services .
159.Pp
160Access control is provided by two means.
161First, all requests must come from one of the machines listed in the file
162.Pa /etc/hosts.lpd ,
163one hostname per line.
164A plus "+" may be used as a wildcard to grant access to all hosts.
165Second, if the
166.Dq rs
167capability is specified in the
168.Xr printcap 5
169entry for the printer being accessed,
170.Em lpr
171requests will only be honored for those users with accounts on the
172machine with the printer.
173.Pp
174.Nm
175performs reverse DNS lookups on network clients.
176If a client hostname cannot be determined from its IP address,
177the print request will be silently dropped.
178This is important to note when debugging print problems
179in dynamic address environments.
180.Pp
181The file
182.Em minfree
183in each spool directory contains the number of disk blocks to leave free
184so that the line printer queue won't completely fill the disk.
185The
186.Em minfree
187file can be edited with your favorite text editor.
188.Pp
189The daemon begins processing files
190after it has successfully set the lock for exclusive
191access (described a bit later),
192and scans the spool directory
193for files beginning with
194.Em cf .
195Lines in each
196.Em cf
197file specify files to be printed or non-printing actions to be performed.
198Each such line begins with a key character to specify what to do
199with the remainder of the line.
200.Bl -tag -width Ds
201.It J
202Job Name.
203String to be used for the job name on the burst page.
204.It C
205Classification.
206String to be used for the classification line on the burst page.
207.It L
208Literal.
209The line contains identification info from the password file and
210causes the banner page to be printed.
211.It T
212Title.
213String to be used as the title for
214.Xr pr 1 .
215.It H
216Host Name.
217Name of the machine where
218.Xr lpr 1
219was invoked.
220.It P
221Person.
222Login name of the person who invoked
223.Xr lpr 1 .
224This is used to verify ownership by
225.Xr lprm 1 .
226.It M
227Send mail to the specified user when the current print job completes.
228.It f
229Formatted File.
230Name of a file to print which is already formatted.
231.It l
232Like
233.Dq f
234but passes control characters and does not make page breaks.
235.It p
236Name of a file to print using
237.Xr pr 1
238as a filter.
239.It t
240Troff File.
241The file contains troff output (cat phototypesetter commands).
242.It n
243Ditroff File.
244The file contains device independent troff output.
245.It r
246DVI File.
247The file contains
248.Tn Tex l
249output
250DVI format from Stanford.
251.It g
252Graph File.
253The file contains data produced by
254.Ic plot .
255.It c
256Cifplot File.
257The file contains data produced by
258.Ic cifplot .
259.It v
260The file contains a raster image.
261.It r
262The file contains text data with
263FORTRAN carriage control characters.
264.It \&1
265Troff Font R.
266Name of the font file to use instead of the default.
267.It \&2
268Troff Font I.
269Name of the font file to use instead of the default.
270.It \&3
271Troff Font B.
272Name of the font file to use instead of the default.
273.It \&4
274Troff Font S.
275Name of the font file to use instead of the default.
276.It W
277Width.
278Changes the page width (in characters) used by
279.Xr pr 1
280and the text filters.
281.It I
282Indent.
283The number of characters to indent the output by (in ASCII).
284.It U
285Unlink.
286Name of file to remove upon completion of printing.
287.It N
288File name.
289The name of the file which is being printed, or a blank for the
290standard input (when
291.Xr lpr 1
292is invoked in a pipeline).
293.El
294.Pp
295If a file cannot be opened, a message will be logged via
296.Xr syslog 3
297using the
298.Dv LOG_LPR
299facility.
300.Nm
301will try up to 20 times to reopen a file it expects to be there,
302after which it will skip the file to be printed.
303.Pp
304.Nm
305uses
306.Xr flock 2
307to provide exclusive access to the lock file and to prevent multiple
308daemons from becoming active simultaneously.
309If the daemon should be killed or die unexpectedly, the lock file
310need not be removed.
311The lock file is kept in a readable
312.Tn ASCII
313form
314and contains two lines.
315The first is the process ID of the daemon and the second is the control
316file name of the current job being printed.
317The second line is updated to reflect the current status of
318.Nm
319for the programs
320.Xr lpq 1
321and
322.Xr lprm 1 .
323.Sh FILES
324.Bl -tag -width "/var/spool/output/*/minfree" -compact
325.It Pa /etc/printcap
326printer description file
327.It Pa /var/spool/output/*
328spool directories
329.It Pa /var/spool/output/*/minfree
330minimum free space to leave
331.It Pa /dev/lp*
332line printer devices
333.It Pa /var/run/printer
334socket for local requests
335.It Pa /etc/hosts.lpd
336lists machine names allowed printer access
337.El
338.Sh SEE ALSO
339.Xr lpq 1 ,
340.Xr lpr 1 ,
341.Xr lprm 1 ,
342.Xr syslog 3 ,
343.Xr hosts 5 ,
344.Xr printcap 5 ,
345.Xr resolv.conf 5 ,
346.Xr lpc 8
347.Rs
348.%T "4.3BSD Line Printer Spooler Manual"
349.Re
350.Sh HISTORY
351An
352.Nm
353daemon appeared in
354.At v6 .
355.Pp
356.Nm
357previously required that clients connected using a privileged port
358(below 1024).
359This restriction was removed because it does not provide additional
360security and also because many modern clients connect using an
361unprivileged port.
362