Copied to clipboard

ssh-keygen

`ssh-keygen` is a command-line tool used for generating SSH keys.

Example

  • Generate a default RSA key pair: ssh-keygen
  • Generate a key pair of a specified type: ssh-keygen -t ed25519
  • Generate a key pair of a specified length: ssh-keygen -b 4096
  • Generate a key pair with a specified comment: ssh-keygen -C "johndoe@example.com"
  • Specify the location of the key: ssh-keygen -f ~/.ssh/my_ssh_key
  • Generate a password-protected key pair: ssh-keygen -N "password"
  • Generate a key pair using a specified hash algorithm: ssh-keygen -E sha256
  • Enable agent forwarding: ssh-keygen -a
  • Quiet mode: ssh-keygen -q

Note: The parameters can be used in combination. For example, ssh-keygen -t ed25519 -b 4096 -C "johndoe@example.com" generates a key pair of type ed25519, with a length of 4096, and a comment of "johndoe@example.com".