Here’s how to setup SSH so you can use keys for authentication.
1. Create a set of keys:
ssh-keygen -t dsa
2. Hit “Enter” three times, we want the default location for the keys, and no passphrase.
3. You should now have a folder called .ssh in your home folder. Inside are the public and private keys.
4. Use SCP to copy the public key, “id_dsa.pub” to your remote hosts.
scp .ssh/id_dsa.pub email@example.com:
5. On each host create a .ssh folder in the account you want to access on the remote host (can be multiple accounts).
6. Move (or copy if multiple) the id_dsa.pub file inside the .ssh folder, renaming it to authorized_keys
mv id_dsa.pub ~/.ssh/authorized_keys
7. Set the folder permissions on .ssh to 700.
chmod 700 ~/.ssh
Log out of the host and try logging back in. If everything is still set to defaults, you should be logged into the remote host without using a password.
This method is as secure as the interactive login but you need to guard your private key.