Skip to content

Instantly share code, notes, and snippets.

@ZilchBloke
Last active April 18, 2023 00:05
Show Gist options
  • Save ZilchBloke/28bc9968c00d0b622f0a6ea8ef6bd814 to your computer and use it in GitHub Desktop.
Save ZilchBloke/28bc9968c00d0b622f0a6ea8ef6bd814 to your computer and use it in GitHub Desktop.
ssh-keygen with ed25519 encryption

ssh-keygen with ed25519 encryption

Generate ed25519 keys for ssh in ~/.ssh/ default-directory with identifying filename and comment.

ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/server_key -C "ServerUsername@ServerHostname"

For windows :

ssh-keygen -o -a 100 -t ed25519 -f $env:USERPROFILE\.ssh\server_key -C "ServerUsername@ServerHostname"

ssh-keygen will create 2 keys file. Public Keys(with .pub) and Private Keys.

Options Meaning
-o Causes ssh-keygen to save private keys using the new OpenSSH format rather than the more compatible PEM format. The new format has increased resistance to brute-force password cracking but is not supported by versions of OpenSSH prior to 6.5. Ed25519 keys always use the new private key format.(IBM.com/docs)
-a <KDF rounds> Specifies the number of KDF (key derivation function) rounds used. Higher numbers result in slower passphrase verification and increased resistance to brute-force password cracking (should the keys be stolen). In this case -a 100 round is used.
-t <type> Specifies the type of the key to create. The possible values are “dsa”, “ecdsa”, “ed25519”, or “rsa”. Here we use -t ed25519
-f <path/filename> Specifies the name & location 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 (windows : $env:USERPROFILE\.ssh\)
-C "<comments>" An option to specify a comment. It’s purely informational and can be anything. But it’s usually filled with <login>@<hostname> for whom this key is generated . The comment is truncated after 1023 characters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment