X11 strikes back – MIT-MAGIC-COOKIE-1 data did not match

Oh no!

Today I again experienced this weird X11 error: when I try to launch a GUI from a Linux CLI, instead of a beautiful (actually not) window I saw this error message:

Xlib: connection to “localhost:10.0” refused by server Xlib: PuTTY X11 proxy: MIT-MAGIC-COOKIE-1 data did not match Error: Can’t open display: localhost:10

Well, I was pretty sure that I already fixed it, but it appears that I have to fix it again.

After some search in Google I finally figured out how to do it. I knew but I forgot 😉
Important: I have to login using my personal account and the “su” to another account. Let’s say my account is “user#1” and the management account is “user#2”.

[user#1]$ xauth list
myserver01/unix:12 MIT-MAGIC-COOKIE-1 1234567890d506b7410d98d7a6fad3f7
myserver01/unix:11 MIT-MAGIC-COOKIE-1 1234567890e6c5446319099f238248be
myserver01/unix:10 MIT-MAGIC-COOKIE-1 1234567890c1c1d202282587895e5d5b

[user#1]$ sudo su - user#2

[user#2]$ xauth add myserver01/unix:10 MIT-MAGIC-COOKIE-1 1234567890c1c1d202282587895e5d5b

That’s all!
But why it happens?!

5 thoughts on “X11 strikes back – MIT-MAGIC-COOKIE-1 data did not match”

  1. Thanks for posting this little gem. I’ve been messing with my systems all morning and it wasn’t until I found your post that I was able to solve my issue.

    I had two different cookies. I deleted them both (using xauth remove) and logged in and my windows would forward again.

    Reply
  2. Even after adding

    xauth add

    It still giving me below issue.

    Xlib: connection to “localhost:10.0” refused by server

    Xlib: PuTTY X11 proxy: MIT-MAGIC-COOKIE-1 data did not match

     

     

     

     

    Reply

Leave a comment