Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve Permission denied (publickey,gssapi-keyex,gssapi-with-mic)?

This question may have been asked before but I don't understand the concept. Can you please help me here?

Weird issue from this morning .. see i just push my file to google cloud computing then showing below error.. I don't know where to look that error.

ri@ri-desktop:~$ gcloud compute --project "project" ssh --zone "europe-west1-b" "instance"
Warning: Permanently added '192.xx.xx.xx' (ECDSA) to the list of known hosts.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
ERROR: (gcloud.compute.ssh) [/usr/bin/ssh] exited with return code [255].
like image 877
Booth Avatar asked Nov 26 '14 15:11

Booth


2 Answers

This occurs when your compute instance has PermitRootLogin no in it's SSHD config and you try to login as root. You can change the login user by adding username@ before the instance name. Here is a complete example:

gcloud compute instances create my-demo-compute \
  --zone us-central1-f \
  --machine-type f1-micro \
  --image-project debian-cloud \
  --image-family debian-8 \
  --boot-disk-size=10GB

gcloud --quiet compute ssh user@hostname --zone us-central1-f

In the example above, gcloud will set the correct credentials and will make sure you login. You can add the --quiet to ignore the ssh-password question.

like image 99
M. Jepma Avatar answered Sep 20 '22 09:09

M. Jepma


One possible cause is that someone else in your project set the per-instance metadata for sshKeys (which overrides the project-wide metadata). When you run gcloud compute instances describe your-instance-name do you see a key called sshKeys in the metadata items?

It would also be helpful to see the contents of the latest log in ~/.config/gcloud/logs/. However, please make sure to scrub it of sensitive information.

like image 24
Sasha Leshinsky Avatar answered Sep 20 '22 09:09

Sasha Leshinsky