後來只好整個重裝一次,重新設定 VNC 的環境。
ubuntu 本身雖然有內建 vino server 這個 VNC 服務,啟用方法也很簡單
但測試了之後發現似乎必須要先在 ubuntu 上登入過一次,之後才有辦法透過 VNC 進行連線。
試了一段時間仍然沒有解答之後,又回頭去尋找 x11vnc 的設定方法,而最後找到可用的方式如 [1] 的步驟。
首先要先建立一個密碼檔,當 VNC 連線時會被要求要輸入密碼,以確保不會輕易地被其他人做遠端控制。
假設密碼檔的存放位置是 /opt/x11vnc.pwd,則輸入以下的指令
1 |
x11vnc -storepasswd /opt/x11vnc . pwd |
接著要讓 x11vnc 開機時自動啟動,要建立 /etc/init/x11vnc.conf 這個設定檔,內容如下。
1 2 3 4 |
start on login-session-start script x11vnc -xkb -noxrecord -noxfixes -noxdamage -repeat -display :0 -auth /var/run/lightdm/root/ :0 -forever -shared - bg -o /var/log/x11vnc .log -rfbauth /opt/x11vnc . pwd -rfbport 5900 end script |
其中部分參數的描述(轉錄自 [1])如下:
-xkb will allow better clipboard interactions in my experience,
-repeat is allowing keyboard repeating keys (most annoying thing when it doesn’t work),
-forever means even if you disconnect from your session, x11vnc will still be alive,
-shared means several users may be connected at the same time (use this only if you plan to connect multiple users simultaneously to it),
-allow enables to restrict the machines that will be able to connect to vnc, remember, vnc is an open door to your machine.
儲存之後,直接將 ubuntu 重開機,用任意的 VNC viewer 連上去就可以了。
參考資料:
1、Installing and configuring x11vnc on Ubuntu 14.04
2、x11vnc server with Xubuntu show black screen in client
沒有留言:
張貼留言