Running remote X-windows applications across ssh from a Fedora server

This post has been created as it may assist others who want to do the same thing. It is not complicated or world shaking.

Often you will run Fedora (or CentOS/RHEL) servers and do not want a GUI desktop installed. However occasionally you may want to run a X-windows GUI application on that server.

This is normally done simply with a normal SSH connection with the remote server allowing X11Forwarding; if the remote server has all the desktop packages installed and boots into GUI mode there is no problem with that approach. However if you SSH into a remote server with “ssh -X user@remotehost” and get a message saying X11 forwarding failed or the command “echo $DISPLAY” returns nothing then congratulations, you have a perfectly normal server install… however you are not able to run GUI applications, which is fortunately easily fixed.

Before you do anything check your /etc/ssh/sshd_config and make sure you have uncommented ‘X11Forwarding yes’ and restarted sshd since doing so. If you had to make that change retry the ssh and echo command above again as while unlikely on a server install you may have had the needed packages all along. Only if you still get the errors do you need to continue reading this post.

It should also be noted that the “X11Forwarding yes” can be set on a per client basis rather than globally if you preffer, an example of that is commented out at the end of the /etc/ssh/sshd_config file on Fedora.

If you have been trying to get this working already you will have already noticed that all fedora server only installs already have a xorg-x11-server-Xorg package installed, for example F32 at the time of writing this post has “xorg-x11-server-Xorg-1.20.8-1.fc32.x86_64” installed by default on a server only install. Obviously this in insuffient to run X-applications across SSH or I would not be writing this post.

To get the required functionality working simply, on the server you wish to remotely connect to using ssh to run GUI apps simply

dnf -y install gdm
systemctl start gdm.service     # note:is enabled by default so will start after reboots

You can then session ssh into the server again, and ‘echo $DISPLAY’ will now have a value.

To test it works, while sshed onto that remote server, simply

sudo dnf -y install xterm
xterm

If you get an xterm window on your client machine with a prompt of the remote server you have it all working.

Important note: on the client machine you must have the X11 forwarding ports open in your firewall, at a minimum have port 6010 open on your client to accept the forwarded X11 session data.

Obviously installing the GDM package installs a few extra required files. Below is a list of all files installed on my server whan I needed to install the GDM package. As the server still boots up in non-GUI mode (unless for some reason you make the changes necessary to change the default runlevel) installed packages used by a desktop session such as pulseaudio and evolution do not start so there is no impact on the server other than the gdm service being started.

[root@xxxx X11]# dnf install gdm
Last metadata expiration check: 1:52:25 ago on Mon 13 Jul 2020 13:44:13.
Dependencies resolved.
=================================================================================================================
 Package                                    Arch        Version                Repository                   Size
=================================================================================================================
Installing:
 gdm                                        x86_64      1:3.36.2-2.fc32        updates                     561 k
Installing dependencies:
 accountsservice                            x86_64      0.6.55-2.fc32          fedora                      118 k
 accountsservice-libs                       x86_64      0.6.55-2.fc32          fedora                       93 k
 bluez-obexd                                x86_64      5.54-1.fc32            fedora                      196 k
 bolt                                       x86_64      0.9-1.fc32             updates                     203 k
 bubblewrap                                 x86_64      0.4.1-1.fc32           fedora                       51 k
 cheese-libs                                x86_64      2:3.34.0-3.fc32        fedora                      814 k
 clutter                                    x86_64      1.26.4-1.fc32          fedora                      1.1 M
 clutter-gst3                               x86_64      3.0.27-3.fc32          fedora                       87 k
 clutter-gtk                                x86_64      1.8.4-7.fc32           fedora                       48 k
 cogl                                       x86_64      1.22.8-1.fc32          updates                     495 k
 colord-gtk                                 x86_64      0.2.0-3.fc32           fedora                       32 k
 cups-pk-helper                             x86_64      0.2.6-9.fc32           fedora                       91 k
 enchant2                                   x86_64      2.2.8-1.fc32           fedora                       63 k
 evolution-data-server                      x86_64      3.36.3-1.fc32          updates                     2.2 M
 evolution-data-server-langpacks            noarch      3.36.3-1.fc32          updates                     1.4 M
 fdk-aac-free                               x86_64      2.0.0-3.fc32           fedora                      401 k
 flatpak-selinux                            noarch      1.6.4-1.fc32           updates                      23 k
 flatpak-session-helper                     x86_64      1.6.4-1.fc32           updates                      77 k
 geoclue2                                   x86_64      2.5.6-1.fc32           fedora                      137 k
 geoclue2-libs                              x86_64      2.5.6-1.fc32           fedora                       51 k
 geocode-glib                               x86_64      3.26.2-1.fc32          fedora                       72 k
 gjs                                        x86_64      1.64.3-3.fc32          updates                     380 k
 gnome-autoar                               x86_64      0.2.4-2.fc32           fedora                       56 k
 gnome-bluetooth                            x86_64      1:3.34.1-1.fc32        fedora                       44 k
 gnome-bluetooth-libs                       x86_64      1:3.34.1-1.fc32        fedora                      318 k
 gnome-control-center                       x86_64      3.36.3-1.fc32          updates                     5.7 M
 gnome-control-center-filesystem            noarch      3.36.3-1.fc32          updates                      12 k
 gnome-desktop3                             x86_64      3.36.3.1-1.fc32        updates                     576 k
 gnome-keyring-pam                          x86_64      3.36.0-1.fc32          fedora                       29 k
 gnome-online-accounts                      x86_64      3.36.0-1.fc32          fedora                      484 k
 gnome-session                              x86_64      3.36.0-2.fc32          fedora                      383 k
 gnome-session-wayland-session              x86_64      3.36.0-2.fc32          fedora                       13 k
 gnome-session-xsession                     x86_64      3.36.0-2.fc32          fedora                       13 k
 gnome-settings-daemon                      x86_64      3.36.1-1.fc32          updates                     1.0 M
 gnome-shell                                x86_64      3.36.4-1.fc32          updates                     1.5 M
 gsound                                     x86_64      1.0.2-11.fc32          fedora                       34 k
 gssdp                                      x86_64      1.0.4-1.fc32           updates                      51 k
 gupnp                                      x86_64      1.0.5-1.fc32           updates                      96 k
 gupnp-av                                   x86_64      0.12.11-3.fc32         fedora                       92 k
 gupnp-dlna                                 x86_64      0.10.5-12.fc32         fedora                       89 k
 harfbuzz-icu                               x86_64      2.6.4-3.fc32           fedora                       16 k
 hyphen                                     x86_64      2.8.8-13.fc32          fedora                       29 k
 ibus                                       x86_64      1.5.22-7.fc32          updates                     7.4 M
 ibus-gtk2                                  x86_64      1.5.22-7.fc32          updates                      28 k
 ibus-gtk3                                  x86_64      1.5.22-7.fc32          updates                      29 k
 ibus-libs                                  x86_64      1.5.22-7.fc32          updates                     262 k
 ibus-setup                                 noarch      1.5.22-7.fc32          updates                      61 k
 iio-sensor-proxy                           x86_64      3.0-1.fc32             fedora                       57 k
 libappindicator-gtk3                       x86_64      12.10.0-28.fc32        updates                      42 k
 libcanberra                                x86_64      0.30-22.fc32           fedora                       87 k
 libcanberra-gtk3                           x86_64      0.30-22.fc32           fedora                       32 k
 libdbusmenu                                x86_64      16.04.0-15.fc32        fedora                      136 k
 libdbusmenu-gtk3                           x86_64      16.04.0-15.fc32        fedora                       41 k
 libgdata                                   x86_64      0.17.12-1.fc32         fedora                      472 k
 libgee                                     x86_64      0.20.3-1.fc32          fedora                      289 k
 libgnomekbd                                x86_64      3.26.1-3.fc32          fedora                      163 k
 libgtop2                                   x86_64      2.40.0-3.fc32          fedora                      150 k
 libgweather                                x86_64      3.36.1-1.fc32          updates                     2.9 M
 libhandy                                   x86_64      0.0.13-4.fc32          updates                     162 k
 libical-glib                               x86_64      3.0.8-1.fc32           fedora                      187 k
 libimobiledevice                           x86_64      1.2.1-0.3.fc32         fedora                       79 k
 libindicator-gtk3                          x86_64      12.10.1-17.fc32        fedora                       67 k
 libmediaart                                x86_64      1.9.4-9.fc32           fedora                       44 k
 libnma                                     x86_64      1.8.28-1.fc32          updates                     302 k
 libnotify                                  x86_64      0.7.9-1.fc32           fedora                       43 k
 libplist                                   x86_64      2.1.0-3.fc32           fedora                       78 k
 libsbc                                     x86_64      1.4-5.fc32             fedora                       44 k
 libusbmuxd                                 x86_64      2.0.0-2.fc32           fedora                       38 k
 libvncserver                               x86_64      0.9.11-11.fc32         fedora                      272 k
 libwpe                                     x86_64      1.6.0-1.fc32           fedora                       26 k
 libxklavier                                x86_64      5.4-15.fc32            fedora                       67 k
 low-memory-monitor                         x86_64      2.0-4.fc32             fedora                       34 k
 mesa-vulkan-drivers                        x86_64      20.1.2-1.fc32          updates                     3.3 M
 mobile-broadband-provider-info             noarch      20190618-3.fc32        fedora                       67 k
 mozjs68                                    x86_64      68.10.0-1.fc32         updates                     6.8 M
 mutter                                     x86_64      3.36.4-1.fc32          updates                     2.4 M
 network-manager-applet                     x86_64      1.16.0-2.fc32          updates                     208 k
 nm-connection-editor                       x86_64      1.16.0-2.fc32          updates                     864 k
 ostree-libs                                x86_64      2020.3-5.fc32          updates                     398 k
 pipewire                                   x86_64      0.3.6-1.fc32           updates                     110 k
 pipewire-libs                              x86_64      0.3.6-1.fc32           updates                     708 k
 pipewire0.2-libs                           x86_64      0.2.7-2.fc32           fedora                      354 k
 pulseaudio                                 x86_64      13.99.1-4.fc32         updates                     1.0 M
 pulseaudio-module-bluetooth-freeworld      x86_64      1.4-1.fc32             rpmfusion-free-updates      100 k
 python3-cairo                              x86_64      1.18.2-4.fc32          fedora                       94 k
 python3-gobject                            x86_64      3.36.1-1.fc32          updates                      17 k
 rtkit                                      x86_64      0.11-23.fc32           fedora                       58 k
 sound-theme-freedesktop                    noarch      0.8-13.fc32            fedora                      378 k
 speexdsp                                   x86_64      1.2.0-1.fc32           updates                     453 k
 startup-notification                       x86_64      0.12-19.fc32           fedora                       42 k
 switcheroo-control                         x86_64      2.2-1.fc32             updates                      38 k
 upower                                     x86_64      0.99.11-3.fc32         fedora                      176 k
 vulkan-loader                              x86_64      1.2.135.0-1.fc32       updates                     126 k
 webkit2gtk3                                x86_64      2.28.3-1.fc32          updates                      15 M
 webkit2gtk3-jsc                            x86_64      2.28.3-1.fc32          updates                     6.0 M
 webrtc-audio-processing                    x86_64      0.3.1-4.fc32           fedora                      313 k
 woff2                                      x86_64      1.0.2-8.fc32           fedora                       61 k
 wpebackend-fdo                             x86_64      1.6.0-1.fc32           fedora                       36 k
 xdg-dbus-proxy                             x86_64      0.1.2-2.fc32           fedora                       43 k
 xdg-desktop-portal                         x86_64      1.7.2-2.fc32           updates                     434 k
 xdg-desktop-portal-gtk                     x86_64      1.7.1-1.fc32           fedora                      239 k
 xorg-x11-server-Xwayland                   x86_64      1.20.8-1.fc32          fedora                      988 k
 xorg-x11-xauth                             x86_64      1:1.1-3.fc32           fedora                       36 k
 xorg-x11-xinit                             x86_64      1.4.0-6.fc32           fedora                       56 k
 zenity                                     x86_64      3.32.0-3.fc32          fedora                      4.3 M
Installing weak dependencies:
 flatpak                                    x86_64      1.6.4-1.fc32           updates                     1.5 M
 gnome-remote-desktop                       x86_64      0.1.8-2.fc32           updates                      69 k
 libldac                                    x86_64      2.0.2.3-5.fc32         fedora                       41 k
 p11-kit-server                             x86_64      0.23.20-1.fc32         fedora                      189 k
 pinentry-gtk                               x86_64      1.1.0-7.fc32           fedora                       48 k
 rygel                                      x86_64      0.36.2-5.fc32          fedora                      1.0 M
 vino                                       x86_64      3.22.0-17.fc32         fedora                      453 k

Transaction Summary
=================================================================================================================
Install  113 Packages

Total download size: 81 M
Installed size: 344 M
Is this ok [y/N]: y

About mark

At work, been working on Tandems for around 30yrs (programming + sysadmin), plus AIX and Solaris sysadmin also thrown in during the last 20yrs; also about 5yrs on MVS (mainly operations and automation but also smp/e work). At home I have been using linux for decades. Programming background is commercially in TAL/COBOL/SCOBOL/C(Tandem); 370 assembler(MVS); C, perl and shell scripting in *nix; and Microsoft Macro Assembler(windows).
This entry was posted in Unix. Bookmark the permalink.