Blogger Information
Blog 60
fans 0
comment 0
visits 66656
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
【Telnet】Telnet安装与配置
大宝
Original
1458 people have browsed it

一、参考链接

阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区

telnet-server-0.17-66.el7.x86_64.rpm

telnet-0.17-66.el7.x86_64.rpm

二、Telnet介绍

Telnet是一种应用层协议,使用于互联网及局域网中,使用虚拟终端的形式,提供双向、以文字字符串为主的命令行接口交互功能。属于TCP/IP协议族的其中之一,是互联网远程登录服务的标准协议和主要方式,常用于服务器的远程控制,可供用户在本地主机执行远程主机上的工作。

三、Telnet安装与配置

<font color=red>本实验基于CentOS 7.9 系统进行操作演示。</font>

  1. [root@master ~]# cat /etc/redhat-release
  2. CentOS Linux release 7.9.2009 (Core)

1 、查询telnet相关服务组件是否已安装

查询telnet-server、telnet-client、xinetd等服务组件是否安装。

查询得知,xinetd、telnet和telnet-server未安装。

  1. [root@master ~]# rpm -qa | grep telnet
  2. [root@master ~]# rpm -qa | grep xinetd
  3. [root@master ~]# yum list | grep telnet
  4. telnet.x86_64 1:0.17-66.el7 updates
  5. telnet-server.x86_64 1:0.17-66.el7 updates
  6. [root@master ~]# yum list | grep xinetd
  7. xinetd.x86_64 2:2.3.15-14.el7 base

xinetd 是 Linux 系统的超级守护进程,长期驻存于后台,并监听来自网络的请求,从而启动对应的服务。而 telnet 正是 xinetd 管辖的服务之一。

2、查询YUM源中是否提供telnet相关组件

查看一下所配置的YUM源内是否提供了telnet相关的安装包

<font color=red>yum provides telnet telnet-server xinetd</font>

  1. [root@master ~]# yum list | grep telnet && yum list | grep xinetd
  2. telnet.x86_64 1:0.17-66.el7 updates
  3. telnet-server.x86_64 1:0.17-66.el7 updates
  4. xinetd.x86_64 2:2.3.15-14.el7 base
  5. [root@master ~]#

3、安装telnet相关服务组件

包含telnet、telnet-server、xinetd服务组件

<font color=red>yum install -y xinetd telnet telnet-server</font>

  1. # 执行此命令进行安装
  2. yum install -y xinetd telnet telnet-server

image-20220222113450796

4、查询是否安装完成

<font color=red>yum list | grep telnet && yum list | grep xinetd</font>

  1. # 执行此命令查询,带@符号的表示已安装。
  2. [root@master ~]# yum list | grep telnet && yum list | grep xinetd
  3. telnet.x86_64 1:0.17-66.el7 @updates
  4. telnet-server.x86_64 1:0.17-66.el7 @updates
  5. xinetd.x86_64 2:2.3.15-14.el7 @base
  1. # 参考链接:https://www.cnblogs.com/gengbo/p/15913541.html
  2. # 查询所有已安装的软件信息
  3. [root@master ~]# rpm -qa telnet telnet-server xinetd
  4. xinetd-2.3.15-14.el7.x86_64
  5. telnet-server-0.17-66.el7.x86_64
  6. telnet-0.17-66.el7.x86_64
  7. # 显示详细信息
  8. [root@master ~]# rpm -qi telnet-server
  9. Name : telnet-server
  10. Epoch : 1
  11. Version : 0.17
  12. Release : 66.el7
  13. Architecture: x86_64
  14. Install Date: Tue 22 Feb 2022 11:34:33 AM CST
  15. Group : System Environment/Daemons
  16. Size : 56361
  17. License : BSD
  18. Signature : RSA/SHA256, Wed 18 Nov 2020 10:20:43 PM CST, Key ID 24c6a8a7f4a80eb5
  19. Source RPM : telnet-0.17-66.el7.src.rpm
  20. Build Date : Tue 17 Nov 2020 12:44:28 AM CST
  21. Build Host : x86-01.bsys.centos.org
  22. Relocations : (not relocatable)
  23. Packager : CentOS BuildSystem <http://bugs.centos.org>
  24. Vendor : CentOS
  25. URL : http://web.archive.org/web/20070819111735/www.hcs.harvard.edu/~dholland/computers/old-netkit.html
  26. Summary : The server program for the Telnet remote login protocol
  27. Description :
  28. Telnet is a popular protocol for logging into remote systems over the
  29. Internet. The package includes a daemon that supports Telnet remote
  30. logins into the host machine. The daemon is disabled by default.
  31. You may enable the daemon by editing /etc/xinetd.d/telnet
  32. # 显示所有文件列表
  33. [root@master ~]# rpm -ql telnet telnet-server xinetd
  34. /usr/bin/telnet
  35. /usr/share/doc/telnet-0.17
  36. /usr/share/doc/telnet-0.17/README
  37. /usr/share/man/man1/telnet.1.gz
  38. /usr/lib/systemd/system/telnet.socket
  39. /usr/lib/systemd/system/telnet@.service
  40. /usr/sbin/in.telnetd
  41. /usr/share/man/man5/issue.net.5.gz
  42. /usr/share/man/man8/in.telnetd.8.gz
  43. /usr/share/man/man8/telnetd.8.gz
  44. /etc/sysconfig/xinetd
  45. /etc/xinetd.conf
  46. /etc/xinetd.d/chargen-dgram
  47. /etc/xinetd.d/chargen-stream
  48. /etc/xinetd.d/daytime-dgram
  49. /etc/xinetd.d/daytime-stream
  50. /etc/xinetd.d/discard-dgram
  51. /etc/xinetd.d/discard-stream
  52. /etc/xinetd.d/echo-dgram
  53. /etc/xinetd.d/echo-stream
  54. /etc/xinetd.d/tcpmux-server
  55. /etc/xinetd.d/time-dgram
  56. /etc/xinetd.d/time-stream
  57. /usr/lib/systemd/system/xinetd.service
  58. /usr/sbin/xinetd
  59. /usr/share/doc/xinetd-2.3.15
  60. /usr/share/doc/xinetd-2.3.15/CHANGELOG
  61. /usr/share/doc/xinetd-2.3.15/COPYRIGHT
  62. /usr/share/doc/xinetd-2.3.15/README
  63. /usr/share/doc/xinetd-2.3.15/empty.conf
  64. /usr/share/doc/xinetd-2.3.15/sample.conf
  65. /usr/share/man/man5/xinetd.conf.5.gz
  66. /usr/share/man/man5/xinetd.log.5.gz
  67. /usr/share/man/man8/xinetd.8.gz

5、启动telnet相关服务

执行命令,开启服务,并设置开机自启动。

  1. systemctl start telnet.socket xinetd
  2. systemctl enable telnet.socket xinetd
  3. systemctl status telnet.socket xinetd

6、查看服务监听端口

  1. [root@master ~]# netstat -tnl |grep 23
  2. tcp6 0 0 :::23 :::* LISTEN
  3. [root@master ~]# ss -tunpl | grep 23
  4. tcp LISTEN 0 128 [::]:23 [::]:* users:(("systemd",pid=1,fd=33))
  5. [root@master ~]#

四、Telnet远程连接测试

1、创建用户xybdiy

  1. [root@master ~]# useradd xybdiy
  2. [root@master ~]# passwd xybdiy
  3. Changing password for user xybdiy.
  4. New password:
  5. BAD PASSWORD: The password is a palindrome
  6. Retype new password:
  7. passwd: all authentication tokens updated successfully.

2、使用xybdiy用户telnet登录

  1. telnet 192.168.200.11
  2. Kernel 3.10.0-1160.53.1.el7.x86_64 on an x86_64
  3. master login: xybdiy
  4. Password:
  5. [xybdiy@master ~]$ su -
  6. Password:
  7. Last login: Tue Feb 22 12:39:35 CST 2022 on pts/1
  8. Last failed login: Tue Feb 22 12:52:02 CST 2022 on pts/2
  9. There was 1 failed login attempt since the last successful login.
  10. [root@master ~]#

3、设置允许ROOT用户Telnet登录

参考链接telnet允许root用户登录 - 规格严格-功夫到家 - 博客园

  1. 1️⃣# 修改login文件
  2. vim /etc/pam.d/login
  3. 注释这一行文件
  4. #account required pam_nologin.so
  5. 按:wq保存退出。
  6. 2️⃣# 注释掉securetty文件
  7. mv /etc/securetty /etc/securetty.bak
  1. C:\Users\xybdiy>telnet 192.168.200.11
  2. Kernel 3.10.0-1160.53.1.el7.x86_64 on an x86_64
  3. master login: root
  4. Password:
  5. Last failed login: Tue Feb 22 13:59:24 CST 2022 from ::ffff:192.168.200.2 on pts/1
  6. There was 1 failed login attempt since the last successful login.
  7. Last login: Tue Feb 22 13:45:55 on pts/2
  8. [root@master ~]#
  1. [root@master ~]# telnet localhost
  2. Trying ::1...
  3. Connected to localhost.
  4. Escape character is '^]'.
  5. Kernel 3.10.0-1160.53.1.el7.x86_64 on an x86_64
  6. master login: root
  7. Password:
  8. Last login: Tue Feb 22 14:11:49 from ::ffff:192.168.200.2
  9. [root@master ~]#
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post