ubuntu中關於開啟telnet認識到的問題

來源:互聯網
上載者:User

在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看作一個啟動服務的管理伺服器。其中使用者的連接埠配置都是可以通過更改設定檔來設定的,這裡就不多說了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.