copy ssh public key
You need to have a public key. If you haven’t generated keys before use:
ssh-keygen -t rsa
copy ssh public key is very simple. there are some ways to achieve this:
Using ssh-copy-id (recommended)
with this very simple command you can copy your public key to any user@host combination
scp .ssh/id_rsa.pub user@host2:.ssh/authorized_keys
cd ~/ before.
The different is that scp will create a new file called authorized_keys while ssh-copy-id will add to id.