Monday, June 16, 2008

Linux: SSH Keys b/w two servers

Say, we have to setup SSH Keys b/w Reqester & Responser machines.
Steps :
* Install OpenSSH on two Linux/ Unix machines.
* To create the base .ssh directory at each machine, make a ssh connection for some other machine from the two machine.
* At machine Reqester type ssh-keygen -t dsa. If this works right you will get two files called id_dsa and id_dsa.pub in your .ssh dir. You can use a passphrase.
* Put the keys from Requester,
scp ~/.ssh/id_dsa.pub Responser:.ssh/authorized_keys
* Now Responser is ready to accept your ssh key. How to tell it which keys to use? The ssh-add command will do it :
ssh-agent sh -c 'ssh-add < /dev/null && bash'

No comments: