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.
(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:Take care with letter case: it won't work, if you write "disallowTCP=false"... I also changed the /etc/X11/xinit/xserverrc file to:
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:
You can verify the success as:
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 axserver-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 restartgdm
.This answer is related to Kubuntu 17.04 and 20.04 and I added it, because none of the other answers (related to
gdm
orlightdm
) helped me. In my casesddm
was running. To check this, run for instanceIf it is is running, processes
sddm
andsddm-helper
are shown. In this case add a configuration file/etc/sddm.conf
with contentfor 20.04 or
for 17.04. After creation of this file reboot your system (may be a
sddm
restart is sufficient). As a consequenceshows the desired
Xorg
option-listen tcp
and the X Server is ready for incoming connections (don't forget to add the remote host withxhost
).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
:sudo vi /etc/lightdm/lightdm.conf.d/50-xserver-command.conf
:This will cause lightdm to run Xorg with the following command line:
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:
Enjoy...
As of Ubuntu 18.04, I looked at the running processes and figured out the display manager being used is gdm3:
Then I edited
/etc/gdm3/custom.conf
and added a line: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.The following command works without modifying any configuration options or restarting the window manager.
Open a terminal window and run this:
It will open TCP port 6000 as a bi-directional channel to the file system-based socket
/tmp/.X11-unix/X0
that your window manager listens to.The
&
at the end means that the command continues running in the background as long as the terminal is open. For some uses, running it only when needed is more secure, but if you need the port to be always open, I recommend creating a service with systemd.On my computer, the
172.17.0.1
is the Docker network card. Alternatively, you can use127.0.0.1
to limit access to local connections or0.0.0.0
to even allow connections from outside (Firewall recommended).When using socat for the first time, you need to install it:
Tested with Ubuntu 20.04.
For Slim change the option
xserver_arguments
in/etc/slim.conf
. And restart your X session.On Xubuntu 20.04, which uses
lightdm
, it seems to be cleaner now. Just addingxserver-allow-tcp=true
to the[Seat:*]
section of/etc/lightdm/lightdm.conf
is enough.