Network

The ssh-keygen command

Generates an SSH key pair (public and private) to connect to servers without a password.

Syntax

ssh-keygen -t TIPO [-b BITS] [-f ARCHIVO]

Most useful options

-tKey type: ed25519 (recommended) or rsa
-bLength in bits (for RSA)
-fKey file path
-CIdentifying comment

Copy-ready examples

$ ssh-keygen -t ed25519Create a modern key

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • The private key (no .pub) is never shared with anyone.
  • If you set a passphrase, the key stays protected if it is stolen.

Related commands

FAQ

ed25519 or RSA?

ed25519: shorter, faster and more secure. Use RSA only for old compatibility.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course