Copy your ssh public key to a server from a machine that doesn’t have ssh-copy-id

A very simple (one command) way of copying your SSH public key to a remote server.

cat ~/.ssh/ | ssh [email protected] "cat >> ~/.ssh/authorized_keys"

or im my case:

cat ~/.ssh/ | 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 for this idea.

By James Collins

A WordPress web developer and ameteur photographer from Perth, Australia. I've been using WordPress since version 2.2.    
More about me →     Follow @james_collins_ on Twitter →

Leave a Reply

Your email address will not be published.