SSH可以';t连接到谷歌云

SSH可以';t连接到谷歌云,ssh,google-cloud-platform,Ssh,Google Cloud Platform,所以,我只做了试用GCloud服务,并尝试通过ssh连接。第一次我忘记了我的Mac电脑的用户名,所以我这样做是错误的: doe-MacBook-Pro:Documents does$ ssh -i ~/.ssh/google_compute_engine xxxx@111.111.111.111 Warning: Identity file /Users/does/.ssh/google_compute_engine not accessible: No such file or directo

所以,我只做了试用GCloud服务,并尝试通过ssh连接。第一次我忘记了我的Mac电脑的用户名,所以我这样做是错误的:

doe-MacBook-Pro:Documents does$ ssh -i ~/.ssh/google_compute_engine xxxx@111.111.111.111
Warning: Identity file /Users/does/.ssh/google_compute_engine not accessible: No such file or directory.
The authenticity of host '111.111.111.111 (111.111.111.111)' can't be established.
ECDSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '111.111.111.111' (ECDSA) to the list of known hosts.
Permission denied (publickey).
然后我知道了我的用户名,我试过:

doe-MacBook-Pro:Documents does$ ssh -i ~/.ssh/google_compute_engine does@111.111.111.111
Warning: Identity file /Users/does/.ssh/google_compute_engine not accessible: No such file or directory.
Permission denied (publickey).

这给了我错误。您能告诉我如何解决这个问题吗?

这与ssh用户名无关。 首先检查两件事,我们可以从那里开始:

  • 权限:您应该可以阅读,即至少0400
  • 文件:它存在吗
    问题解决了

    我忘了没有完成我的
    gcloud compute ssh项目名称
    命令。 在我完成命令后,它创建文件
    google\u compute\u engine

    现在我终于可以通过SSH连接到我的Google云了

    在home dir中,执行
    ls-l.ssh
    ,查看该文件是否存在,以及是否检查了其权限。@下面是关于文件权限的快速教程: