Files
dbx/docs/content/docs/ssh-tunnel.cn.mdx
T
t8y2 89fa8c02be docs: add landing page and upgrade all documentation with advanced components
- Add product landing page with hero section, stats, feature cards, database badges, comparison table, and screenshots
- Register Fumadocs MDX components (Tabs, Steps, Callout, Cards, Accordions) globally
- Rewrite all 17 doc pages (CN + EN) with richer content, use cases, and advanced components
- Add competitive comparison table (vs DBeaver/Navicat/TablePlus)
- Add ~300 lines of responsive landing page CSS
2026-05-07 14:53:35 +08:00

53 lines
1.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: SSH 隧道
description: 通过 SSH 隧道安全连接防火墙后的数据库,支持密码和密钥认证。
---
<Callout type="info">
内置 SSH 隧道,无需在终端手动建立。支持密码和密钥认证,可选暴露给局域网供团队共享。
</Callout>
当数据库服务器不允许直接远程访问时(例如在防火墙或私有网络后面),你可以通过 SSH 隧道安全地连接。
## 配置
在创建或编辑数据库连接时,启用"SSH 隧道"选项:
| 字段 | 说明 |
|---|---|
| SSH 主机 | SSH 服务器的地址 |
| SSH 端口 | SSH 端口(默认 22) |
| SSH 用户名 | 登录 SSH 服务器的用户名 |
## 认证方式
<Tabs groupId="ssh-auth" items={['密钥认证(推荐)', '密码认证']}>
<Tab value="密钥认证(推荐)">
选择本地的 SSH 私钥文件(如 `~/.ssh/id_rsa`、`~/.ssh/id_ed25519`):
- **密钥路径** — 点击文件选择器浏览并选择私钥文件
- **密钥密码** — 如果私钥设置了密码保护,在此输入
密钥认证比密码认证更安全,推荐优先使用。
</Tab>
<Tab value="密码认证">
输入 SSH 用户的登录密码即可。适用于允许密码登录的服务器。
</Tab>
</Tabs>
## 允许局域网访问
<Callout type="warn">
启用"允许局域网访问"后,同一网络中的其他设备也可以通过你的机器访问该 SSH 隧道。仅在可信网络中启用此选项。
</Callout>
默认情况下,SSH 隧道仅监听 `localhost`。启用局域网访问后,隧道绑定到 `0.0.0.0`,适用于团队协作或多设备共享数据库连接的场景。
## 工作原理
1. DBX 与 SSH 服务器建立连接
2. 创建本地端口,将流量通过 SSH 隧道转发到数据库服务器
3. DBX 通过转发的本地端口连接数据库
隧道在数据库连接期间保持活跃,断开连接时自动关闭。