inetd 中文man页面

系统
inetd通常在系统启动时由/etc/rc.local引导。inetd会监听指定internet端口是否有连接要求。当发现有某个端口有连接要求时,inetd将决定由哪个服务器进程来响应该连接要求,并调用该服务器程序。当程序运行结束后,inetd会继续对该端口进行监听(除了以下所涉及的原因)。从本质上讲,inetd可以只运行一个守护进程,该守护进程可以在需要时调用其它服务进程,从而减轻系统负担。

NAME

inetd - 因特网“超级服务”  

总览

inetd - [ -d ] [ -q 队列长度 ] [ 配置文件名 ]  

描述

inetd通常在系统启动时由/etc/rc.local引导。inetd会监听指定internet端口是否有连接要求。当发现有某个端口有连接要求时,inetd将决定由哪个服务器进程来响应该连接要求,并调用该服务器程序。当程序运行结束后,inetd会继续对该端口进行监听(除了以下所涉及的原因)。从本质上讲,inetd可以只运行一个守护进程,该守护进程可以在需要时调用其它服务进程,从而减轻系统负担。  

选项

inetd的可用选项:

-d
打开调试功能。
-q
队列长度设置端口监听队列的长度值,默认值为128。

说明

在运行时,inetd会读取它的配置文件,默认为/etc/inetd.conf。该配置文件的每一个栏都有一个条目,栏中每一项由空格或制表符进行分隔。以井号开头的是注释文本。其格式如下所示:

service name 服务名
socket type 接口类型
protocol
协议名
wait/nowait[.max] 等待/不等待
user[.group] 用户/组
server program 服务器程序
server program arguments 服务器程序参数

如果定义的是基于Sun-RPC的服务,则将包含有以下内容:

service name/version 服务名
socket type 接口类型
rpc/protocol 协议名
wait/nowait[.max] 等待/不等待
user[.group] 用户/组
server program 服务器程序
server program arguments 服务器程序参数

服务名指的是一个在文件/etc/services中有定义的合法服务。相对局域网而言(下面讨论),服务名须为该服务的官方名称(即,处于文件 /etc/services中的第一行)。当定义一个基于Sun-RPC的服务时,此栏内容须是一个在文件/etc/rpc中有定义的合法服务名。在斜械右侧的是RPC的版本号。此版本号可以是一个单一数字,也可以是一个从低到高的版本范围,如:“rusers/1-3”。

接口类型则是“stream”、“dgram”、“raw”、“rdm”或“seqpacket”中的一个,这取决于其数据的类型是什么。

协议名须是在文件/etc/protocols中有定义的合法协议。例如:“tcp”或“udp”。基于RPC的服务可以定义为:“rpc/tcp”或“rpc/udp”。

等待/不等待栏仅当定义接口类型为datagram时有效(其它接口在这里都使用“不等待”)。如果希望一个数据包到达它的同侪后,服务器立刻释放端口,使inetd可以继续监听此端口,即称为“多线程服务”,此时该栏须设为“不等待”。如果服务器都在一个端口传输数据包而且不会将此端口释放,则称此为“单一线程”,此时应设此栏为“等待”。Comsat(8)和talkd(8)是后一种数据类型的应用。Tftpd(8)则是一个例外,此数据服务建立的是一个虚拟的连接,为了避免竞争,此处应设为“等待”。服务器读在取第一个数据包后,重新建立一个新的接口供inetd继续提供监听使用,而旧的接口将在处理完该任务后将自动中断。可选项后缀“max”(与“等待”可“不等待”用逗号分隔)定义inetd在60秒内提供服务的最大进程数,缺省值为 40。

用户栏应包含可以使用该服务程序用户的用户名。此选项充许赋于inetd服务器程序低于root的权限。可以在用户名后用逗号分隔加上组名称,此选项可以使inetd在运行时以所定义的组身份运行而非/etc/password文件中定义的身份。如果在此定义了组名而所定义的用户名不是root 时,该用户所在组的名字将自动附加到此处。

服务器程序栏应包含全路径的服务器程序名,inetd在监听到某套接字上有请求时会调过该服务器程序。如果某服务由inetd内部提供,则此处应填“internal”。

服务器程序参数栏中应包含所有服务器程序运行时必须的各参数。如果服务程序由inetd内部提供,则此处应填“internal”。

inetd通过内部常规工作,自身也提供一些小的服务。这些服务有 “echo”、“discard”、“chargen”、“daytime”(人类语言)和“time”(以秒为单位的机器语言,从1900年1月1日零时开始计时)。所有这些服务都是基于tcp的。如想更深一步了解这些服务,可以从网上获得相关RFC文档。

inetd在接收到SIGHUP挂起信号后会重新读取其配置文件。在重读配置文件后,可能增加、减少或改变已有的服务。inetd在运行时会创建一个/var/run/inetd.pid的文件用来存放它的进程号。

另见 SEE ALSO

comsat(8), fingerd(8), ftpd(8), rexecd(8), rlogind(8), rshd(8), lnetd(8), tftpd(8)

#p#

NAME

inetd - internet ``super-server''  

SYNOPSIS

inetd [-di ] [-q queuelength ] [configuration file ]  

DESCRIPTION

Inetd should be run at boot time by /etc/rc.local (see rc(8)). If your init(8) can respawn arbitrary daemons, inetd can be run from init instead; then init will restart it if it crashes. You must use the -i option to prevent inetd from backgrounding itself, or init will become confused.

