Generate SSH Key
Generate an SSH Key Pair
Generate a Key on Windows
Using PuTTYgen
1Open PuTTYgen
Install the PuTTY package when required and launch the PuTTYgen utility.
2Select the key type
Select an SSH-2 key type and the required key length. RSA with at least 2048 bits is commonly supported.
3Generate the key
Click Generate and move the mouse over the empty area until the key generation is complete.
4Protect the private key
Enter and confirm a key passphrase when additional protection is required.
5Save the keys
Copy the generated public key and save the private key using Save private key. Store the private key in a secure location.
.ppk format. Use PuTTYgen’s conversion features when another OpenSSH-compatible format is required.
Using Windows OpenSSH
On Windows systems with the OpenSSH client installed, open PowerShell or Command Prompt and run:
ssh-keygen -t rsa -b 4096
Press Enter to accept the default file location, then enter an optional passphrase.
Generate a Key on Linux or macOS
1Open Terminal
Open a terminal session on the local computer.
2Run ssh-keygen
Generate an RSA key pair with the following command:
ssh-keygen -t rsa -b 4096
A custom comment can be added to identify the key:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
3Select the storage location
Press Enter to use the default path or provide another file location.
4Set a passphrase
Enter a passphrase to protect the private key, or press Enter twice to create the key without one.
Generated Key Files
| File | Purpose |
|---|---|
~/.ssh/id_rsa |
Private key. Keep this file secret and never upload or share it. |
~/.ssh/id_rsa.pub |
Public key. Add its complete content to the platform account or remote server. |
Copy the Public Key
Display the public key on Linux or macOS:
cat ~/.ssh/id_rsa.pub
On Windows PowerShell:
Get-Content $env:USERPROFILE\.ssh\id_rsa.pub
- Copy the complete single-line value.
- Do not remove the key type at the beginning.
- Do not add line breaks inside the key.
- The final comment is optional but can help identify the key owner.
Security Recommendations
- Never share the private key.
- Store private keys only on trusted devices.
- Use a passphrase for sensitive or production access.
- Create separate keys for separate users or devices when practical.
- Remove unused or compromised public keys from the platform account.
- Back up private keys securely when losing them would block required access.
