我尝试研究类似的问题,但没有一个解决方案可以帮助我的问题。
我在 Ubuntu 16.04 LTS 上的 Virtualbox 上使用 Hortonworks HDP 2.6.5 沙箱。 Hortonworks 正在运行,VirtualBox 上显示以下内容:
按照说明,我使用 localhost 上的 4200 端口通过以下命令进行 ssh:
ssh [user]@127.0.0.1 -p 4200
这导致我出现以下错误:
ssh_exchange_identification: Connection closed by remote host
我尝试调试,得到以下日志:
OpenSSH_7.2p2 Ubuntu-4ubuntu2.4, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 4200.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/mahsa/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/mahsa/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/mahsa/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/mahsa/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/mahsa/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/mahsa/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/mahsa/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/mahsa/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.4
debug1: ssh_exchange_identification: HTTP/1.1 400 Bad Request
如果有人可以帮助解决这个问题,我将不胜感激。
谢谢
最佳答案
HDP Sandbox 控制台中打印的有关 SSH 访问的说明具有误导性。端口 4200 对于使用浏览器使用 HTTP 协议(protocol)进行 shell 访问非常有用,因此不适用于命令行 ssh。请注意日志末尾的“HTTP/1.1 400 Bad Request”错误消息。尝试使用端口 2222,如下所示:
提示> ssh root@localhost -p 2222
关于ubuntu - Ubuntu 上的 Hortonworks SSH 问题 : ssh_exchange_identification: Connection closed by remote host,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52764029/