Reputation: 8002
I'm kind of a neophyte with server administration. Just trying to put up some PHP scripts with a cron job. Rather than use the gcloud terminal for everything, I thought it would be easier to use Filezilla. I need an SSH key to connect, so I generated one:
gcloud compute ssh my-app
I entered a password and the console showed:
Your identification has been saved in /home/goldenjoe/.ssh/google_compute_engine.
Your public key has been saved in /home/goldenjoe/.ssh/google_compute_engine.pub.
I gather that these are in the home directory of my instance, but how do I actually access them and use them on my local machine?
Upvotes: 0
Views: 2626
Reputation: 8002
Ah, I had a fundamental misunderstanding. I was executing these commands in the VM shell instance I SSH'd into through GCP. I should have been executing them in the terminal on my local device. When I run them on my local machine, the keys appeared in a local directory.
Upvotes: 0
Reputation: 105
It looks like this is a duplicate questions of this one: How to get the ssh keys for a new Google Compute Engine instance?
Follow that and you will find a very detailed explanation for your question.
Upvotes: 0
Reputation: 27
basically SSH keys are just plain text file used for authentication, in an asymmetric way. Your public key can be transported and showed to anybody, but your private key must be keep secret. You can easily copy/paste the content via vi, nano, cat or whatever.
That said, you can let gcloud manage this for you, or use the SSH configuration like that :
user@host
ssh -i myprivate.key user@host
~/.ssh/config
on your localhost and specify your private key for your VM like thatHost 1.2.3.4
IdentityFile ~/.ssh/myprivate.key
User user
Upvotes: 1