“SSH Configuration on GCP”

SSH Configuration on GCP


Server: Centos 7.0

Workstation: macOS Mojave 10.14.2

Generate a Key

  1. Open a terminal, using ssh-keygen tool.

    ssh-keygen -t rsa -f ~/.ssh/[KEY_FILENAME] -C [USERNAME]


    The USERNAME should be identical to the counterpart of your instance.

  2. You must restrict access to your private key or you will get a denial when you try to connect the server using ssh command

    chmod 400 ~/.ssh/[KEY_FILENAME]
  3. The key generated was stored at ~/.ssh. You can access the content of your key by cat command in the terminal.

Upload SSH Key to GCP Instance

  1. Click the EDIT tab. Imgur

  2. Copy your pub file content and paste into the textbox. Imgur

  3. Click the save button.

Test SSH Connection on the Terminal

Use the command below