Monday, March 10, 2008

SSH with no password

This is a very handy setting I use to login to various machines with out actually entering the password every time.
I have used this to setup user accounts on different servers so that I can monitor processes, disk space, etc.
lets first do the actual no password setup.

On Server 1
$ ssh-keygen -t dsa
Do not enter any password for key as this will defeat the whole purpose of not typing a password.
this creates id_dsa and id_dsa.pub files in ~/.ssh which are private and public keys respectively.
On Server 2
copy id_dsa.pub from Server 1 to Server 2
append the contents of id_dsa.pub to ~/.ssh/authorized_keys2
$ cat id_dsa.pub >> ~/.ssh/authorized_keys2

Now ssh from Server 1 for that user to Server 2 does not require a password.

No comments: