Skip to content

Generate a user SSH key on Windows

To use key-based authentication, first generate a public/private key pair.

ssh-keygen

ssh-keygen.exe is used to generate key files.

You can select an algorithm such as DSA, RSA, ECDSA or Ed25519. Use a strong algorithm and key length, such as Ed25519 in this example. The default algorithm depends on your OpenSSH version.

1. Run the command

To generate key files with the Ed25519 algorithm, run the following command from PowerShell or cmd :

ssh-keygen -t ed25519

The command should display the following output (with your username in place of “username”):

Generating public/private ed25519 key pair.
Enter file in which to save the key (C:\Users\username/.ssh/id_ed25519):

2. Specify the key file path

You can press Enter to accept the default or specify a path and/or filename for the generated keys.

3. Specify the passphrase

You will be prompted for a passphrase to encrypt your private key file.

A passphrase protects the private key file. It is separate from the two-factor authentication used to sign in to the web interface.

Leave the passphrase empty if required by your intended use; otherwise, use a passphrase to protect the private key.

Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\username/.ssh/id_ed25519.
Your public key has been saved in C:\Users\username/.ssh/id_ed25519.pub.
The key fingerprint is:
SHA256:OIzc1yE7joL2Bzy8!gS0j8eGK7bYaH1FmF3sDuMeSj8 username@LOCAL-HOSTNAME

The key's randomart image is:
+--[ED25519 256]--+
| . |
| o |
| . + + . |
| o B * = . |
| o= B S . |
| .=B O o |
| + =+% o |
| *oo.O.E |
|+.o+=o. . |
+----[SHA256]-----+

You now have an Ed25519 public/private key pair at the specified location.

Files ending in .pub are public keys; files without an extension are private keys:

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----         6/3/2021   2:55 PM            464 id_ed25519
-a----         6/3/2021   2:55 PM            103 id_ed25519.pub

External documentation