A) Generate a new ssh private / public key pair.
ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:BIGLONGNUMBERHEREXXXX user@startnet
The key's randomart image is:
+---[RSA 2048]----+
| . +.o*+ |
|............. |
+----[SHA256]-----+
ls -l .ssh/
-rw------- 1 user user 410 Jul 28 18:20 authorized_keys
-rw------- 1 user user 1679 Aug 14 14:48 id_rsa
-rw-r--r-- 1 user user 411 Aug 14 14:48 id_rsa.pub
-rw-r--r-- 1 user user 1110 Aug 14 14:52 known_hosts
B) Copy the id_rsa.pub public key to the server you want to connect to & set .ssh file permissions.
METHOD 1: copy the key over to the other server automatically using ssh commands and your login password.
cat .ssh/id_rsa.pub | ssh paul@tennisadmin.co.uk 'cat >> .ssh/authorized_keys'
ssh paul@tennisadmin.co.uk "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"
METHOD 2: copy the key over to the other server using FTP manually.
FTP a copy of the id_rsa.pub key over to the server you want to connect to and manually add the key to .ssh/authorized_keys.
ssh paul@tennisadmin.co.uk cat id_rsa.pub >> .ssh/authorized_keys chmod 700 .ssh chmod 640 .ssh/authorized_keys
C) Once the key is copied and the permissions set you'll be able to ssh or sftp over straight away without a password!
sftp paul@tennisadmin.co.uk
Connected to tennisadmin.co.uk...
Got this from https://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps