欢迎光临
我们一直在努力

服务器部署RustDesk记录

文章目录

    • 部署架构图
  • 背景
    • 第一步:安装 Docker 和 Docker Compose
    • 第二步:创建部署目录
    • 第三步:创建 docker-compose.yml 文件
      • 服务架构说明
    • 第四步:检查配置文件并启动服务
    • 第五步:查看服务日志并生成密钥
    • 第六步:开放防火墙端口
    • 第七步:启用 UFW 防火墙
    • 第八步:获取 Key 并完成部署
      • 密钥生成与验证流程
    • 常用
      • 服务状态监控视图
      • 端口与协议关系图
      • 查看服务状态
      • 重启服务
      • 重置 / 重新生成 Key

部署架构图

#mermaid-svg-XiYTYziDFrD4yHDd{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-XiYTYziDFrD4yHDd .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-XiYTYziDFrD4yHDd .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-XiYTYziDFrD4yHDd .error-icon{fill:#552222;}#mermaid-svg-XiYTYziDFrD4yHDd .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-XiYTYziDFrD4yHDd .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-XiYTYziDFrD4yHDd .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-XiYTYziDFrD4yHDd .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-XiYTYziDFrD4yHDd .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-XiYTYziDFrD4yHDd .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-XiYTYziDFrD4yHDd .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-XiYTYziDFrD4yHDd .marker{fill:#333333;stroke:#333333;}#mermaid-svg-XiYTYziDFrD4yHDd .marker.cross{stroke:#333333;}#mermaid-svg-XiYTYziDFrD4yHDd svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-XiYTYziDFrD4yHDd p{margin:0;}#mermaid-svg-XiYTYziDFrD4yHDd .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#mermaid-svg-XiYTYziDFrD4yHDd .cluster-label text{fill:#333;}#mermaid-svg-XiYTYziDFrD4yHDd .cluster-label span{color:#333;}#mermaid-svg-XiYTYziDFrD4yHDd .cluster-label span p{background-color:transparent;}#mermaid-svg-XiYTYziDFrD4yHDd .label text,#mermaid-svg-XiYTYziDFrD4yHDd span{fill:#333;color:#333;}#mermaid-svg-XiYTYziDFrD4yHDd .node rect,#mermaid-svg-XiYTYziDFrD4yHDd .node circle,#mermaid-svg-XiYTYziDFrD4yHDd .node ellipse,#mermaid-svg-XiYTYziDFrD4yHDd .node polygon,#mermaid-svg-XiYTYziDFrD4yHDd .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-XiYTYziDFrD4yHDd .rough-node .label text,#mermaid-svg-XiYTYziDFrD4yHDd .node .label text,#mermaid-svg-XiYTYziDFrD4yHDd .image-shape .label,#mermaid-svg-XiYTYziDFrD4yHDd .icon-shape .label{text-anchor:middle;}#mermaid-svg-XiYTYziDFrD4yHDd .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-XiYTYziDFrD4yHDd .rough-node .label,#mermaid-svg-XiYTYziDFrD4yHDd .node .label,#mermaid-svg-XiYTYziDFrD4yHDd .image-shape .label,#mermaid-svg-XiYTYziDFrD4yHDd .icon-shape .label{text-align:center;}#mermaid-svg-XiYTYziDFrD4yHDd .node.clickable{cursor:pointer;}#mermaid-svg-XiYTYziDFrD4yHDd .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-XiYTYziDFrD4yHDd .arrowheadPath{fill:#333333;}#mermaid-svg-XiYTYziDFrD4yHDd .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-XiYTYziDFrD4yHDd .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-XiYTYziDFrD4yHDd .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-XiYTYziDFrD4yHDd .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-XiYTYziDFrD4yHDd .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-XiYTYziDFrD4yHDd .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-XiYTYziDFrD4yHDd .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-XiYTYziDFrD4yHDd .cluster text{fill:#333;}#mermaid-svg-XiYTYziDFrD4yHDd .cluster span{color:#333;}#mermaid-svg-XiYTYziDFrD4yHDd div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-XiYTYziDFrD4yHDd .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-XiYTYziDFrD4yHDd rect.text{fill:none;stroke-width:0;}#mermaid-svg-XiYTYziDFrD4yHDd .icon-shape,#mermaid-svg-XiYTYziDFrD4yHDd .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-XiYTYziDFrD4yHDd .icon-shape p,#mermaid-svg-XiYTYziDFrD4yHDd .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-XiYTYziDFrD4yHDd .icon-shape .label rect,#mermaid-svg-XiYTYziDFrD4yHDd .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-XiYTYziDFrD4yHDd .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-XiYTYziDFrD4yHDd .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-XiYTYziDFrD4yHDd :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}

