I use the following setup to forward X11 output from my local machine to the server. I will outline the setup:

  1. X11 server and the client are on the same local machine.
  2. The X11 server runs on my local machine A.
  3. The client runs on my local machine as a docker container and is called B.
  4. I try to forward graphical output from a program (R) on the client B to the server on host A.

Here is how the access works:

  • My client B has read access to /tmp/.X11-unix. Hence, it has access to the unix domain socket unix:0.
  • I allow access to this socket to the client B by issuing xhost +si:localuser:$(USER) on the host A. (Which is a server interpreted address which grants access to a single local user.)

All of this works as expected BUT whenever I try to access the socket the first try is not working and I get the error X11 protocol error: BadAccess (attempt to access private resource denied). When I close the X11 graphics device again and reopen it everything works. The problem persists even when I use a totally different setup that relies on ssh-based X11-forwarding. I could trace the problem back to the cairo device if I use a Xlib device access is successful at first try. Does anyone have experience with programs that access the X11 server's unix domain socket with a cairo device or has any kind of idea why this is happening?

  • maybe ~/.Xauth is stale and gets removed or truncated the first time. It's something like that anyway, I expect - the problem is not the failed first try most likely, but the last successful session's sloppy exit. – mikeserv Aug 24 '14 at 9:32
  • 1
    I assume by ~/.Xauth you mean the ~/.Xauthority file. No such file is ever created (I checked just now.) as I don't rely on xauth based authentication. The really strange thing is that using a Xlib graphics device will run without any problems but a cairo based does not. (I'm still searching the depths of the web for hints. :)) – lord.garbage Aug 24 '14 at 9:41
  • much luck. look in the /var/log/Xorg.log.[num] files and possibly in the paths specified by $XDG_CONFIG_DIRS, $XDG_DATA_DIRS, $XDG_RUNTIME_DIR – mikeserv Aug 24 '14 at 9:51
  • Please post the command-lines you're using for the server and the client. – James Youngman Aug 24 '14 at 12:00
  • I use bash as default shell/cli and xterm as terminal emulator. – lord.garbage Aug 24 '14 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.