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 firstname.lastname@example.org
Now try logging into the machine, with "ssh 'email@example.com'", and check in:
to make sure we haven't added extra keys that you weren't expecting.
Ehy, I wasn’t aware of this! It’s about time to retire the following kludge:
cat .ssh/id_rsa.pub | ssh firstname.lastname@example.org ‘mkdir .ssh; chmod 700 .ssh; cat >> .ssh/authorized_keys2; chmod 600 .ssh/authorized_keys2’
Good find Martijn!
If you use homebrew, you can just:
brew install ssh-copy-id