如何使用远程连接(ssh)打开 GUI 程序?

如何使用远程连接(ssh)打开 GUI 程序?

我正在使用 Ubuntu/gnome (10.04) 远程连接两个运行 Ubuntu (12.04) 的嵌入式系统 (略有不同)。我使用以下命令进行连接:

ssh -X -l username 192.168.1.blah

然后,在终端中我可以使用运行基于 GUI 的程序的命令,例如gedit

gedit filename.txt

现在,在第一个系统上,gedit我的 PC 桌面上打开了一个漂亮的窗口,让我可以编辑远程文件。然而,在第二个系统上,我收到以下错误消息:

** (gedit:3637): WARNING **: Could not connect to session bus

为什么会这样?我怎样才能使第二个连接像第一个连接一样工作?

更新 1:第一台机器报告linaro 12.03,不是12.04

更新2:以下是第一台机器上的dbus搜索( )的输出:dpkg -l *dbus* | grep ^i

ii  dbus                                   1.4.14-1ubuntu1                                            simple interprocess messaging system (daemon and utilities)
ii  dbus-x11                               1.4.14-1ubuntu1                                            simple interprocess messaging system (X11 deps)
ii  gir1.2-dbusmenu-glib-0.4               0.5.0-0ubuntu4~linaro2                                     typelib file for libdbusmenu-glib4
ii  gir1.2-dbusmenu-gtk-0.4                0.5.0-0ubuntu4~linaro2                                     typelib file for libdbusmenu-gtk4
ii  libdbus-1-3                            1.4.14-1ubuntu1.3                                          simple interprocess messaging system (library)
ii  libdbus-1-dev                          1.4.14-1ubuntu1.3                                          simple interprocess messaging system (development headers)
ii  libdbus-glib-1-2                       0.94-4                                                     simple interprocess messaging system (GLib-based shared library)
ii  libdbus-glib1.0-cil                    0.5.0-3build1                                              CLI implementation of D-Bus (GLib mainloop integration)
ii  libdbus1.0-cil                         0.7.0-4                                                    CLI implementation of D-Bus
ii  libdbusmenu-glib4                      0.5.0-0ubuntu4~linaro2                                     library for passing menus over DBus
ii  libdbusmenu-gtk3-4                     0.5.0-0ubuntu4~linaro2                                     library for passing menus over DBus - GTK+ version
ii  libdbusmenu-gtk4                       0.5.0-0ubuntu4~linaro2                                     library for passing menus over DBus - GTK+ version
ii  libdbusmenu-qt2                        0.9.0-0ubuntu2                                             a Qt library that implements the DBusMenu spec
ii  libdconf-dbus-1-0                      0.10.0-0ubuntu1                                            simple configuration storage system - D-Bus library
ii  libnih-dbus1                           1.0.3-4ubuntu2                                             NIH D-Bus Bindings Library
ii  libqt4-dbus                            4:4.7.4-0ubuntu8.1linaro1                                  Qt 4 D-Bus module
ii  python-dbus                            0.84.0-2                                                   simple interprocess messaging system (Python interface)
ii  qdbus                                  4:4.7.4-0ubuntu8.1linaro1                                  Qt 4 Dbus Tool

这是第二台机器:

ii  dbus                                   1.4.18-1ubuntu1                            simple interprocess messaging system (daemon and utilities)
ii  dbus-x11                               1.4.18-1ubuntu1                            simple interprocess messaging system (X11 deps)
ii  gir1.2-dbusmenu-glib-0.4               0.6.1-0ubuntu3                             typelib file for libdbusmenu-glib4
ii  gir1.2-dbusmenu-gtk-0.4                0.6.1-0ubuntu3                             typelib file for libdbusmenu-gtk4
ii  gir1.2-gjsdbus-1.0                     1.32.0-1ubuntu1                            GObject introspection data for GJS
ii  gstreamer-dbus-media-service           0.1.17-upstream-0ubuntu3                   Media service for Ubuntu Mobile
ii  libdbus-1-3                            1.4.18-1ubuntu1                            simple interprocess messaging system (library)
ii  libdbus-glib-1-2                       0.98-1ubuntu1                              simple interprocess messaging system (GLib-based shared library)
ii  libdbusmenu-glib4                      0.6.1-0ubuntu3                             library for passing menus over DBus
ii  libdbusmenu-gtk3-4                     0.6.1-0ubuntu3                             library for passing menus over DBus - GTK+ version
ii  libdbusmenu-gtk4                       0.6.1-0ubuntu3                             library for passing menus over DBus - GTK+ version
ii  libdbusmenu-qt2                        0.9.2-0ubuntu1                             Qt implementation of the DBusMenu protocol
ii  libnih-dbus1                           1.0.3-4ubuntu9                             NIH D-Bus Bindings Library
ii  libqt4-dbus                            4:4.8.1-0ubuntu4                           Qt 4 D-Bus module
ii  python-dbus                            1.0.0-1ubuntu1                             simple interprocess messaging system (Python interface)
ii  python-dbus-dev                        1.0.0-1ubuntu1                             main loop integration development files for python-dbus
ii  qdbus                                  4:4.8.1-0ubuntu4                           Qt 4 D-Bus tool

答案1

您可能需要检查存储在 /etc/ssh/ssh_config 中的 openssh 设置。确保 X11Forwarding 行设置为“yes”。

相关内容