Mostly used for passwordless SSH login; there are a few methods to copy your SSH public key to the SSH server.

  1. Use SSH‘s bundled command, ssh-copy-id

    $ ssh-copy-id [email protected]

    If you want to use other public key rather that then one in the default location,
    use the -i option as the following

    $ ssh-copy-id -i ~/.ssh/other_key.pub [email protected]
  2. Manually append the content of your public key file (normally ~/.ssh/id_rsa.pub to the server’s ~/.ssh/authorized_keys
  3. Using the following simple Bash script

    $ cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat >> ~/.ssh/authorized_keys