解决ssh中的”Connection closed by 10.0.0.21“问题
2017-12-19 10:18
351 查看
远程的电脑是个新安装的ubuntu,在本地执行ssh时,出现错误”Connection closed by 10.0.0.21“。
解决步骤:
首先保证远程PC的ssh 服务启动,使用命令ps -e | grep ssh查看,出现以下信息说明服务已经开启。
12570 ? 00:00:00 sshd
然后现在命令行中加入 -v,如下
ssh -v ubuntu@10.0.0.21
会出现一系列打印信息:
发现是本地机器将SSH2_MSG_KEXINIT 发送过去后,远程机器断开连接。怀疑是对方的key还未生成,执行命令sudo dpkg-reconfigure openssh-server
出现打印信息如下:
[sudo] password for ubuntu:
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
Creating SSH2 ED25519 key; this may take some time ...
ssh stop/waiting
ssh start/running, process 12683
连接就ok了
参考链接:https://stackoverflow.com/questions/2419412/ssh-connection-stop-at-debug1-ssh2-msg-kexinit-sent
解决步骤:
首先保证远程PC的ssh 服务启动,使用命令ps -e | grep ssh查看,出现以下信息说明服务已经开启。
12570 ? 00:00:00 sshd
然后现在命令行中加入 -v,如下
ssh -v ubuntu@10.0.0.21
会出现一系列打印信息:
ubuntu@ubuntu-ThinkPad-X220:~$ ssh -v ubuntu@10.0.0.21 OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: Applying options for * debug1: Connecting to 10.0.0.21 [10.0.0.21] port 22. debug1: Connection established. debug1: identity file /home/ubuntu/.ssh/id_rsa type 1 debug1: identity file /home/ubuntu/.ssh/id_rsa-cert type -1 debug1: identity file /home/ubuntu/.ssh/id_dsa type -1 debug1: identity file /home/ubuntu/.ssh/id_dsa-cert type -1 debug1: identity file /home/ubuntu/.ssh/id_ecdsa type -1 debug1: identity file /home/ubuntu/.ssh/id_ecdsa-cert type -1 debug1: identity file /home/ubuntu/.ssh/id_ed25519 type -1 debug1: identity file /home/ubuntu/.ssh/id_ed25519-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 pat OpenSSH_6.6.1* compat 0x04000000 debug1: SSH2_MSG_KEXINIT sent Connection closed by 10.0.0.21
发现是本地机器将SSH2_MSG_KEXINIT 发送过去后,远程机器断开连接。怀疑是对方的key还未生成,执行命令sudo dpkg-reconfigure openssh-server
出现打印信息如下:
[sudo] password for ubuntu:
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
Creating SSH2 ED25519 key; this may take some time ...
ssh stop/waiting
ssh start/running, process 12683
连接就ok了
参考链接:https://stackoverflow.com/questions/2419412/ssh-connection-stop-at-debug1-ssh2-msg-kexinit-sent
相关文章推荐
- ssh_exchange_identification: Connection closed by remote host 问题的解决 (转)
- ssh_exchange_identification: Connection closed by remote host 问题的解决
- ssh问题:ssh_exchange_identification: Connection closed by remote host...
- 在Centos 6.6 中ssh出现Connection to localhost closed by remote host的问题排查
- 【OpenStack】SSH登录虚拟机出现"Read from socket failed: Connection reset by peer"问题的解决办法
- 【OpenStack】SSH登录虚拟机出现"Read from socket failed: Connection reset by peer"问题的解决办法
- Cygwin使用SSH出现Connection closed by 127.0.0.1的解决方法
- ssh问题:ssh_exchange_identification: Connection closed by remote host
- ssh无密码登录报错‘Connection closed by ::1’ 问题
- 解决ssh连接提示Connection closed by xx
- telnet mysql时出现:is not allowed to connect to this MySQL serverConnection closed by foreign host问题的解决
- 使用xshell连接服务器问题:ssh_exchange_identification: Connection closed by remote host
- ssh问题:ssh_exchange_identification: Connection closed by remote host
- ssh/scp:ssh_exchange_identification:Connection closed by remote host的问题
- Connection closed by foreign host问题解决
- Cygwin使用SSH出现Connection closed by 127.0.0.1的解决方法
- XShell提示Connection closed by foreign host的问题 和 路由器分配IP的规则
- Connection closed by foreign host.-运营商线路问题导致
- 关于Putty连接Linux出现Network error:Connection reset by peer LINUX问题解决
- Junipor交换机 ssh_exchange_identification: Connection closed by remote host