I try to ssh from my local host to GCP cloud shell and get the error:
$ 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].
with debug option:
$ 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].
What I tried already:
- restarting ssh-agent on local machine
- rebooting my local machine and cloud shell
gcloud compute config-ssh
(on both local machine and cloud shell) returned only WARNING: No host aliases were added to your SSH configs because instances have no public IP.
- removing all ssh keys from GCP Compute => Metadata => SSH Keys
- renaming
~/.ssh
and trying to connect again
ssh-add -l
returns both of my keys: rsa (from gcp) and ed25519 (created manually)
- permissions of
/home/kossak/.ssh
are 700
- permissions of
/home/kossak/.ssh/google_compute_engine
are 600
- connecting to another SSH server in my local network with a ssh key - works properly
- executing git commands with ssh key authorization (eg
git remote update
) - works properly
I use:
- Linux Manjaro
- Google Cloud SDK 410.0.0
I can login to cloud shell from another host so the problem is probably with my computer. Anybody knows what's wrong or how to debug it?
Thank you for any advice.