Thursday, July 19, 2007

Aah..Yet Finally : Password less login for SSH

I was trying for a password less login since yesterday. Some how, it didn't workout for me. Finally, it is working now.

Commands to follow to have a password less login from your system to remote host:
At your host:
1.ssh-keygen -t dsa
give empty for all options it asks (just enter enter)
and make sure that your ssh folder is read and writable by only you. chmod -R 700 .ssh
2.now, copy id_dsa.pub file from your machine to remote host.
3.ssh to remote host
check whether .ssh file is existing. If not create one and should have only read and write option.
and copy id_dsa.pub file contents to .ssh/authorized_keys file.
and chmod 600 .ssh/authorized_keys
4. exit from remote host
now, try to ssh to remote host. It should login without asking for any password.

If it is not working,
then edit /etc/ssh/sshd_config file. make sure you uncomment Protocol2,1 options and comment Protocol2 option as shown below:
Protocol 2,1
#Protocol 2

and also make sure the following lines are present:
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

If present, uncomment them.

And restart your ssh daemon in your machine.

It should work now.

No comments: