SSH 密钥的奇怪 SSH 问题

use*_*393 1 linux ssh

我在使用 ssh 时遇到了一个奇怪的问题。我得到一个

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
Run Code Online (Sandbox Code Playgroud)

每次我连接到服务器。然后我清除了 known_hosts 文件并再次连接。2 到 3 分钟后,我再次访问服务器,然后WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!又来了。ssh 连接在连接后自动中止。我确信我的 IP 和 ssh 密钥没有改变。我已经检查了服务器并且 id_rsa 和 id_rsa.pub 密钥都没有改变。我的服务器也变得很慢。此外,我已经针对同步攻击调整了我的服务器,但仍然没有结果。谁能帮我?


问题仍然存在。托管公司告诉我网络没有任何问题。当 ssh 连接由于这个奇怪的问题而终止时,实际上用户并没有退出。当我使用 ssh 进入一个新会话时,我可以通过键入 W 命令看到旧用户仍然登录。如果这个用户也断开连接,当我重新登录时,我可以看到 3 个用户登录,这意味着用户不会被注销。

这些是服务器断开连接时的日志

Jul 31 10:28:33 cl-t229-203cl sshd[2082]: debug1: Forked child 6551.
Jul 31 10:28:33 cl-t229-203cl sshd[6551]: Set /proc/self/oom_score_adj to 0
Jul 31 10:28:33 cl-t229-203cl sshd[6551]: debug1: rexec start in 5 out 5 newsock 5 pipe 7 sock 8
Jul 31 10:28:33 cl-t229-203cl sshd[6551]: debug1: inetd sockets after dupping: 3, 3
Jul 31 10:28:33 cl-t229-203cl sshd[6551]: Connection from 173.45.65.243 port 56944
Jul 31 10:28:33 cl-t229-203cl sshd[6551]: debug1: Client protocol version 2.0; client software version OpenSSH_5.3
Jul 31 10:28:33 cl-t229-203cl sshd[6551]: debug1: match: OpenSSH_5.3 pat OpenSSH*
Jul 31 10:28:33 cl-t229-203cl sshd[6551]: debug1: Enabling compatibility mode for protocol 2.0
Jul 31 10:28:33 cl-t229-203cl sshd[6551]: debug1: Local version string SSH-2.0-OpenSSH_5.3
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: permanently_set_uid: 74/74
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: list_hostkey_types: ssh-rsa
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: SSH2_MSG_KEXINIT sent
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: SSH2_MSG_KEXINIT received
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: kex: client->server aes128-ctr hmac-md5 none
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: kex: server->client aes128-ctr hmac-md5 none
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: SSH2_MSG_NEWKEYS sent
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: expecting SSH2_MSG_NEWKEYS
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: SSH2_MSG_NEWKEYS received
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: KEX done
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: userauth-request for user root service ssh-connection method none
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: attempt 0 failures 0
Jul 31 10:28:33 cl-t229-203cl sshd[6551]: debug1: PAM: initializing for "root"
Jul 31 10:28:33 cl-t229-203cl sshd[6551]: debug1: PAM: setting PAM_RHOST to "173.45.65.243"
Jul 31 10:28:33 cl-t229-203cl sshd[6551]: debug1: PAM: setting PAM_TTY to "ssh"
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: userauth-request for user root service ssh-connection method keyboard-interactive
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: attempt 1 failures 0
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: keyboard-interactive devs
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: auth2_challenge: user=root devs=
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: kbdint_alloc: devices 'pam'
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: debug1: auth2_challenge_start: trying authentication method 'pam'
Jul 31 10:28:33 cl-t229-203cl sshd[6552]: Postponed keyboard-interactive for root from 173.45.65.243 port 56944 ssh2
Run Code Online (Sandbox Code Playgroud)

Mad*_*ter 6

断开连接(TCP 流去同步)和密钥更改的组合非常强烈地表明您有两个具有相同 IP 地址的设备。这台服务器是在你的局域网上,还是你通过路由器访问的东西?

编辑:我肯定会向托管公司提出这个问题。可能有人误解了地址分配,或者/etc/sysconfig/network-scripts/ifcfg-eth0(或操作系统等效文件)中存在拼写错误,或者托管公司已经塞满了。但你不知道,直到你和他们交谈。

如果服务器是本地的,您可以查看 ARP 缓存以查看服务器的 MAC 地址在每次退出后是否发生变化。但是因为它很遥远,他们也必须为你做这件事。