How does GDM authenticate to the X Server

gdmx11xorg

Given that you usually have to authenticate to the X Server by way of a "magic cookie" stored in the .xauthority file in the user's home directory: How does GDM (like most login processes, running as root, I would assume) connect to the X Server in order to draw the login display? Does it use any .xauthority files stored in the root user's home directory or does it bypass authentication altogether?

Best Answer

On my system ps finds this:

/usr/bin/Xorg -br :0 vt7 -nolisten tcp -auth /var/lib/xdm/authdir/authfiles/A:0-wEJjac

The display manager starts X with the auth file to use as parameter. It can use that file directly.

Edit 1:

It's KDM in my case, not GDM.