ssh-keygen
cat ~/.ssh/id_rsa.pub
nano ~/.ssh/authorized_keys
#then add your public key in the end (new line pls)
# generate ssh key first on your source host:
ssh-keygen -t rsa
# copy it to the remote/target host:
ssh-copy-id remote_username@server_ip_addressCopy
# if for some reason the above method unavailable, use:
cat ~/.ssh/id_rsa.pub | ssh remote_username@server_ip_address "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
ssh-copy-id -i $HOME/.ssh/id_rsa.pub user@server1.cyberciti.biz
A public key that is copied to the SSH server(s).
Anyone with a copy of the public key can encrypt data which
can then only be read by the person who holds the corresponding private
key.
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDD3889tTsdyhHAakHJk3tIEwlFL6cL4i7XVBkOq+bvlvXyM+rzH+ZVpBUn8JBTjsACPkZvag4lR82qDlG2l4PKvDuUuGZVu5BIcAvUrVNroD8fs03eAuYme2oIfY8UHObzlXwsIOHMktJTs/EagHKuhW4ku+MxBdnX4a1gGIFj8zVL80yyJg7JAtlZtDe/wxKiHqCMb+tejtneYWHnHQBn0kv8tkr1LsodF1M6JVuYjF5V8cThN73PE6luOCa9AmZej0s0/oLprmINbyg+8Nk0JwqwkPiZvox+8m1o4ww02fhXuDRvapgku61/zgzbsGoBBDVaXdUsfWHObVblg4/0AujJWl20/qXAZkGDXgJ574ud0bFcgNJ2FVT9BzJDzxd46SQnDTelWr/jx5DY6sdsUH+VxFHC6SfzXWiSYLauDWTstWdIzxPy78RZ/9nDsavelLVNHahzhB7/T6qDTwSdCoDIrq3Jg69r1hda1CfSG27t4naSWMjEAZd4B3UEBMM= root@99153e607ab3