来自谷歌计算引擎实例,通过 ssh 连接到网络终端
[gcp-instance] $ ssh-copy-id user@server
/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
user@server's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'user@server'" and check to make sure that only the key(s) you wanted were added.
[gcp-instance] $ ssh user@server
Welcome to Linux Mint 18.3 Sylvia (GNU/Linux 4.4.0-142-generic x86_64)
....
[user@server] $
亲爱的,它起作用了。
在服务器上,设置:/etc/ssh/sshd_configPasswordAuthentication no
退出服务器并重试...
[user@server] $ exit
[gcp-instance] $ ssh user@server
Welcome to Linux Mint 18.3 Sylvia (GNU/Linux 4.4.0-142-generic x86_64)
....
[user@server] $
太好了,它又起作用了,现在注销服务器和 GCE 实例......
[user@server] $ exit
[gcp-instance] $ exit
在Web界面中再次登录GCE实例...
[gcp-instance] $ ssh user@server
Permission denied (publickey).
为什么第一次和第二次都有效,但在重新启动 GCE 实例后第三次尝试却不起作用?