Quick SSH key creation

From One-Eyed Man Wiki
Jump to navigation Jump to search

ssh-keygen -t ed25519 -f $HOME/.ssh/id_ed25519 -C "$(whoami)@$(hostname)-$(date +'%y%m%d')"

The ssh-keygen command will create a new key and the most common options are below:

  • -t {rsa,ed25519} Key type: RSA or ED25519
  • -b [number] Number of bits, only needed for RSA keys
  • -C "Comment" Comment for the key
  • -f filename The filename for the key

By default new SSH keys will go into the .ssh folder in the current users home folder. The default RSA keys will have the filenames id_rsa for the private key and id_rsa.pub for the public key while Ed25519 keys will use the similar filename id_ed25519 for the private key and id_ed25519.pub for the public key.