"Could not connect to display" in one user account
Solution 1
X11vnc
may be what you want. It will allow you to share the entire desktop using vnc.
Alternatively for more control: to allow X11 to put individual windows on the display, and also on the local display, then use xauth
to configure the security. Note xhost
can also be used to do the same as xauth
, but it is very insecure, it will allow any machine on your network to access your desktop, and control your applications (even if you use host based authentication).
Solution 2
I run unit tests of my GUI application using QTestLib on a headless continuous integration server by setting up an X virtual framebuffer.
Xvfb :1 &
PID=$!
DISPLAY=:1 make check
kill $PID
Related videos on Youtube
trivelt
Updated on September 18, 2022Comments
-
trivelt almost 2 years
I have a GUI application written in Qt and I wanted to run tests by ssh (or Jenkins). There is only one user account, which allows to run it in display mode (ofc when I previously do
export $DISPLAY=:0
. On other user, jenkins, I saw an error in console:QXcbConnection: Could not connect to display :0 Aborted (core dumped)
What should I do to allow this user to run applications in graphical mode? I use Ubuntu 14.04.
-
Admin almost 10 yearsWhen you
ssh
are you trying to display on the local or remote machine? -
Admin almost 10 yearsOn remote machine, but I also tried do it connecting by rdesktop and the result is the same - user1 can run application (and I see window etc.), but user2 can't.
-
Admin almost 10 yearsYou also need to use
xauth
, though I can not remember the detail. Another option is to use X11vnc -
Admin almost 10 yearsAs a rule, you can't use another display. If you are in A, then ssh to B, you would have to display in A, you cannot display in B.
-
Admin almost 10 years@richard: thanks! I installed x11vnc and it works. Earlier I had only xvncviewer.
-
-
ctrl-alt-delor almost 10 yearsDanger, danger: don't do
xhost +
, unless the network you are connected to is secure. So if you are connected to the internet, and don't have a tested fire wall that will block X11… then don't do this. If you are considering usingxhost
then you should be consideringxauth
as it is much more secure. -
AdminBee almost 4 yearsWelcome to the site, and thank you for your contribution. However, would this approach not allow all local connections? That might be more permissive than the OP wants ...