X2Go

出自 Arch Linux 中文维基

X2Go 使你可以通過網絡訪問一台計算機的圖形化桌面。訪問時的網絡傳輸使用了 Secure Shell 協議,因而傳輸是加密的。

注意: X2Go 並不能兼容所有桌面環境。你可以先查閱 X2Go 桌面環境兼容性,尤其是當你要映射當前的桌面環境時。

安裝[編輯 | 編輯原始碼]

官方倉庫中提供了下列兩個軟件包供安裝

服務器端配置[編輯 | 編輯原始碼]

配置 Secure Shell 守護進程[編輯 | 編輯原始碼]

X2Go 使用 Secure Shell 才能工作,所以你首先需要配置 sshd 守護進程使其允許 X11 轉發並啟動它。參閱 OpenSSH - X11 轉發OpenSSH - 管理 sshd 守護進程

加載 fuse 內核模塊[編輯 | 編輯原始碼]

為使服務器端能夠訪問客戶端計算機上的文件,你需要加載 fuse 內核模塊

你可以查看 lsmod | grep fuse 是否返回匹配項,若無,則需要加載 fuse 內核模塊

設置 SQLite 數據庫[編輯 | 編輯原始碼]

在服務器端執行下列命令以初始化 x2go 服務器運行所需的 SQLite 數據庫:

# x2godbadmin --createdb

Control published applications[編輯 | 編輯原始碼]

X2Go can publish the installed applications in a menu to the client. This is controlled by the files in /etc/x2go/applications/. This location however is not created by default and can be created by creating a symlink to /usr/share/applications/.

Alternatively instead of creating a symlink one could also create a folder and link only the desired applications instead. See [1] for more information.

啟動 X2Go 服務器端守護進程[編輯 | 編輯原始碼]

至此,只需 啟動 x2goserver.service 即可。

客戶端配置[編輯 | 編輯原始碼]

運行 X2Go 客戶端

$ x2goclient
注意: 確保你可以打開一個從客戶端到服務器的 ssh 會話 ssh username@host

現在,你可以創建多個會話,它們將出現在 X2Go 客戶端程序主窗口的右面並且可以用鼠標點擊選中。每一項都是由你的用戶名、主機名、IP 地址和 SSH 連接端口組成。你還可以進一步基於不同連接速度(從 modem 到 LAN)以及想要遠程啟動的不同桌面環境定義若干個配置文件。

訪問本地桌面[編輯 | 編輯原始碼]

To access the local desktop, the one currently running on the server rather than a new one, one can choose the option "Connection to local desktop" in "session type" in the X2Go Client as long as the users match, if it is user foo accessing the session of user foo.

無論如何,要訪問本地不同用戶的桌面,你需要安裝 x2godesktopsharingAUR 並加載 x2godesktopsharing

客戶端與服務器(桌面)交換數據[編輯 | 編輯原始碼]

在 x2go 客戶端(例如:筆記本電腦)上,本地目錄可被共享。服務器端將通過 fuse 和 sshfs 訪問這些目錄並將其掛載到服務器端你的家目錄下的若干子目錄上。這樣你就可以在服務器上訪問你的筆記本電腦上的數據或者互傳文件。也可以每次啟動會話時自動掛載共享目錄。

臨時離開一個會話[編輯 | 編輯原始碼]

X2Go 的另一個特色功能就是可以掛起一個會話。這意味着你可以從一個客戶端裡離開某一個會話,然後用另一個客戶端重新打開這個會話(即便是同一地點的另一個客戶端)。這樣你可以在局域網啟動一個會話,隨後在筆記本電腦上重新打開這個會話。在此期間,會話數據由一個 SQLite 數據庫存儲和管理。會話的狀態由一個名為 x2gocleansessions 的進程來保持。

排錯[編輯 | 編輯原始碼]

桌面環境不啟動[編輯 | 編輯原始碼]

本地會話阻止了 X2Go 的新會話[編輯 | 編輯原始碼]

當本地已經有一個桌面會話在運行而 X2Go 嘗試新建一個會話時失敗。這是典型的 D-Bus 相關的問題,詳情參閱 [2]。 如果 D-Bus 啟動失敗,嘗試用定製桌面類型代替默認的會話類型。For the command, use the desktop starter as an option of dbus-launch, for example dbus-launch startxfce4. This is a way to launch a session bus instance, set the appropriate environment variables so that the new session can find the bus.

