Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Cloud- Unable SSH into instance via cloud shell. #21

Closed
wibbene opened this issue Apr 4, 2021 · 7 comments
Closed

Google Cloud- Unable SSH into instance via cloud shell. #21

wibbene opened this issue Apr 4, 2021 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@wibbene
Copy link

wibbene commented Apr 4, 2021

Unable to ssh into instance via Google Cloud. This may be because the ssh-keys metadata is throwing out wacky errors in gcp-instance.tf file.

@wibbene
Copy link
Author

wibbene commented Apr 4, 2021

Unable to ssh into instance via Google Cloud. This may be because the ssh-keys metadata is throwing out wacky errors in gcp-instance.tf file.

commenting out a line to see if that fixes it

@wibbene
Copy link
Author

wibbene commented Apr 4, 2021

That didn't work. Did find this new error though

Invalid key. Required format: username@example.com or google-ssh {"userName":"username@example.com","expireOn":""}

@wibbene
Copy link
Author

wibbene commented Apr 4, 2021

Alright, it looks like when you press the "add ssh key" button on the VM instance, google attempts to add keys BUT this kills the unbuntu user and then you lose access to your instance. Looking into how to use OS login instead.

@chadgeary
Copy link
Owner

I know we chatted about this on discord - but do you have the error you mentioned in the first comment? Was it from terraform or in the gcp web console?

@wibbene
Copy link
Author

wibbene commented Apr 7, 2021

It is caused by something that terraform is configuring. Because of the first issue, the second issue is happening.

@wibbene
Copy link
Author

wibbene commented Apr 7, 2021

I am still running it down in my free time because otherwise the script works great!

@chadgeary
Copy link
Owner

chadgeary commented Apr 12, 2021

To recap, the malformed SSH key is fixed in 6242d2e

google cloud ssh keys work with or without a key name. e.g.: ssh-rsa some_key_data my_key_name or ssh-rsa some_key_data) BUT if the key name is omitted the google cloud web console complains.

I've added logic in terraform to add ubuntu as the key name if the user does not supply a key name in gcp.tfvars, which should clear that error up.

To re-iterate - a missing key name would not have prevented SSH access. Going to close this as solved.

@chadgeary chadgeary self-assigned this Apr 12, 2021
@chadgeary chadgeary added the enhancement New feature or request label Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants