Telnet 服务

telnet和ssh一样是一种远程登录服务,他们之间有两个最明显的差别:

  • telnet是明文传输,ssh是加密传输;
  • telenet默认端口23,ssh默认端口22;

其他无非是一些协议规格和使用命令的差异。

telnet对于安全性能要求不高的嵌入式系统环境使用比较多。

telnet需要被连接服务器运行telnet服务,客户端主动链接服务端的telnet服务,并通过登录验证。

下面我们介绍在ubuntu系统上安装telnet服务,并通过图形化工具和命令行的telnet客户端连接服务器测试。

安装telnet服务

安装telnetd

ubuntu@ubuntu-virtual-machine:~$ sudo apt-get install telnetd 

安装xinetd

ubuntu@ubuntu-virtual-machine:~$ sudo apt-get install xinetd 

配置并启动telnet服务

ubuntu@ubuntu-virtual-machine:~$ sudo vim /etc/inetd.conf #添加: telnet  stream   tcp   nowait  telnetd  /usr/sbin/tcpd/  /usr/sbin/in.telnetd telnet  stream   tcp   nowait  root     /usr/sbin/tcpd/  /usr/sbin/in.telnetd  ubuntu@ubuntu-virtual-machine:~$ sudo vim /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  ubuntu@ubuntu-virtual-machine:~$ sudo vim /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 #in.telnetd是telnetd安装文件 log_on_failure += USERID }  ubuntu@ubuntu-virtual-machine:~$ sudo systemctl restart xinetd.service # 重启xinetd 

客户端连接telnet

工具登录

有很多ssh工具可以使用图形化工具进行telnet登录。

登录成功,可以像使用本地terminal一样使用终端命令了。

命令行登录

Windows和linux下都支持telnet客户端命令,Windows一般需要到“程序和功能”中手动打开此功能;Linux一般需要安装telnet命令。

其命令格式是一样的:

ubuntu@ubuntu-virtual-machine:~$ telnet 192.168.115.138 23 # 这里23可以省略,如果是其他端口必须写明 Trying 192.168.115.138... Connected to 192.168.115.138. Escape character is '^]'. Ubuntu 20.04.4 LTS ubuntu-virtual-machine login: ubuntu Password: Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.13.0-40-generic x86_64)   * Documentation:  <https://help.ubuntu.com>  * Management:     <https://landscape.canonical.com>  * Support:        <https://ubuntu.com/advantage>  101 updates can be applied immediately. To see these additional updates run: apt list --upgradable  Your Hardware Enablement Stack (HWE) is supported until April 2025. Last login: Wed Apr 27 22:15:35 CST 2022 from 192.168.115.1 on pts/4 ubuntu@ubuntu-virtual-machine:~$ 

版权声明:

作者: freeclashnode

链接: https://www.freeclashnode.com/news/article-997.htm

来源: FreeClashNode

文章版权归作者所有,未经允许请勿转载。

免费节点实时更新

热门文章

最新文章

归档