When running, inetd listens for connections on certain internet sockets. When a connection is found on one of its sockets, it looks up what service the socket corresponds to, and invokes a program to service the request. After the program is finished, it will continue to listen on the socket, except in some special cases which will be described below. Essentially, inetd allows running one daemon to invoke several others, reducing load on the system.  

OPTIONS

The options available for inetd:

-d
Turns on several kinds of debugging and make inetd behave if run in a debugger. Also implies -i
-i
Do not background; for running from init(8).
-q queuelength
Sets the size of the socket listen queue to the specified value. Default is 128.

CONFIGURATION

Upon execution, inetd reads its configuration information from a configuration file which, by default, is /etc/inetd.conf There must be an entry for each field of the configuration file, with entries for each field separated by a tab or a space. Comments are denoted by a ``#'' at the beginning of a line. There must be an entry for each field. The fields of the configuration file are as follows:

service name[@hostname]
socket type
protocol
wait/nowait[.max]
user[.group]
server program
server program arguments

To specify an Sun-RPC based service, the entry would contain these fields.

service name/version[@hostname]
socket type
rpc/protocol
wait/nowait[.max]
user[.group]
server program
server program arguments

The service-name entry is the name of a valid service in the file /etc/services For ``internal'' services (discussed below), the service name must be the official name of the service (that is, the first entry in /etc/services ) . When used to specify a Sun-RPC based service, this field is a valid RPC service name in the file /etc/rpc . The part on the right of the ``/'' is the RPC version number. This can simply be a single numeric argument or a range of versions. A range is bounded by the low version to the high version - ``rusers/1-3''

If a string of the form @hostname is appended to the service, it causes inetd to bind to the port for the service on only the specific IP address associated with hostname instead of listening on all available addresses. This can be done as many times as desired for different addresses, which permits setting up ``virtually hosted'' services. Note, however, that while you can listen to as many specific addresses as you want, kernel restrictions prevent inetd from listening to the same port on a specific address and the general address at once. hostname should be a resolvable hostname or an IP address associated with one of the interfaces of the local system.

The socket-type should be one of ``stream'' ``dgram'' ``raw'' ``rdm'' or ``seqpacket'' depending on whether the socket is a stream, datagram, raw, reliably delivered message, or sequenced packet socket.

The protocol must be a valid protocol as given in /etc/protocols Examples might be ``tcp'' or ``udp'' Rpc based services are specified with the ``rpc/tcp'' or ``rpc/udp '' service type.

The wait/nowait entry is applicable to datagram sockets only (other sockets should have a ``nowait'' entry in this space). If a datagram server connects to its peer, freeing the socket so inetd can received further messages on the socket, it is said to be a ``multi-threaded'' server, and should use the ``nowait'' entry. For datagram servers which process all incoming datagrams on a socket and eventually time out, the server is said to be ``single-threaded'' and should use a ``wait'' entry. Comsat(8) (biff(1) ) and talkd(8) are both examples of the latter type of datagram server. Tftpd(8) is an exception; it is a datagram server that establishes pseudo-connections. It must be listed as ``wait'' in order to avoid a race; the server reads the first packet, creates a new socket, and then forks and exits to allow inetd to check for new service requests to spawn new servers. The optional ``max'' suffix (separated from ``wait'' or ``nowait'' by a dot) specifies the maximum number of server instances that may be spawned from inetd within an interval of 60 seconds. When omitted, ``max'' defaults to 40.

The user entry should contain the user name of the user as whom the server should run. This allows for servers to be given less permission than root. An optional group name can be specified by appending a dot to the user name followed by the group name. This allows for servers to run with a different (primary) group id than specified in the password file. If a group is specified and user is not root, the supplementary groups associated with that user will still be set.

The server-program entry should contain the pathname of the program which is to be executed by inetd when a request is found on its socket. If inetd provides this service internally, this entry should be ``internal''

The server program arguments should be just as arguments normally are, starting with argv[0], which is the name of the program. If the service is provided internally, the word ``internal'' should take the place of this entry.  

BUILTINS

Inetd provides several ``trivial'' services internally by use of routines within itself. These services are ``echo'' ``discard'' ``chargen'' (character generator), ``daytime'' (human readable time), and ``time'' (machine readable time, in the form of the number of seconds since midnight, January 1, 1900). All of these services are tcp based. For details of these services, consult the appropriate RFC from the Network Information Center.

Inetd rereads its configuration file when it receives a hangup signal, SIGHUP Services may be added, deleted or modified when the configuration file is reread. Inetd creates a file /var/run/inetd.pid that contains its process identifier.  

SEE ALSO

comsat(8), fingerd(8), ftpd(8), rexecd(8), rlogind(8), rshd(8), telnetd(8), tftpd(8)  

责任编辑:韩亚珊 来源: CMPP.net
相关推荐

2011-08-15 10:21:09

man中文man

2011-08-24 16:48:36

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-25 15:09:38

clearerr中文man

2011-08-25 15:19:39

dirname中文man

2011-08-25 15:21:53

execl中文man

2011-08-25 16:28:50

fread中文man

2011-08-25 16:52:54

getchar中文man

2011-08-25 17:27:58

rewind中文man

2011-08-25 18:41:31

vprintf中文man

2011-08-23 10:03:40

useradd中文man

2011-08-23 10:29:02

chpasswd中文man

2011-08-23 10:34:22

convertquot中文man

2011-08-23 15:39:34

rpmbuild中文man

2011-08-23 18:00:21

LDP中文man

2011-08-25 09:40:49

UPDATE中文man

2011-08-24 15:11:15

explain中文man

2011-08-24 15:29:06

grant中文man

2011-08-24 15:48:38

INSERT中文man
点赞
收藏

51CTO技术栈公众号