cygwin ssh no putty yes?
Asked Answered
D

4

9

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).

Doncaster answered 22/2, 2009 at 16:25 Comment(0)
D
19

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.

Dawes answered 22/2, 2009 at 16:38 Comment(3)
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?Yeanling
@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.Dawes
It's really useful. My cygwin ssh utils now working! Menu Conversions/Export OpenSSH key. Thank you Joonas!Flaminius
C
6

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.

Coriecorilla answered 22/2, 2009 at 18:27 Comment(0)
P
2

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.

Paderna answered 23/2, 2009 at 9:48 Comment(0)
F
2

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

Fley answered 2/4, 2012 at 5:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.