Table of Contents
How to push your SSH key to your SSH server
ssh-copy-id is the command for this, we can simply use it thus:
ssh-copy-id -i ~/.ssh/id_rsa.pub -p 22 fred@10.1.1.1
Above, we're assuming your private key is in the usual place (~/.ssh/id_rsa.pub) change this if you've put it elsewhere, Port we're using is 22 (the standard port) and the account on the remote server is 'fred' at the server 10.1.1.1
You will probably be prompted for a password, enter it and it will then upload your key.
To enable BOTH Key and Password (recommended) edit your sshd_config file which normally resides in /etc/ssh
Add the line
AuthenticationMethods "publickey,password"
and comment out or remove the line
PasswordAuthentication yes
Then restart sshd (systemctl restart sshd) and test.
Generate Public/Private Key Pair for SSH
If you've come here looking to CREATE a private/public key, then its very simple, just use
ssh-keygen -t rsa
This will (should) create your key pair in your ~/.ssh folder.