Skip to content

Instantly share code, notes, and snippets.

@WillieYang
Last active September 26, 2017 12:12
Show Gist options
  • Save WillieYang/e08c0c3e3b57efa0bb2e3dbad7d3569c to your computer and use it in GitHub Desktop.
Save WillieYang/e08c0c3e3b57efa0bb2e3dbad7d3569c to your computer and use it in GitHub Desktop.
How to ssh login to the instance from GCP VM
// 1. Create a ssh key file with private and public key:
ssh-keygen -t rsa -f ~/.ssh/[key_value name] -C [username]
// 2. Restrict access to the private key so that only myself can read it and nobody can write to it:
chmod 400 ~/.ssh/ssh-vm-key
// 3. Add the public key to the instance metadata
// 4. Remote login to the linux server using ssh:
ssh -i ~/.ssh/[key_value_name] [username]@[external address]
// 5. Or just using:
ssh root@[ip address] would be fine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment