Forrest logo
back to the ssh-keygen tool

ssh:tldr:014d5

ssh: Retrieve public key from secret key.
$ ssh-keygen -y -f ${~--ssh-OpenSSH_private_key}
try on your machine

The command ssh-keygen -y -f ${~--ssh-OpenSSH_private_key} is used to generate the public key from a specified private key file.

Let's break down the command:

  • ssh-keygen is the command-line utility used for generating and managing SSH keys.
  • -y is an option that tells ssh-keygen to output the public key corresponding to the private key file specified.
  • -f is another option that specifies the input private key file from which the public key should be derived.
  • ${~--ssh-OpenSSH_private_key} is a placeholder for the actual path and filename of the private key file.

In summary, the command takes a private key file as input and produces the corresponding public key as output. The resulting public key can be used for things like SSH authentication or adding it to a server's authorized keys list.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ssh-keygen tool