Working with SSH Keys

Snippets

Just a quick snippet to describe how to generate an SSH RSA Key-Pair for SSH key based authentication.

First to generate the SSH key pair you can use:

ssh-keygen -t rsa

It will ask you some questions, such as password and location.
The default location is ~/.ssh/id_rsa for the private key and ~/.ssh/id_rsa.pub for the public key.

To then transfer this key to another server you can use this:

ssh-copy-id -i ~/.ssh/id_rsa.pub User@host.domain.tld

This will automatically check and see if the key is present and copy it to the appropriate user folder.