157

有没有办法将 PEM 文件转换为 PPK 文件?(您可能会猜到 Amazon EC2 给了我一个 PEM 文件,我需要使用 PPK 格式进行 SSH 连接)。

4

11 回答 11

264

Use PuTTYGen

Creating and Using SSH Keys

Overview

vCloud Express now has the ability to create SSH Keys for Linux servers. This function will allow the user to create multiple custom keys by selecting the "My Account/Key Management" option. Once the key has been created the user will be required to select the desired SSH Key during the “Create Server” process for Linux.

Create and Use SSH Keys

  1. Create keys
    • Navigate to “My Account”</li>
    • Select “Key Management”</li>
    • Create New Key.
      • During the key creation process you will be prompted to download your private key file in .PEM format. You will not be able to download the private key again as it is not stored in vCloud Express.
      • The “Default” checkbox is used for the API.
  2. Deploy server and select key
  3. Connect

    • SSH (Mac/Linux)
      • Copy .PEM file to the machine from which you are going to connect.
      • Make sure permissions on .PEM file are appropriate (chmod 600 file.pem)
      • Connect with ssh command: ssh vcloud@ipaddress –i privkey.pem
    • Putty (Windows)
      • Download Putty and puttygen from - here
      • Use puttygen to convert .PEM file to .PPK file.
      • Start puttygen and select “Load”</li>
      • Select your .PEM file.
      • Putty will convert the .PEM format to .PPK format. enter image description here
      • Select “Save Private Key” A passphrase is not required but can be used if additional security is required.
    • Connect with Putty.

      • Launch Putty and enter the host IP address. If connecting to the 10.X private address you must first establish an SSL VPN connection.
      • Navigate to Connection/SSH/Auth
      • Click “Browse” and select the .PPK file you exported from puttygen. enter image description here

      • Click “Open.” When connection comes up enter username (default is vcloud).

Instructions copied from here

于 2010-07-06T22:35:04.477 回答
75

我很震惊,因为解决方案非常简单,所以这个问题没有得到回答。

如前几篇文章所述,您不想使用 C# 转换它,而只想转换一次。使用 PuTTYGen 很容易做到这一点。

  1. 从 AWS 下载您的 .pem
  2. 打开 PuTTYgen
  3. 单击右侧的“加载”大约向下 3/4
  4. 将文件类型设置为 *.*
  5. 浏览并打开您的 .pem 文件
  6. PuTTY 将自动检测所需的一切,您只需单击“保存私钥”即可保存您的 ppk 密钥以与 PuTTY 一​​起使用

享受!

于 2011-11-15T05:34:10.270 回答
19
  1. 下载puttygen
  2. 然后打开puttygen
  3. 点击加载
  4. 将文件类型设置为. 所有文件
  5. 保存私钥
  6. 然后你可以保存文件成为ppk文件的任何名称
于 2017-03-23T15:07:48.227 回答
18

如果您有 Linux 机器,只需在系统中安装 puttygen 并使用以下命令转换密钥

pem 到 ppk 使用以下命令:

puttygen keyname -o keyname.ppk

下面的命令用于将 ppk 转换为 pem 而不是 pem 到 ppk

puttygen filename.ppk -O private-openssh -o filename.pem

于 2019-12-26T17:49:36.830 回答
9

要通过 SSH 连接到 AWS EC2 实例,即使在 Windows 机器上,您也不需要将 .PEM 文件转换为 PPK 文件,使用“git bash”工具进行简单 SSH。无需下载和转换这些软件 - 希望这将节省您下载和转换密钥的时间,并让您有更多时间在 EC2 上。

于 2017-12-10T07:17:30.757 回答
7
  1. 将 YourPEMFILE.pem 保存到 .ssh 目录
  2. 从命令提示符运行 puttygen

    一个。单击“加载”按钮以“加载现有的私钥文件”<br> b. 将文件过滤器更改为“所有文件 ( . )
    选择 YourPEMFILE.pem
    d。单击打开
    e。Puttygen 显示一条通知说它已成功导入外键。单击确定。
    F。点击“保存私钥”按钮
    g。当询问您是否确定要在不输入密码的情况下保存时,回答“是”。
    H。输入文件名 YourPEMFILE.ppk
    i。点击“保存”</p>

于 2019-03-01T05:55:00.407 回答
6

将 .pem 文件转换为适用于 Windows 10 的 .ppk

您需要执行以下操作:


1.使用Pageant下载PuTTYGen2.“加载”按钮并选择您的“.pem”文件。3.“保存私钥”按钮并保存您的“.ppk”文件。4.打开Pageant并按“添加密钥”按钮。只是所有。继续在后台运行 Pageant5.现在通过SSHSFTP登录,无需选择密码字段。




在此处输入图像描述


在此处输入图像描述


在此处输入图像描述

于 2019-10-09T17:33:58.443 回答
2

用于 Ubuntu/Linux 和 PEM 到 PPK 的 PuTTYgen

sudo apt install putty-tools
puttygen -t rsa -b 2048 -C "user@host" -o keyfile.ppk
于 2019-12-22T12:08:49.713 回答
1

我使用了 ZOC 终端仿真器的试用版,它工作正常。它很容易接受亚马逊的 *.pem 文件。

诀窍是,您需要为用户名指定“ec2-user”而不是“root”——尽管 EC2 控制台中显示了示例,但这是错误的!;-)

于 2011-05-22T16:53:03.290 回答
1

sudo yum install putty

sudo apt-get install putty-tools

将 .pem 文件转换为 .ppk 文件

sudo puttygen pemKey.pem -o ppkKey.ppk -O private

将 .ppk 文件转换为 .pem 文件

sudo puttygen ppkkey.ppk -O private-openssh -o pemkey.pem

于 2021-05-29T14:35:56.400 回答
0

我对 PuttyGen 有同样的问题,不想导入 openSSH 私钥。我尝试了一切,我发现旧版本的 PuttyGen 不支持导入 OpenSSH。一旦我下载了最新的 Putty,puttygen 就允许它很好地导入 openssh 私钥。现在,我的办公桌边上有一个洞,过去一个小时我的头一直在撞它。

于 2019-05-16T20:50:56.707 回答