> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/welcome/cn/virtual-machine/overview/ssh-key-pair.md).

# SSH 密钥对

SSH（安全外壳）密钥对用于身份认证和加密通信，包括公钥和私钥。公钥可以用来加密只有私钥才能解密的消息。这一特性被用作通过密钥对进行身份认证的方式。您的 SSH 密钥对包含多个公钥，可以放置在服务器上以安全访问它。

## 支持的格式

SSH 密钥通常存储在 \~/.ssh/ 目录中。

<table><thead><tr><th width="169">格式</th><th width="210">以...开头</th><th>最小长度</th></tr></thead><tbody><tr><td><strong>RSA</strong></td><td>ssh-rsa</td><td>2048 位</td></tr><tr><td><strong>ED25519</strong></td><td>ssh-ed25519</td><td>256 位</td></tr><tr><td><strong>ECDSA</strong></td><td>ecdsa-sha2-nistp</td><td>256 位</td></tr></tbody></table>

{% hint style="info" %} <mark style="color:blue;">**注意**</mark>

* <mark style="color:blue;">提供您的公钥。注意不要使用私钥。</mark>
* <mark style="color:blue;">建议您使用</mark> <mark style="color:blue;">**RSA**</mark> <mark style="color:blue;">或</mark> <mark style="color:blue;">**ED25519**</mark> <mark style="color:blue;">密钥，因为它们具有良好的兼容性和安全性。</mark>
  {% endhint %}

## 示例

这里以 RSA 格式为例。

### 公钥

```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDx6VN...
```

### 私钥

```
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: AES-256-CBC,5764636E65726F726974686D616E6F6E
...
-----END RSA PRIVATE KEY-----
```

## 限制

您可以添加最多 5 个公钥 SSH 密钥以创建 SSH 密钥对。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.console.zenlayer.com/welcome/cn/virtual-machine/overview/ssh-key-pair.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
