Posted at




down vote

The command in the above answer is just printing public key portion in RFC4716 format.

At some point, ssh-keygen generates openssh private key which doesn't use cipher supported by puttygen.

ssh-keygen doesn't provide option to specify cipher name to encrypt the resulting openssh private key.

There is a workaround: remove the passphrase from the key before importing into puttygen.

$ cp ~/.ssh/id_ed25519 ~/.ssh/id_ed25519-for-putty

$ ssh-keygen -p -f ~/.ssh/id_ed25519-for-putty

Enter old passphrase:

Enter new passphrase (empty for no passphrase):

Enter same passphrase again:

Then, use puttygen to convert ~/.ssh/id_ed25519-for-putty into .ppk and set the passphrase from puttygen.

Don't forget to shred and remove ~/.ssh_id_ed25519-for-putty afterwards for obvious reason.




1: ssh-keygenで普通にed25519形式のキーを生成します。ここでは普通にパスワードを入力して平気です。

cd ~/.ssh

ssh-keygen -t ed25519 -C "コメント(メルアドとか入れとく)"

2: 加工するのでコピーを取る

cp ~/.ssh/id_ed25519 ~/.ssh/id_ed25519-for-putty

3: 2.で作成したコピーを編集して、パスワードを空にしましょう。

ssh-keygen -p -f ~/.ssh/id_ed25519-for-putty

Enter old passphrase: <your passphrase>
Enter new passphrase (empty for no passphrase): <press Enter>
Enter same passphrase again: <press Enter>

// 後始末
sudo chown あなたのユーザ名:あなたのユーザ名 id_ed25519
sudo chmod 600 id_ed25519

5: 生成したid_ed25519-for-puttyをwindowsに移動させて、puttygenにimportします!


参考URL: stackoverflow