X11 connection rejected because of wrong authentication.

Problem

After doing a sudo, I get this error:

X11 connection rejected because of wrong authentication.

Solution

  1. Be sure the non-root user can get X working. Try running xterm.
  2. Run xauth list as the non-root user. You should see something like:

machinename/unix:14 MIT-MAGIC-COOKIE-1 058aexd13d0436b3463abd79acd31234

  1. Run echo $DISPLAY to see which number is used for this host. (eg localhost:14.0 means 14)
  2. Login as root. sudo -i
  3. Add the cookie. auth add machinename/unix:14 MIT-MAGIC-COOKIE-1 058aexd13d0436b3463abd79acd31234

References


Linux

75 Words

2011-01-21 10:47 +0000