Last active
September 26, 2017 12:12
-
-
Save WillieYang/e08c0c3e3b57efa0bb2e3dbad7d3569c to your computer and use it in GitHub Desktop.
How to ssh login to the instance from GCP VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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