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