本文介绍如何在常用的Ubuntu和CentOS中安装telnet服务器。
在Ubunut中安装telnet服务器
Ubuntu自带telnet客户端,但是没有telnet服务器。
安装telnet服务器的步骤:
$ sudo apt install telnetd
$ sudo apt install xinetd
然后运行:
$sudo service xinetd status
● xinetd.service - LSB: Starts or stops the xinetd daemon.
Loaded: loaded (/etc/init.d/xinetd; generated)
Active: active (running) since Mon 2019-07-22 15:15:46 CST; 4s ago
Docs: man:systemd-sysv-generator(8)
Tasks: 1 (limit: 2287)
CGroup: /system.slice/xinetd.service
└─3541 /usr/sbin/xinetd -pidfile /run/xinetd.pid -stayalive -inetd_compat -i
Jul 22 15:15:46 ubuntu xinetd[3541]: Reading included configuration file: /etc/xinetd.d
Jul 22 15:15:46 ubuntu xinetd[3541]: Reading included configuration file: /etc/xinetd.d
Jul 22 15:15:46 ubuntu xinetd[3541]: Reading included configuration file: /etc/xinetd.d
Jul 22 15:15:46 ubuntu xinetd[3541]: Reading included configuration file: /etc/xinetd.d
Jul 22 15:15:46 ubuntu xinetd[3541]: Reading included configuration file: /etc/xinetd.d
Jul 22 15:15:46 ubuntu xinetd[3541]: Reading included configuration file: /etc/xinetd.d
Jul 22 15:15:46 ubuntu xinetd[3541]: Reading included configuration file: /etc/xinetd.d
Jul 22 15:15:46 ubuntu xinetd[3541]: added service telnet [file=/etc/inetd.conf] [line=23]
Jul 22 15:15:46 ubuntu xinetd[3541]: 2.3.15.3 started with libwrap loadavg labeled-netw
Jul 22 15:15:46 ubuntu xinetd[3541]: Started working: 1 available service
看到红色的那一行,就说明telnet服务器已经运行起来了。
默认端口号是标准的23号,通过ps查看进程,只能看到xinetd进程,看不到telnet进程。
在CentOS中安装telnet服务器
CentOS默认连telnet客户端都没有。
$ sudo yum install telnet telnet-server xinetd
然后启动telnet服务器:
$ sudo service telnet.socket start
$sudo service xinetd start
CentOS的telnet服务器运行起来后,用telnet客户端登录(必须配置firewall-cmd,打开23号端口),有bash可以使用。
最后,有两篇文章您可能需要: