After googling around a bit for a tutorial for a friend and failing to find a sufficiently succinct one, I decided to write my checklist here so I don’t forget. If you want to do passwordless authentication to an SSH server using SSH keys, these are the steps you should follow:
# Enter your passphrases when requested.
ssh-keygen -t rsa
# Copy the key to the server's ~/.ssh/ dir.
scp id_rsa.pub username@server:~/.ssh/
# Log on to the server.
ssh username@server
# Switch to the dir. If it doesn't exist, create it (see below).
cd .ssh/
# This is how to create it if it doesn't exist:
mkdir .ssh
chmod 700 .ssh
# Append the key to the server's authorized_keys
cat id_rsa.pub >> authorized_keys
# Delete your public key, as we don't need it any more.
rm id_rsa.pub
# Change the permissions of the file so the server can read it.
chmod 600 authorized_keys
You should now be able to log in without a password. If this doesn’t work, make sure your private key is on your local machine at ~/.ssh/id_rsa and that the SSH server is configured to accept SSH key logins (“PubkeyAuthentication Yes” in your sshd_config file). Also check the HostKey paths in the config file to make sure they point to your private key.
That’s it!