无法 SSH 进入 Cloud Shell

无法 SSH 进入 Cloud Shell

我尝试从本地主机 ssh 到 GCP 云外壳并收到错误:

$ 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
  • 重启我的本地机器和云外壳
  • gcloud compute config-ssh(在本地机器和云端外壳上)仅返回WARNING: No host aliases were added to your SSH configs because instances have no public IP.
  • 从 GCP Compute => 元数据 => 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 Manjaro
  • Google Cloud SDK 410.0.0

我可以从另一台主机登录到 Cloud Shell所以问题可能出在我的电脑上。有人知道哪里出了问题或者如何调试吗?

感谢您的任何建议。

相关内容