Skip to content

Generate an SSH Key

Generate an SSH key

Generate an ED25519 key for most systems. Use RSA only when you need legacy compatibility.

Linux and macOS

Open a terminal. OpenSSH is included with most Linux distributions and macOS.

Generate an ED25519 key

ssh-keygen -t ed25519 -C "[email protected]"

Generate an RSA key

ssh-keygen -t rsa -b 4096 -C "[email protected]"

In both options, you will be prompted to choose where to save the key.

Press Enter to use the default location:

~/.ssh/id_ed25519

or

~/.ssh/id_rsa

Next, you'll be asked to create an optional passphrase. A passphrase encrypts your private key and provides additional security if your computer is ever compromised.

After the process completes, two files will be created:

id_ed25519
id_ed25519.pub

or

id_rsa
id_rsa.pub

The .pub file is your public key. Upload it to your VPS. Keep the private-key file secure.

{% hint style="warning" %} Never share, upload, or email your private key.

Windows with PuTTYgen

PuTTYgen is included with PuTTY and provides an easy way to generate SSH keys for Windows users.

{% stepper %}

Open PuTTYgen

Download PuTTY. Use the 64-bit x86 version. Then open PuTTYgen from the Start menu.

{% endstep %}

{% step %}

Generate and save the key

Under Parameters, select ED25519. If using RSA, set the key size to 4096 bits.

Select Generate and move the mouse until completion. Optionally add a passphrase. Select Save private key, then copy the public-key text. {% endstep %}

The copied text is your public SSH key. Add it during deployment or after deploying a VPS.