在我安装zsh来装饰我的终端之前,它工作得很好。事实上,我不知道这是否造成了问题。
我收到一个错误: ssh_exchange_identification:远程主机关闭的连接
➜ ssh test_ssh
ssh_exchange_identification: Connection closed by remote host
➜ ssh -v test_ssh
OpenSSH_7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /Users/mike/.ssh/config
debug1: /Users/mike/.ssh/config line 34: Applying options for test_ssh
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: /etc/ssh/ssh_config line 52: Applying options for *
debug1: Connecting to 15.164.49.113 port 7779.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /Users/mike/.ssh/key/admin.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/mike/.ssh/key/admin.pem-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6
debug1: ssh_exchange_identification: HTTP/1.1 400 Bad Request发布于 2019-06-17 07:57:21
在我自己的例子中,当我尝试从我的MacBook终端直接登录到VPS时,我可以从ssh登录并得到这个错误。
如何解决此错误ssh_exchange_identification:远程主机关闭的连接
(当您在VPS上创建新用户时,总是会发生这种情况。您将得到此错误,因为您只有root的ssh配置,而不是新用户)
mac终端上的类型为$ cd ~/..ssh
现在~/.ssh create a config file with the following content: $ nano配置
然后复制这个
Host *
ForwardAgent no
ForwardX11 no
ForwardX11Trusted yes
User shapeshed
Port 22
Protocol 2保存和退出
类型
$ ls结果
authorized_keys id_rsa id_rsa1.pub config id_rsa.pub known_hosts
$ cat id_rsa.pub (在macOS终端上查看您的公钥)
复制您的mac os终端公钥和contr X以退出(如果您也使用纳米文本编辑器)
现在,在您的VPS(远程服务器)上,确保您在新用户创建时登录。
用户@.非根
$ cd ~/.ssh
$ ls注意你刚刚
authorized_keys known_hostsas你的结果..。没有公开密钥让VPS识别从您的计算机上登录现在让我们在VPS上创建新的id_rsa.pub
$ nano id_rsa.pub粘贴您的mac os id_rsa.pub您复制,保存和退出。
类型
$ ssh -vvv user@**.**.**.** 用您的IP替换**,然后看到您的VPS从您的终端登录,而不需要密码。
bazzlylinksSolution
https://stackoverflow.com/questions/55934198
复制相似问题