# 创建 SSH 密钥对

## 前提条件

要在 zenConsole 上创建 SSH 密钥对，您需要先在本地计算机上获取生成的公钥。详细信息请参阅 [获取生成的公钥](/welcome/cn/virtual-machine/best-practice/access-a-virtual-machine.md#ssh-key-pair)。

## 操作步骤

1. 登录 [**zenConsole**](https://console.zenlayer.com/)。
2. 转到 **计算** > **虚拟机** > **SSH 密钥对** 并点击 **创建 SSH 密钥对**。

   <div align="left"><figure><img src="/files/2h8wAwmjsuXQULe7kpsz" alt="" width="563"><figcaption><p>创建 SSH 密钥对</p></figcaption></figure></div>
3. 输入最多 5 个公钥到 SSH 密钥对中。注意格式。\
   公钥文件通常在 "/.ssh" 文件夹中命名为 "id\_rsa.pub"，并以 "ssh-rsa" 开头。请勿使用您的私钥。
4. 标记您的密钥对。
5. *<mark style="color:green;">(可选)</mark>* 如果需要，添加备注。
6. 点击 **确认**。
7. *<mark style="color:green;">(可选)</mark>* 如果不再需要该密钥对，在列表页面中点击 **删除**。

## 结果

您可以在随后创建虚拟机实例时选择 **SSH 密钥对** 登录凭证。

<div align="left"><figure><img src="/files/97ArwbSk2BPOyPbv6U2n" alt=""><figcaption><p>设置 SSH 密钥对登录凭证</p></figcaption></figure></div>

您现在可以使用 SSH 密钥对访问此虚拟机，而无需输入密码。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/welcome/cn/virtual-machine/get-started/network-and-security/create-an-ssh-key-pair.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
