Unable to connect to remote host: Connection refused

时间:2024-03-16 10:58:30

从虚拟机telnet到开发板的时候出现错误:Unable to connect to remote host: Connection refused

Unable to connect to remote host: Connection refused

上网查阅得知 刚安装的Ubuntu 12.04还没有telnet功能,需要配置一下。开启telnet服务做服务器。

1、首先查看telnet运行状态#netstat -a | grep telnet输出为空,表示没有开启该服务

2、安装telnet

  • sudo apt-get install telnetd-ssl
  • sudo apt-get install telnetd
  • sudo apt-get install xinetd

telnet 与 xinetd 的关系:xinetd是新一代的网络守护进程服务程序,telnet进程由xinetd守护。

cat /etc/inetd.conf  | grep telnet 

Unable to connect to remote host: Connection refused

3、修改xinetd和telnet配置文件

1) sudo vim /etc/xinetd.conf

        instances = 60
        log_type = SYSLOG authpriv
        log_on_success = HOST PID
        log_on_failure = HOST
        cps = 25 3

Unable to connect to remote host: Connection refused
includedir /etc/xinetd.d

2)增加/修改 sudo vim /etc/xinetd.d/telnet
Ubuntu 12.04 默认不存在该文件。
      # default: on
      # description: The telnet server serves telnet sessions; it uses \
      # unencrypted username/password pairs for authentication.
        service telnet 
       {
         disable = no  
         Instance =UNLIMITED 
         Nice =0
         flags = REUSE
         socket_type = stream
         wait = no
         user = root
         server = /usr/sbin/in.telnetd
         log_on_failure += USERID
        }

Unable to connect to remote host: Connection refused

重启xinetd服务

Unable to connect to remote host: Connection refused

然后,开发板也需要打开telnet,在/etc/init.d/rcS文件中增加telnetd&,然后重启

Unable to connect to remote host: Connection refused

现在可以telnet到开发板了 telnet 192.168.1.10登录 

输入root 直接回车不需要密码

Unable to connect to remote host: Connection refused