Tuesday, October 6, 2009

SSH login without password

I tried the classic way of password less entry. For those who do not know how to do this, its a three step process. If you are on machine A and want to login to machine B using username U then following is the sequence of commands:

On machine A:
1)ssh-keygen -t rsa

Assuming you went with the default settings, now we need to copy the public key to machine B

On machine A:
2)ssh U@B mkdir -p .ssh
3)cat id_rsa.pub | ssh U@B 'cat >> .ssh/authorized_keys'

Now try "ssh U@B", it should not be a problem logging in.

I had problems in Ubuntu, Jaunty trying this and even after doing the above steps got an error "Agent admitted failure to sign using the key" and had to enter the password.
This can be solved by setting SSH_AUTH_KEYS to 0.
Just do "export SSH_AUTH_KEYS=0" on the prompt and it will work like a charm.

Hope this saves few minutes for someone out there! :-)