Skip to content

Instantly share code, notes, and snippets.

@DoZator
Last active March 5, 2025 20:04
Show Gist options
  • Save DoZator/72fcebb81d7214384e7a5480c5ea2c95 to your computer and use it in GitHub Desktop.
Save DoZator/72fcebb81d7214384e7a5480c5ea2c95 to your computer and use it in GitHub Desktop.
Make SSH keys

SSH key types

RSA: It depends on key size. If it has 3072 or 4096-bit length, then you’re good. But 2048 bit keys are indeed acceptable until 2030.

How many bits my ssh key is:

    ssh-keygen -l -f ~/.ssh/{key_name}.pub

Create your RSA SSH 4096 bit key:

    ssh-keygen -o -t rsa -b 4096 -f ~/.ssh/{key_name} -C "[email protected]"

ed25519: It’s the most recommended public-key algorithm available today!

Create your ed25519 SSH key:

    ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/{key_name} -C "[email protected]"
  • -o: Save the private-key using the new OpenSSH format rather than the PEM format. Actually, this option is implied when you specify the key type as ed25519.

  • -a: It’s the numbers of KDF (Key Derivation Function) rounds. Higher numbers result in slower passphrase verification, increasing the resistance to brute-force password cracking should the private-key be stolen.

  • -t: Specifies the type of key to create, in our case the ed25519.

  • -f: Specify the filename of the generated key file. If you want it to be discovered automatically by the SSH agent, it must be stored in the default .ssh directory within your home directory.

  • -C: An option to specify a comment. It’s purely informational and can be anything. But it’s usually filled with @ who generated the key.

Add your ed25519 key for github.com

Open your ~/.ssh/config file, then modify the file to contain the following lines.

Host github.com
  IdentityFile ~/.ssh/id_ed25519
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment