Monday, May 29, 2006

How to set up ssh keys for Linux

How to set up ssh keys for Linux

1. Run "ssh-keygen -t dsa" on the machine which is the client.
Files Generated :
$(HOME)/.ssh/id_dsa : Your private Key
$(HOME)/.ssh/id_dsa.pub : Your public Key
You can enter empty passphrase.
Type can rsa and dsa for version 2 and rsa1 for version 1.
2. Now ssh into the server.You need to type password this time.
you have to transfer the publickey to server.
cd $(HOME)/.ssh
cat $(HOME)/.ssh/id_dsa.pub >> authorized_keys2

Note : Don't introduce any extra spaces, slashes or any other characters
If the file already exists, append the output of id_dsa.pub to EOF.

3. Repeat for Other machine if you want.
4. Now you can login without entering passwords.
On some machines, it might ask you to verify the host key,
but will happen only for the first time.