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

Booth picture Booth · Nov 26, 2014 · Viewed 15.9k times · Source

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].

Answer

M. Jepma picture M. Jepma · Mar 3, 2017

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.