In this document, you'll learn how to create and use SSH Key to connect to a GCP Ubuntu Server from a Windows laptop. You'll get step-by-step instructions with pictures to make the process easy and straightforward.
Benefits of Using SSH Key
Using SSH Key provides a secure way of remotely logging into a server, without the need to enter a password. It eliminates the risk of password theft and ensures that only authorized individuals can access the server. It's also more convenient than entering a password every time you want to log in.
Creating SSH Key on Local Machine
Step 1: Open Terminal
Open the terminal on your local machine.
Step 2: Generate SSH Key
Use the ssh-keygen command to generate an SSH Key. Choose a location to save the key and set a passphrase.
Step 3: Verify SSH Key Generation
Verify that the SSH Key has been generated and saved in the specified location.
Copying SSH Key to GCP Ubuntu Server
Step | Command | Description |
1 | cat ~/.ssh/id_rsa.pub | ssh [USER]@[REMOTE-SERVER-IP] 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys' | Copy the SSH Key to the GCP Ubuntu Server. |
2 | ssh [USER]@[REMOTE-SERVER-IP] | Log into the GCP Ubuntu Server using SSH Key authentication. |
Step-by-Step Process with Pictures
Creating SSH Key on Local Machine
Use the terminal to generate an SSH Key on your local machine.
SSH Key File Location
Verify that the SSH Key has been generated and saved in the specified location.
Copying SSH Key to GCP Ubuntu Server
Copy the SSH Public Key to the GCP Ubuntu Server by appending it to the authorized_keys file.
Connecting to GCP Ubuntu Server from Windows Laptop using SSH Key
Configure PuTTY and connect to the GCP Ubuntu Server from your Windows laptop, using the SSH Key authentication.
Conclusion
Using SSH Key authentication provides a secure and convenient way to remotely log into a server, making it an essential tool for any system administrator or developer. By following these simple steps, you'll be able to create and use an SSH Key on your local machine and GCP Ubuntu Server, without the need to enter a password every time you log in.