我正在尝试使用gcompute ssh SSH到GCE实例 . 到目前为止,我似乎完成了一切,但是当我跑步时

gcloud compute ssh --zone "us-central1-b" --project "projectname" "instancename" --ssh-flag="-v"

我明白了

debug1:读取配置数据/ etc / ssh / ssh_config debug1:/ etc / ssh / ssh_config第48行:应用* debug1的选项:连接到104.XXX.XXX.XXX端口22. debug1:已 Build 连接 . DEBUG1:标识文件/Users/myusername/.ssh/google_compute_engine类型0 DEBUG1:key_load_public:没有这样的文件或目录DEBUG1:标识文件/Users/myusername/.ssh/google_compute_engine-cert类型-1 DEBUG1:本地版本字符串SSH-2.0 -OpenSSH_7.6 DEBUG1:远程协议版本2.0,远程软件版本OpenSSH_5.3 DEBUG1:匹配:OpenSSH_5.3轻拍OpenSSH_5 * COMPAT 0x0c000000 DEBUG1:验证到104.XXX.XXX.XXX:22为 '名为myUsername' DEBUG1:使用hostkeyalias :compute.1694426511137997XXXX DEBUG1:SSH2_MSG_KEXINIT发送DEBUG1:SSH2_MSG_KEXINIT接收DEBUG1:KEX:算法:的Diffie-Hellman群交换-SHA256 DEBUG1:KEX:主机密钥算法:SSH-RSA DEBUG1:KEX:服务器 - >客户端的密码:aes128- CTR MAC:umac-64@openssh.com压缩:无DEBUG1:KEX:客户端 - >服务器的密码:AES128-CTR MAC:umac-64@openssh.com压缩:无DEBUG1:SSH2_MSG_KEX_DH_GEX_REQUEST(2048 <3072 <8192)发送DEBUG1 :得到SSH2_MSG_KEX_DH_GEX_GROUP debug1:SSH2_MSG_KEX_DH_GEX_INIT发送debug1:得到SSH2 _MSG_KEX_DH_GEX_REPLY DEBUG1:服务器主机密钥:支持SSH-RSA SHA256:CYFI CPP T4kyOTSjoe80CUgt0GL3tXisLch / 8axxx DEBUG1:使用hostkeyalias:compute.1694426511137997XXXX DEBUG1:主机 'compute.1694426511137997XXXX' 是已知的,RSA主机密钥相匹配 . debug1:找到密钥/Users/myusername/.ssh/google_compute_known_hosts:1 debug1:重启后429496XXXX阻止debug1:SSH2_MSG_NEWKEYS发送debug1:期待SSH2_MSG_NEWKEYS debug1:SSH2_MSG_NEWKEYS收到debug1:rekey 4294967296阻止debug1:SSH2_MSG_SERVICE_ACCEPT收到debug1:认证可以继续:publickey,gssapi-keyex,gssapi-with-mic debug1:下一个身份验证方法:publickey debug1:提供公钥:RSA SHA256:rP2W5aPDGoUEqYu0XYUaTuqUZ7 / FqRTTuc3HOWaXxxx /Users/myusername/.ssh/google_compute_engine debug1:可以继续的身份验证:publickey,gssapi -keyex,gssapi-with-mic调试1:不再需要尝试验证方法 . myusername@104.XXX.XXX.XXX:权限被拒绝(publickey,gssapi-keyex,gssapi-with-mic) . 错误:(gcloud.compute.ssh)[/ usr / bin / ssh]退出并返回代码[255] .

这是我到目前为止所尝试的内容

  • 从项目元数据页面删除了我的SSH密钥

  • 计算实例设置为从项目继承SSH密钥,因此在实例的SSH页面中没有任何更改

  • 我使用我的帐户使用'gcloud auth login'再次通过Gcloud进行了身份验证 .

  • 然后我做了'gcloud init'再次设置配置,默认项目和时区

  • 已验证端口22上的防火墙是否已使用“gcloud compute firewall-rules list”打开

  • 使用'ssh-keygen -t rsa -f~ / .ssh / google_compute_engine -C myusername'续订了我的rsa公钥

  • 使用“gcloud compute ssh svuppala @ instancename”使用新公钥更新了gcloud元数据

  • https://console.cloud.google.com/compute/metadata/sshKeys?project=xxx验证了相同的内容

  • 重新安装了gcloud sdk并再次执行了上述步骤

  • 我从未直接向实例添加任何键

我似乎已经筋疲力尽了 . 任何帮助都非常感谢!