linux提供服務是由運行在後臺的守護程序(daemon)來執行的。
守護進程的工作就是打開1個端口(port),等待(listen)進入的連接。在C/S模式中,如果客戶提請了1個連接,守護進程就創建(fork)子進程來響應這個連接,而父進程繼續監聽其他服務的請求。
但 是,對於系統所提供的每1個服務,如果都必須運行1個監聽某個端口連接發生的守護程序,那麼通常意味着系統資源的浪費。爲此,引入“擴展的網絡守護進程服 務程序”xinetd(xinetd internet daemon)。telnet服務也是由xinetd守護的。
2。檢測telnet、telnet-server的rpm包是否安裝
OS:RedHat9
[root@localhost root]#rpm -qa telnet
telnet-0.17-25
//telnet*.rpm是默認安裝的//
[root@localhost root]#rpm -qa telnet-server
空
//telnet*.rpm是默認沒有安裝的//
3。安裝telnet-server
第3張盤上有telnet-server-0.17-25.i386.rpm
[root@localhost root]#rpm -ivh telnet-server*.i386.rpm --這個軟件包依賴於xinet這個包。
4。修改telnet服務配置文件
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
PS:
安裝telnet-server後,系統纔有文件/usr/sbin/in.telnetd
5。重新啓動xinetd守護進程
由於telnet服務也是由xinetd守護的,所以安裝完telnet-server,要啓動telnet服務就必須重新啓動xinetd
[root@localhost root]#service xinetd restart
或
[root@localhost root]#/etc/init.d/xinetd restart
6。關閉系統的防火牆,如果不能修改,則先修改下用戶認證方式再試試(setup -> Authentication configuration)
linux系統默認的防火牆是“high”
命令行界面CLI:
[root@localhost root]# setup
選擇:“firewall configuration”
選擇:security level——“no firewall”
7。設置root用戶可以telnet主機(生產環境下不建議這樣)
# vi /etc/securetty 添加pts/0,要控制root同時telnet數量,就添加多少個pts/x,其中x爲0-255-...的數字。示例如下:
# cat /etc/securetty
console
vc/1
vc/2
vc/3
vc/4
vc/5
tty1
tty2
tty3
tty4
tty5
tty6
pts/0
pts/1
pts/2
pts/3
8。測試
c:> telnet IP
Trying...
Connected to IP
Escape character is '^]'.
Red Hat Enterprise Linux Server release 5 (Tikanga)
Kernel 2.6.18-8.el5 on an i686
login:
9。telnet默認開機啓動
1)。命令ntsysv
找到telnet,用空格鍵激活(*)服務
2)。命令chkconfig
chkconfig --add telnet
chkconfig telnet on
3)。圖形用戶界面GUI
redhat-conhat-config-services
或
“主菜單”——“系統設置”——“服務器設置”——“服務”
PS:
由於telnet登陸時是明文傳送密碼,所以不安全,建議使用ssh(secure shell)替代!
windows下一般用F-Secure SSH ,putty SSH
10。Trouble Shooting
(1).我在我機子上輸入 telnet 192.168.1.18 (裝有Fedora Core 6 系統的機器)
dos提示:
Unencrypted connection refused.Goodbye.
失去了跟主機的連接
解決參考:
"Unencrypted connection refused,Goodbye"
解決辦法:因爲開啓的Telnet server爲/etc/xinetd.d/ekrb5-telnet
所以修改ekrb5-telnet項目disable=yes即可.重啓服務service inetd restart即可.
(2).red hat linux enterprise 5 在從別的機上telnet 過去時出現如下錯誤:
(發出命令爲: telnet 10.x.x.x)
getnameinfo: localhost: Success
Temporary failure in name resolution: Illegal seek
失去了跟主機的連接。
10.200.1.130 clientmachine,但是加了也不行,解決參考如下:
分析原因是red hat 5的用戶認證鑑權方式比較嚴格,且也不能修改Firewall 的設置,只要把 Authentication configuration 裏的一些選項去掉便可。
# setup
選擇 Authentication configuration 去掉一些認證方式,然後再修改Firewall configuration裏設置。