I have struggled with this a bit but I think it is a common scenario. So for my (future and maybe your) benefit here is the current way I have been setting up SSH under Windows (XP) with cygwin.
- Place the following windows script in the start-up folder, e.g., C:\Documents and Settings\All Users\Start Menu\Programs\Startup:
bash --login c:\cygwin\sshagentrc
- Edit cygwin.bat file so that it looks like this:
- Place the following code in a file .sshagentrc in the c:\cygwin directory
Individual User Setups
- Modify your .bashrc file to include the following lines:
The SVN_SSH is useful when using subversion with ssh (svn+ssh protocol); you can also create a Windows environment variable.
- Goto HOME directory
- Enter the required passphrase (and remember it!)
- This should create a file named identity (or similar) in folder ~/.ssh.
- Email the public key, in files *.pub, to your administrator so that he can add the public key to the required servers.
If you want to run PuTTY (Pageant) as well because you like apps like TortoiseSVN, then
- Import the OpenSSH key into PuTTYgen and create a PuTTY-compatible key (I store it with the OpenSSH keys in my cygwin home directory: c:\cygwin\home\<userid>\.ssh\identity.ppk)
- Place the pageant.exe shortcut into your startup directory
- Modify the short-cut property to “c:\PUTTY_HOME\pageant.exe” “HOME\.ssh\identity.ppk”
This will start up pageant when you log in, asks for your SSH key passphrase and you’re set for the day.
The setup initialises ssh-agent when you log into windows and adds your SSH key to the agent’s session. When starting a cygwin terminal, the .bashrc script ensures that the terminal shares the agent’s session.
Overall, you only have to type in your SSH key’s passphrase once and the rest is easy sailing 😉