歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu中Telnet的使用

Ubuntu中Telnet的使用

日期:2017/2/28 17:01:43   编辑:Linux教程

首先在Ubuntu中安裝xinetd(它是inetd替代品):

sudo apt-get install xinetd

再安裝telnetd,在Ubuntu中沒有telnetd這個軟件包,它是包含在inetutils-telnetd軟件包中:

sudo apt-get install inetutils-telnetd

在/etc/xinetd.d目錄下新建文件,名稱為telnet,內容為:

# default: off
# description: Telnet service which is the interface of remote access.
# This is the tcp version.I omited the UDP's.

service telnet
(
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/sbin/telnetd
disable = no
}

重新啟動xinetd:

sudo /etc/init.d/xinetd restart

在終端查看telnet服務有沒有打開:

netstat -ta | grep telnet

輸出可能如下:

tcp 0 0 *:telnet *:* LISTEN

說明telnet已啟動.

現在先在本地測試一下

再在Windows平台下測試一下

若只允許在局域網內的機器訪問,則可在/etc/hosts.allow文件中添加所在局域網的IP段地址或網絡組:

# /etc/hosts.allow: list of hosts that are allowed to access the system.
# See the manual pages hosts_access(5) and hosts_options(5).
#
# Example: ALL: LOCAL @some_netgroup
# ALL: .foobar.edu EXCEPT terminalserver.foobar.edu
#
# If you're going to protect the portmapper use the name "portmap" for the
# daemon name. Remember that you can only use the keyword "ALL" and IP
# addresses (NOT host or domain names) for the portmapper, as well as for
# rpc.mountd (the NFS mount daemon). See portmap(8) and rpc.mountd(8)
# for further information.
#

Copyright © Linux教程網 All Rights Reserved