iEFdev

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.

Install

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

sudo curl https://raw.githubusercontent.com/beautifulcode/ssh-copy-id-for-OSX/master/ssh-copy-id.sh -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

Usage

ssh-copy-id -i ~/.ssh/your_id_file.pub username@remote-server.foo

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.

Comments