How to make X.org listen tcp port to remote connections?

15,674

With Xorg 1.17 and later, -nolisten tcp is the default, and you need to explicitly state -listen tcp to enable tcp connections.

Share:
15,674

Related videos on Youtube

looijerto
Author by

looijerto

Updated on September 18, 2022

Comments

  • looijerto
    looijerto over 1 year

    Ubuntu 15.04 64-bit desktop.

    After install system X server run with -nolisten tcp option:

    922 tty7     Ssl+   0:05  \_ /usr/bin/X -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
    

    I add xserver-allow-tcp=true into /etc/lightdm/lightdm.conf and reboot. So X now started without -nolisten tcp:

    2688 tty7     Ssl+   0:07  \_ /usr/bin/X -core :0 -seat seat0 -auth /var/run/lightdm/root/:0 vt7 -novtswitch
    

    But X not actually listen any tcp port:

    sudo netstat -Wpnatu
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      645/cupsd       
    tcp        0      0 192.168.1.110:55524     192.168.1.2:22          ESTABLISHED 4016/slogin     
    tcp        0      0 192.168.1.110:1008      192.168.1.2:2049        ESTABLISHED -               
    tcp6       0      0 ::1:631                 :::*                    LISTEN      645/cupsd       
    tcp6       1      0 ::1:57617               ::1:631                 CLOSE_WAIT  2955/indicator-prin
    tcp6       1      0 ::1:57413               ::1:631                 CLOSE_WAIT  782/cups-browsed
    tcp6       1      0 ::1:57412               ::1:631                 CLOSE_WAIT  782/cups-browsed
    udp        0      0 0.0.0.0:32586           0.0.0.0:*                           790/dhclient    
    udp        0      0 0.0.0.0:68              0.0.0.0:*                           790/dhclient    
    udp        0      0 0.0.0.0:631             0.0.0.0:*                           782/cups-browsed
    udp        0      0 0.0.0.0:5353            0.0.0.0:*                           663/avahi-daemon: r
    udp        0      0 0.0.0.0:44534           0.0.0.0:*                           663/avahi-daemon: r
    udp6       0      0 :::40820                :::*                                663/avahi-daemon: r
    udp6       0      0 :::54127                :::*                                790/dhclient    
    udp6       0      0 :::5353                 :::*                                663/avahi-daemon: r
    

    So, what else i must to do?

    UPD:

    With Xorg 1.17 and later, -nolisten tcp is the default, and you need to explicitly state -listen tcp to enable tcp connections.

    According this comment by alanc, i try add another line to lightdm.conf:

    xserver-command=X -listen tcp
    

    Finally all work as expected. My result lightdm.conf:

    [Seat:*]
    autologin-guest=false
    autologin-user=ubuntu
    autologin-user-timeout=0
    autologin-session=lightdm-autologin
    xserver-allow-tcp=true
    xserver-command=X -listen tcp
    

    And it's completely solved my problem.

  • Mark Setchell
    Mark Setchell about 7 years
    Just a little note... you can find the Xorg/X11 server version using the following command in Terminal... X -version.
  • Trinimon
    Trinimon over 6 years
    For systems running the sddm display manager, check out askubuntu.com/a/963719/555176
  • JL M
    JL M about 3 years
    A lot old answers on the subject gives the same kind of explanation. But on a Debian 10 (Buster) with Server X version 1.20.4 and lightdm 1.26.0 this is not enough. Still looking for right answer !!