One of the most secure things you can do to your server is to disable password logins. You should always disable root login. The first thing you need to do is locally retrieve or create your public ssh key. To see if you have one already created check in this location. On a Mac it’s
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/user/.ssh/id_rsa.
Your public key has been saved in /Users/user/.ssh/id_rsa.pub.
The key fingerprint is:
The key's randomart image is:
--[ RSA 2048]----
| . |
| = o O . |
| = * * |
| o = |
| o S . |
| o o = |
| o . E |
$ scp .ssh/id_rsa.pub email@example.com:.ssh/authorized_keys
$ cat ~/.ssh/id_rsa.pub | ssh firstname.lastname@example.org "cat >> .ssh/authorized_keys"