Ssh

無法讓 gnome-session 通過 SSH 工作

  • April 5, 2019

要通過 ssh 從我的家用電腦登錄我的辦公室電腦,我需要執行以下兩個步驟:首先我登錄到我的辦公室伺服器:ssh -X myOfficeServerID@myofficeServer然後我使用本地 IP 登錄到我的電腦:ssh -X myOfficeComputerID@myOfficeComputerIP。我希望能夠遠端查看我的桌面並使用 GUI。

這是執行的結果gnome-session

[myOfficeComputerID@myOfficeComputer]$gnome-session
gnome-session[17491]: WARNING: Unable to determine session: Unable to lookup session information for process '17491'
GNOME_KEYRING_SOCKET=/tmp/keyring-TokklK/socket
SSH_AUTH_SOCK=/tmp/keyring-TokklK/socket.ssh
GNOME_KEYRING_PID=17507

** (gnome-settings-daemon:17510): WARNING **: You can only run one xsettings manager at a time; exiting

** (gnome-settings-daemon:17510): WARNING **: Unable to start xsettings manager: Could not initialize xsettings manager.

** (gnome-settings-daemon:17510): WARNING **: Connection failed, reconnecting...

** (gnome-settings-daemon:17510): WARNING **: Failed to connect context: Connection refused
Window manager warning: Screen 0 on display "localhost:10.0" already has a window manager; try using the --replace option to replace the current window manager.
Window manager warning: Screen 0 on display "localhost:10.0" already has a window manager; try using the --replace option to replace the current window manager.
Starting Dropbox...Connection failure: Connection refused
pa_context_connect() failed: Connection refused
Done!

(polkit-gnome-authentication-agent-1:17571): polkit-gnome-1-WARNING **: Unable to determine the session we are in: Remote Exception invoking org.freedesktop.ConsoleKit.Manager.GetSessionForUnixProcess() on /org/freedesktop/ConsoleKit/Manager at name org.freedesktop.ConsoleKit: org.freedesktop.ConsoleKit.Manager.GeneralError: Unable to lookup session information for process '17571' org.freedesktop.ConsoleKit.Manager.GeneralError Unable%20to%20lookup%20session%20information%20for%20process%20%2717571%27
system-config-printer-applet: failed to start NewPrinterNotification service

** (gnome-panel:17538): CRITICAL **: panel_applet_frame_change_background: assertion `PANEL_IS_WIDGET (GTK_WIDGET (frame)->parent)' failed

** (nm-applet:17578): WARNING **: <WARN>  request_name(): Could not acquire the NetworkManagerUserSettings service.
 Error: (9) Connection ":1.261" is not allowed to own the service "org.freedesktop.NetworkManagerUserSettings" due to security policies in the configuration file

Failed to play sound: Not available

** (gnome-volume-control-applet:17590): WARNING **: Connection failed, reconnecting...

** (gnome-volume-control-applet:17590): WARNING **: Failed to connect context: Connection refused
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension

** (gnome-volume-control-applet:17590): WARNING **: Connection failed, reconnecting...

** (gnome-volume-control-applet:17590): WARNING **: Failed to connect context: Connection refused

** (gnome-settings-daemon:17510): WARNING **: Grab failed for some keys, another application may already have access the them.

** (gnome-settings-daemon:17510): WARNING **: Clipboard manager is already running.

** (gnome-settings-daemon:17510): WARNING **: Connection failed, reconnecting...

** (gnome-settings-daemon:17510): WARNING **: Failed to connect context: Connection refused
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
failed to create drawable
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension
^CTraceback (most recent call last):
 File "/usr/share/system-config-printer/applet.py", line 434, in <module>
   waitloop.run()
KeyboardInterrupt
** Message: Got disconnected from the session message bus; retrying to reconnect every 10 seconds

(gnome-settings-daemon:17510): GConf-WARNING **: Directory `/desktop/gtk' was not being monitored by GConfClient 0xda21e0

