SSH: Copying public key to remote server
Oct 16, 2020
Show that there is no public key for this SSH key:
ssh-keygen -l -f ~/.ssh/id_rsa
Generate public key from the private key provided with the -f option:
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
Check again:
ssh-keygen -l -f ~/.ssh/id_rsa
Copying to public key to remote server (Linux):
ssh-copy-id username@remote_host
Copying to public key to remote server (Windows):
cat ~/.ssh/id_rsa.pub | ssh username@remote_host "cat >> ~/.ssh/authorized_keys"
Now you can login without password:
ssh username@remote_host