February 21st, 2020

  • shlomif

Tech Tip: Setting up remote X11 over TCP to Xephyr

Warning! The instructions given here may decrease your systems' security and may make it more vulnerable. Use at your own risk.

I recently wanted to set up a remote X.org / X11 connection to a Xephyr server, which is an X server that runs inside a window. I only found partial information in web searches, so I wanted to provide a top-to-bottom guide for accomplishing this task.

The Xephyr man page omits the info in Xnest's man page and that in the "Xserver" man page. Xephyr supports most of the flags in all of them.

To facilitate customisation, we will declare and use the following shell constants:


You may need to stop the firewalls on both client and server using something like:

sudo systemctl stop firewalld.service

Or the stop-iptables script.

Now start Xephyr on the local desktop:

Xephyr -listen tcp -listen unix -listen local -screen 1024x768 :"$xephyr_port"

Then connect to it and use xhost:

# On the X server
export DISPLAY=":$xephyr_port"
xterm &
xhost +

Now you should be able to connect to the Xephyr X server from the remote box:

# On the remote machine
export DISPLAY="$remote_xephyr_ip_host":"$xephyr_port"
xterm &
# Or a different window manager.


Copyright by Shlomi Fish, 2020.

You can reuse this entry under the Creative Commons Attribution 4.0 Unported licence, or at your option any later version of it. See the instructions on how to comply with it.

Whatever code given here is provided under the MIT / Expat licence.