To save from constantly having to enter usernames and passwords when logging into remote servers it is possible to set up a key that can be used to open the connection. This document briefly describes how a key can be created and used.
Use ssh-keygen to create a new key
ssh-keygen -t rsa
Do not enter a pass phrase if this key is going to be used for automatic login (e.g., for cron backups).
This should create two files, one containing the public key (usually ~/.ssh/id_rsa.pub and one containing the private key file (usually ~/.ssh/id_rsa).
Copy the public key to the remote machine you want to connect to (in this case example.com)
scp ~/.ssh/id_rsa.pub example.com:
Now log into that machine using ssh and append that file's contents to ~/.ssh/authorized_keys:
cat id_rsa.pub >> ~/.ssh/authorized_keys
You can now delete the public key from your server. You should now be able to log into your server without a password using ssh (replace the username lorcan with your own username on the server):
ssh lorcan@example.com