ssh-keygen is a standard component of the Secure Shell protocol suite found on Unix, Unix-like, and Microsoft Windows computer systems used to establish secure shell sessions between remote computers over insecure networks, through the use of various cryptographic techniques
In this post we’re going to learn how we can generate SSH Keys compatible with Google Cloud VMs
Private Key and Public Key
- Public Key is added on any Server or Machine which needs to be authenticated by users.
- Private Keys should be kept secret by users, it gives them access to the Server or Machine.
Download the Putty Gen
Generate Public Key
- Click on Generate and move the mouse over the area with some randomness.
- Remove the Key Comment.
- Copy the Public Key starting from ssh-rsa.
- Add the username you want to use for server auth at the end of the page with one space.
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCVWR+656cKJERmrC7wJ8J3DWfR7eJ8GsYKXUH3BL16fiPbsb2NBW4aZmuwNZyfijNwDtyLRsA3KAyQdTKAj3qze1JLgfF3fW/g0Yg5zzbHFs46v2JUGHm1/+BsBf6MaQwGX3qUfVpEPOh5kLCincC56fmjzd0I8FmkkNToTR3/3xPtIZjR8OO9xwpnZ0BknrPYBu+nplCj4BLUrFC+PrZyIPPsDclLftUtF27KYRtQ8ZS9ejYEdaO6kFwZt3SrQGQ9ZpuuXpY+lpsMUNvMkXqvJVzqkr1+ovYnjFUBvzvgL4l2cm22bPQBmeB5dhqixC/E1AgqpimKAXJfTC34KvuZ ubuntu
Generate Private Key
- Click on Conversions in Menu.
- Export OpenSSH Key and save the file.
- You can use the file where it needs to be like in putty or open the file in notepad and copy the content.
Adding Private Key inside Google Cloud VM
- While it can be done while creating your VM, we suggest how to add the key later.
- Click on the VM Name.
- Click on Edit.
- Go to the end of the page and click on Show and Edit under SSH Keys.
- Click on Add Item.
- And Paste the Private Key with Username included in it.
- Click on save.
You can use Termius to use the Public Key to log in with your Server IP and username.