在 Mac 终端中使用 PPK 文件通过 SSH 连接到远程连接 [英] Use PPK file in Mac Terminal to connect to remote connection over SSH

查看:62
本文介绍了在 Mac 终端中使用 PPK 文件通过 SSH 连接到远程连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在 Windows XP 上使用 Putty,并使用 .ppk 文件连接到我的 Linux 服务器(多台服务器).

I have been using Putty on Windows XP and used the .ppk file to connect to my Linux servers (several servers).

在服务器上我有以下文件夹和文件 ~/.ssh/authorized_keys

On the servers I have the following folder and file ~/.ssh/authorized_keys

我现在想使用 Mac 通过终端连接.我已经手动设置了到服务器的远程连接,想知道如何使用 ppk 文件或其中的私钥/公钥进行设置.

I now want to use a Mac to connect via the terminal. I have set up the remote connections to the servers manually and want to know how I can setup using the ppk file or the private/public key within it.

请注意:我已经在使用来自 Windows 的私钥/公钥登录,所以我不需要使用 keygen 创建一个新的密钥,我只想知道如何设置,因为我已经拥有了这些密钥.(也就是说,我服务器上已经有了授权密钥列表,还有公私钥).

Please note : I already am using private/public key login from Windows so I do not need to create a new key using keygen, I just want to know how to set up now that I have the keys already. (In other words, I already have the authorized key lists on the server, and the public and private key).

推荐答案

您可以在 Mac 上直接从终端 ssh,但您需要使用 .PEM 键而不是 putty .PPK 键.您可以在 Windows 上使用 PuttyGen 将 .PEM 转换为 .PPK,不过我不确定其他方式.

You can ssh directly from the Terminal on Mac, but you need to use a .PEM key rather than the putty .PPK key. You can use PuttyGen on Windows to convert from .PEM to .PPK, I'm not sure about the other way around though.

您也可以通过 portbrew 使用 putty for Mac 转换密钥:

You can also convert the key using putty for Mac via port or brew:

sudo port install putty

brew install putty

这也将安装 puttygen.要让 puttygen 输出一个 .PEM 文件:

This will also install puttygen. To get puttygen to output a .PEM file:

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

获得密钥后,打开终端窗口并:

Once you have the key, open a terminal window and:

ssh -i privatekey.pem user@my.server.com

私钥必须具有严格的安全设置,否则 SSH 会报错.确保只有用户可以读取密钥.

The private key must have tight security settings otherwise SSH complains. Make sure only the user can read the key.

chmod go-rw privatekey.pem

这篇关于在 Mac 终端中使用 PPK 文件通过 SSH 连接到远程连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