Ubuntu16.04 下安装telnet服务并用SecureCRT链接

1、安装inetd服务:

sudo apt-get install openbsd-inetd

2、安装telnetd服务:

sudo apt-get install xinetd telnetd

3、打开inetd.conf文件并在末尾加入一行配置:

sudo vi /etc/inetd.conf

telnet stream tcp nowait telnetd /usr/sbin/tcpd /usr/sbin/in.telnetd

4、修改 xinetd配置文件:

kangruojin@kangruojin:~$ sudo cat /etc/xinetd.conf
# Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/

defaults
{

# Please note that you need a log_type line to be able to use log_on_success
# and log_on_failure. The default is the following :
# log_type = SYSLOG daemon info
instances = 60
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30

}

includedir /etc/xinetd.d
kangruojin@kangruojin:~$ 

5、在xinetd.d的管理目录下新建文件,对telnet服务进行配置:

kangruojin@kangruojin:~$ cat /etc/xinetd.d/telnet    
# default: on
# description: The telnet server serves telnet sessions;it uses
# unencrypted username/password pairs for authentication.
service telnet
{
        disable = no
        flags = REUSE
        socket_type = stream
        wait = no
        user = root
        server = /usr/sbin/in.telnetd
        log_on_failure += USERID
}

kangruojin@kangruojin:~$ 

6、重启网卡和相关服务(不行的话重启系统),确保配置生效,服务启动:

$sudo service inetd restart

$sudo service xinetd restart

$sudo service networking restart

$sudo reboot     #或者重启

7、重启后查看telnet服务是否启动,通过SecureCRT连接并显示中文:

SecureCRT设置:Options-->Session Options-->Appearance-->Character encoding:UTF-8

Ubuntu 16.04.6 LTS
kangruojin login: kangruojin
Password: 
Last login: Fri Mar 29 21:31:59 CST 2019 from 192.168.80.1 on pts/4
Welcome to Ubuntu 16.04.6 LTS (GNU/Linux 4.15.0-46-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

21 个可升级软件包。
9 个安全更新。

kangruojin@kangruojin:~$ ls
examples.desktop  S3C2440  vmware-tools-patches  公共的  模板  视频  图片  文档  下载  音乐  桌面
kangruojin@kangruojin:~$ 

kangruojin@kangruojin:~$ netstat -a | grep telnet
tcp        0      0 *:telnet                *:*                     LISTEN

#服务已经启动,处于LISTEN(监听23)状态
tcp        0      2 192.168.80.99:telnet    192.168.80.1:9065       ESTABLISHED

#有telnet客户端连接,处于ESTABLISHED(通信)状态
kangruojin@kangruojin:~$

参考Blog:ubuntu 下安装配置 telnet server服务

你可能感兴趣的:(Linux使用与操作系统原理,环境配置与错误处理)