Skip to content

Instantly share code, notes, and snippets.

@rohitfarmer
Last active October 17, 2018 23:21
Show Gist options
  • Select an option

  • Save rohitfarmer/e238d6757ab35d95a3c5e41fdd80da05 to your computer and use it in GitHub Desktop.

Select an option

Save rohitfarmer/e238d6757ab35d95a3c5e41fdd80da05 to your computer and use it in GitHub Desktop.
Google Cloud Platform

To ssh to google compute engine instance.

First generate a ssh key pair on your local machine; use the username on the instance else it will create the user same as user on the local machine.

ssh-keygen -t rsa -f ~/.ssh/name -C username

chmod 400 ~/.ssh/name

Then login to your compute engine dashboard and click on metadata tab on the left. Go to ssh keys section and click edit, create a new entry and past the name.pub contents there.

ssh -i ~/.ssh/name username@external ip address
sftp -i ~/.ssh/name username@external ip addresss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment