Linux - SSH Login Key

There are a number of tutorials teaching how to set up SSH Client Key, however they will require a copy of private key inside your ./ssh/known_hosts.   It could be difficult to manage and brings troubles when you are accessing from another device.

Method (operates on local machine):

# ssh-keygen -t rsa
# cat ~/.ssh/ | ssh user@server 'cat >> .ssh/authorized_keys'
# openssl rsa -in ~/.ssh/id_rsa -out key.pem

The last line was used to generate a .pem key file, so that we can use this key file to access the server, via:

# ssh -i key.pem user@server

Connecting via Windows:

Reference on RSA Key: