Path: 宝塔面板 API 参考 › 密码管理

`POST /password`

获取面板密码认证和 SSH 密钥认证的配置状态。

## Request body

_Required._

- `opPostPassword.request_time` (string, required) — Unix 时间戳；与接口密钥一起生成 request_token。
- `opPostPassword.request_token` (string, required) — 按 API 概览中的双重 MD5 签名算法生成。
- `opPostPassword.action` (string, required) — 固定值 `GetConfig`

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "action": "string"
}
```

## Code samples

### cURL（填写面板地址与签名）

```curl
curl --request POST \
  --url "https://your-panel.example.com:8888/password" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "request_time=<Unix时间戳>" \
  --data-urlencode "request_token=<按 API 概览生成的签名>" \
  --data-urlencode "action=GetConfig"
```

## Responses

### default

接口响应，业务状态见下方详细说明。

#### Example

```json
{
  "password": "no",
  "pubkey": "no",
  "rsa_auth": "no"
}
```

- `opPostPassword.response.default.password` (string, optional) — 密码登录：`yes`/`no`
- `opPostPassword.response.default.pubkey` (string, optional) — 公钥认证：`yes`/`no`
- `opPostPassword.response.default.rsa_auth` (string, optional) — RSA 认证：`yes`/`no`


## GetConfig

获取面板密码认证和 SSH 密钥认证的配置状态。

- **路由**：`POST /password`
- **action**：`GetConfig`

## 输入参数

| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| action | 是 | String | 固定值 `GetConfig` |

## 输出参数

| 参数名称 | 类型 | 描述 |
|----------|------|------|
| password | String | 密码登录：`yes`/`no` |
| pubkey | String | 公钥认证：`yes`/`no` |
| rsa_auth | String | RSA 认证：`yes`/`no` |

## 示例

```json
{"password": "no", "pubkey": "no", "rsa_auth": "no"}
```

## 相关方法

- `SetPassword` — 开启密码认证
- `StopPassword` — 关闭密码认证
- `StopKey` — 关闭密钥认证
- `get_mysql_root` — 获取 MySQL root 密码

