OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / netkit / original / man8 / inetd.8
1 .\" Copyright (c) 1985, 1991 The Regents of the University of California.
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     from: @(#)inetd.8       6.7 (Berkeley) 3/16/91
33 .\"     $Id: inetd.8,v 1.18 2000/07/30 23:56:58 dholland Exp $
34 .\"
35 .Dd August 22, 1999
36 .Dt INETD 8
37 .Os "Linux NetKit (0.17)"
38 .Sh NAME
39 .Nm inetd
40 .Nd internet
41 .Dq super-server
42 .Sh SYNOPSIS
43 .Nm inetd
44 .Op Fl di
45 .Op Fl q Ar queuelength
46 .Op Ar configuration file
47 .Sh DESCRIPTION
48 .Nm Inetd
49 should be run at boot time by
50 .Pa /etc/rc.local
51 (see
52 .Xr rc 8 ) .
53 If your 
54 .Xr init 8
55 can respawn arbitrary daemons,
56 .Nm inetd
57 can be run from init instead; then init will restart it if it crashes.
58 You must use the
59 .Fl i
60 option to prevent
61 .Nm inetd
62 from backgrounding itself, or init will become confused.
63 .Pp
64 When running,
65 .Nm inetd listens for connections on certain
66 internet sockets.  When a connection is found on one of its sockets, 
67 it looks up what service the socket corresponds to, and invokes a 
68 program to service the request. After the program is finished, it 
69 will continue to listen on the socket, except in some special cases 
70 which will be described below.  Essentially,
71 .Nm inetd
72 allows running one daemon to invoke several others,
73 reducing load on the system.
74 .Ss OPTIONS
75 The options available for
76 .Nm inetd:
77 .Bl -tag -width Ds
78 .It Fl d
79 Turns on several kinds of debugging and make inetd behave if run in a 
80 debugger. Also implies
81 .Fl i .
82 .It Fl i
83 Do not background; for running from
84 .Xr init 8 .
85 .It Fl q Ar queuelength
86 Sets the size of the socket listen queue to the specified
87 value. Default is 128.
88 .El
89 .Ss CONFIGURATION
90 Upon execution,
91 .Nm inetd
92 reads its configuration information from a configuration
93 file which, by default, is
94 .Pa /etc/inetd.conf .
95 There must be an entry for each field of the configuration
96 file, with entries for each field separated by a tab or
97 a space.  Comments are denoted by a ``#'' at the beginning
98 of a line.  There must be an entry for each field.  The
99 fields of the configuration file are as follows:
100 .Pp
101 .Bd -unfilled -offset indent -compact
102 service name[@hostname]
103 socket type
104 protocol
105 wait/nowait[.max]
106 user[.group]
107 server program
108 server program arguments
109 .Ed
110 .Pp
111 To specify an 
112 .Em Sun-RPC 
113 based service, the entry would contain these fields.
114 .Pp
115 .Bd -unfilled -offset indent -compact
116 service name/version[@hostname]
117 socket type
118 rpc/protocol
119 wait/nowait[.max]
120 user[.group]
121 server program
122 server program arguments
123 .Ed
124 .Pp
125 The
126 .Em service-name
127 entry is the name of a valid service in
128 the file
129 .Pa /etc/services .
130 For
131 .Dq internal
132 services (discussed below), the service
133 name
134 .Em must
135 be the official name of the service (that is, the first entry in
136 .Pa /etc/services ) . 
137 When used to specify a
138 .Em Sun-RPC
139 based service, this field is a valid RPC service name in
140 the file
141 .Pa /etc/rpc . 
142 The part on the right of the 
143 .Dq /
144 is the RPC version number. This
145 can simply be a single numeric argument or a range of versions.
146 A range is bounded by the low version to the high version - 
147 .Dq rusers/1-3 .
148 .Pp
149 If a string of the form
150 .Em @hostname 
151 is appended to the service, it causes inetd to bind to the port for
152 the service on only the specific IP address associated with
153 .Em hostname ,
154 instead of listening on all available addresses. This can be done as
155 many times as desired for different addresses, which permits setting
156 up ``virtually hosted'' services. Note, however, that while you can
157 listen to as many specific addresses as you want, kernel restrictions
158 prevent 
159 .Nm inetd
160 from listening to the same port on a specific address and the general
161 address at once.
162 .Em hostname
163 should be a resolvable hostname or an IP address associated with one
164 of the interfaces of the local system.
165
166 .Pp
167 The
168 .Em socket-type
169 should be one of
170 .Dq stream ,
171 .Dq dgram ,
172 .Dq raw ,
173 .Dq rdm ,
174 or
175 .Dq seqpacket ,
176 depending on whether the socket is a stream, datagram, raw,
177 reliably delivered message, or sequenced packet socket.
178 .Pp
179 The
180 .Em protocol
181 must be a valid protocol as given in
182 .Pa /etc/protocols .
183 Examples might be
184 .Dq tcp
185 or
186 .Dq udp .
187 Rpc based services are specified with the 
188 .Dq rpc/tcp
189 or 
190 .Dq rpc/udp 
191 service type.
192
193 .Pp
194 The
195 .Em wait/nowait
196 entry is applicable to datagram sockets only (other sockets should
197 have a
198 .Dq nowait
199 entry in this space).  If a datagram server connects
200 to its peer, freeing the socket so
201 .Nm inetd
202 can received further messages on the socket, it is said to be
203 a
204 .Dq multi-threaded
205 server, and should use the
206 .Dq nowait
207 entry.  For datagram servers which process all incoming datagrams
208 on a socket and eventually time out, the server is said to be
209 .Dq single-threaded
210 and should use a
211 .Dq wait
212 entry.
213 .Xr Comsat 8
214 .Pq Xr biff 1
215 and
216 .Xr talkd 8
217 are both examples of the latter type of
218 datagram server.
219 .Xr Tftpd 8
220 is an exception; it is a datagram server that establishes pseudo-connections.
221 It must be listed as
222 .Dq wait
223 in order to avoid a race;
224 the server reads the first packet, creates a new socket,
225 and then forks and exits to allow
226 .Nm inetd
227 to check for new service requests to spawn new servers.
228 The optional
229 .Dq max
230 suffix (separated from
231 .Dq wait
232 or
233 .Dq nowait
234 by a dot) specifies the maximum number of server instances that may be
235 spawned from
236 .Nm inetd
237 within an interval of 60 seconds. When omitted,
238 .Dq max
239 defaults to 40.
240 .Pp
241 The
242 .Em user
243 entry should contain the user name of the user as whom the server
244 should run.  This allows for servers to be given less permission
245 than root. An optional group name can be specified by appending a dot to
246 the user name followed by the group name. This allows for servers to run with
247 a different (primary) group id than specified in the password file. If a group
248 is specified and user is not root, the supplementary groups associated with
249 that user will still be set.
250 .Pp
251 The
252 .Em server-program
253 entry should contain the pathname of the program which is to be
254 executed by
255 .Nm inetd
256 when a request is found on its socket.  If
257 .Nm inetd
258 provides this service internally, this entry should
259 be
260 .Dq internal .
261 .Pp
262 The
263 .Em server program arguments
264 should be just as arguments
265 normally are, starting with argv[0], which is the name of
266 the program.  If the service is provided internally, the
267 word
268 .Dq internal
269 should take the place of this entry.
270 .Ss BUILTINS
271 .Nm Inetd
272 provides several
273 .Dq trivial
274 services internally by use of
275 routines within itself.  These services are
276 .Dq echo ,
277 .Dq discard ,
278 .Dq chargen
279 (character generator),
280 .Dq daytime
281 (human readable time), and
282 .Dq time
283 (machine readable time,
284 in the form of the number of seconds since midnight, January
285 1, 1900).  All of these services are tcp based.  For
286 details of these services, consult the appropriate
287 .Tn RFC
288 from the Network Information Center.
289 .Pp
290 .Nm Inetd
291 rereads its configuration file when it receives a hangup signal,
292 .Dv SIGHUP .
293 Services may be added, deleted or modified when the configuration file
294 is reread.
295 .Nm Inetd
296 creates a file
297 .Em /var/run/inetd.pid
298 that contains its process identifier.
299 .Sh SEE ALSO
300 .Xr comsat 8 ,
301 .Xr fingerd 8 ,
302 .Xr ftpd 8 ,
303 .Xr rexecd 8 ,
304 .Xr rlogind 8 ,
305 .Xr rshd 8 ,
306 .Xr telnetd 8 ,
307 .Xr tftpd 8
308 .Sh HISTORY
309 The
310 .Nm
311 command appeared in
312 .Bx 4.3 .
313 Support for
314 .Em Sun-RPC 
315 based services is modelled after that
316 provided by
317 .Em SunOS 4.1 .