客户端连接

Docker 容器

开始部署 RustDesk

安装 Docker & Docker Compose

创建部署目录

配置 docker-compose.yml

启动 hbbs & hbbr 服务

生成密钥

配置防火墙端口

客户端连接配置

部署完成

hbbsID/中继服务器

hbbr中继服务器

远程设备

通过 hbbs 注册

通过 hbbr 中继数据

背景

1、服务器系统:Ubuntu 22.04.5 LTS 2、Rustdesk An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

第一步:安装 Docker 和 Docker Compose

依次执行以下命令:

# 先更新软件包列表,然后升级所有已安装的软件(确保系统最新,减少后续错误)
sudo apt update && sudo apt upgrade -y

# 安装 Docker
sudo apt install -y docker.io docker-compose

# 开机自启
sudo systemctl enable –now docker

# 把当前用户加入 docker 组,避免每次都要 sudo(推荐)
sudo usermod -aG docker $USER

执行完后,重新登录服务器(退出 SSH 再重新连),让 docker 组权限生效。

第二步:创建部署目录

# 创建 RustDesk 部署目录
mkdir -p ~/rustdesk/data

# 进入目录
cd ~/rustdesk

第三步:创建 docker-compose.yml 文件

服务架构说明

#mermaid-svg-b3WvK3RYIJl6xvuJ{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-b3WvK3RYIJl6xvuJ .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-b3WvK3RYIJl6xvuJ .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-b3WvK3RYIJl6xvuJ .error-icon{fill:#552222;}#mermaid-svg-b3WvK3RYIJl6xvuJ .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-b3WvK3RYIJl6xvuJ .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-b3WvK3RYIJl6xvuJ .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-b3WvK3RYIJl6xvuJ .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-b3WvK3RYIJl6xvuJ .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-b3WvK3RYIJl6xvuJ .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-b3WvK3RYIJl6xvuJ .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-b3WvK3RYIJl6xvuJ .marker{fill:#333333;stroke:#333333;}#mermaid-svg-b3WvK3RYIJl6xvuJ .marker.cross{stroke:#333333;}#mermaid-svg-b3WvK3RYIJl6xvuJ svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-b3WvK3RYIJl6xvuJ p{margin:0;}#mermaid-svg-b3WvK3RYIJl6xvuJ .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#mermaid-svg-b3WvK3RYIJl6xvuJ .cluster-label text{fill:#333;}#mermaid-svg-b3WvK3RYIJl6xvuJ .cluster-label span{color:#333;}#mermaid-svg-b3WvK3RYIJl6xvuJ .cluster-label span p{background-color:transparent;}#mermaid-svg-b3WvK3RYIJl6xvuJ .label text,#mermaid-svg-b3WvK3RYIJl6xvuJ span{fill:#333;color:#333;}#mermaid-svg-b3WvK3RYIJl6xvuJ .node rect,#mermaid-svg-b3WvK3RYIJl6xvuJ .node circle,#mermaid-svg-b3WvK3RYIJl6xvuJ .node ellipse,#mermaid-svg-b3WvK3RYIJl6xvuJ .node polygon,#mermaid-svg-b3WvK3RYIJl6xvuJ .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-b3WvK3RYIJl6xvuJ .rough-node .label text,#mermaid-svg-b3WvK3RYIJl6xvuJ .node .label text,#mermaid-svg-b3WvK3RYIJl6xvuJ .image-shape .label,#mermaid-svg-b3WvK3RYIJl6xvuJ .icon-shape .label{text-anchor:middle;}#mermaid-svg-b3WvK3RYIJl6xvuJ .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-b3WvK3RYIJl6xvuJ .rough-node .label,#mermaid-svg-b3WvK3RYIJl6xvuJ .node .label,#mermaid-svg-b3WvK3RYIJl6xvuJ .image-shape .label,#mermaid-svg-b3WvK3RYIJl6xvuJ .icon-shape .label{text-align:center;}#mermaid-svg-b3WvK3RYIJl6xvuJ .node.clickable{cursor:pointer;}#mermaid-svg-b3WvK3RYIJl6xvuJ .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-b3WvK3RYIJl6xvuJ .arrowheadPath{fill:#333333;}#mermaid-svg-b3WvK3RYIJl6xvuJ .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-b3WvK3RYIJl6xvuJ .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-b3WvK3RYIJl6xvuJ .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-b3WvK3RYIJl6xvuJ .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-b3WvK3RYIJl6xvuJ .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-b3WvK3RYIJl6xvuJ .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-b3WvK3RYIJl6xvuJ .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-b3WvK3RYIJl6xvuJ .cluster text{fill:#333;}#mermaid-svg-b3WvK3RYIJl6xvuJ .cluster span{color:#333;}#mermaid-svg-b3WvK3RYIJl6xvuJ div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-b3WvK3RYIJl6xvuJ .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-b3WvK3RYIJl6xvuJ rect.text{fill:none;stroke-width:0;}#mermaid-svg-b3WvK3RYIJl6xvuJ .icon-shape,#mermaid-svg-b3WvK3RYIJl6xvuJ .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-b3WvK3RYIJl6xvuJ .icon-shape p,#mermaid-svg-b3WvK3RYIJl6xvuJ .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-b3WvK3RYIJl6xvuJ .icon-shape .label rect,#mermaid-svg-b3WvK3RYIJl6xvuJ .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-b3WvK3RYIJl6xvuJ .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-b3WvK3RYIJl6xvuJ .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-b3WvK3RYIJl6xvuJ :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}

