how to enable the X Windows TCP port 6000 listener on ubuntu

new versions of X (Xorg) default to no tcp. it must be explicitly enabled. in ubuntu, or other systems using lightdm, edit the lightdm config file to look something like the snippet below. this was tested on ubuntu 14.04:

cat /etc/*ase

  DISTRIB_ID=Ubuntu
  DISTRIB_RELEASE=14.04
  DISTRIB_CODENAME=trusty
  DISTRIB_DESCRIPTION="Ubuntu 14.04.3 LTS"
  NAME="Ubuntu"
  VERSION="14.04.3 LTS, Trusty Tahr"
  ID=ubuntu
  ID_LIKE=debian
  PRETTY_NAME="Ubuntu 14.04.3 LTS"
  VERSION_ID="14.04"
/etc/lightdm/lightdm.conf
  [Seat:*]
  xserver-allow-tcp=true
  xserver-command=/usr/bin/X -listen tcp

on xubuntu 18.4, that doesn’t work. grrr…

# this adds -listen tcp, but still followed by -nolisten tcp:
sed 's/core$/listen tcp/' /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf

finally had to do this. ooh, yuk.

vim /usr/bin/Xorg
# on "exec.*/Xorg[.wrap] lines, replace "$@" with:
# -listen tcp :0 -seat seat0 -auth /var/run/lightdm/root/:0 vt7 -novtswitch

be sure to kill X/Xorg so that a new daemon is launched and picks up the change.