Adding ssh-id-copy to OSX !

There’s a very convenient shell script bundled with some distributions of OpenSSH called ssh-copy-id. It seems not to be the case with Leopard’s or Lion’s SSH.
In order to get it, we can simply check it out of a GIT repository. Execute these two commands:

sudo curl 'https://raw.github.com/gist/1639381/eea46277ba544fcbd0a0768e8b3f854880ddb772/ssh-copy-id' -o /usr/bin/ssh-copy-id
sudo chmod +x /usr/bin/ssh-copy-id

Now execute ssh-id-copy like this:

MBP:~ martijn$ ssh-copy-id root@192.168.0.7
Now try logging into the machine, with "ssh 'root@192.168.0.7'", and check in:

~/.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

2 thoughts on “Adding ssh-id-copy to OSX !

  1. Ehy, I wasn’t aware of this! It’s about time to retire the following kludge:

    cat .ssh/id_rsa.pub | ssh root@192.168.1.101 ‘mkdir .ssh; chmod 700 .ssh; cat >> .ssh/authorized_keys2; chmod 600 .ssh/authorized_keys2’

    Good find Martijn!

    Giuliano

Leave a Reply

Your email address will not be published. Required fields are marked *