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