How to generate a secure SSH key pair?

jimzandueta

Jim Zandueta

Posted on August 16, 2022

How to generate a secure SSH key pair?

Required Reading:

  • None

Optional Reading:

  • None

-

Generate an SSH key pair

  • Open your favorite terminal
  • Run the ssh-keygen command
$ ssh-keygen -t rsa -b 4096 -C "tonystark@avengers.com"
Enter fullscreen mode Exit fullscreen mode

INFO: For increased security, the type flag -t rsa and the bits flag -b 4096 are required. The comment flag -C "tonystark@avengers.com" allows us to easily identify who owns the SSH key.

  • Specify the key file name. Default is id_rsa
  • Enter a passphrase *optional

ssh-keygen-sample

WARNING: If you already have a default SSH key ~/.ssh/id_rsa, DO NOT OVERWRITE IT. If you are not careful, you will lose SSH access to your cloud servers and git platforms. Instead, give your new SSH key a new name, such as id_rsa_avengers.

-

Resources

💖 💪 🙅 🚩
jimzandueta
Jim Zandueta

Posted on August 16, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related