5

While digging into X Windows or X11 stuff

I found that X display uses MIT-MAGIC-COOKIE to allow client-server to exchange display data.

One thing I don't understand is that I am able to locate and view the MIT-MAGIC-COOKIE in the server(Xclient) with the command

xauth list

and I see stuff like

James5/unix:10  MIT-MAGIC-COOKIE-1  1bcafdd569b2e1e6dd0dfaf446f437a6
James5/unix:13  MIT-MAGIC-COOKIE-1  5e536e4c17c94372ebc932f6d1c43abc
James5/unix:15  MIT-MAGIC-COOKIE-1  999ac8b086f2f8091aa970f40b739ff4
James5/unix:11  MIT-MAGIC-COOKIE-1  89287e67dfc851c5e7188fc5b7e4dc31

but from what I've learned, the user side should also have this cookie as well in order to compare the cookie from the received X display data.

but when I come back to my 'user side' laptop and type

Black@Black-PC ~
$ xauth list

an error message like this appears...

xauth:  file /home/Black/.Xauthority does not exist

Where on earth can I locate the .Xauthority file on the user side?

Randall
  • 415
  • 4
  • 14
kwagjj
  • 2,309
  • 6
  • 22
  • 29
  • You probably need to generate it: if your session works without it, it means that you've disabled auth on server side somehow (maybe `xhost +`?). Try a `xauth export` of the relevant keys on the server, followed by a `xauth merge` of the generated file on the client. – didierc Jun 23 '14 at 10:14

1 Answers1

8

The X server's copy of the cookie is not stored in your home directory, since it's not associated with your user, but in the system files.

If you find the X server process in ps you'll usually see it was started with an -auth argument specifying the path to the cookie file, such as:

test  1498  1497   0   Jun 24 vt/7        9:47 /usr/bin/Xorg :0 -nolisten tcp -br -novtswitch -auth /tmp/gdm-auth-cookies-94aq
alanc
  • 2,996
  • 16
  • 27