無法 ssh 進入雲端 shell

無法 ssh 進入雲端 shell

我嘗試從本地主機 ssh 到 GCP cloud shell 並收到錯誤:

$ gcloud cloud-shell ssh --authorize-session
sign_and_send_pubkey: signing failed for RSA "/home/kossak/.ssh/google_compute_engine" from agent: agent refused operation
<USER>@<IP>: Permission denied (publickey).
ERROR: (gcloud.cloud-shell.ssh) [/usr/bin/ssh] exited with return code [255].

附調試選項:

$ gcloud cloud-shell ssh --authorize-session --verbosity debug
DEBUG: Running [gcloud.cloud-shell.ssh] with arguments: [--authorize-session: "True", --verbosity: "debug"]
DEBUG: Starting new HTTPS connection (1): cloudshell.googleapis.com:443
DEBUG: https://cloudshell.googleapis.com:443 "GET /v1/users/me/environments/default?alt=json HTTP/1.1" 200 None
DEBUG: Starting new HTTPS connection (1): cloudshell.googleapis.com:443
DEBUG: https://cloudshell.googleapis.com:443 "POST /v1/users/me/environments/default:authorize?alt=json HTTP/1.1" 200 None
DEBUG: Running command [/usr/bin/ssh -t -p 6000 -i /home/kossak/.ssh/google_compute_engine -o StrictHostKeyChecking=no <USER>@<IP> -- DEVSHELL_PROJECT_ID=<PROJECT_ID> bash -l].
DEBUG: Executing command: ['/usr/bin/ssh', '-t', '-p', '6000', '-i', '/home/kossak/.ssh/google_compute_engine', '-o', 'StrictHostKeyChecking=no', '<USER>@<IP>', '--', 'DEVSHELL_PROJECT_ID=<PROJECT_ID>', 'bash -l']
sign_and_send_pubkey: signing failed for RSA "/home/kossak/.ssh/google_compute_engine" from agent: agent refused operation
<USER>@<IP>: Permission denied (publickey).
DEBUG: (gcloud.cloud-shell.ssh) [/usr/bin/ssh] exited with return code [255].
Traceback (most recent call last):
  File "/home/kossak/apps/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 987, in Execute
    resources = calliope_command.Run(cli=self, args=args)
  File "/home/kossak/apps/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 807, in Run
    resources = command_instance.Run(args)
  File "/home/kossak/apps/google-cloud-sdk/lib/surface/cloud_shell/ssh.py", line 114, in Run
    command.Run(connection_info.ssh_env)
  File "/home/kossak/apps/google-cloud-sdk/lib/googlecloudsdk/command_lib/util/ssh/ssh.py", line 1541, in Run
    raise CommandError(args[0], return_code=status)
googlecloudsdk.command_lib.util.ssh.ssh.CommandError: [/usr/bin/ssh] exited with return code [255].
ERROR: (gcloud.cloud-shell.ssh) [/usr/bin/ssh] exited with return code [255].

我已經嘗試過的:

  • 在本機上重新啟動 ssh-agent
  • 重新啟動我的本機電腦和雲端 shell
  • gcloud compute config-ssh(在本機機器和雲端shell上)僅返回WARNING: No host aliases were added to your SSH configs because instances have no public IP.
  • 從 GCP 計算 => 元資料 => SSH 金鑰中刪除所有 ssh 金鑰
  • 重新命名~/.ssh並嘗試再次連接
  • ssh-add -l返回我的兩個密鑰:rsa(來自 gcp)和 ed25519(手動建立)
  • 權限為/home/kossak/.ssh700
  • 權限為/home/kossak/.ssh/google_compute_engine600
  • 使用 ssh 金鑰連接到本地網路中的另一個 SSH 伺服器 - 工作正常
  • 使用 ssh 金鑰授權執行 git 命令(例如git remote update) - 工作正常

我用:

  • Linux 曼札羅
  • Google雲端 SDK 410.0.0

我可以從另一台主機登入cloud shell所以問題可能出在我的電腦。有人知道出了什麼問題或如何調試嗎?

感謝您的任何建議。

相關內容