您的位置:首页 > 其它

ubuntu中关于开启telnet认识到的问题

2011-05-27 00:38 302 查看
在UBUNTU中,开启TELNET服务:

靠,没想到这么麻烦。

因为在RED HAT中开起时很简单;

vi /etc/xinetd.d/telnet

service telnet

{

disable = yes

flags = REUSE

socket_type = stream

wait = no

user = root

server = /usr/sbin/in.telnetd

log_on_failure += USERID

}

将disable=yes行前加#,或者改为disable=no

这样就行啦。

但是在UBUNTU中的/ETC中根本没有找到XINETD.D文件夹。

XINETD.D经常在网络配置中见到。这是什么?

Introduction

Many network
enabled Linux applications don't rely on themselves to provide
restricted access or bind to a particular TCP port; instead they often
offload a lot of this work to a program suite made just for this
purpose, xinetd.

Managing xinetd Programs

The xinetd RPM
is installed by default in Fedora Linux and uses /etc/xinetd.conf as its
main configuration file. Fortunately you usually don't have to edit
this file so that day to day xinetd operation is frequently limited to
only starting and stopping xinetd managed applications.

Controlling xinetd

The starting and
stopping of the xinetd daemon is controlled by the by scripts in the
/etc/init.d directory and its behavior at boot time is controlled by
chkconfig.
You can start/stop/restart xinetd after booting by using the following commands:
[root@bigboy tmp]# service xinetd start[root@bigboy tmp]# service xinetd stop[root@bigboy tmp]# service xinetd restart

To get xinetd configured to start at boot you can use the chkconfig command.
[root@bigboy tmp]# chkconfig xinetd on


Controlling xinetd-Managed Applications

Xinetd-managed
applications all store their configuration files in the /etc/xinetd.d
directory. Each configuration file has a disable statement that you can
set to yes or no. This governs whether xinetd is allowed to start them
or not.
You don't have
to edit these files to activate or deactivate the application. The
chkconfig command does that for you automatically will also stops or
starts the application accordingly too! Here is an example of the
activation and deactivation of the Samba SWAT web GUI management
application.
[root@bigboy tmp]# chkconfig swat on[root@bigboy tmp]# chkconfig swat off

xinetd是新一代的网络守护进程服务程序,又叫超级Internet服务器,常用来管理多种轻量级Internet服务。

xinetd提供类似于inetd+tcp_wrapper的功能,但是更加强大和安全。

基础知识

linux提供服务是由运行在后台的守护程序(daemon)来执行的。

守护进程的工作就是打开1个端口(port),等待(listen)进入的连接。在C/S模式中,如果客户提请了1个连接,守护进程就创建(fork)子进程来响应这个连接,而父进程继续监听其他服务的请求。

但是,对于系统所提供的每1个服务,如果都必须运行1个监听某个端口连接发生的守护程序,那么通常意味着系统资源的浪费。为此,引入“扩展的网络

守护进程服务程序”xinetd(xinetd internet daemon)。telnet服务也是由xinetd守护的。

以上估计可以初步了解XINETD。

4 使用xinetd启动守护进程

原则上任何系统服务都可以使用xinetd,然而最适合的应该是那些常用的网络服务,同时,这个服务的请求数目和频繁程度不会太高。

像DNS和Apache就不适合采用这种方式

而像FTP、Telnet、SSH等就适合使用xinetd模式,

系统默认使用xinetd的服务可以分为如下几类。

① 标准Internet服务:telnet、ftp。

② 信息服务:finger、netstat、systat。

③ 邮件服务:imap、imaps、pop2、pop3、pops。

④ RPC服务:rquotad、rstatd、rusersd、sprayd、walld。

⑤ BSD服务:comsat、exec、login、ntalk、shell、talk。

⑥ 内部服务:chargen、daytime、echo、servers、services、time。

⑦ 安全服务:irc。

⑧ 其他服务:name、tftp、uucp。

具体可以使用xinetd的服务在/etc/services文件中指出。

