就在我那用了一學期的 Teamviewer 被封鎖,看到 Teamviewer 月費大概一千元台幣後,我不得不來找別的方法遠端操控實驗室電腦(暈),於是想到之前曾在 Windows 上設定的 Google Chrome Remote Desktop。結果就耗費了我大概三、四個小時在嘗試…….。其實最好的做法應該還是用終端機遠端控制,但是我一直搞不定那台 S-Linux 的 firewalld 防火牆(預設防火牆似乎不是 iptables)。我用 ping 應該都是成功的,但是 traceroute 就一直失敗,然後就一直卡著……。由於下週一就要 Meeting 啦,我實在是沒辦法了,只好繼續嘗試遠端控制螢幕的方法。
先講重點:事實上還是沒辦法遠端操控,因為 Google 提供的功能只是「開一個新的桌面環境」,也就是新的 X window,像是 GNOME 跟 KDE。換言之,我還是看不見實驗室的電腦畫面,但是可以控制所有的資料與程式,以及擁有一個全新的桌面環境。反之,實驗室那台電腦也看不見有人正在遠端操控,他只能夠從 System Monitor 看見突然有一堆程式跑出來了,然後使用的記憶體變多了(暈倒)。另外我也不太清楚底下步驟的意義是什麼,只是在網路上看一堆教學文並且自己隨便嘗試非常多次後的心得總結。
我底下是以 Google 的 Access another computer with Chrome Remote Desktop 內容來說明我的具體設定方式。
Step 1: Download and set up Chrome Remote Desktop
Download the Chrome Remote Desktop app.
單純地下載 Chrome,其實我有點忘記我的步驟了 XD 但應該就只是簡單地下載安裝吧?
Step 2: Install the Debian package for the host components
Download the 64-bit Debian Package here.
這是給 Debian 的 Linux 作業系統套件包,但我使用的 Scientific Linux 是基於 Redhat 的 Linux 作業系統,所以我特地去找了 Google Chrome Remote Desktop 的 Redhat 系統套件包。我在這裡找到了 Extras Packages for Enterprise Linux 7 for x86_64,也就是 chrome-remote-desktop-68.0.3440.106-3.el7.x86_64.rpm。就是下載並安裝它吧!
Step 3: Create a virtual desktop session
If you have Ubuntu 12.04, skip to Step 4.
- Look in
/usr/share/xsessions/
for the .desktop file for your preferred desktop environment.- For example, Cinnamon has a file named “cinnamon.desktop” with the following command:
gnome-session --session=cinnamon
- For example, Cinnamon has a file named “cinnamon.desktop” with the following command:
- Create a file called .chrome-remote-desktop-session in your home directory with the following content:
exec /usr/sbin/lightdm-session "<YOUR_EXEC_COMMAND>"
- Replace
<YOUR_EXEC_COMMAND>
with the command at the end of your .desktop file:- In the example for Cinnamon, the correct command is
exec /usr/sbin/lightdm-session 'gnome-session --session=cinnamon'
- Unity desktops require some additional code. The full command is
DESKTOP_SESSION=ubuntu XDG_CURRENT_DESKTOP=Unity XDG_RUNTIME_DIR=/run/user/$(id -u) exec /usr/sbin/lightdm-session 'gnome-session --session=ubuntu'
- In the example for Cinnamon, the correct command is
- Save the file called “.chrome-remote-desktop-session”.
其實我覺得上面有些步驟都跳太快了,我後來在 Reddit 找到這篇 How to properly install and use Chrome Remote Desktop on Linux: Ubuntu, Mint, etc. 教學文,我就以這篇 Reddit 教學文的方法來解釋上面幾個步驟。
Step 4 : 尋找桌面檔
Look in
/usr/share/xsessions/
for the .desktop file for your preferred desktop environment.For example, Cinnamon has a file named “cinnamon.desktop” with the following command:gnome-session --session=cinnamon
去 /usr/share/xsessions/ 尋找你的桌面檔(*.desktop),如下圖所示。
接著開啟終端機,輸入 gnome-session –session=cinnamon。但我其實不知道為什麼要做這步,我做了似乎也沒什麼反應,而且那篇 Reddit 教學文似乎也沒提到這個步驟。接下來我以 Reddit 教學文的方法,將上述 Google 說明中的 2-4 點做如下說明:
Step 5 : 確定你的桌面檔位址與名稱
接著我們打開你應該會用的桌面檔,像是我從檔名判斷左邊的 1-kde-plasma-standard.desktop 應該才是我使用的桌面檔,右邊看起來像是安全模式?打開之後尋找 Exec=…. 的程式碼,如下圖。
你可以看到我那行程式碼為 Exec=/usr/bin/startkde,這是指執行這個 startkde 桌面環境檔。於是我們可以把它複製一下。接著呢,根據 Reddit 教學文的說法,我們應該去找所謂的 Session manager(識別管理員?),但其實我找不到。Reddit 作者找到了 lightdm-session 與 lightdm 兩個檔,如下圖。
我有特地去搜尋 “session”,有找到 gnome-session,但我後來發現這是錯的,因為我其實是使用 KDE 桌面環境,而不是 GNOME 桌面環境,雖然其實不管是哪個桌面環境,結果都是可以遠端操控就是了,差別在於最後你是以哪個桌面環境來開啟新的作業視窗。總之我就先無視這步。
Step 6 : 建立名為 .chrome-remote-desktop-session 的 shell 腳本,內容就是啓動你想在遠程登錄時用的桌面環境。
接著就是在你的 /home/user/ 資料夾新增一個名為 .chrome-remote-desktop-session 的文字檔,並且在裡面輸入如 Reddit 作者所言的:exec + session manager + 桌面環境執行檔
exec /usr/sbin/lightdm-session “startxfce4”
但是因為我沒找到我的 session manager,並且經過諸多測試,我後來就直接讓它變成:
我其實覺得這兩個對我來說是一樣的 XD 而且我將後面 “” 內容去掉似乎也沒影響。
Step 7 : 在 .profile 或 .bashrc 中設定桌面大小
開啟你的 .profile 檔,而如果是 RHEL 系統,那應該是開啟 .bashrc,位址應該是在 /home/user/ 中,當然你也可以直接在 vim 裡修改它。在裡面新增如下內容
#Chrome remote desktop info export CHROME_REMOTE_DESKTOP_DEFAULT_DESKTOP_SIZES=”YOUR_PREFERRED/DEFAULT_RESOLUTION_HERE”
我將後面的「偏好解析度」自己手動設定為 1920×1080,如下圖的最後一行,最後就是在終端機輸入 source ~/.bashrc,讓它載入新設定。
Step 8 : 大功告成!
用 Chrome 開啟 chrome://apps,進入遠端操控頁面,按下「我的電腦」中的「啟用遠端連線」。接著自行設定 PIN 碼,就完成啦。之後你就可以在別台電腦中,登入相同的 Google 帳戶,在這個「我的電腦」清單中看見你那台電腦囉。點下那台電腦,輸入剛才設定的 PIN 碼就可以登入啦。而這與上方的「遠端協助」的差別是,「遠端協助」需要遠端電腦前方有人幫你看分享碼,而這個「我的電腦」設定則不需要。只要有個 PIN 碼就可自行登入了。
參考教學文
- How to properly install and use Chrome Remote Desktop on Linux: Ubuntu, Mint, etc.
- Configuring Chrome Remote Desktop with Ubuntu Gnome 14.04
- archlinux 上用 chrome 實現
透明計算遠程登錄 - How to configure chrome remote desktop using Deepin?
- I’ve finally understood how to create your own Chrome Remote Desktop App
- How to Install Chrome Remote Desktop on Ubuntu 18.04
- Can’t Configure Chrome Remote Desktop
- [分享] Chrome遠端 ubuntu 設定
台大物理系、化工系學士?
雙主修?
哈囉您好,小弟是在台大化工系畢業後,當完兵一年,再回來藉轉學考蟲考上台大物理系 🙂 所以並不是雙主修。不過我抵免了 145 學分,所以讀兩年就從物理系畢業囉,隨後推甄上台大電子所,到現在 ^^
以下是如何在ubuntu 開啟Google Remote Desktop , 並且共享桌面,我已經試用成功過,讓你參考
他主要是修改Google Remote Desktop 的程式碼,讓遠端直接抓取已存在的X session
https://medium.com/@vsimon/how-to-install-chrome-remote-desktop-on-ubuntu-18-04-52d99980d83e
感謝分享唷!之後或許有機會用到 ^^
話說現在 Google Chrome Remote 好像改版了,原先的不能用了。然後我用新的遠端桌面時,簡單地按一按匯入工具就可以了,不曉得之前做的這些設定有沒有派上用場 XD