Passwordless ssh login in Ubuntu

Passwordless ssh login in Ubuntu

$ sudo apt-get remove lsh-server.

$ sudo apt-get install openssh-server openssh-client

$ sudo /etc/init.d/ssh restart

$ rm ~/.ssh/known_hosts (or just edit to remove the offending keys)

$ ssh-keygen -t rsa

$ ssh-copy-id -i ~/.ssh/id_rsa.pub username@host

If this does not work verify that

1) /etc/ssh/sshd_config contains these lines and that they are uncommented

RSAAuthentication yes
PubkeyAuthentication yes

2) Your home directory, the .ssh directory and the contained files have the right permissions:

$HOME drwxr-xr-x
$HOME/.ssh drwx——

authorized_keys -rw——-
id_rsa -rw——-
known_hosts -rw-r–r–