[Linux] 設定 Ubuntu 20.04 的 vino VNC server

[Linux] 設定 Ubuntu 20.04 的 vino VNC server

很久以前寫過一篇 用 Mac 連上 Ubuntu 15.04 的 vino VNC server

最近重裝了 Ubuntu 20.04,發現有些設定不太一樣,

重新記錄一篇吧~

 

1. 啟用 Ubuntu 的 Screen Sharing

首先,到 Ubuntu > Settings > Sharing 裡面,

發現裡面有 Media Sharing 和 Remote Login,但沒有以前的 Screen Sharing:

 

這是因為 vino-server 套件還沒有安裝的關係…

執行下面指令來安裝 vino-server:

sudo apt install vino

 

關掉設定視窗,重新再開,

這時就出現 Screen Sharing 的選項了:

 

設定一下密碼,同時把可用的網路勾選起來,就能啟用 Screen Sharing 了。

如果沒有選取任何的網路,是不能啟用的喔:

 

2. 從 Mac 連上 vino-server

在 Mac 上用 vnc viewer,是無法連上剛剛跑起來的 vino-server 的,

錯誤訊息裡提到無法連線的原因,

是因為無法使用我們選擇的安全性設定:

 

來做一下實驗吧~

先把正在執行中的 vino-server 砍掉:

sudo killall vino-server

 

接著手動將 vino-server 跑起來,

這樣子我們可以看到它執行時跑出來的訊息,

寫說它支援的 security type 是 TLS (18),

authentication type 是 VNC Authentication (2):

testuser@localhost:~$ DISPLAY=:0 /usr/lib/vino/vino-server

26/03/2021 05:42:59 PM Autoprobing TCP port in (all) network interface
26/03/2021 05:42:59 PM Listening IPv6://[::]:5900
26/03/2021 05:42:59 PM Listening IPv4://0.0.0.0:5900
26/03/2021 05:42:59 PM Autoprobing selected port 5900
26/03/2021 05:42:59 PM Advertising security type: 'TLS' (18)
26/03/2021 05:42:59 PM Re-binding socket to listen for VNC connections on TCP port 5900 in (all) interface
26/03/2021 05:42:59 PM Listening IPv6://[::]:5900
26/03/2021 05:42:59 PM Listening IPv4://0.0.0.0:5900
26/03/2021 05:42:59 PM Clearing securityTypes
26/03/2021 05:42:59 PM Advertising security type: 'TLS' (18)
26/03/2021 05:42:59 PM Clearing securityTypes
26/03/2021 05:42:59 PM Advertising security type: 'TLS' (18)
26/03/2021 05:42:59 PM Advertising authentication type: 'No Authentication' (1)
26/03/2021 05:42:59 PM Re-binding socket to listen for VNC connections on TCP port 5900 in (all) interface
26/03/2021 05:42:59 PM Listening IPv6://[::]:5900
26/03/2021 05:42:59 PM Listening IPv4://0.0.0.0:5900
26/03/2021 05:42:59 PM Clearing securityTypes
26/03/2021 05:42:59 PM Clearing authTypes
26/03/2021 05:42:59 PM Advertising security type: 'TLS' (18)
26/03/2021 05:42:59 PM Advertising authentication type: 'VNC Authentication' (2)

 

這時從 Mac 用 vnc viewer 連上去 vino server,

就會看到 server 才剛跟 client 講說它支援的是 security type 18,

client 端就馬上斷線了:

26/03/2021 05:43:05 PM [IPv4] Got connection from client client.test.org
26/03/2021 05:43:05 PM   other clients:
26/03/2021 05:43:05 PM Client Protocol Version 3.7
26/03/2021 05:43:05 PM Advertising security type 18
26/03/2021 05:43:05 PM Client client.test.org gone

 

上網查了一下,要將 vino 的加密關閉才行:

gsettings set org.gnome.Vino require-encryption false

 

重新手動執行 vino-server,

訊息有一點不同,security type 除了原本的 TLS (18) 外,

現在還多了一個 VNC Authentication (2):

26/03/2021 05:43:19 PM Advertising security type: 'TLS' (18)
26/03/2021 05:43:19 PM Advertising authentication type: 'VNC Authentication' (2)
26/03/2021 05:43:19 PM Advertising security type: 'VNC Authentication' (2)

 

這時再從 Mac 的 vnc viewer 連到 vino server,

client 端看到 server 端回的 security type 18 和 2 後,

就回覆使用 security type 2 (VNC Authentication) 了:

26/03/2021 05:44:13 PM [IPv4] Got connection from client client.test.org
26/03/2021 05:44:13 PM   other clients:
26/03/2021 05:44:13 PM Client Protocol Version 3.7
26/03/2021 05:44:13 PM Advertising security type 18
26/03/2021 05:44:13 PM Advertising security type 2
26/03/2021 05:44:13 PM Client returned security type 2

 

這時 vnc viewer 終於碰的到 vino server 啦:

 

參考資料:How to Enable Remote Desktop Sharing in Ubuntu 20.04 | UbuntuHandbook

(本頁面已被瀏覽過 5,734 次)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料