Generate SSH Key Pair in Linux

Following command creates SSH key pair:


It will then prompt you for the location (the default ~/.ssh/id_rsa) and for a passphrase. The result will be two files, id_rsa (the private key) and (the public key). The public key will be store on this server while the private key will be copied into the client.

More details can be found here

Following command needs to be run on the server to push generated public key to SSH key repo:

cat ~/.ssh/ >> ~/.ssh/authorized_keys

This will append newly generated public key to existing authorized keys.

Finally appropriate permissions need to be set on the server:

chmod 600 ~/.ssh/authorized_keys

More details on SSH configuration can be found here

Leave a Reply

Your email address will not be published. Required fields are marked *

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