On PC
ssh-keygen -t rsa -f ~/.ssh/[KEY_FILENAME] -C [USERNAME]
Eg. ssh-keygen -t rsa -b 4096 -f ~/.ssh/userjohnnykey -C johnny
Produces private and public key files .ssh/[KEY_FILENAME].pub AND .ssh/[KEY_FILENAME]
Eg. .ssh/userjohnnykey.pub and .ssh/userjohnnykey
make sure to 'chmod 600 .ssh/[KEY_FILENAME]' (private key file)
Eg. chmod 600 .ssh/userjohnnykey
On Google Cloud -
Goto 'COMPUTE ENGINE' / 'METADATA' / 'SSH Keys'
Select 'Edit' / 'Add Item'
PASTE in the public key .ssh/userjohnnykey.pub
(Google will add the key to the VM's .ssh/autorized_keys file)
To SSH from your PC
ssh johnny@goggle-instance-35.189.72.232 -i .ssh/userjohnnykey
Or set up in .ssh/config
Host controller pi0 pimanager
HostName goggle-instance-35.189.72.232
Port 22
User johnny
IdentityFile ~/.ssh/userjohnnykey
No comments:
Post a Comment