我无法从 Windows 命令提示符通过 SSH 连接到 Google Cloud 中托管的 Fedora VM。我尝试在网络中搜索答案,但找不到专门针对 Windows 的任何解释/解决方案。
我已执行以下步骤:
- 在谷歌云中创建了一个虚拟机,如下图所示
fedora-cloud-base-gcp-34-1-2-x86-64
允许通过防火墙中的端口 22 访问虚拟机。
在 Windows 命令提示符中运行以下命令来生成公钥和私钥:
ssh-keygen -t ECDSA
将公钥添加到VM。
现在当我跑步时ssh 用户名@主机在 .ssh 文件夹的命令提示符中,出现以下错误:
PS C:\Users\user1\.ssh> ssh -i C:/Users/user1/.ssh/id_ecdsa [email protected]
The authenticity of host '34.19.24.7 (34.19.24.7)' can't be established.
ECDSA key fingerprint is SHA256:3/NMD26H/bhz9DJYHssTcFAKEpttgpobGac.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '34.19.24.7' (ECDSA) to the list of known hosts.
[email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
有趣的是,我能够连接到使用“Debian”映像创建的同一子网下的其他虚拟机。
是什么原因导致此故障以及如何解决此问题?
PFB 此命令的调试日志:
PS C:\Users\user1\.ssh> ssh -v -i C:/Users/user1/.ssh/id_ecdsa [email protected]
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Connecting to 34.19.24.7 [34.19.24.7] port 22.
debug1: Connection established.
debug1: identity file C:/Users/user1/.ssh/id_ecdsa type 2
debug1: identity file C:/Users/user1/.ssh/id_ecdsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.5
debug1: match: OpenSSH_8.5 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 34.19.24.7:22 as 'user1'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:3/NMD26H/bhz9DJYHssTcFAKEpttgpobGac
debug1: Host '34.19.24.7' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\user1/.ssh/known_hosts:2
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: C:/Users/user1/.ssh/id_ecdsa ECDSA SHA256:nGbnvW+SfJQfakeHcpXzw+8nJbtnqQWPNQtro+q/8 explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: publickey
debug1: Offering public key: C:/Users/user1/.ssh/id_ecdsa ECDSA SHA256:nGbnvW+SfJQU9fakepXzw+8nJbtnqQWPNQtro+q/8 explicit
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: No more authentication methods to try.