1

I've been searching around on Google but I cannot find my answer on how to create a new MIT-MAGIC-COOKIE.

I recently did a reinstall and I had copied over my files from a backup back into my home folder, and now I can't open up nemo file manager whenever I run sudo or doing with Open as Root on it because it's giving me;

Could not open X display
Invalid MIT-MAGIC-COOKIE-1 keyerror: XDG_RUNTIME_DIR not set in the environment.

Everywhere I looked up it was only giving me answers on how to forward a MIT-MAGIC-COOKIE for SSH. I want to know how to RE-create a NEW magic cookie to replace the invalid one. Some places I read up on says to do

rm ~/.Xauthority

but this isn't fixing anything for me. What are the steps I need to do to create a new magic cookie?

  • "XDG_RUNTIME_DIR not set in the environment." you need to fix this askubuntu.com/questions/456689/… Problem you probably have is that the user is not correct since this mostly happens when you use nautilus with root/sudo and mess up ownership. – Rinzwind Mar 4 '15 at 10:33
  • @Rinzwind That doesn't really help me solve the issue. I'm still left with the same problem as mentioned above. How do I go about setting XDG_RUNTIME_DIR into my environment permanently? – user94959 Mar 4 '15 at 10:45
-1

found a proper answer solution that actually works;

by doing the following in terminal

grep 'pam_xauth.so' /etc/pam.d/*  | awk -F ":" '{ printf "%s\t(%s)\n", $2, $1}'

and if that didn't work I did this which did work;

Defaults env_keep=DISPLAY

into /etc/sudoers then logged out and back in again, and vòila it worked!

  • 2
    Unfortunately, this doesn't help me to understand what is wrong. The grep doesn't return anything for me, and DISPLAY is already set correctly. – Carlo Wood Dec 2 '16 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy