I recently needed to add my rsa public key to multiple servers where the .ssh directory didn’t already exist nor the .ssh/authorized_keys in addition to the correct permissions for the .ssh directory and authorized_keys file
I found this taken from the below post on how to install it on OS X: http://thesystemisntdown.blogspot.com/2010/03/ssh-copy-id-on-os-x.html
I can’t find an official source for the ssh-copy-id. If you can, please comment a link for me.
Nevertheless, this should get you what you’re looking for:
wget http://blog.christopherpitzer.com/wp-content/uploads/ssh-copy-id -O /usr/bin/ssh-copy-id
sudo chmod +x /usr/bin/ssh-copy-id
Note: ssh-copy-id appends to authorized_keys file
I created this script to run in order to add to multiple servers:
Note: You need to run this script from your home directory and if you have dsa keys instead of rsa keys, make sure to use the correct name.