Saturday, January 16, 2021

How to copy a public key to a server

 First make sure you have a public key and an authorized_keys file under you ~/.ssh folder

If you don't have a public key (id_rsa.pub) a file under the .ssh directory, then you can run the ssh-keygen command

ssh-keygen

Just press enter and use the default values for the key. 

Also, create the authorized_keys file to put in there the public keys of the other computers

cat ~/.ssh/id_rsa.pub | ssh ip.address 'cat >> .ssh/authorized_keys'