Try   HackMD

架設 RustDesk server 與 clint端使用

梓育(moon.starsky37@gmail.com)Wed, Nov 23, 2022 10:00 AM

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

RustDesk 是一款開源的跨平台遠端GUI軟體,類似於 Anydesk 或 TeamViewer,但開源且免費。

雖然 RustDesk 提供了幾個免費的中繼服務器,但如果對資安上有疑慮,官方也提供了可以自行架設的中繼伺服器的方案。而且在docker(-compose)已經安裝完的情況下,可以更接近無痛安裝。

安裝docker

安裝docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/{YOUR-DOCKER-COMPOSE-VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  • 將 /usr/local/bin/docker-compose 建立軟連結到 /usr/bin/docker-compose 以避免輸入指令時找不到 docker-compose 指令
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
  • 以上步驟也可以用一行指令完成
v=$(curl -s https://github.com/docker/compose/releases/latest) && v=${v#*href} && v=${v#*\"} && v=${v%\"*} && v=${v##*/} && sudo curl -L "https://github.com/docker/compose/releases/download/${v}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose && sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

最後可以檢查版本確認是否有安裝成功。

docker-compose --version

安裝RustDesktop Server

官方提供的架設文件在: https://rustdesk.com/docs/en/self-host/install
其中我們會使用docker-compose的方式進行安裝。
首先我們需要知道我們中繼伺服器,也就是目前我們架設docker compose的這台機器用的IP,但如果已經設定好對外的網域的話,也可以直接使用你設定的domain即可。

hostname -I

接著建立一個docker-compose啟用檔案。

touch docker-compose.yml

接著用nano、vim或任何文字編輯器填入以下內容並存檔,其中第16行的 example.com:21117,需要改成你的IP或是你的網域。
e.g.192.168.0.XXX:21117

version: '3' networks: rustdesk-net: external: false services: hbbs: container_name: hbbs ports: - 21115:21115 - 21116:21116 - 21116:21116/udp - 21118:21118 image: rustdesk/rustdesk-server:latest command: hbbs -r example.com:21117 volumes: - ./hbbs:/root networks: - rustdesk-net depends_on: - hbbr restart: unless-stopped hbbr: container_name: hbbr ports: - 21117:21117 - 21119:21119 image: rustdesk/rustdesk-server:latest command: hbbr volumes: - ./hbbr:/root networks: - rustdesk-net restart: unless-stopped

完成之後執行

docker-compose up -d # -d會在背景執行,如果想先看到執行情況的話可以不加

可以看到log會有以下內容代表成功安裝

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Clint端設定伺服器及連線到其他電腦

為了展示結果我們會除了中繼伺服器之外再額外設定兩台電腦(一台ubuntu desktop,一台windows)。
在個別的電腦可以先安裝client side對應的軟體。
下載頁面: https://github.com/rustdesk/rustdesk/releases

安裝完之後執行會看到以下畫面

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

點選ID旁邊的更多選項並點選"ID/Relay Server"看到會跳出來一個新的小視窗,並在"ID Server"空格中填入你剛剛中繼伺服器的IP或網域。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

當兩台電腦的Client Side都設定好之後,假設你想要從Windows連線到Ubuntu Desktop的電腦,你要在Windows的Client Side中的下圖位置填入,Ubuntu的連線ID

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

填了之後案Connect 然後在這個畫面稍代之後會要填入密碼(或者在ubuntu那台電腦上跳出來的新視窗直接按下Accept),就可以完成連線了
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • 連線完成的畫面
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

    除了遠端桌面外,點選他的Transfer File也可以看到像是FileZilla一樣的檔案傳輸介面
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →