How to create new Magic Cookie?

8,924

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!

Share:
8,924

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    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?

    • Rinzwind
      Rinzwind about 9 years
      "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.
    • Admin
      Admin about 9 years
      @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?
  • Carlo Wood
    Carlo Wood over 7 years
    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.