首先在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.
#