↑ ↓ select, Enter open, Esc close

Derive the public key from a private SSH key

Adjust the values, the command updates live
user@server
ssh-keygen -y -f ~/.ssh/id_ed25519_server

Reads the private key and prints the matching public key to standard output. For protected keys, the passphrase is requested. The output can be added directly to an authorized_keys file or redirected into a .pub file with >.

Note: The comment at the end is missing from the output, it only exists in the original .pub file.

Also searched as

  • get public key from private key ssh
  • recreate missing id_ed25519.pub
  • ssh-keygen -y

Related one-liners

All in SSH

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.