"What is SSH key?"
An SSH key consists of a “private key” and a “public key”.
A SSH public key(.ssh/id_rsa.pub) is exactly what is used to “publish” and grant access to a particular service or server. It is used to allow a host to grant access to a particular service or server.
In contrast, SSH private keys (id_rsa
) should never be shared or given to others**.
I am a Windows user, I explain how to create SSH key for Windows user. If you are Mac / Linux user, you just open terminal and do from "How to create an SSH key"
But Windows user, you have to to set up Linix enbironment before creating SSH key.
WSL2 (Windows Subsystem for Linux 2) is a feature for running a Linux environment on Windows; it is available by default on the latest version of Windows 10/11.
"How to set up WSL2 for Windows user"
STEP1
・ Install WSL2
(If you don't have the WSL2 terminal set up yet) --my pc did not have WSL2.
・Open PowerShell as Administrator(type "powershell" and right click then select 'Run as Administrator' )
・Type that in Powershill
wsl --install
This command will install WSL and set WSL2 as the default version. It will also install the Ubuntu distribution by default.
Step2
Set Up WSL2
After restarting, you should find the Ubuntu app in your Start menu. Open it to complete the installation.
You'll be prompted to create a new user account and password for your WSL2 distribution.
Step3
Open your WSL2 terminal (Ubuntu). See "How to create an SSH key"
*Installing WSL2 (Windows Subsystem for Linux 2) allows you to use various Linux distributions, including Ubuntu, on Windows.
It's inside Ubuntu looks like.
"How to create an SSH key"
From the computer that you normally use to SSH to our servers:
Windows: Use WSL2
Mac / Linux: Open terminal
(This time, I am explaining for Windows user.)
STEP 1
Type that in "Ubuntu". (NOT in Windows powershell!)
ssh-keygen -t rsa
It is for the directory to contain the key.
Hit enter.
STEP2
Insert password you like twice.
*Ttps:The password entered is not displayed.The password entered is not displayed. (At first I panicked, thinking my keyboard was broken, but never mind, just press enter calmly when you finish typing the password.)
*Important:Be sure to keep track of the passphrase, because you must enter the passphrase whenever you use the key.
STEP3
Type this.
cat .ssh/id_rsa.pub
This command is used to display the contents of the SSH public key (id_rsa.pub)
STEP4
Copy and paste the contents (alphabets start from 'ssh-rsa') to Host along with email address.
References:
https://docs.acquia.com/acquia-cloud-platform/manage-apps/command-line/getting-started/generate
My lab members' Tips
Chat-GPT :)