SSH Configuration on GCP
Server: Centos 7.0
Workstation: macOS Mojave 10.14.2
Generate a Key
Open a terminal, using
ssh-keygen -t rsa -f ~/.ssh/[KEY_FILENAME] -C [USERNAME]
The USERNAME should be identical to the counterpart of your instance.
You must restrict access to your private key or you will get a denial when you try to connect the server using
chmod 400 ~/.ssh/[KEY_FILENAME]
The key generated was stored at
~/.ssh. You can access the content of your key by
catcommand in the terminal.
Upload SSH Key to GCP Instance
pubfile content and paste into the textbox.
Click the save button.
Test SSH Connection on the Terminal
Use the command below
ssh -i [PATH_TO_PRIVATE_KEY] [USERNAME]@[EXTERNAL_IP_ADDRESS]
PATH_TO_PRIVATE_KEYshould not contain
[USERNAME]is identical to the instance name.