#On Client:
ssh-keygen -t rsa
scp ~/.ssh/id_rsa.pub username@hostname:~/.ssh/authorized_keys
#On Server (to disable passwords and only allow key)
sudo nano /etc/ssh/sshd_config
#change "PasswordAuthentication yes" --> "PasswordAuthentication no"
#remove "#" in front of the line if present