(gnome-settings-daemon:17510): GConf-WARNING **: Directory `/desktop/gnome/interface' was not being monitored by GConfClient 0xda21e0

(gnome-settings-daemon:17510): GConf-WARNING **: Directory `/apps/gnome_settings_daemon/gtk-modules' was not being monitored by GConfClient 0xda21e0

(gnome-settings-daemon:17510): GConf-WARNING **: Directory `/desktop/gnome/font_rendering' was not being monitored by GConfClient 0xda21e0

(gnome-settings-daemon:17510): GConf-WARNING **: Directory `/desktop/gnome/sound' was not being monitored by GConfClient 0xda21e0
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details -  1: Failed to get connection to session: Failed to connect to socket /tmp/dbus-gk7tyDBsRK: Connection refused)
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details -  1: Failed to get connection to session: Failed to connect to socket /tmp/dbus-gk7tyDBsRK: Connection refused)
[myOfficeComputerID@myOfficeComputer ~]$ 
(gnome-settings-daemon:17510): GConf-WARNING **: Directory `/desktop/gnome/peripherals/mouse' was not being monitored by GConfClient 0xda21e0
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details -  1: Failed to get connection to session: Failed to connect to socket /tmp/dbus-gk7tyDBsRK: Connection refused)
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details -  1: Failed to get connection to session: Failed to connect to socket /tmp/dbus-gk7tyDBsRK: Connection refused)
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details -  1: Failed to get connection to session: Failed to connect to socket /tmp/dbus-gk7tyDBsRK: Connection refused)
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details -  1: Failed to get connection to session: Failed to connect to socket /tmp/dbus-gk7tyDBsRK: Connection refused)
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details -  1: Failed to get connection to session: Failed to connect to socket /tmp/dbus-gk7tyDBsRK: Connection refused)
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details -  1: Failed to get connection to session: Failed to connect to socket /tmp/dbus-gk7tyDBsRK: Connection refused)
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details -  1: Failed to get connection to session: Failed to connect to socket /tmp/dbus-gk7tyDBsRK: Connection refused)
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details -  1: Failed to get connection to session: Failed to connect to socket /tmp/dbus-gk7tyDBsRK: Connection refused)
GConf Error: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details -  1: Failed to get connection to session: Failed to connect to socket /tmp/dbus-gk7tyDBsRK: Connection refused)
^C

這些命令會繼續不停地執行,直到我按下 ^C,正如您在命令中看到的那樣:

Initializing nautilus-gdu extension
Initializing nautilus-open-terminal extension
Initializing nautilus-dropbox 1.4.0
Shutting down dropbox extension
Shutting down nautilus-open-terminal extension
Shutting down nautilus-gdu extension

同時,firefox從我的辦公室電腦上執行的東西,但底部面板不會停止載入東西。

兩個 SSH 會話都需要使用 -X 選項啟動。

但是,如果您想要整個會話,您可能需要考慮使用X2go之類的東西,因為它會壓縮圖像並且有一些代理可以減少頻寬消耗並且它可以恢復會話……

當您的遠端 gnome-session 啟動一個替換您本地視窗管理器的遠端 metacity 時,執行整個 gnome-session 可能會產生令人不快的副作用。

您的附加資訊顯示了我提到的“令人不快的副作用”。當你已經有一個桌面環境正在執行時,你不能簡單地執行gnome-session,因為 gnome-session 會嘗試接管,而你正在執行的桌面環境不會那麼容易。對於 X 程序,無論是通過 SSH 遠端執行還是本地執行,都沒有區別。

根據您想要實現的目標,您可以啟動一個xnest會話並將其用於您的遠端 gnome 會話。

xnest -geometry 1280x1024 :123 &
DISPLAY=:123 ssh -X firsthop
ssh -X secondhop
gnome-session

注意:在某些發行版中,二進製文件以Xnest大寫 x 命名。

引用自:https://unix.stackexchange.com/questions/46861