I generated a keys with putty w/ no passphrase. putty works fine, but now i installed cygwin and would like to use ssh to login. For some reason i'm prompted for a passphrase? why? putty just logs straight in? i don't want to have to generate a new key and annoy the network admins. here is what it looks like in cygwin: $ ssh -i Documents\ and\ Settings/xxxxx/My\ Documents/xxxxx\ putty\ keys/private\ key.ppk dev.xxxxxx.com Enter passphrase for key 'Documents and Settings/xxxxx/My Documents/xxxxx putty keys/private key.ppk': Permission denied (publickey).
4 Answers
Putty uses its own .ppk format for keyfiles, and Cygwin's ssh probably can't read them correctly.
Solution: convert the .ppk file to OpenSSH key format with puttygen.exe.

- 36,252
- 29
- 106
- 169
-
I have a key pair I generated with openssh and then converted into putty keys. oddly enough the putty one works but the openssh doesn't. tried using puttygen but no luck with that either. any ideas? – user1084563 Mar 09 '12 at 09:31
-
@user1084563: So you have a key pair generated with openssh and it doesn't work with openssh? Sorry, I don't think puttygen can fix that. The problem is somewhere else. – Joonas Pulakka Mar 09 '12 at 09:55
-
It's really useful. My cygwin ssh utils now working! Menu Conversions/Export OpenSSH key. Thank you Joonas! – artoodetoo Oct 04 '13 at 13:39
You need to get "puttygen.exe" from the putty webpage http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html to convert your key to the OpenSSH format. Then it should just work.

- 7,059
- 6
- 31
- 58
If you can login with putty, there is no need to "annoy the network admins". Just generate a new key with cygwin, then login with putty and place your new public key in your .ssh/authorized_keys file. You should now be able to login with cygwin's ssh.
EDIT:
By the way, a sure way to "piss off" any admin is to use unencrypted keys.

- 30,436
- 41
- 178
- 315

- 47,505
- 4
- 67
- 87
You can export PuTTY keys to OpenSSH format and append them to your .ppk file, so that it becomes a valid key for ssh-add.
Just export the private key with PuTTYGen then add it to the .ppk file, then you should be able to ssh-add it. But note that when you edit the .ppk itself with PuTTYGen, it will ovewrite the file.
You can also use a script like this for adding a .ppk file into your SSH agent:
file=~/`basename $0`.tmp
trap "rm -v $file" EXIT
echo -n "Password: "
read -s pwd
echo $pwd | puttygen -P -q -O private-openssh $1 -o $file
ssh-add $file
Source: http://bazaar.launchpad.net/~renatosilva/+junk/scripts/view/head:/ppk-add.sh

- 21
- 1