Monday, December 15, 2025

X forwarding from a distrobox on a remote host

X11 connection rejected because of wrong authentication.

Assuming ssh is set to allow X11Forwarding, on a remote host .Xauthority will be created. But if you enter a distrobox on the remote host, the file can't be found. So in distrobox, export `XAUTHORITY` to point to the host's .Xauthority
distrobox-enter archbox
export XAUTHORITY=/run/host/home/username-on-host/.Xauthority
xeyes
It also works same when waypipe is used.