路徑問題[編輯 | 編輯原始碼]

用 ssh 登錄時,桌面環境的可執行程序(如 startkdestartgnomestartxfce4 等)可能未包含在 $PATH 環境變量中。在此情況下,不要簡單地選擇默認的 KDE、Gnome 或 XFCE,而應使用桌面環境可執行程序的全路徑,例如 /usr/bin/startxfce4。 也可以啟動 openbox 或其他窗口管理器,這會提示你輸入服務器的用戶名和口令,然後會看到 X2Go 圖標一閃而過隨後進入桌面。

x2go 客戶端中無選擇屏幕[編輯 | 編輯原始碼]

由於 iproute2 的回退導致 ss 指定了 -u 標記時不顯示結果,as done in /usr/bin/x2golistdesktops[3]

詳情參閱 [4][5]

會話沒有正常登出[編輯 | 編輯原始碼]

由於這個 bug 導致 X2Go 會話可能不能正常登出。X2Go 可能被會話初始化腳本輸出的過量日誌行搞懵了。一個簡單的解決方法是定製一個會話腳本並且將日誌輸出重定向到某個文件或空文件/dev/null,然後指定把 X2Go 客戶端應用程序指向這個定製腳本。

以下是 XFCE 的一個定製腳本範例:

#!/bin/sh
#
#xfce4-session spits out quite a bit of text during logout, which I guess
#confuses x2go so we would get a black screen and session hang.
#adding redirect to a logfile like "~/logfile" or "/dev/null" nicely solved it
# see https://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=914
/usr/bin/xfce4-session > /dev/null

通知區無顯示[編輯 | 編輯原始碼]

參照#本地會話阻止了 X2Go 的新會話的解決方法。

共享文件夾未掛載(Windows 客戶端)[編輯 | 編輯原始碼]

The ssh-daemon used by the X2go windows client uses depreceated ssh-dss keys by default and because Arch does not accept them your shared folders will not mount. Check out this bug report for more information.

This can be solved on the windows side by generating different type of key:

C:\Program Files (x86)\x2goclient\ssh-keygen -b 2048 -t rsa

And simply replace c:\Users\User\.x2go\etc\ssh_host_dsa_key and c:\Users\User\.x2go\etc\ssh_host_dsa_key.pub with the newly generated key files.

Other workarrounds from [6] might help, too.

Workaround for failing compositing window manager for remote session[編輯 | 編輯原始碼]

本文或本章節的語言、語法或風格需要改進。參考:Help:Style

原因:請提供模板的第一個位置參數以概括原因。(在Talk:X2Go討論)

This is useful for situations, when the computer running x2goserver is used also for local sessions with e.g. compiz as the window manager. For remote connections with x2goclient, compiz fails to load and metacity should be used instead. The following is for GNOME, but could be modified for other desktop environments. (Getting compiz ready is not part of this how-to.)

Create /usr/local/share/applications/gnome-wm-test.desktop:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=gnome-wm-test
Exec=/usr/local/bin/gnome-wm-test.sh
NoDisplay=true

Create script /usr/local/bin/gnome-wm-test.sh:

#!/bin/sh
# Script for choosing compiz when possible, otherwise metacity
# Proper way to use this script is to set the key to mk-gnome-wm
# /desktop/gnome/session/required_components/windowmanager
xdpyinfo 2> /dev/null | grep -q "^ *Composite$" 2> /dev/null
IS_X_COMPOSITED=$?
if [ $IS_X_COMPOSITED -eq 0 ] ; then
    gtk-window-decorator &
    WM="compiz ccp --indirect-rendering --sm-client-id $DESKTOP_AUTOSTART_ID"
else
    WM="metacity --sm-client-id=$DESKTOP_AUTOSTART_ID"
fi
exec bash -c "$WM"

Modify the following gconf key to start the session with gnome-wm-test window manager:

$ gconftool-2 --type string --set /desktop/gnome/session/required_components/windowmanager "gnome-wm-test"

/bin/bash: No such file or directory when connect (or what ever shell you use)[編輯 | 編輯原始碼]

In you ssh configuration, if you chroot a user, this user need to have his own /bin directory inside his chrooted directory. If not, you will not be able to connect.

參閱[編輯 | 編輯原始碼]