解读/etc/xinetd.conf和/etc/xinetd.d/*

1) /etc/xinetd.conf

xinetd
的配置文件是/etc/xinetd.conf,但是它只包括几个默认值及/etc/xinetd.d目录中的配置文件。如果要启用或禁用某项
xinetd服务,编辑位于/etc/xinetd.d目录中的配置文件。例如,disable属性被设为yes,表示该项服务已禁用;disable属
性被设为no,表示该项服务已启用。/etc/xinetd.conf有许多选项,下面是RHEL 4.0的/etc/xinetd.conf。

# Simple configuration file for xinetd

# Some defaults, and include /etc/xinetd.d/

defaults

{

instances = 60

log_type = SYSLOG authpriv

log_on_success = HOST PID

log_on_failure = HOST

cps = 25 30

}

includedir /etc/xinetd.d

— instances = 60:表示最大连接进程数为60个。

— log_type = SYSLOG authpriv:表示使用syslog进行服务登记。

— log_on_success= HOST PID:表示设置成功后记录客户机的IP地址的进程ID。

— log_on_failure = HOST:表示设置失败后记录客户机的IP地址。

— cps = 25 30:表示每秒25个入站连接,如果超过限制,则等待30秒。主要用于对付拒绝服务攻击。

— includedir /etc/xinetd.d:表示告诉xinetd要包含的文件或目录是/etc/xinetd.d。

5. 解读/etc/xinetd.conf和/etc/xinetd.d/*

1) /etc/xinetd.conf

xinetd
的配置文件是/etc/xinetd.conf,但是它只包括几个默认值及/etc/xinetd.d目录中的配置文件。如果要启用或禁用某项
xinetd服务,编辑位于/etc/xinetd.d目录中的配置文件。例如,disable属性被设为yes,表示该项服务已禁用;disable属
性被设为no,表示该项服务已启用。/etc/xinetd.conf有许多选项,下面是RHEL 4.0的/etc/xinetd.conf。

# Simple configuration file for xinetd

# Some defaults, and include /etc/xinetd.d/

defaults

{

instances = 60

log_type = SYSLOG authpriv

log_on_success = HOST PID

log_on_failure = HOST

cps = 25 30

}

includedir /etc/xinetd.d

— instances = 60:表示最大连接进程数为60个。

— log_type = SYSLOG authpriv:表示使用syslog进行服务登记。

— log_on_success= HOST PID:表示设置成功后记录客户机的IP地址的进程ID。

— log_on_failure = HOST:表示设置失败后记录客户机的IP地址。

— cps = 25 30:表示每秒25个入站连接,如果超过限制,则等待30秒。主要用于对付拒绝服务攻击。

— includedir /etc/xinetd.d:表示告诉xinetd要包含的文件或目录是/etc/xinetd.d。

2) /etc/xinetd.d/*

下面以/etc/xinetd.d/中的一个文件(rsync)为例。

service rsync

{

disable = yes

socket_type = stream

wait = no

user = root

server = /usr/bin/rsync

log_on_failure += USERID

}

下面说明每一行选项的含义。

— disable = yes:表示禁用这个服务。

— socket_type = stream:表示服务的数据包类型为stream。

— wait = no:表示不需等待,即服务将以多线程的方式运行。

— user = root:表示执行此服务进程的用户是root。

— server = /usr/bin/rsync:启动脚本的位置。

— log_on_failure += USERID:表示设置失败时,UID添加到系统登记表。

5 配置xinetd

1) 格式

/etc/xinetd.conf中的每一项具有下列形式:

service service-name

{

……

}

其中service是必需的关键字,且属性表必须用大括号括起来。每一项都定义了由service-name定义的服务。

service-name是任意的,但通常是标准网络服务名,也可增加其他非标准的服务,只要它们能通过网络请求激活,包括localhost自身发出的网络请求。有很多可以使用的属性,稍后将描述必需的属性和属性的使用规则。

操作符可以是=、+=或-=。所有属性可以使用=,其作用是分配一个或多个值,某些属性可以使用+=或-=,其作用分别是将其值增加到某个现存的值表中,或将其值从现存值表中删除。

2) 配置文件

相关的配置文件如下:

/etc/xinetd.conf

/etc/xinetd.d/* //该目录下的所有文件

/etc/hosts.allow

/etc/hosts.deny

3) disabled与enabled


者的参数是禁用的服务列表,后者的参数是启用的服务列表。他们的共同点是格式相同(属性名、服务名列表与服务中间用空格分开,例如disabled =
in.tftpd
in.rexecd),此外,它们都是作用于全局的。如果在disabled列表中被指定,那么无论包含在列表中的服务是否有配置文件和如何设置,都将被
禁用;如果enabled列表被指定,那么只有列表中的服务才可启动,如果enabled没有被指定,那么disabled指定的服务之外的所有服务都可
以启动。

*****************************************************************************************

更多关于XINETD的信息:

MAN XINETD。CONF

*********************************************************************************************

1. 声明:这个命令不是在所有的linux发行版本中都有。主要是在redhat、fedora、mandriva和centos中。

2. 此命令位于/sbin目录下,用file命令查看此命令会发现它是一个脚本命令。

3. 分析脚本可知此命令的作用是去/etc/init.d目录下寻找相应的服务,进行开启和关闭等操作。

4. 开启httpd服务器:service httpd start

start可以换成restart表示重新启动,stop表示关闭,reload表示重新载入配置。

5. 关闭mysql服务器:service mysqld stop

6. 强烈建议大家将service命令替换为/etc/init.d/mysqld stop

linux中的服务管理与微软

的windows中的不是很相同,大概我对微软服务器的服务启动也不是很了解,在这里说一下linux的服务吧。

linux的服务分为两种,一种是系统服务,就是在系统启动的时候就可以自动启动的那种;还有一种就是由xinet服务来引导的守护进程型的服务。
xinet也是一个服务,其能够同时监听多个指定的端口,在接收用户请求时,它能够根据用户请求的端口不同,启动不同的网络服务进程来处理这些用户请求。
可以把xinetd看作一个启动服务的管理服务器。其中用户的端口配置都是可以通过更改配置文件来设置的,这里就不多说了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: