Skip to content

Instantly share code, notes, and snippets.

@IAmSuyogJadhav
Created September 6, 2019 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IAmSuyogJadhav/44cedf28ac636a11fb2cd21ec19c0e44 to your computer and use it in GitHub Desktop.
Save IAmSuyogJadhav/44cedf28ac636a11fb2cd21ec19c0e44 to your computer and use it in GitHub Desktop.
SSH to your GCP Instance as the root user.even when outbound SSH port (22) is blocked on your local system.

On Local System

  1. Run the following command to generate a key.
$ ssh-keygen

You'll be asked to enter passphrase. You can leave that empty.

Enter passphrase (empty for no passphrase):
Enter same passphrase again:

A pair of keys (public and private) will now be generated and saved at the location you earlier entered.

Your identification has been saved in /Users/username/.ssh/id_rsa.
Your public key has been saved in /Users/username/.ssh/id_rsa.pub.
The key fingerprint is:
<Your Key Here> your@email.com
  1. Start the ssh-agent:
$ eval `ssh-agent`
Agent pid 59566

add your key to the agent:

ssh-add ~/.ssh/id_rsa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment