为什么 SSH 和 ssh-copy-id 突然停止工作?

为什么 SSH 和 ssh-copy-id 突然停止工作?

设置非常简单,我在 GCP 上有两个虚拟机,一个是 jenkins 服务器,另一个是 nodejs 服务器。

昨天,我成功生成了一个 rsa 密钥(以 jenkins 用户身份),然后通过 ssh-copy-id 将其复制到 nodejs 服务器。之后,我可以毫无问题地通过 ssh 进入 nodejs 服务器。

今天,我登录,ssh 和 ssh-copy-id 都失败了。

ssh-copy-id 输出:

jenkins@idg-ops:~$ ssh-copy-id -i [email protected]
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/var/lib/jenkins/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]: Permission denied (publickey)

ssh 输出:

debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /var/lib/jenkins/.ssh/id_rsa RSA SHA256:vPyeyakbpyqjcBF9KixHb7u5sSCtX4lf9bvrtsiwY2g
debug1: Authentications that can continue: publickey
debug1: Trying private key: /var/lib/jenkins/.ssh/id_dsa
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ecdsa
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ed25519
debug1: Trying private key: /var/lib/jenkins/.ssh/id_xmss
debug1: No more authentication methods to try.

现在 nodejs 服务器上似乎没有 matthewcarltyson 的任何密钥。

奇怪的。

在服务器上:

May 24 21:26:57 idg-nodejs sshd[10609]: Did not receive identification string from 122.114.37.11 port 34782
May 24 21:27:06 idg-nodejs sshd[10611]: Connection closed by authenticating user matthewcarltyson 35.223.18.153 port 59434 [preauth]
May 24 21:27:06 idg-nodejs sshd[10613]: Connection closed by authenticating user matthewcarltyson 35.223.18.153 port 59436 [preauth]
May 24 21:27:06 idg-nodejs sshd[10615]: Connection closed by authenticating user matthewcarltyson 35.223.18.153 port 59438 [preauth]
May 24 21:29:56 idg-nodejs sshd[10617]: Connection closed by authenticating user matthewcarltyson 35.223.18.153 port 59444 [preauth]
May 24 21:29:56 idg-nodejs sshd[10619]: Connection closed by authenticating user matthewcarltyson 35.223.18.153 port 59446 [preauth]
May 24 21:29:56 idg-nodejs sshd[10621]: Connection closed by authenticating user matthewcarltyson 35.223.18.153 port 59448 [preauth]
May 24 21:30:56 idg-nodejs sshd[10623]: Connection closed by authenticating user matthewcarltyson 35.223.18.153 port 59450 [preauth]
May 24 21:30:56 idg-nodejs sshd[10625]: Connection closed by authenticating user matthewcarltyson 35.223.18.153 port 59452 [preauth]
May 24 21:30:57 idg-nodejs sshd[10627]: Connection closed by authenticating user matthewcarltyson 35.223.18.153 port 59454 [preauth]
May 24 21:33:14 idg-nodejs sshd[10629]: Connection closed by authenticating user matthewcarltyson 35.223.18.153 port 59460 [preauth]
May 24 21:33:14 idg-nodejs sshd[10631]: Connection closed by authenticating user matthewcarltyson 35.223.18.153 port 59462 [preauth]
May 24 21:33:14 idg-nodejs sshd[10633]: Connection closed by authenticating user matthewcarltyson 35.223.18.153 port 59464 [preauth]
May 24 21:45:55 idg-nodejs sshd[10686]: Did not receive identification string from 205.185.114.91 port 33754
May 24 21:47:48 idg-nodejs sshd[10687]: Connection closed by authenticating user matthewcarltyson 35.223.18.153 port 59480 [preauth]
May 24 22:14:04 idg-nodejs sshd[10740]: Did not receive identification string from 192.241.208.162 port 51702
May 24 22:17:01 idg-nodejs CRON[10741]: pam_unix(cron:session): session opened for user root by (uid=0)
May 24 22:17:01 idg-nodejs CRON[10741]: pam_unix(cron:session): session closed for user root
May 24 23:01:16 idg-nodejs sshd[10848]: Did not receive identification string from 81.161.63.103 port 63924
May 24 23:01:26 idg-nodejs sshd[10849]: Connection closed by 81.161.63.103 port 12594 [preauth]
May 24 23:01:27 idg-nodejs sshd[10852]: Connection reset by authenticating user root 81.161.63.103 port 12692 [preauth]
May 24 23:01:27 idg-nodejs sshd[10856]: Connection reset by 81.161.63.103 port 12690 [preauth]
May 24 23:01:27 idg-nodejs sshd[10850]: Connection reset by authenticating user root 81.161.63.103 port 12687 [preauth]
May 24 23:01:27 idg-nodejs sshd[10851]: Connection reset by authenticating user root 81.161.63.103 port 12686 [preauth]
May 24 23:17:01 idg-nodejs CRON[10907]: pam_unix(cron:session): session opened for user root by (uid=0)
May 24 23:17:01 idg-nodejs CRON[10907]: pam_unix(cron:session): session closed for user root

相关内容