我终于从 ISP 获得了公共 IP,并且我正在尝试通过互联网设置 SSH 服务器,以便可以连接到我的计算机。当我从本地网络连接时,完全没有问题,但当我从互联网连接时,我收到以下消息:
[oliver@brick ~]$ ssh -v oliver@{IP}
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf
debug1: /etc/ssh/ssh_config.d/05-redhat.conf line 2: include /etc/crypto-policies/back-ends/openssh.config matched no files
debug1: /etc/ssh/ssh_config.d/05-redhat.conf line 8: Applying options for *
debug1: Connecting to {IP} [{IP}] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/oliver/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/oliver/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/oliver/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/oliver/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/oliver/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/oliver/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/oliver/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/oliver/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version dropbear_0.51
debug1: no match: dropbear_0.51
debug1: Authenticating to {IP}:22 as 'oliver'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: (no match)
Unable to negotiate with {IP} port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
我还尝试将 diffie-hellman-group1-sha1 指定为密钥交换方法,然后连接,但在要求输入密码后,它说权限被拒绝,即使我知道我输入了正确的密码。但我不明白出了什么问题,因为如果我在客户端和服务器上运行 ssh -Q kex,它们都有不止一种匹配的密钥交换方法,它不应该与本地连接相同吗?当然,我已将路由器配置为转发端口 22。我已在多台计算机上尝试过此操作,并使用不同的计算机作为服务器和客户端。我根本没有配置 sshd_config 。怎么了?我在尝试过的计算机上运行 Arch Linux 和 Fedora,但我也尝试过使用 Android 手机进行连接
答案1
我的路由器还运行着 SSH 服务器,因此客户端正在尝试连接到该服务器。我只是使用另一个端口进行转发并且它有效。感谢 user4556274 通过阅读调试输出来解决这个问题,该输出显示我正在连接到 dropbear 服务器,而不是我正在运行的 OpenSSH 服务器