An SSH key lets you sign in to a server without entering your account password each time. It has two files: a private key that stays on your computer, and a public key that you add to the server.
#1. Open PowerShell
Open the Start menu, search for PowerShell, and launch it.
#2. Create the key pair
Run:
ssh-keygen -t ed25519 -C "your-email@example.com"
When asked where to save the key, press Enter to use the default location:
C:\Users\YourName\.ssh\id_ed25519
When asked for a passphrase, enter one for extra protection, or press Enter to leave it empty.
#3. Copy your public key
Run:
Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub | Set-Clipboard
This copies the public key to your clipboard. It is the file ending in .pub.
Never share or upload id_ed25519. That is your private key.
#4. Add the key to your server
Sign in to the server using your current method, then run:
mkdir -p ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys
Paste the public key on a new line, save the file, then set its permissions:
chmod 600 ~/.ssh/authorized_keys
In nano, save with Ctrl+O, press Enter, then exit with Ctrl+X.
#5. Test the key
In PowerShell, replace deploy and the server address with your own:
ssh deploy@your-server-address
If you created the key in a non-default location, specify it with -i:
ssh -i "$env:USERPROFILE\.ssh\my_server_key" deploy@your-server-address
If it connects successfully, your SSH key is working.