6

It seems every version of Ubuntu has a different way to enable remote connections to the local X server.

I'm asking this question, while I do my own research: how can I enable the X server listening to TCP port 6000 on my machine, thus allowing remote X clients to connect to said port and use my display?

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
ΤΖΩΤΖΙΟΥ
  • 1,038
  • 1
  • 10
  • 18
  • 1
    I recommend using socat, as explained here: https://askubuntu.com/a/1360248/364151. The solution is not specific to a particular window manager or Ubuntu release. – Gogowitsch Aug 26 '21 at 15:19

4 Answers4

6

Based on information found in this page about enabling XDCMP and the file /etc/gdm/gdm.schemas, I managed to create the following file:

# /etc/gdm/custom.conf
[xdmcp]

[chooser]

[security]
DisallowTCP=false

[debug]

I also changed the /etc/X11/xinit/xserverrc file to:

exec /usr/bin/X11/X

i.e. I removed the -nolisten tcp options to the X executable. I don't know if I needed to. You might want to try avoiding this edit.

After that, all that is needed is a restart of the gdm process:

sudo service gdm restart

You can verify the success as:

tzot@tzot-laptop:/etc/X11
$ netstat -an | grep -F 6000
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN
tcp6       0      0 :::6000                 :::*                    LISTEN
ΤΖΩΤΖΙΟΥ
  • 1,038
  • 1
  • 10
  • 18
  • 1
    You're right, "every version of Ubuntu has a different way": your answer doesn't work anymore in Linux Mint 19 (Ubuntu 18 I think). It's partly Xorg's fault ([see this](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=785495#10)), now `-nolisten tcp` is implied, you need an explicit `-listen tcp`! I found no way to have `gdm3` add this argument when it runs `Xorg`. It's easy with `sddm` (`man sddm.conf`). – L. Levrel Oct 19 '18 at 16:07
3

if found it in /etc/gdm/gdm.schemas

converted true to false, now it works

<schema>
  <key>security/DisallowTCP</key>
  <signature>b</signature>
  <default>false</default>
</schema>

http://supermanhelp.com

  • I tried this and and the other /etc/gdm/custom.conf tweak, restarted gdm. ps shows X is no longer running with -nolisten tcp ... and yet tcp X connections are still denied even after using xhost + . I'm running Ubuntu 10.10. (Like others, I have a couple use cases where ssh X forwarding is insufficient such using Emacs to open frames on multiple displays). Anything else I can try? – djb Apr 06 '11 at 12:16
1

In later versions of ubuntu the procedure above no longer works due to a new display manager LightDM. To check this execute the shell command:

    ps aux | grep `cat /tmp/.X0-lock'

and check for lightdm and the notcp switch. If found update your system by adding to /etc/lightdm.conf the following entry in the [SeatDefaults] section:

    xserver-allow-tcp=true

Finally restart your computer and check it works with

   netstat -an | grep -F 6000

as shown above.

1

As every configuration is different, I found mine with:

sudo grep --include=\*.conf -rwl '/etc/' -e "SeatDefaults"

If you don't find a file, you can try expanding the search by changing '/etc/' to '/'

Once you locate your file add what others suggested under the [SeatDefaults] section:

xserver-allow-tcp=true

Save the file and restart the computer. You may need to use the xauth on the server you want to access (full info here), e.x.:

xauth extract − $DISPLAY | ssh TheRemoteHost xauth merge −

You may also need to use xhost (here). Finally in a new console Ctrl+Alt+F1 use:

sudo X -query TheXhost :1
mature
  • 161
  • 2
  • 11
Plamen
  • 111
  • 1