Forward X without SSH

Preface

Generally it is recommended to forward X using SSH, as it provides an encrypted connection. However, on machines limited to a local network, tunneling through SSH results in a performance hit.

This article covers how to forward X without using SSH on Ubuntu 18.04.

Local machine = the machine you have access to and want to do work on.

Remote machine = the machine that will be running the applications.

Steps

  1. Enable X Server to listen via TCP on the local machine.
    • sudo vim /etc/X11/xinit/xserverrc
      • Change: exec /usr/bin/X -nolisten tcp "$@"
      • To: exec /usr/bin/X "$@"
    • sudo vim /etc/gdm3/custom.conf
      • Add Enable=true under the [xmdcp] section.
      • Add DisallowTCP=false under [security] section.
  2. Restart X on the local machine.
    • There are several ways to accomplish this, here are a couple of easy ones:
      • sudo reboot
      • Switch to a text mode and back to graphical mode:
        • sudo systemctl isolate multi-user.target
        • sudo systemctl isolate graphical.target
  3. Add local hostname to hosts file on the remote machine.
    • sudo vim /etc/hosts
      • Add:  ip_address   hostname    [aliases]
  4. Add remote hostname to authorized xhosts on local machine.
    • xhost +hostname
  5. Export the DISPLAY environment variable on the remote machine to that of the local machine.
    • export DISPLAY=hostname:0.0
  6. Launch an X application via SSH or telnet when connected to the remote machine, and it should open on the local machine.

Example Screenshot