2016-04-14 178 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了。