Passwordless SSH Login

On the Local Box at the prompt:

ssh-keygen -t dsa
scp ~/.ssh/id_dsa.pub name@192.168.1.106:/home/name/
ssh username@remote

Now you will be on the Remote Box. Do the following:

mkdir /home/name/.ssh
cat ~/id_dsa.pub >> ~/.ssh/authorized_keys
chown -R demo:demo /home/demo/.ssh
chmod 700 /home/demo/.ssh
chmod 600 /home/demo/.ssh/authorized_keys
exit

Back to the Local Box

ssh-add ~/.ssh/id_dsa

Thats it! you should now be able to SSH to your server without being prompted for a pass.

A (very) easy alternative — 1 line

cat .ssh/id_dsa.pub | ssh name@192.168.1.106 'cat >> .ssh/authorized_keys'

Things to remember:

  • Public key goes on the remote box, Private key stays on local box
  • You only have to do ssh-keygen once. Ever. After that you can append your public key to any server.