How to setup ssh keys on Linux/Unix?

You can speed up the login process to a remote host by setting up ssh keys to identify your local host (i.e., the computer you are sitting in front of) as a trusted computer for the remote host.

1. Open Terminal
2. Type ssh-keygen
3. Press ‘Enter’ when prompted for ‘Enter file in which to save the key (/home/you/.ssh/id_rsa)
4. Type a ‘Passphrase’ when prompted
5. You’ll now have the ssh keys generated and saved in /home/you/.ssh/id_rsa.pub
6. Copy the newly generated public key to the intended remote host using the following command:
ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
In the command, remote-host is the servername of the remote host you’d like to access. E.g., bert.student.eecs.qmul.ac.uk (for students) or frank.eecs.qmul.ac.uk (for staff/PhD)
7. Enter password for logging into the remote host
8. Your computer (i.e., local host) will now be identified as a trusted source in the remote host. Going forward, you can login to the remote host by typing ssh remote-host in terminal, followed by providing your passphrase

Please see here for detailed information on the usage of ssh-keygen and ssh-copy-id commands

Note: These are instructions for Linux/Unix machines, for Windows see this instead — FAQ on ssh key generation in Windows