無法 SSH 有多種可能性,可以從最容易排查的開始進行
-
使用者權限 - IAM 權限
-
網路相關 - 確認 VM 可以連線至網路和 Port 22 是否有打開
-
VM 的狀態 - 是否為 Running 狀態
May 31
1. 透過 GCP console 連線
2. 透過第三方工具連線 SSH。
3. 使用 OS Login
如上述都無法成功連線,請啟用 Serial Console 查看錯誤訊息。
Q: GCEGuestAgent Error non_windows_accounts.go:158: Error updating SSH keys for {USER}: mkdir /home/{USER}/.ssh: no such file or directory.
A: 需手動從 serial console 進去新增此路徑
-----
Q: Connection Failed
系統錯誤訊息:You cannot connect to the VM instance because of an unexpected error. 並且在關機重開該機器、調整機器內設定時遇到以下 error:
Operation type [start] failed with message "The resource '*@*.com' of type 'serviceAccount' was not found."
A: Service account 遭到刪除、無法找到時會跳該 Error,將機器關機調整 service account 即可解決。
-----
Q: 在檢查 VM log 時,並未發現此 log ```GCEGuestAgent Info: GCE Agent Started (version YYYYMMDD.NN) ```
此問題是 Google guest environment [1] 並未自動啟動,因此需可以嘗試以下方式:
sudo systemctl enable google-guest-agent
sudo systemctl start google-guest-agent
sudo apt update
sudo apt install google-compute-engine google-compute-engine-oslogin \
google-guest-agent google-osconfig-agent
確認並返回
確認並返回
確認並返回