2016-04-14 177 views
-1

因此,我只是试用GCloud服务,并尝试通过ssh连接。在第一时间我忘记了我的Mac的用户名,所以我没有错做这个:SSH无法连接到Google Cloud

doe-MacBook-Pro:Documents does$ ssh -i ~/.ssh/google_compute_engine [email protected] 
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 [email protected] 
Warning: Identity file /Users/does/.ssh/google_compute_engine not accessible: No such file or directory. 
Permission denied (publickey). 

,这让我的错误。你能告诉我如何解决这个问题?

回答

1

这与ssh用户名无关。第一 检查两件事情,我们可以从那里:

  1. 权限:应该是您可读,即至少0400
  2. 文件:它在所有的存在吗?
+0

我该怎么做? – yogieputra

+0

在你的主目录中,执行'ls -l .ssh',看看这个文件是否存在,以及它是否检查了它的权限。 –

+0

@Liverpool这是一个文件权限的快速教程:http://www.tutorialspoint.com/unix/unix-file-permission.htm –

0

问题已解决!

我忘了没有完成我的gcloud compute ssh project-name命令。 完成命令后,它会创建文件google_compute_engine。 现在我终于可以通过SSH连接到我的Google Cloud了。