A very simple (one command) way of copying your SSH public key to a remote server.
cat ~/.ssh/id_rsa.pub | ssh [email protected] "cat >> ~/.ssh/authorized_keys"
or im my case:
cat ~/.ssh/id_dsa.pub | ssh [email protected] "cat >> ~/.ssh/authorized_keys"
(replace [email protected] with your SSH username and server hostname)
I’ve previously tried to do this using a manual copy-and-paste method, but it is error prone because the key quite often gets split over multiple lines.
Using this method helps ensure that your SSH key gets copied over completely.
Thanks to commandlinefu.com for this idea.