ssh-keygen

Generate ssh-keygen commands for common SSH key tasks

Build ssh-keygen commands for creating keys, converting PEM, changing passphrases, checking fingerprints, and removing stale known_hosts entries.

Choose a task, adjust the options, and copy the exact command you need.

Task

Create a new SSH key pair with your preferred algorithm and file path.

Command options

Generated command

Copy the command and run it locally in Terminal.

ssh-keygen -t ed25519 -C "you@example.com" -f ~/.ssh/id_ed25519

After generating the command, manage the connection workflow in DartShell

Keep your SSH hosts, file transfer, and database access together after the key setup step is done.

What this ssh-keygen tool helps with

Create the right command faster

Instead of searching for flags every time, choose a task and copy a command that already includes the common options.

Handle PEM and legacy compatibility

Some platforms still expect PEM output, especially when they document RSA-based SSH onboarding flows.

Fix host key mismatch warnings

Use the known_hosts cleanup command when SSH warns that a remote host identification has changed.

Common ssh-keygen examples

Create a modern Ed25519 key

ssh-keygen -t ed25519 -C "you@example.com" -f ~/.ssh/id_ed25519

Create an RSA 4096 key in PEM format

ssh-keygen -t rsa -b 4096 -m PEM -C "deploy@example.com" -f ~/.ssh/id_rsa

Remove an outdated known_hosts entry

ssh-keygen -R github.com

Recover the public key from a private key

ssh-keygen -y -f ~/.ssh/id_ed25519 > ~/.ssh/id_ed25519.pub

Show a key fingerprint

ssh-keygen -lf ~/.ssh/id_ed25519.pub -E sha256

Common ssh-keygen and SSH key errors

Key problems usually show up as a short message from ssh or ssh-keygen. The first column is what you see; the last one is the command that resolves it.

Error messageWhat it meansWhat to change
Permissions 0644 for 'id_ed25519' are too openThe private key is readable by other local accounts, so SSH refuses to use it.Run chmod 600 ~/.ssh/id_ed25519, chmod 700 ~/.ssh, and keep the public key at 644.
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!The fingerprint in known_hosts no longer matches the server, which happens after a reinstall, an IP change, or a real interception.Verify the new fingerprint through a separate channel, then run ssh-keygen -R hostname and reconnect.
Load key "~/.ssh/id_ed25519": invalid formatThe private key was truncated, lost its line breaks when copied, or uses a format the tool cannot read (new OpenSSH format versus PEM).Check that the file starts with -----BEGIN OPENSSH PRIVATE KEY-----; for PEM, convert with ssh-keygen -p -m PEM -f ~/.ssh/id_ed25519.
Saving key "~/.ssh/id_ed25519" failed: No such file or directoryThe ~/.ssh directory does not exist yet.Run mkdir -p ~/.ssh && chmod 700 ~/.ssh, then generate the key again.
unknown key type ed25519An older SSH server or network device does not support Ed25519 keys.Create a widely supported key instead: ssh-keygen -t rsa -b 4096 -m PEM -f ~/.ssh/id_rsa.
Load key "...": error in libcryptoThe private key file is damaged, encrypted with a passphrase you did not enter, or not a key at all.Restore from backup; check readability with ssh-keygen -y -f ~/.ssh/id_ed25519 before using it again.

Related tools

SSH config example generator

Attach the new key, a custom port, and a jump host to a reusable Host alias.

SCP command generator

Build upload and download commands that use the same identity file.

SSH port forwarding generator

Turn the tunnel settings you keep re-typing into one ready-to-run command.