Today I tried to find the ssh-copy-id program for MinGW shells but I couldn’t find it anywhere. So I decided to write a shell script to imitate it and of course try to learn some basic shell scripting.

To be honest this is one of my first takes at shell scripting. But the resulting script works and seems fairly robust so here it is for any fellow MinGW users who need to copy their identities to remote machines.

The script creates the .ssh directory on the remote machine if it doesn’t exist and ensures correct permissions for both the directory and the identity file. It should work in most MSYS-based installations: MinGW, MSYS, MSYS-Git, etc. – but if it doesn’t let me know!

To use it: download the file, put it in a directory in your PATH (I put it inside the bin directory of my shell) and give it execution permissions (+x).

Happy SSH’ing!

Leave a Reply