Setup SSH Public Key authentication to login to a target

  • On your host machine, use ssh-keygen to generate an SSH key pair
    • ssh-keygen -t rsa
      • Follow the prompts
        • choose the <location> for the file
        • choose a <keyname> e.g. id_rsa_name_of_target
        • set a strong password to unlock the private key
        • default key-length is 2048-bits (don’t change if you do not understand what you are doing)
        • at the end of this process you will have a private/public keyfile <keyname> and a separate file with only the public key <>
      • N.B the private must never ever leave the host
      • Comprehensive information can be found at the link below information can be found at
  • Output the public key  in the format required by the target e.g. Open Media Vault v2.0 needs the public key to be output in RFC 4716 format
    • ssh-keygen -e -f </location/keyname>
  • Copy the public key to the target.
  • Use the host machine where the private key is stored to login to target server
    • ssh <user>@<IP address of target> -i <location>/<keyname>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.