:date: 2012-11-09 14:33 .. index:: tech, ssh SSH === It's a bit here, isn't it. Well, that's because I'm a bit busy these days. Unfortunately. A bit too focussed on tech as well. But that generates at least some output. Like this one: A script to deploy your public SSH key on a lot of remote hosts. Making this script cost me a lot. I went through several different approaches to find a solution: * in :program:`bash` * in :program:`perl` * in :program:`bash` with :program:`expect` At the end and after I've managed it in :program:`bash` with :program:`expect`, I figured out that this was a common problem and somebody has written a tool called :command:`copy-ssh-id` for it, that does most of the stuff. Very annoying. So I've stripped most of the old script away and ended up with a weird, little script that does the magic in one line. In order to make it work for you as well, you need some more information, I guess: #. To make it work I had to temporarily modify my :file:`~/.ssh/config` file. I got a lot of host-verification-errors when running the script and couldn't deploy a single key until I've disabled the host verification for all hosts while running the script. .. code:: bash Host * StrictHostKeyChecking no #. The format of the host-file you provide with the *-l* parameter is probably not what you'll have available. You therefore need to adjust the :samp:`$hostname` assignment in the script according to your source-file. #. The too :command:`ssh-copy-id` only uses hostnames. Your source-file therefore should contain the hostnames of the hosts, only the IP addresses will not work.