Code, Computers & Random Junk

Ssh-copy-id on OS X

This is a really nice script I found a while ago in this blog post that brings ssh-copy-id to OS X.


From Terminal, you can directly download/install it with:

sudo curl -o /usr/local/bin/ssh-copy-id
sudo chmod +x /usr/local/bin/ssh-copy-id

…or if you are using Homebrew.

sudo brew install ssh-copy-id


ssh-copy-id -i ~/.ssh/

Don’t forget to set persmissions on your remote files:

chmod 600 $REMOTE_HOME/.ssh/id_dsa
chmod 400 $REMOTE_HOME/.ssh/authorized_keys

chmod 400 brings a little more security to the file. It’ll make the authorized_keys file read-only for the user and denied to all other permissions.