我已将 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/