Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: (gcloud.compute.ssh) Could not fetch resource: - Insufficient Permission

Tags:

ssh

gcloud

I am having trouble working through the Compute Engine Quickstart: Build a to-do app with a MongoDB tutorial. (edit: I am running the tutorial from within the compute engine console; i.e. https://console.cloud.google.com/compute/instances?project=&tutorial=compute_quickstart)

I SSH into the backend instance. I enter the "gcloud compute" command as copied from the tutorial. I am prompted to enter a passphrase. The following is returned:

WARNING: The public SSH key file for gcloud does not exist.

WARNING: The private SSH key file for gcloud does not exist.

WARNING: You do not have an SSH key for gcloud.

WARNING: SSH keygen will be executed to generate a key.

Enter passphrase (empty for no passphrase): 

Enter same passphrase again: 

Your identification has been saved in

...

<< Identifying detail ommitted >>

...

**ERROR: (gcloud.compute.ssh) Could not fetch resource:
 - Insufficient Permission**

I had run through this stage of the tutorial on a previous occasion with no problems. I am working from a Windows 10 PC with the google-cloud-sdk installed. I am using google chrome. I have tried in both regular and incognito modes.

Any help or advice greatfully received!

  • DaveDub
like image 586
Dave Wooldridge Avatar asked Mar 31 '18 06:03

Dave Wooldridge


People also ask

Can t SSH into Google Cloud instance?

If gcloud CLI is out of date, you may be attempting to connect using a username that is not configured. To resolve this issue, update the gcloud CLI. You tried to connect to a Windows VM that doesn't have SSH enabled. To resolve this error, set the enable-windows-ssh key to TRUE in project or instance metadata.

Could not SSH into the instance?

ssh) Could not SSH to the instance. It is possible that your SSH key has not propagated to the instance yet. Try running this command again. If you still cannot connect, verify that the firewall and instance are set to accept ssh traffic.

How do I change SSH port in GCP?

run sudo systemctl reload sshd. service to apply the changes. in the cloud console, there's also "open in a browser window on a custom port".


2 Answers

It looks like the attempt to SSH is recognising the instance in your project, but the user doesn't have the required permissions to access the machine.

Have you tried running:

gcloud auth login 

and completing the web-based authorization to ensure you are attempting to access the machine as the correct (authenticated) user? This process ensures the Cloud SDK you are running inherits the permissions of the user specified in the web-based authorisation. See here for more information on this.

It's also worth adding the link to the tutorial you are following to your question.

like image 83
neilH Avatar answered Sep 21 '22 21:09

neilH


Besides the accepted answer, be sure you are in the correct gcloud project

gcloud projects list 

Then

gcloud config set project <your-project> 
like image 36
Alex Nolasco Avatar answered Sep 23 '22 21:09

Alex Nolasco