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

lightdmnetworkingremote desktopremote-x-sessionxorg

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.

Best Answer

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