You are not logged in.

#1 2017-07-03 17:01:02

heystove
Member
Registered: 2014-02-06
Posts: 14

[SOLVED] GDM (using Xorg) does not set $DISPLAY variable

Hey all, I noticed that GDM (using Xorg, not Wayland) does not set the $DISPLAY variable. It's blank!

I'm trying to set up TigerVNC's x0vncserver so that I can remotely login to a GNOME session. But since no $DISPLAY is set, x0vncserver fails to start.

$ x0vncserver -display=:0 -passwordfile=/home/stove/.vnc/passwd
No protocol specified
x0vncserver: unable to open display ":0"

Even if I omit the -display flag, it still won't start. This is because omitting that flag will cause x0vncserver to use whatever's in $DISPLAY.

Running something like

export DISPLAY=:0

doesn't work. x0vncserver still fails with the same message.

SOLUTION:

x0vncserver will not work for this purpose because it lacks the capability to use another user's Xauthority file.

From the information I've gathered today, I learned that, since 3.16, GDM runs Xorg in its own session. Doing so prevents the $DISPLAY variable from being readable to other users because it is not exported system-wide. The display is ":0" however.

To share GDM's Xorg display over VNC, you must use a VNC client that (1) is intended to be run as root and (2) can specify the Xauthority file to use. In this case, I used x11vnc. The command line to use is right in the wiki, under the GDM heading.

# x11vnc -display :0 -auth /run/user/120/gdm/Xauthority

I hope this helps folks in the future!

Last edited by heystove (2017-07-04 01:10:21)

Offline

Board footer

Powered by FluxBB