Moving the X11 socket to XDG_RUNTIME_DIR
Carsten Haitzler
raster at rasterman.com
Thu Jul 3 06:44:53 UTC 2025
On Wed, 02 Jul 2025 19:40:13 +0100 "Artur Manuel" <amad at atl.tools> said:
> Hello, hope this email comes in good faith.
>
> I was thinking of any benefits that could arise from moving the X11
> socket from /tmp/.X11-unix to $XDG_RUNTIME_DIR/.X11-unix and I thought
> of a few. This thought was inspired by Wayland and their approach for
> sockets, and from how I see it, it may benefit XWayland.
>
> - Moving the X11 socket to XDG_RUNTIME_DIR makes Xorg seem as if it is
> willing to adopt the XDG specification (which it already does with
> Xorg logs going to ~/.local/share/Xorg), but I feel as if this change
> would cement that further.
you'd break compat for any binaries that statically compiled xlib etc. in. they
would have no idea where to find the socket for DISPLAY=:0 ...
> - I think that the X11 socket being so easy to access (as it is 0777,
> and in /tmp) is a security flaw which shouldn't exist even in terms of
> backwards compatibility. I think this can be resolved by
> symlinking, but if most programs work fine without needing to symlink
> then that's amazing.
so do you propose the xserver sets up these symlinks? if x is running as $USER
then putting it in the xdg runtime dir makes sense. but then... you have issues
with multiple users fighting over /tmp/.X11-unix for the compat symlinks (in the
in the case of 2 x sessions running as 2 users on different vt's etc.).
> - You wouldn't run into unpredictability issues regarding where the X11
> socket is on many systems, as most systems now use XDG_RUNTIME_DIR. As
> for Windows, they can keep %TEMP% or %TMP% or whatever it is called.
> I also believe some of the Windows-specific functions could benefit
> from a rewrite, so moving the socket may bring that closer.
i agree in principle a xorg running as $USER (not root) would be a
cleaner/better solution with the socket where you propose... but changing this
has implications for compatibility.
this is a choice of "keep compat" or "improve things and maybe break a few
things on the way".
i PERSONALLY would vote for small breaks like this as being acceptable for
their improvements, as i would also vote in general for improvements to xorg
and protocols if they broke things in clever and well through out ways to make
it a better place. i'm just pointing out that there is an issue that comes
along with this.
> I thought of these for a while and was thinking of where I could ask
> about it to but I want to ask about it here before taking any bigger
> steps. I admittedly am not the greatest fan of Xorg but I need to wait
> for the Wayland situation to improve on FreeBSD before I make the
> switch. It is okay now but not amazing in it's current state, while Xorg
> is just good enough on here for me to use it.
>
> I look forward to your (plural) views.
>
> Cheers,
> --
> Artur Manuel (amadaluzia)
>
--
------------- Codito, ergo sum - "I code, therefore I am" --------------
Carsten Haitzler - raster at rasterman.com
More information about the xorg-devel
mailing list