无法从某台特定计算机通过 SSH 进入服务器(连接已关闭/未收到身份验证字符串)

无法从某台特定计算机通过 SSH 进入服务器(连接已关闭/未收到身份验证字符串)

我使用 ssh 访问最近用 16.04 设置的服务器时遇到了问题,但只能从特定计算机(我的笔记本电脑)访问。当我运行 时ssh -vvv -p sshPort user@host,我得到了以下输出:

OpenSSH_7.2p2 Ubuntu-4, OpenSSL 1.0.2g-fips  1 Mar 2016
debug1: Reading configuration data /home/user/.ssh/config
debug1: /home/user/.ssh/config line 1: Applying options for *
debug1: /home/user/.ssh/config line 35: Applying options for host
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "host" port xxxx
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to host [xxx.xxx.xxx.xxx] port xxxx.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_rsa type 1                                                                                                                                        
debug1: key_load_public: No such file or directory                                                                                                                                            
debug1: identity file /home/user/.ssh/id_rsa-cert type -1                                                                                                                                  
debug1: key_load_public: No such file or directory                                                                                                                                            
debug1: identity file /home/user/.ssh/id_dsa type -1                                                                                                                                       
debug1: key_load_public: No such file or directory                                                                                                                                            
debug1: identity file /home/user/.ssh/id_dsa-cert type -1                                                                                                                                  
debug1: key_load_public: No such file or directory                                                                                                                                            
debug1: identity file /home/user/.ssh/id_ecdsa type -1                                                                                                                                     
debug1: key_load_public: No such file or directory                                                                                                                                            
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1                                                                                                                                
debug1: key_load_public: No such file or directory                                                                                                                                            
debug1: identity file /home/user/.ssh/id_ed25519 type -1                                                                                                                                   
debug1: key_load_public: No such file or directory                                                                                                                                            
debug1: identity file /home/user/.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-4
ssh_exchange_identification: Connection closed by remote host

在服务器端,/var/log/auth.log只有以下条目:

Apr 28 18:50:49 host sshd[2618]: Did not receive identification string from yyy.yyy.yyy.yyy

到目前为止,我还无法弄清楚为什么会发生这种情况,我愿意听取建议。我排除了一些可能性:

不是端口转发/防火墙配置问题:我可以从远程 VPS 登录到此主机,因此从 WAN 访问正常。我还可以从同一 LAN 上的另一台主机 ssh 登录。

这不是 fail2ban/denyhosts 的问题:这是新安装,尚未配置自动禁止软件。 /etc/hosts.deny/etc/hosts.allow均为空。SSH 配置是 16.04 附带的默认配置。

不是 SSH 代理:我可以从我的笔记本电脑通过代理转发 SSH 进入其他主机,然后从那里通过 SSH 进入我遇到问题的主机。

我最近在笔记本电脑上安装了 kvm 和 bridge-utils。我看到有人提到 bridge-utils 可能存在问题,但我对此表示怀疑,因为 ssh 在其他主机上运行良好。

任何帮助将不胜感激!

答案1

我已经解决了这个问题。虽然我仍然不确定根本原因,但看来更改路由器转发的端口已经解决了问题。我所在的端口可能已被另一条转发规则使用,或被路由器保留使用。

相关内容