[root@localhost ~]# telnet 服務器 IP
#連接并管理遠程服務器,因為數據明文傳輸,所以不安全
[root@localhost ~]# telnet 服務器IP 端口
#測試遠程服務器的端口是否開啟。如果能夠正常連接,則證明該端口是開啟的
[root@localhost ~]# telnet 192.168.0.210 22
#測試一下192.168.0.210這臺服務器上的22(ssh服務)端口是否打開
#連接成功后,退出時使用"Ctrl+]"快捷鍵回到telnet交互模式,再輸入"quit"退出
[root@localhost ~]#rpm-ivh/mnt/cdroin/Packages/telnet-server-0.17-47.el6.i686.rpm
[100%]
###############
Preparing...
1:telnet-server
###############
[100%]
#安裝
[root@localhost ~]# chkconfig -list
#安裝之后查詢一下
…省略部分輸出...
基于xinetd的服務:
chargen-dgram:關閉
chargen-stream:關閉
cvs:關閉
daytime-dgram:關閉
daytime-stream:關閉
discard-dgram:關閉
discard-stream:關閉
echo-dgram:關閉
echo-stream:關閉
rsync:關閉
tcpmux-server:關閉
telnet:關閉
time-dgram:關閉
time-stream:關閉
#Telnet服務已經安裝,是基于xinetd的服務,自啟動狀態是關閉
[root@localhost ~]#vi /etc/xinetd.d/telnet
#default: on
#description: The telnet server serves telnet sessions; it uses /
#unencrypted username/password pairs for authentication.
service telnet
#服務的名稱為telnet
{
flags = REUSE
#標志為REUSE,設定TCP/IP socket可重用
socketjtype = stream
#使用 TCP協議數據包
wait = no
#允許多個連接同時連接
user = root
#啟動服務的用戶為root
server = /usr/sbin/in.telnetd
#服務的啟動程序
log_on_failure += USERID
#登錄失敗后,記錄用戶的ID
disable = yes
#服務不啟動
}
[root@localhost ~]#vi /etc/xinetd.d/telnet
#修改配置文件
service telnet {
…省略部分輸出…
disable = no
#把 yes 改為no
}
[root@localhost ~]# service xinetd restart
#重啟xinetd服務
停止 xinetd:
[確定]
正在啟動xinetd:
[確定]
[root@localhost ~]# netstat -tlun|grep 23
tcp 0 0 :::23 :::* LISTEN
#查看端口,23端口啟動,表示Telne服務已經啟動了
[root@localhost ~]# chkconfig 服務名 on|off
#基于xinetd的服務沒有自己的運行級別,而依靠xinetd服務的運行級別,所以不用指定--level選項
[root@localhost ~]# chkconfig telnet on
#啟動Telnet服務的自啟動
[root@localhost ~]# chkconfig --list|grep telnet
telnet:啟用
#查看服務的自啟動,Telnet服務變為了"啟用"
[root@localhost ~]# chkconfig telnet off
#關閉Telnet服務的自啟動
[root@localhost ~]# chkconfig --list|grep telnet
telnet:關閉
#查看服務的自啟動,Telnet服務變為了 "關閉"
[root@localhost ~]# vi /etc/xinetd.d/telnet service telnet
{
disable = yes
...省略部分輸出...
}
[root@localhost ~]# service xinetd restart
停止xinetd: [確定]
正在啟動xinetd: [確定】
[root@localhost ~]# chkconfig telnet off
#先關閉Telnet服務的啟動和自啟動,保證不會對后面的實驗產生影響
[root@localhost ~]# vi /etc/xinetd.d/telnet service telnet
{
disable = no
...省略部分輸出...
}
[root@localhost ~]# service xinetd restart
停止xinetd: [確定]
正在啟動xinetd: [確定】
#然后啟動Telnet服務
[root@localho.st ~] # chkconfig --list | grep telnet
telnet:啟用
#看到了嗎?我們一開始已經把Telnet服務的自啟動關閉了。后面的實驗雖然只啟動了#Telnet服務,但是該服務自動變為了自啟動狀態
新聞熱點
疑難解答