19

This is on Ubuntu 10.10 (Maverick Meerkat) 64-bit desktop.

I want to make my X server listen to remote connections from clients in other machines on the local network. I know about ssh -X and that is not what I want. I vaguely remember changing something like TCPListen from no to yes, but I don't remember where this change should be applied.

I'm interested in either a GUI method or a CLI one.

PS editing /etc/X11/xinit/xserverrc to remove the -nolisten tcp option and rebooting does not work.

  • Hint It is probably worth disabling the firewall (iptables) while you are trying to get things going. – user243114 Feb 3 '14 at 12:55
  • @user243114 hint returned unused, but thanks anyway :) – ΤΖΩΤΖΙΟΥ Feb 4 '14 at 19:17
18

(Here follows an almost verbatim copy of a self-answer from an identical question on serverfault which I'd forgotten about; askubuntu wasn't yet created).

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

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

[chooser]

[security]
DisallowTCP=false

[debug]

Take care with letter case: it won't work, if you write "disallowTCP=false"... 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.

If you only change the xserverrc file, X will nevertheless start with "-nolisten TCP".

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

Update

After an upgrade to 12.04, I had the same issue. This time, the culprit is the lightdm that the system uses. The file that needs to be updated is /etc/lightdm/lightdm.conf and the required addition is a xserver-allow-tcp=true in the [SeatDefaults] section.

And afterwards, I also found that answer. :)

Synopsis

So, in 10.10 this still works: create /etc/gdm/custom.conf with contents as specified above and restart gdm.

| improve this answer | |
  • 1
    For Ubuntu 14.04, the only thing needed is having a file like /usr/share/lightdm/lightdm.conf.d/100-custom.conf containing ` [SeatDefaults] server-allow-tcp=true ` – Nitz Mar 2 '15 at 19:18
  • @Nitz, note that's xserver-allow-tcp=true you are missing the 'x' in your comment. You could delete your existing comment and rewrite it. Although the answer includes that solution now. – Alexis Wilke May 17 '16 at 22:12
  • 1
    I commented on your original question on server fault : now Xorg by default doesn't listen TCP. One needs to add -listen tcp to enable it, but gdm3 doesn't seem to offer this possibility. – L. Levrel Oct 19 '18 at 16:13
5

Ubuntu 18.04 running as lubuntu 18.04 with lightdm 1.26.0, this is what I had to do (only took me a couple weeks to figure it all out). You have to create both /etc/lightdm/lightdm.conf and /etc/lightdm.conf.d/50-xserver-command.conf as follows:

sudo vi /etc/lightdm/lightdm.conf:

[Seat:*]

xserver-allow-tcp=true
xserver-command=X -listen tcp

sudo vi /etc/lightdm/lightdm.conf.d/50-xserver-command.conf:

[Seat:*]

xserver-command=X -core -listen tcp

This will cause lightdm to run Xorg with the following command line:

Xorg -listen tcp :0 -seat seat0 -auth /var/run/lightdm/root/:0 -listen tcp vt7  
   -novtswitch

This has "-listen tcp" twice, but it doesn't hurt anything. If you don't have both files, one of the Xorg options will be "-nolisten tcp" which overrides the other "-listen tcp". I finally found the clues to this here.

Then add: xhost + to your .bashrc

Restart and check that Xorg is now listening on port 6000:

$ netstat -nal | grep 6000
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN     
tcp6       0      0 :::6000                 :::*                    LISTEN     

Enjoy...

| improve this answer | |
4

This answer is related to Kubuntu 17.04 and 20.04 and I added it, because none of the other answers (related to gdm or lightdm) helped me. In my case sddm was running. To check this, run for instance

ps -eal | grep sddm

If it is is running, processes sddm and sddm-helper are shown. In this case add a configuration file /etc/sddm.conf with content

[X11]
ServerArguments=-listen tcp

for 20.04 or

[XDisplay]
ServerArguments=-listen tcp

for 17.04. After creation of this file reboot your system (may be a sddm restart is sufficient). As a consequence

ps ax | grep sddm 

shows the desired Xorg option -listen tcp and the X Server is ready for incoming connections (don't forget to add the remote host with xhost).

| improve this answer | |
  • 1
    Note that as of SDDM 0.14.0 (which ships with Kubuntu 17.10 Artful), the [XDisplay] section has been renamed [X11]. This caused much confusion when I was trying to help my coworker until I ran a man 5 sddm.conf on our 16.04 and 17.10 machines respectively, and noticed the discrepancy! – keithzg Nov 23 '17 at 0:25
3

As of Ubuntu 18.04, I looked at the running processes and figured out the display manager being used is gdm3:

$ ps ax|grep dm
 1515 ?        Ssl    0:00 /usr/sbin/gdm3

Then I edited /etc/gdm3/custom.conf and added a line:

[security]
DisallowTCP=false

As mentioned, opening up port 6000 is not secure. However, I'm using this only at home network and the port is further secured by iptables to open up only to my primary laptop, it should be ok.

| improve this answer | |
  • How does this differ from the accepted answer? – Stephen Rauch Jun 24 '18 at 1:07
  • 1
    Not fundamentally different but in 18.04 the configuration file is "/etc/gdm3/custom.conf" while in the accepted answer is "/etc/gdm/custom.conf" – Bing Ren Jun 25 '18 at 7:29
1

For Slim change the option xserver_arguments in /etc/slim.conf. And restart your X session.

| improve this answer | |
  • 1
    What is Slim? You should add a link in your answer, so that you demonstrate it's relevant to the question. – ΤΖΩΤΖΙΟΥ Jul 18 '19 at 7:49
1

On Xubuntu 20.04, which uses lightdm, it seems to be cleaner now. Just adding xserver-allow-tcp=true to the [Seat:*] section of /etc/lightdm/lightdm.conf is enough.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.