Thursday 2 October 2014

Setting up SSH keys

SSH keys are used for various purposes like key based authentication, certificate generation etc., This page talks about the steps to be performed for generating ssh keys on linux machine. In this example I am using CentOS 6.4 32-bit OS.


openssh provide a utility called ssh-keygen to generate the keys
Execute the below command

$ ssh-keygen -t rsa -C "balaji.katika@gmail.com"

-t is used to specify the type of the key to create. 'RSA' algorithm is used here.
-C is for comments. I have provided my email id here.

Specify the passphrase (make sure to remember it !!) if required. Choose the default location. By default it choses <home-dir>/.ssh/

It creates two new files id_rsa (private key) and id_rsa.pub (public key)

Store this key in the ssh-agent. It is a program to hold private keys used for public key authentication.
Start this program if not already started as below

$ ssh-agent -s

Add the key to the agent as below

ssh-add <Path to the key file generate above>
e.g: ssh-add ~/.ssh/id_rsa





No comments:

Post a Comment