ssh 连接停止于 "debug1: SSH2_MSG_KEXINIT sent"

标签 ssh

我已将 ssh 端口号从 22 更改为 2222 之前设置的默认 ssh 端口 22 的连接没问题 我已正确映射路由器上的 NAT

当我尝试调试它时

ssh -v -p2222 www.example.com

我遇到此错误

debug1: SSH2_MSG_KEXINIT

以下是所有调试日志

bob@server:~$ ssh -v -p2222 www.example.com
OpenSSH_4.7p1 Debian-8ubuntu1.2, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to www.example.com [100.100.100.100] port 2222.
debug1: Connection established.
debug1: identity file /home/bob/.ssh/identity type -1
debug1: identity file /home/bob/.ssh/id_rsa type -1
debug1: identity file /home/bob/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.7p1 Debian-8ubuntu1.2
debug1: match: OpenSSH_4.7p1 Debian-8ubuntu1.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.7p1 Debian-8ubuntu1.2
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 100.100.100.100

就像连接关闭一样 我在网络内外的几台机器上使用了 gnome-terminal、putty、securecrt 仍然出现相同的错误

最佳答案

我刚刚在 XEN 主机上发生了这种情况。我从另一个主机复制了这个主机,按照惯例,我在执行此操作后删除了/etc/ssh 中的主机 key ,认为稍后会生成新的主机 key 。但这从未发生过,并且 sshd 在没有主机 key 的情况下愉快地启动了。当尝试 ssh 到该主机时,它会在 SSH2_MSG_KEXINIT 之后退出。我所要做的就是创建主机 key ,在基于 debian 的机器上是这样完成的:

dpkg-reconfigure openssh-server

关于ssh 连接停止于 "debug1: SSH2_MSG_KEXINIT sent",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2419412/

相关文章:

go - 如何使用 Go 的 ssh 包创建 socks5 隧道?

ubuntu - 在 Amazon ec2 Ubuntu 服务器上挂载和外部硬盘驱动器

mysql - 如何从mysql控制台导出数据库

mysql - 每 1 小时自动通过 SSH 隧道对远程 mysql 服务器运行一次 select 语句

docker - 轻松访问 Windows Docker 容器上的文件

php - 在 Composer 中使用 --prefer-dist 会导致找不到,但是可以找到源

firefox - 将脚本制作成 SSH 的最佳方法?

git - OpenShift Jenkins git clone 失败 : Host key verification failed

linux - 使用 Net::Telnet ssh 进入 linux

perl - 创建 perl 脚本来远程连接到另一台服务器并读取文件?