Migrate to RunxBuild and earn up to $50 in hosting credit on your first deposit.

Calculate your savings
unxBuild

ssh-keygen rsa: The Right Way to Generate a Key in 2026

Sean

Platform Writer

Jun 29, 2026
5 min read

rsa is the legacy default for ssh-keygen. ed25519 is the modern default, and the right answer depends on the team. Most teams should be using ed25519. rsa is still supported, still secure at 4096 bits, and still the right answer for the team that has a legacy requirement.

ssh-keygen rsa: The Right Way to Generate a Key in 2026

Table of contents

What ssh-keygen does

ssh-keygen generates a public-private key pair for SSH authentication. The public key is added to the server’s ~/.ssh/authorized_keys file. The private key is kept on the client and is used to prove identity.

The key pair is the authentication credential. Anyone with the private key can log in as the user. The team that loses a private key has to rotate the key and remove the public key from every server.

The algorithm choices

The algorithm choices in 2026:

  • rsa. The legacy default. 2048 bits is the minimum; 4096 bits is the recommended. Still supported, still secure, but the key is large and the signing is slow.
  • ed25519. The modern default. 256 bits, the key is small, the signing is fast. The right answer for most teams in 2026.
  • ecdsa. The middle ground. Smaller than rsa, faster than rsa, but the algorithm has had implementation issues in the past.
  • dsa. The legacy. Deprecated, not supported in OpenSSH 7.0+. The team that is using dsa should rotate to ed25519.

rsa in 2026

rsa is still supported, still secure at 4096 bits, and still the right answer for the team that has a legacy requirement. The trade-off: the key is large (the 4096-bit rsa public key is 800 bytes, vs. 68 bytes for ed25519), and the signing is slow (the rsa signature is 256 bytes, vs. 64 bytes for ed25519).

The team that is using rsa should be using 4096 bits. The team that is using 1024 bits should rotate. The team that is using 2048 bits is in the middle; rotate to 4096 bits or to ed25519.

ed25519 in 2026

ed25519 is the modern default. The key is small, the signing is fast, and the algorithm is considered to be at least as secure as a 4096-bit rsa key. The right answer for most teams in 2026.

The team that is starting a new project should be using ed25519. The team that is maintaining a legacy project should rotate to ed25519 when the team has the engineering time.

How to generate

The commands:

The -C flag adds a comment to the public key. The default location is ~/.ssh/id_ed25519 (or ~/.ssh/id_rsa).

The passphrase: the team should use a passphrase. A private key without a passphrase is a private key that can be used by anyone who finds the file.

How to use

The flow:

  • The team generates the key pair on the client.
  • The team copies the public key to the server: ssh-copy-id user@server.
  • The team logs in: ssh user@server. The client uses the private key to prove identity.

The team should rotate keys every 1-2 years. The rotation: generate a new key pair, add the new public key to the server, log in with the new key, remove the old public key from the server, delete the old private key from the client.

FAQ

What is ssh-keygen?

The command for generating a public-private key pair for SSH authentication. The default location is ~/.ssh/id_.

What is the difference between rsa and ed25519?

rsa is the legacy default, 4096 bits is the recommended size, the key is large and the signing is slow. ed25519 is the modern default, 256 bits, the key is small and the signing is fast. ed25519 is the right answer for most teams in 2026.

What is the right key size for rsa?

4096 bits. 2048 bits is the minimum; 1024 bits is too small. The team that is using 1024 bits should rotate.

Should I use a passphrase on my private key?

Yes. A private key without a passphrase is a private key that can be used by anyone who finds the file. The passphrase is the last line of defense.

How often should I rotate my SSH keys?

Every 1-2 years. The rotation: generate a new key pair, add the new public key to the server, log in with the new key, remove the old public key, delete the old private key.

If you are setting up a new project with SSH access, the RunxBuild hosting calculator is the place to model the line items. The instances, the storage, the bandwidth, the SSH sessions - each one is a separate number, and the team’s mental model for the platform is the sum of those numbers. The RunxBuild dashboard is where the team sees the actual SSH sessions in one place.

#ssh#ssh-keygen#rsa#ed25519#security