原文网址:Ubuntu之apt-get--安装telnet--方法/教程_IT利刃出鞘的博客-CSDN博客

简介

本文介绍Ubuntu如何安装telnet。

telnet服务说明

在安装telnet之前,有必要进行说明下:

在数据传输时,telnet采用明文传输,如果是远程使用特别是通过跨局域网使用时,要注意网络安全。如果要远程操作,强烈建议使用ssh服务,它具有加密功能。telnet一般用在不需要注意网络安全如局域网中使用。

安装步骤

1、安装xinetd

sudo apt-get install xinetd  

2、安装telnet守护进程

sudo apt-get install telnetd  

3、修改配置文件

sudo vi /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  
  # start the insert content  
  # if I have time, I will add some comments about this part.  
  instances =60  
  log_type = SYSLOG authpriv  
  log_on_success = HOST PID  
  log_on_failure = HOST  
  cps = 25 30  
  # end the insert content  
}  
includedir /etc/xinetd.d  

 检查无误后保存退出。

关于上述内容的说明:

  1. instances = 60:表示最大连接进程数为60个。
  2. log_type = SYSLOG daemon info:表示使用syslog进行服务登记。
  3. log_on_success= HOST PID:表示设置成功后记录客户机的IP地址的进程ID。
  4. log_on_failure = HOST:表示设置失败后记录客户机的IP地址。
  5. cps = 25 30:表示每秒25个入站连接,如果超过限制,则等待30秒。主要用于对付      拒绝服务攻击。
  6. includedir /etc/xinetd.d:表示告诉xinetd要包含的文件或目录是/etc/xinetd.d。

4、添加telnet配置

注意:/etc/xinetd.d/目录下是没有telnet文件的,因此,需要     先建立该文件,再添加配置信息。

sudo vi /etc/xinet.d/telnet  

telnet配置信息如下所示:

service telnet  
{  
  disable = no  
  flags = REUSE  
  socket_type = stream  
  wait = no  
  user = root  
  server = /usr/sbin/in.telnetd  
  log_on_failure += USERID  
}  

关于上述内容的说明:

  1. disable = no:表示启用这个服务。
  2. socket_type = stream:表示服务的数据包类型为stream。
  3. wait = no:表示不需等待,即服务将以多线程的方式运行。
  4. user = root:表示执行此服务进程的用户是root。
  5. server = /usr/bin/in.telnetd:启动程序的位置。
  6. log_on_failure += USERID:表示设置失败时,在/etc/xinetd.conf中设置的         default值基础之上还把UID添加到系统登记表。

5、重启服务

sudo /etc/init.d/xinetd restart 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