Linux上でOpehSSH形式の鍵をPuTTY形式(ppk)に変換する方法 †Linux上で、ssh-keygen -t rsa コマンドによりSSH認証鍵を作成後、 尚、Windowsであればputtygenコマンドをダウンロードし実行すればGUIによる変換操作が可能です。(Download PuTTY Windows) 参考サイト †Windows用PuTTY 動作確認Linux †$ lsb_release -cd Description: Ubuntu 18.04.2 LTS Codename: bionic puttyのインストール †puttygenコマンドを使用したいので、puttyパッケージを以下のコマンドでインストールします。
OpenSSH形式の秘密鍵をppkに変換する †以下、puttygenコマンドを使用しOpenSSH形式の秘密鍵をPuTTY形式の秘密鍵に変換します。 puttygen OpenSSH形式の秘密鍵ファイル -O private -o 出力ファイル名 以下に例を記します。
上記コマンドを実行すると、パスフレーズを聞かれますのでパスフレーズを入力しEnterキーを押下します。 puttygenの-O, -oオプションの意味は以下の通りです。
以下はhelpオプションの出力になります。 $ puttygen --help PuTTYgen: key generator and converter for the PuTTY tools Release 0.70 Usage: puttygen ( keyfile | -t type [ -b bits ] ) [ -C comment ] [ -P ] [ -q ] [ -o output-keyfile ] [ -O type | -l | -L | -p ] -t specify key type when generating (ed25519, ecdsa, rsa, dsa, rsa1) -b specify number of bits when generating key -C change or specify key comment -P change key passphrase -q quiet: do not display progress bar -O specify output type: private output PuTTY private key format private-openssh export OpenSSH private key private-openssh-new export OpenSSH private key (force new format) private-sshcom export ssh.com private key public RFC 4716 / ssh.com public key public-openssh OpenSSH public key fingerprint output the key fingerprint -o specify output file -l equivalent to `-O fingerprint' -L equivalent to `-O public-openssh' -p equivalent to `-O public' --old-passphrase file specify file containing old key passphrase --new-passphrase file specify file containing new key passphrase --random-device device specify device to read entropy from (e.g. /dev/urandom) 以上、Linux上でOpenSSH形式の秘密鍵をPuTTY形式に変換する方法でした。 |