#author("2019-03-05T09:48:42+09:00","","")
#navi(../)
* Linux上でOpehSSH形式の鍵をPuTTY形式(ppk)に変換する方法 [#ve5a95b1]
Linux上で、ssh-keygen -t rsa コマンドによりSSH認証鍵を作成後、~
PuTTY形式にLinux上で変換したい場合は、本資料が役に立つと思います。
FileZillaで鍵認証設定をしようとすると、鍵の形式がPPKとPEM形式となっていたため、本資料を作成しました。~

尚、Windowsであればputtygenコマンドをダウンロードし実行すればGUIによる変換操作が可能です。([[Download PuTTY Windows>https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html]])

#htmlinsertpcsp(linux_ads_top.html,linux-sp.html)
#contents

* 参考サイト [#e1ef4a74]
Windows用PuTTY
-[[Download PuTTY(Windows)>https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html]]

* 動作確認Linux [#ff6874b1]
 $ lsb_release -cd
 Description: Ubuntu 18.04.2 LTS
 Codename:    bionic

* puttyのインストール [#g6bbc6ce]
puttygenコマンドを使用したいので、puttyパッケージを以下のコマンドでインストールします。
+ 端末(ターミナル)を起動します。
+ 以下のコマンドを実行します。
 sudo apt install putty
+ yes/noが表示されたら、Yを押しEnterキーを押下します。
上記の操作でputtygenコマンドがインストールされます。

* OpenSSH形式の秘密鍵をppkに変換する [#oe9740f3]
以下、puttygenコマンドを使用しOpenSSH形式の秘密鍵をPuTTY形式の秘密鍵に変換します。~
変換コマンドの構文は以下の通りです。
 puttygen OpenSSH形式の秘密鍵ファイル -O private -o 出力ファイル名
以下に例を記します。
-OpenSSH形式の秘密鍵ファイル名~
sakura-ssh-key
-出力するPuTTY形式のファイル名~
sakura.ppk
上記の場合、以下のような構文になります。
 puttygen sakura-ssh-key -O private -o sakura.ppk

上記コマンドを実行すると、パスフレーズを聞かれますのでパスフレーズを入力しEnterキーを押下します。~
以上の操作により、変換されたファイルが出力されます。

puttygenの-O, -oオプションの意味は以下の通りです。~
- -Oにprivateを指定したので、PuTTY形式を指定したことになります。
- -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形式に変換する方法でした。

#htmlinsertpcsp(linux_ads_btm.html,linux-sp.html)


トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS