SSL keys

SSH connection using ssh keys

To be able to connect to a remote host using ssh keys, the remote server needs to be configured to allow this.

Create your keys

$ ssh-keygen

The default location for the keys will be in ~/.ssh directory.

Copy public key to target host

$ ssh-copy-id username@remote-host

You will be prompted for your password to the remote site.

If this step is successful, you can try logging in with:

$ ssh username@remote-host

Generate a private key.

$ openssl genrsa -out my-priv.key 2048

Generate the public key.

$ openssl rsa -in my-priv.key -pubout -out my-pub.pem