Docker 配置

RustDesk 服务架构

中继连接

启动

启动

挂载

挂载

hbbs 服务ID/中继服务器端口: 21115-21119

hbbr 服务中继服务器端口: 21116

客户端 A

客户端 B

docker-compose.yml

数据卷~/rustdesk/data

在当前目录(~/rustdesk)中执行以下命令创建配置文件:

nano docker-compose.yml

然后把下面完整内容复制粘贴进去:

version: '3'

services:
hbbs:
container_name: hbbs
image: rustdesk/rustdeskserver:latest
command: hbbs r your_server_ip:21117 # 把 your_server_ip 改成你服务器的公网 IP
volumes:
./data:/root
network_mode: "host"
restart: unlessstopped

hbbr:
container_name: hbbr
image: rustdesk/rustdeskserver:latest
command: hbbr
volumes:
./data:/root
network_mode: "host"
restart: unlessstopped

把 your_server_ip 替换成你服务器的实际公网 IP(例如 123.45.67.89)。

保存并退出:

  • 按键盘 Ctrl + O(保存文件)
  • 按 Enter(确认文件名)
  • 按 Ctrl + X(退出 nano)
  • 第四步:检查配置文件并启动服务

    在 ~/rustdesk 目录下依次执行以下命令:

    # 1. 查看你刚才创建的文件内容(确认是否正确)
    cat docker-compose.yml

    # 2. 启动两个服务(hbbs 和 hbbr)
    sudo docker compose up -d

    在这里插入图片描述

    第五步:查看服务日志并生成密钥

    依次执行以下命令

    # 查看 hbbs 日志(最重要的)
    sudo docker logs hbbs

    # 查看 hbbr 日志
    sudo docker logs hbbr

    # 查看两个容器运行状态
    sudo docker compose ps

    在这里插入图片描述

    在这里插入图片描述

    第六步:开放防火墙端口

    依次执行以下命令:

    sudo ufw allow 21115/tcp
    sudo ufw allow 21116/tcp
    sudo ufw allow 21116/udp
    sudo ufw allow 21117/tcp
    sudo ufw allow 21118/tcp
    sudo ufw allow 21119/tcp

    sudo ufw reload

    第七步:启用 UFW 防火墙

    依次执行以下命令:

    # 先允许 SSH(防止启用后把自己锁在外面!)
    sudo ufw allow 22/tcp

    # 启用 UFW
    sudo ufw enable

    # 查看最终状态
    sudo ufw status

    在这里插入图片描述

    第八步:获取 Key 并完成部署

    密钥生成与验证流程

    RustDesk 客户端

    密钥文件

    Docker 容器

    用户

    RustDesk 客户端

    密钥文件

    Docker 容器

    用户

    #mermaid-svg-h6iOwD2vN2F349Dp{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-h6iOwD2vN2F349Dp .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-h6iOwD2vN2F349Dp .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-h6iOwD2vN2F349Dp .error-icon{fill:#552222;}#mermaid-svg-h6iOwD2vN2F349Dp .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-h6iOwD2vN2F349Dp .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-h6iOwD2vN2F349Dp .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-h6iOwD2vN2F349Dp .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-h6iOwD2vN2F349Dp .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-h6iOwD2vN2F349Dp .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-h6iOwD2vN2F349Dp .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-h6iOwD2vN2F349Dp .marker{fill:#333333;stroke:#333333;}#mermaid-svg-h6iOwD2vN2F349Dp .marker.cross{stroke:#333333;}#mermaid-svg-h6iOwD2vN2F349Dp svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-h6iOwD2vN2F349Dp p{margin:0;}#mermaid-svg-h6iOwD2vN2F349Dp .actor{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-h6iOwD2vN2F349Dp text.actor>tspan{fill:black;stroke:none;}#mermaid-svg-h6iOwD2vN2F349Dp .actor-line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-h6iOwD2vN2F349Dp .innerArc{stroke-width:1.5;stroke-dasharray:none;}#mermaid-svg-h6iOwD2vN2F349Dp .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333;}#mermaid-svg-h6iOwD2vN2F349Dp .messageLine1{stroke-width:1.5;stroke-dasharray:2,2;stroke:#333;}#mermaid-svg-h6iOwD2vN2F349Dp #arrowhead path{fill:#333;stroke:#333;}#mermaid-svg-h6iOwD2vN2F349Dp .sequenceNumber{fill:white;}#mermaid-svg-h6iOwD2vN2F349Dp #sequencenumber{fill:#333;}#mermaid-svg-h6iOwD2vN2F349Dp #crosshead path{fill:#333;stroke:#333;}#mermaid-svg-h6iOwD2vN2F349Dp .messageText{fill:#333;stroke:none;}#mermaid-svg-h6iOwD2vN2F349Dp .labelBox{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-h6iOwD2vN2F349Dp .labelText,#mermaid-svg-h6iOwD2vN2F349Dp .labelText>tspan{fill:black;stroke:none;}#mermaid-svg-h6iOwD2vN2F349Dp .loopText,#mermaid-svg-h6iOwD2vN2F349Dp .loopText>tspan{fill:black;stroke:none;}#mermaid-svg-h6iOwD2vN2F349Dp .loopLine{stroke-width:2px;stroke-dasharray:2,2;stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);}#mermaid-svg-h6iOwD2vN2F349Dp .note{stroke:#aaaa33;fill:#fff5ad;}#mermaid-svg-h6iOwD2vN2F349Dp .noteText,#mermaid-svg-h6iOwD2vN2F349Dp .noteText>tspan{fill:black;stroke:none;}#mermaid-svg-h6iOwD2vN2F349Dp .activation0{fill:#f4f4f4;stroke:#666;}#mermaid-svg-h6iOwD2vN2F349Dp .activation1{fill:#f4f4f4;stroke:#666;}#mermaid-svg-h6iOwD2vN2F349Dp .activation2{fill:#f4f4f4;stroke:#666;}#mermaid-svg-h6iOwD2vN2F349Dp .actorPopupMenu{position:absolute;}#mermaid-svg-h6iOwD2vN2F349Dp .actorPopupMenuPanel{position:absolute;fill:#ECECFF;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);filter:drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));}#mermaid-svg-h6iOwD2vN2F349Dp .actor-man line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;}#mermaid-svg-h6iOwD2vN2F349Dp .actor-man circle,#mermaid-svg-h6iOwD2vN2F349Dp line{stroke:hsl(259.6261682243, 59.7765363128%, 87.9019607843%);fill:#ECECFF;stroke-width:2px;}#mermaid-svg-h6iOwD2vN2F349Dp :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}

    ID服务器: 服务器IP

    中继服务器: IP:21117

    Key: 公钥内容

    启动 hbbs/hbbr 服务

    自动生成密钥对

    读取公钥 cat id_ed25519.pub

    返回公钥文本

    配置服务器信息

    使用公钥进行身份验证

    验证成功,建立连接

    执行以下命令,获取你的 Key(公钥):

    cat ~/rustdesk/data/id_ed25519.pub

    其中id_ed25519为文件名每次生成不一样

    记录以下信息:

    • ID 服务器:服务器 IP 地址
    • 中继服务器:服务器 IP 地址:21117
    • Key(公钥):text3rmxxxx-xxxYcrXIqs4ZA=

    将信息填入RustDesk程序

    在这里插入图片描述

    常用

    服务状态监控视图

    #mermaid-svg-0DmbGSRxTDu0zqBq{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-0DmbGSRxTDu0zqBq .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-0DmbGSRxTDu0zqBq .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-0DmbGSRxTDu0zqBq .error-icon{fill:#552222;}#mermaid-svg-0DmbGSRxTDu0zqBq .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-0DmbGSRxTDu0zqBq .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-0DmbGSRxTDu0zqBq .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-0DmbGSRxTDu0zqBq .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-0DmbGSRxTDu0zqBq .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-0DmbGSRxTDu0zqBq .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-0DmbGSRxTDu0zqBq .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-0DmbGSRxTDu0zqBq .marker{fill:#333333;stroke:#333333;}#mermaid-svg-0DmbGSRxTDu0zqBq .marker.cross{stroke:#333333;}#mermaid-svg-0DmbGSRxTDu0zqBq svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-0DmbGSRxTDu0zqBq p{margin:0;}#mermaid-svg-0DmbGSRxTDu0zqBq .mermaid-main-font{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}#mermaid-svg-0DmbGSRxTDu0zqBq .exclude-range{fill:#eeeeee;}#mermaid-svg-0DmbGSRxTDu0zqBq .section{stroke:none;opacity:0.2;}#mermaid-svg-0DmbGSRxTDu0zqBq .section0{fill:rgba(102, 102, 255, 0.49);}#mermaid-svg-0DmbGSRxTDu0zqBq .section2{fill:#fff400;}#mermaid-svg-0DmbGSRxTDu0zqBq .section1,#mermaid-svg-0DmbGSRxTDu0zqBq .section3{fill:white;opacity:0.2;}#mermaid-svg-0DmbGSRxTDu0zqBq .sectionTitle0{fill:#333;}#mermaid-svg-0DmbGSRxTDu0zqBq .sectionTitle1{fill:#333;}#mermaid-svg-0DmbGSRxTDu0zqBq .sectionTitle2{fill:#333;}#mermaid-svg-0DmbGSRxTDu0zqBq .sectionTitle3{fill:#333;}#mermaid-svg-0DmbGSRxTDu0zqBq .sectionTitle{text-anchor:start;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}#mermaid-svg-0DmbGSRxTDu0zqBq .grid .tick{stroke:lightgrey;opacity:0.8;shape-rendering:crispEdges;}#mermaid-svg-0DmbGSRxTDu0zqBq .grid .tick text{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;fill:#333;}#mermaid-svg-0DmbGSRxTDu0zqBq .grid path{stroke-width:0;}#mermaid-svg-0DmbGSRxTDu0zqBq .today{fill:none;stroke:red;stroke-width:2px;}#mermaid-svg-0DmbGSRxTDu0zqBq .task{stroke-width:2;}#mermaid-svg-0DmbGSRxTDu0zqBq .taskText{text-anchor:middle;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}#mermaid-svg-0DmbGSRxTDu0zqBq .taskTextOutsideRight{fill:black;text-anchor:start;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}#mermaid-svg-0DmbGSRxTDu0zqBq .taskTextOutsideLeft{fill:black;text-anchor:end;}#mermaid-svg-0DmbGSRxTDu0zqBq .task.clickable{cursor:pointer;}#mermaid-svg-0DmbGSRxTDu0zqBq .taskText.clickable{cursor:pointer;fill:#003163!important;font-weight:bold;}#mermaid-svg-0DmbGSRxTDu0zqBq .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163!important;font-weight:bold;}#mermaid-svg-0DmbGSRxTDu0zqBq .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163!important;font-weight:bold;}#mermaid-svg-0DmbGSRxTDu0zqBq .taskText0,#mermaid-svg-0DmbGSRxTDu0zqBq .taskText1,#mermaid-svg-0DmbGSRxTDu0zqBq .taskText2,#mermaid-svg-0DmbGSRxTDu0zqBq .taskText3{fill:white;}#mermaid-svg-0DmbGSRxTDu0zqBq .task0,#mermaid-svg-0DmbGSRxTDu0zqBq .task1,#mermaid-svg-0DmbGSRxTDu0zqBq .task2,#mermaid-svg-0DmbGSRxTDu0zqBq .task3{fill:#8a90dd;stroke:#534fbc;}#mermaid-svg-0DmbGSRxTDu0zqBq .taskTextOutside0,#mermaid-svg-0DmbGSRxTDu0zqBq .taskTextOutside2{fill:black;}#mermaid-svg-0DmbGSRxTDu0zqBq .taskTextOutside1,#mermaid-svg-0DmbGSRxTDu0zqBq .taskTextOutside3{fill:black;}#mermaid-svg-0DmbGSRxTDu0zqBq .active0,#mermaid-svg-0DmbGSRxTDu0zqBq .active1,#mermaid-svg-0DmbGSRxTDu0zqBq .active2,#mermaid-svg-0DmbGSRxTDu0zqBq .active3{fill:#bfc7ff;stroke:#534fbc;}#mermaid-svg-0DmbGSRxTDu0zqBq .activeText0,#mermaid-svg-0DmbGSRxTDu0zqBq .activeText1,#mermaid-svg-0DmbGSRxTDu0zqBq .activeText2,#mermaid-svg-0DmbGSRxTDu0zqBq .activeText3{fill:black!important;}#mermaid-svg-0DmbGSRxTDu0zqBq .done0,#mermaid-svg-0DmbGSRxTDu0zqBq .done1,#mermaid-svg-0DmbGSRxTDu0zqBq .done2,#mermaid-svg-0DmbGSRxTDu0zqBq .done3{stroke:grey;fill:lightgrey;stroke-width:2;}#mermaid-svg-0DmbGSRxTDu0zqBq .doneText0,#mermaid-svg-0DmbGSRxTDu0zqBq .doneText1,#mermaid-svg-0DmbGSRxTDu0zqBq .doneText2,#mermaid-svg-0DmbGSRxTDu0zqBq .doneText3{fill:black!important;}#mermaid-svg-0DmbGSRxTDu0zqBq .doneText0.taskTextOutsideLeft,#mermaid-svg-0DmbGSRxTDu0zqBq .doneText0.taskTextOutsideRight,#mermaid-svg-0DmbGSRxTDu0zqBq .doneText1.taskTextOutsideLeft,#mermaid-svg-0DmbGSRxTDu0zqBq .doneText1.taskTextOutsideRight,#mermaid-svg-0DmbGSRxTDu0zqBq .doneText2.taskTextOutsideLeft,#mermaid-svg-0DmbGSRxTDu0zqBq .doneText2.taskTextOutsideRight,#mermaid-svg-0DmbGSRxTDu0zqBq .doneText3.taskTextOutsideLeft,#mermaid-svg-0DmbGSRxTDu0zqBq .doneText3.taskTextOutsideRight{fill:black!important;}#mermaid-svg-0DmbGSRxTDu0zqBq .crit0,#mermaid-svg-0DmbGSRxTDu0zqBq .crit1,#mermaid-svg-0DmbGSRxTDu0zqBq .crit2,#mermaid-svg-0DmbGSRxTDu0zqBq .crit3{stroke:#ff8888;fill:red;stroke-width:2;}#mermaid-svg-0DmbGSRxTDu0zqBq .activeCrit0,#mermaid-svg-0DmbGSRxTDu0zqBq .activeCrit1,#mermaid-svg-0DmbGSRxTDu0zqBq .activeCrit2,#mermaid-svg-0DmbGSRxTDu0zqBq .activeCrit3{stroke:#ff8888;fill:#bfc7ff;stroke-width:2;}#mermaid-svg-0DmbGSRxTDu0zqBq .doneCrit0,#mermaid-svg-0DmbGSRxTDu0zqBq .doneCrit1,#mermaid-svg-0DmbGSRxTDu0zqBq .doneCrit2,#mermaid-svg-0DmbGSRxTDu0zqBq .doneCrit3{stroke:#ff8888;fill:lightgrey;stroke-width:2;cursor:pointer;shape-rendering:crispEdges;}#mermaid-svg-0DmbGSRxTDu0zqBq .milestone{transform:rotate(45deg) scale(0.8,0.8);}#mermaid-svg-0DmbGSRxTDu0zqBq .milestoneText{font-style:italic;}#mermaid-svg-0DmbGSRxTDu0zqBq .doneCritText0,#mermaid-svg-0DmbGSRxTDu0zqBq .doneCritText1,#mermaid-svg-0DmbGSRxTDu0zqBq .doneCritText2,#mermaid-svg-0DmbGSRxTDu0zqBq .doneCritText3{fill:black!important;}#mermaid-svg-0DmbGSRxTDu0zqBq .doneCritText0.taskTextOutsideLeft,#mermaid-svg-0DmbGSRxTDu0zqBq .doneCritText0.taskTextOutsideRight,#mermaid-svg-0DmbGSRxTDu0zqBq .doneCritText1.taskTextOutsideLeft,#mermaid-svg-0DmbGSRxTDu0zqBq .doneCritText1.taskTextOutsideRight,#mermaid-svg-0DmbGSRxTDu0zqBq .doneCritText2.taskTextOutsideLeft,#mermaid-svg-0DmbGSRxTDu0zqBq .doneCritText2.taskTextOutsideRight,#mermaid-svg-0DmbGSRxTDu0zqBq .doneCritText3.taskTextOutsideLeft,#mermaid-svg-0DmbGSRxTDu0zqBq .doneCritText3.taskTextOutsideRight{fill:black!important;}#mermaid-svg-0DmbGSRxTDu0zqBq .vert{stroke:navy;}#mermaid-svg-0DmbGSRxTDu0zqBq .vertText{font-size:15px;text-anchor:middle;fill:navy!important;}#mermaid-svg-0DmbGSRxTDu0zqBq .activeCritText0,#mermaid-svg-0DmbGSRxTDu0zqBq .activeCritText1,#mermaid-svg-0DmbGSRxTDu0zqBq .activeCritText2,#mermaid-svg-0DmbGSRxTDu0zqBq .activeCritText3{fill:black!important;}#mermaid-svg-0DmbGSRxTDu0zqBq .titleText{text-anchor:middle;font-size:18px;fill:#333;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}#mermaid-svg-0DmbGSRxTDu0zqBq :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}

    00:00

    03:00

    06:00

    09:00

    12:00

    15:00

    18:00

    21:00

    运行中

    状态检查

    资源监控

    日志查看

    重启操作

    日常维护

    密钥重置

    密钥轮换

    服务状态

    监控检查

    维护窗口

    RustDesk 服务生命周期管理

    端口与协议关系图

    #mermaid-svg-PhaXvPvQ7jGyC3Hy{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-PhaXvPvQ7jGyC3Hy .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .error-icon{fill:#552222;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .marker{fill:#333333;stroke:#333333;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .marker.cross{stroke:#333333;}#mermaid-svg-PhaXvPvQ7jGyC3Hy svg{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-PhaXvPvQ7jGyC3Hy p{margin:0;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .label{font-family:\”trebuchet ms\”,verdana,arial,sans-serif;color:#333;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .cluster-label text{fill:#333;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .cluster-label span{color:#333;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .cluster-label span p{background-color:transparent;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .label text,#mermaid-svg-PhaXvPvQ7jGyC3Hy span{fill:#333;color:#333;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .node rect,#mermaid-svg-PhaXvPvQ7jGyC3Hy .node circle,#mermaid-svg-PhaXvPvQ7jGyC3Hy .node ellipse,#mermaid-svg-PhaXvPvQ7jGyC3Hy .node polygon,#mermaid-svg-PhaXvPvQ7jGyC3Hy .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .rough-node .label text,#mermaid-svg-PhaXvPvQ7jGyC3Hy .node .label text,#mermaid-svg-PhaXvPvQ7jGyC3Hy .image-shape .label,#mermaid-svg-PhaXvPvQ7jGyC3Hy .icon-shape .label{text-anchor:middle;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .rough-node .label,#mermaid-svg-PhaXvPvQ7jGyC3Hy .node .label,#mermaid-svg-PhaXvPvQ7jGyC3Hy .image-shape .label,#mermaid-svg-PhaXvPvQ7jGyC3Hy .icon-shape .label{text-align:center;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .node.clickable{cursor:pointer;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .arrowheadPath{fill:#333333;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-PhaXvPvQ7jGyC3Hy .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-PhaXvPvQ7jGyC3Hy .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-PhaXvPvQ7jGyC3Hy .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .cluster text{fill:#333;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .cluster span{color:#333;}#mermaid-svg-PhaXvPvQ7jGyC3Hy div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\”trebuchet ms\”,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-PhaXvPvQ7jGyC3Hy rect.text{fill:none;stroke-width:0;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .icon-shape,#mermaid-svg-PhaXvPvQ7jGyC3Hy .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .icon-shape p,#mermaid-svg-PhaXvPvQ7jGyC3Hy .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .icon-shape .label rect,#mermaid-svg-PhaXvPvQ7jGyC3Hy .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-PhaXvPvQ7jGyC3Hy .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-PhaXvPvQ7jGyC3Hy .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-PhaXvPvQ7jGyC3Hy :root{–mermaid-font-family:\”trebuchet ms\”,verdana,arial,sans-serif;}

    必需端口

    UDP 端口

    TCP 端口

    21115/tcphbbs

    21116/tcphbbs/hbbr

    21117/tcphbbs

    21118/tcphbbs

    21119/tcphbbs

    21116/udphbbs

    22/tcpSSH

    客户端

    管理员

    查看服务状态

    # 查看两个服务的运行状态
    sudo docker compose ps

    # 查看 CPU、内存占用
    sudo docker stats

    重启服务

    cd ~/rustdesk
    sudo docker compose restart

    重置 / 重新生成 Key

    # 1. 停止服务
    cd ~/rustdesk
    sudo docker compose down

    # 2. 删除旧的密钥文件
    rm -f ~/rustdesk/data/id_ed25519*
    rm -f ~/rustdesk/data/*.pub

    # 3. 重新启动服务(会自动生成新的 Key)
    sudo docker compose up -d

    # 4. 查看新的 Key
    cat ~/rustdesk/data/id_ed25519.pub

    希望本片文章对你有所帮助,掰掰~👋

    赞(0)
    未经允许不得转载:171主机测评 » 服务器部署RustDesk记录
    分享到: 更多 (0)

    评论 抢沙发

    • 昵称 (必填)
    • 邮箱 (必填)
    • 网址